From e9ba573159e18569610d7c42ce2488259316d55a Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 15 Jan 2021 18:41:48 +0100 Subject: [PATCH 1/2] Remove invalid visibility macros Signed-off-by: Jose Luis Rivero --- include/ignition/gazebo/System.hh | 14 +++++++------- include/ignition/gazebo/components/Factory.hh | 12 ++++++------ src/cmd/ign.cc | 12 ++++++------ src/ign.cc | 14 +++++++------- src/ign.hh | 14 +++++++------- test/plugins/EventTriggerSystem.hh | 3 ++- test/plugins/MockSystem.hh | 4 +++- test/plugins/Null.hh | 2 +- 8 files changed, 39 insertions(+), 36 deletions(-) diff --git a/include/ignition/gazebo/System.hh b/include/ignition/gazebo/System.hh index fc2a3403c1..49cb510640 100644 --- a/include/ignition/gazebo/System.hh +++ b/include/ignition/gazebo/System.hh @@ -59,13 +59,13 @@ namespace ignition /// * Executed with simulation time at (t0 + dt) /// * Used to read out results at the end of a simulation step to be used /// for sensor or controller updates. - class IGNITION_GAZEBO_VISIBLE System + class System { /// \brief Constructor - public: System(); + public: System() = default; /// \brief Destructor - public: virtual ~System(); + public: virtual ~System() = default; }; /// \class ISystemConfigure ISystem.hh ignition/gazebo/System.hh @@ -74,7 +74,7 @@ namespace ignition /// Configure is called after the system is instatiated and all entities /// and components are loaded from the corresponding SDF world, and before /// simulation begins exectution. - class IGNITION_GAZEBO_VISIBLE ISystemConfigure { + class ISystemConfigure { /// \brief Configure the system /// \param[in] _entity The entity this plugin is attached to. /// \param[in] _sdf The SDF Element associated with this system plugin. @@ -91,21 +91,21 @@ namespace ignition /// \class ISystemPreUpdate ISystem.hh ignition/gazebo/System.hh /// \brief Interface for a system that uses the PreUpdate phase - class IGNITION_GAZEBO_VISIBLE ISystemPreUpdate { + class ISystemPreUpdate { public: virtual void PreUpdate(const UpdateInfo &_info, EntityComponentManager &_ecm) = 0; }; /// \class ISystemUpdate ISystem.hh ignition/gazebo/System.hh /// \brief Interface for a system that uses the Update phase - class IGNITION_GAZEBO_VISIBLE ISystemUpdate { + class ISystemUpdate { public: virtual void Update(const UpdateInfo &_info, EntityComponentManager &_ecm) = 0; }; /// \class ISystemPostUpdate ISystem.hh ignition/gazebo/System.hh /// \brief Interface for a system that uses the PostUpdate phase - class IGNITION_GAZEBO_VISIBLE ISystemPostUpdate{ + class ISystemPostUpdate{ public: virtual void PostUpdate(const UpdateInfo &_info, const EntityComponentManager &_ecm) = 0; }; diff --git a/include/ignition/gazebo/components/Factory.hh b/include/ignition/gazebo/components/Factory.hh index 490d18e813..d26ee7f965 100644 --- a/include/ignition/gazebo/components/Factory.hh +++ b/include/ignition/gazebo/components/Factory.hh @@ -41,7 +41,7 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE { namespace components { /// \brief A base class for an object responsible for creating components. - class IGNITION_GAZEBO_VISIBLE ComponentDescriptorBase + class ComponentDescriptorBase { /// \brief Destructor public: virtual ~ComponentDescriptorBase() = default; @@ -54,7 +54,7 @@ namespace components /// \brief A class for an object responsible for creating components. /// \tparam ComponentTypeT type of component to describe. template - class IGNITION_GAZEBO_VISIBLE ComponentDescriptor + class ComponentDescriptor : public ComponentDescriptorBase { /// \brief Create an instance of a ComponentTypeT Component. @@ -66,7 +66,7 @@ namespace components }; /// \brief A base class for an object responsible for creating storages. - class IGNITION_GAZEBO_VISIBLE StorageDescriptorBase + class StorageDescriptorBase { /// \brief Destructor public: virtual ~StorageDescriptorBase() = default; @@ -79,7 +79,7 @@ namespace components /// \brief A class for an object responsible for creating storages. /// \tparam ComponentTypeT type of component that the storage will hold. template - class IGNITION_GAZEBO_VISIBLE StorageDescriptor + class StorageDescriptor : public StorageDescriptorBase { /// \brief Create an instance of a storage that holds ComponentTypeT @@ -92,7 +92,7 @@ namespace components }; /// \brief A factory that generates a component based on a string type. - class IGNITION_GAZEBO_VISIBLE Factory + class Factory : public ignition::common::SingletonT { /// \brief Register a component so that the factory can create instances @@ -329,7 +329,7 @@ namespace components /// \param[in] _compType Component type name. /// \param[in] _classname Class name for component. #define IGN_GAZEBO_REGISTER_COMPONENT(_compType, _classname) \ - class IGNITION_GAZEBO_VISIBLE IgnGazeboComponents##_classname \ + class IgnGazeboComponents##_classname \ { \ public: IgnGazeboComponents##_classname() \ { \ diff --git a/src/cmd/ign.cc b/src/cmd/ign.cc index a4a58c129b..720188a30d 100644 --- a/src/cmd/ign.cc +++ b/src/cmd/ign.cc @@ -32,32 +32,32 @@ #include "ign.hh" ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE char *ignitionGazeboVersion() +extern "C" char *ignitionGazeboVersion() { return strdup(IGNITION_GAZEBO_VERSION_FULL); } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE char *gazeboVersionHeader() +extern "C" char *gazeboVersionHeader() { return strdup(IGNITION_GAZEBO_VERSION_HEADER); } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE void cmdVerbosity( +extern "C" void cmdVerbosity( const char *_verbosity) { ignition::common::Console::SetVerbosity(std::atoi(_verbosity)); } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE const char *worldInstallDir() +extern "C" const char *worldInstallDir() { return IGN_GAZEBO_WORLD_INSTALL_DIR; } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE int runServer(const char *_sdfString, +extern "C" int runServer(const char *_sdfString, int _iterations, int _run, float _hz, int _levels, const char *_networkRole, int _networkSecondaries, int _record, const char *_recordPath, int _logOverwrite, const char *_playback, const char *_file) @@ -206,7 +206,7 @@ extern "C" IGNITION_GAZEBO_VISIBLE int runServer(const char *_sdfString, } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE int runGui(const char *_guiConfig) +extern "C" int runGui(const char *_guiConfig) { ignition::common::SignalHandler sigHandler; bool sigKilled = false; diff --git a/src/ign.cc b/src/ign.cc index 09bb0dbf8a..9faf652e09 100644 --- a/src/ign.cc +++ b/src/ign.cc @@ -35,32 +35,32 @@ #include "ignition/gazebo/gui/Gui.hh" ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE char *ignitionGazeboVersion() +extern "C" char *ignitionGazeboVersion() { return strdup(IGNITION_GAZEBO_VERSION_FULL); } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE char *gazeboVersionHeader() +extern "C" char *gazeboVersionHeader() { return strdup(IGNITION_GAZEBO_VERSION_HEADER); } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE void cmdVerbosity( +extern "C" void cmdVerbosity( const char *_verbosity) { ignition::common::Console::SetVerbosity(std::atoi(_verbosity)); } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE const char *worldInstallDir() +extern "C" const char *worldInstallDir() { return IGN_GAZEBO_WORLD_INSTALL_DIR; } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE const char *findFuelResource( +extern "C" const char *findFuelResource( char *_pathToResource) { std::string path; @@ -115,7 +115,7 @@ extern "C" IGNITION_GAZEBO_VISIBLE const char *findFuelResource( } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE int runServer(const char *_sdfString, +extern "C" int runServer(const char *_sdfString, int _iterations, int _run, float _hz, int _levels, const char *_networkRole, int _networkSecondaries, int _record, const char *_recordPath, int _recordResources, int _logOverwrite, int _logCompress, @@ -355,7 +355,7 @@ extern "C" IGNITION_GAZEBO_VISIBLE int runServer(const char *_sdfString, } ////////////////////////////////////////////////// -extern "C" IGNITION_GAZEBO_VISIBLE int runGui(const char *_guiConfig) +extern "C" int runGui(const char *_guiConfig) { // argc and argv are going to be passed to a QApplication. The Qt // documentation has a warning about these: diff --git a/src/ign.hh b/src/ign.hh index 9f8aeca3dc..3b7cd3c5e4 100644 --- a/src/ign.hh +++ b/src/ign.hh @@ -21,18 +21,18 @@ /// \brief External hook to read the library version. /// \return C-string representing the version. Ex.: 0.1.2 -extern "C" IGNITION_GAZEBO_VISIBLE char *ignitionGazeboVersion(); +extern "C" char *ignitionGazeboVersion(); /// \brief Get the Gazebo version header. /// \return C-string containing the Gazebo version information. -extern "C" IGNITION_GAZEBO_VISIBLE char *gazeboVersionHeader(); +extern "C" char *gazeboVersionHeader(); /// \brief Set verbosity level /// \param[in] _verbosity 0 to 4 -extern "C" IGNITION_GAZEBO_VISIBLE void cmdVerbosity( +extern "C" void cmdVerbosity( const char *_verbosity); -extern "C" IGNITION_GAZEBO_VISIBLE const char *worldInstallDir(); +extern "C" const char *worldInstallDir(); /// \brief External hook to run simulation server. /// \param[in] _sdfString SDF file to run, as a string. @@ -55,7 +55,7 @@ extern "C" IGNITION_GAZEBO_VISIBLE const char *worldInstallDir(); /// \param[in] _recordTopics Colon separated list of topics to record. Leave /// null to record the default topics. /// \return 0 if successful, 1 if not. -extern "C" IGNITION_GAZEBO_VISIBLE int runServer(const char *_sdfString, +extern "C" int runServer(const char *_sdfString, int _iterations, int _run, float _hz, int _levels, const char *_networkRole, int _networkSecondaries, int _record, const char *_recordPath, int _recordResources, int _logOverwrite, @@ -67,13 +67,13 @@ extern "C" IGNITION_GAZEBO_VISIBLE int runServer(const char *_sdfString, /// \brief External hook to run simulation GUI. /// \param[in] _guiConfig Path to Ignition GUI configuration file. /// \return 0 if successful, 1 if not. -extern "C" IGNITION_GAZEBO_VISIBLE int runGui(const char *_guiConfig); +extern "C" int runGui(const char *_guiConfig); /// \brief External hook to find or download a fuel world provided a URL. /// \param[in] _pathToResource Path to the fuel world resource, ie, /// https://staging-fuel.ignitionrobotics.org/1.0/gmas/worlds/ShapesClone /// \return C-string containing the path to the local world sdf file -extern "C" IGNITION_GAZEBO_VISIBLE const char *findFuelResource( +extern "C" const char *findFuelResource( char *_pathToResource); #endif diff --git a/test/plugins/EventTriggerSystem.hh b/test/plugins/EventTriggerSystem.hh index 4ad37f592c..5265b03d8a 100644 --- a/test/plugins/EventTriggerSystem.hh +++ b/test/plugins/EventTriggerSystem.hh @@ -25,13 +25,14 @@ namespace ignition { namespace gazebo { -class IGNITION_GAZEBO_VISIBLE EventTriggerSystem : +class EventTriggerSystem : public gazebo::System, public gazebo::ISystemConfigure, public gazebo::ISystemUpdate { // needed for linter public: EventTriggerSystem() = default; + public: ~EventTriggerSystem() = default; public: void Configure(const Entity &/*_entity*/, const std::shared_ptr &/*_sdf*/, diff --git a/test/plugins/MockSystem.hh b/test/plugins/MockSystem.hh index fee1048f3f..f8a61e893a 100644 --- a/test/plugins/MockSystem.hh +++ b/test/plugins/MockSystem.hh @@ -23,12 +23,14 @@ namespace ignition { namespace gazebo { - class IGNITION_GAZEBO_VISIBLE MockSystem : + class MockSystem : public gazebo::System, public gazebo::ISystemPreUpdate, public gazebo::ISystemUpdate, public gazebo::ISystemPostUpdate { + public: MockSystem() = default; + public: ~MockSystem() = default; public: size_t preUpdateCallCount {0}; public: size_t updateCallCount {0}; public: size_t postUpdateCallCount {0}; diff --git a/test/plugins/Null.hh b/test/plugins/Null.hh index d26f2dcd40..f0ed87d56d 100644 --- a/test/plugins/Null.hh +++ b/test/plugins/Null.hh @@ -33,7 +33,7 @@ namespace systems { /// \class Null Null.hh ignition/gazebo/systems/Null.hh /// \brief Minimal system implementation - class IGNITION_GAZEBO_VISIBLE Null: + class Null: public System, public ISystemConfigure, public ISystemPreUpdate, From 84f1d31abe9a5cb2247e438d0eee5ae78e08ea76 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 21 Jan 2021 15:49:47 +0100 Subject: [PATCH 2/2] Change system to be a header only file Signed-off-by: Jose Luis Rivero --- src/CMakeLists.txt | 1 - src/System.cc | 25 ------------------------- 2 files changed, 26 deletions(-) delete mode 100644 src/System.cc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c029e2900..983c764e17 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,6 @@ set (sources ServerConfig.cc ServerPrivate.cc SimulationRunner.cc - System.cc SystemLoader.cc Util.cc View.cc diff --git a/src/System.cc b/src/System.cc deleted file mode 100644 index 318e3d431d..0000000000 --- a/src/System.cc +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2018 Open Source Robotics Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ -#include "ignition/gazebo/System.hh" - -using namespace ignition::gazebo; - -////////////////////////////////////////////////// -System::System() = default; - -////////////////////////////////////////////////// -System::~System() = default;