From 71505aed9a839390119b91bf455c88c0d76259ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Tue, 28 Apr 2020 18:49:48 +0200 Subject: [PATCH] Make getClass() a const method --- include/core/common/factory.h | 6 +++--- include/core/processor/factory_processor.h | 6 +++--- include/core/sensor/factory_sensor.h | 11 ++++++----- include/core/solver/factory_solver.h | 2 +- include/core/tree_manager/factory_tree_manager.h | 6 +++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/core/common/factory.h b/include/core/common/factory.h index d97810fe3..1510362e6 100644 --- a/include/core/common/factory.h +++ b/include/core/common/factory.h @@ -244,7 +244,7 @@ class Factory bool registerCreator(const std::string& _type, CreatorCallback createFn); bool unregisterCreator(const std::string& _type); TypeBasePtr create(const std::string& _type, TypeInput... _input); - std::string getClass(); + std::string getClass() const; private: CallbackMap callbacks_; @@ -301,7 +301,7 @@ inline Factory<TypeBase, TypeInput...>& Factory<TypeBase, TypeInput...>::get() } template<class TypeBase, typename... TypeInput> -inline std::string Factory<TypeBase, TypeInput...>::getClass() +inline std::string Factory<TypeBase, TypeInput...>::getClass() const { return "Factory<class TypeBase>"; } @@ -319,7 +319,7 @@ class LandmarkBase; typedef Factory<LandmarkBase, const YAML::Node&> FactoryLandmark; template<> -inline std::string FactoryLandmark::getClass() +inline std::string FactoryLandmark::getClass() const { return "FactoryLandmark"; } diff --git a/include/core/processor/factory_processor.h b/include/core/processor/factory_processor.h index 738d3558a..5fc2f8f14 100644 --- a/include/core/processor/factory_processor.h +++ b/include/core/processor/factory_processor.h @@ -170,7 +170,7 @@ struct ParamsProcessorBase; typedef Factory<ParamsProcessorBase, const std::string&> FactoryParamsProcessor; template<> -inline std::string FactoryParamsProcessor::getClass() +inline std::string FactoryParamsProcessor::getClass() const { return "FactoryParamsProcessor"; } @@ -180,7 +180,7 @@ typedef Factory<ProcessorBase, const std::string&, const ParamsProcessorBasePtr> FactoryProcessor; template<> -inline std::string FactoryProcessor::getClass() +inline std::string FactoryProcessor::getClass() const { return "FactoryProcessor"; } @@ -193,7 +193,7 @@ typedef Factory<ProcessorBase, const std::string&, const ParamsServer&> AutoConfFactoryProcessor; template<> -inline std::string AutoConfFactoryProcessor::getClass() +inline std::string AutoConfFactoryProcessor::getClass() const { return "AutoConfFactoryProcessor"; } diff --git a/include/core/sensor/factory_sensor.h b/include/core/sensor/factory_sensor.h index 67ef5f597..ff0574aaa 100644 --- a/include/core/sensor/factory_sensor.h +++ b/include/core/sensor/factory_sensor.h @@ -212,9 +212,9 @@ namespace wolf // ParamsSensor factory struct ParamsSensorBase; typedef Factory<ParamsSensorBase, - const std::string&> FactoryParamsSensor; + const std::string&> FactoryParamsSensor; template<> -inline std::string FactoryParamsSensor::getClass() +inline std::string FactoryParamsSensor::getClass() const { return "FactoryParamsSensor"; } @@ -222,10 +222,11 @@ inline std::string FactoryParamsSensor::getClass() // Sensor factory typedef Factory<SensorBase, const std::string&, - const Eigen::VectorXd&, const ParamsSensorBasePtr> FactorySensor; + const Eigen::VectorXd&, + const ParamsSensorBasePtr> FactorySensor; template<> -inline std::string FactorySensor::getClass() +inline std::string FactorySensor::getClass() const { return "FactorySensor"; } @@ -240,7 +241,7 @@ typedef Factory<SensorBase, const ParamsServer&> AutoConfFactorySensor; template<> -inline std::string AutoConfFactorySensor::getClass() +inline std::string AutoConfFactorySensor::getClass() const { return "AutoConfFactorySensor"; } diff --git a/include/core/solver/factory_solver.h b/include/core/solver/factory_solver.h index b05521782..e3cc58a4a 100644 --- a/include/core/solver/factory_solver.h +++ b/include/core/solver/factory_solver.h @@ -214,7 +214,7 @@ typedef Factory<SolverManager, const ParamsServer&> FactorySolver; template<> -inline std::string FactorySolver::getClass() +inline std::string FactorySolver::getClass() const { return "FactorySolver"; } diff --git a/include/core/tree_manager/factory_tree_manager.h b/include/core/tree_manager/factory_tree_manager.h index 91f2b9531..a56dae93e 100644 --- a/include/core/tree_manager/factory_tree_manager.h +++ b/include/core/tree_manager/factory_tree_manager.h @@ -23,7 +23,7 @@ struct ParamsTreeManagerBase; typedef Factory<ParamsTreeManagerBase, const std::string&> FactoryParamsTreeManager; template<> -inline std::string FactoryParamsTreeManager::getClass() +inline std::string FactoryParamsTreeManager::getClass() const { return "FactoryParamsTreeManager"; } @@ -33,7 +33,7 @@ typedef Factory<TreeManagerBase, const std::string&, const ParamsTreeManagerBasePtr> FactoryTreeManager; template<> -inline std::string FactoryTreeManager::getClass() +inline std::string FactoryTreeManager::getClass() const { return "FactoryTreeManager"; } @@ -46,7 +46,7 @@ typedef Factory<TreeManagerBase, const std::string&, const ParamsServer&> AutoConfFactoryTreeManager; template<> -inline std::string AutoConfFactoryTreeManager::getClass() +inline std::string AutoConfFactoryTreeManager::getClass() const { return "AutoConfFactoryTreeManager"; } -- GitLab