From c16524ef6cc9a9812a40204162d09a07b5be80f0 Mon Sep 17 00:00:00 2001 From: jcasals <jcasals@iri.upc.edu> Date: Tue, 28 Apr 2020 11:47:24 +0200 Subject: [PATCH] Rename LandmarkFactory -> FactoryLandmark --- include/core/common/factory.h | 18 +++++++++--------- src/landmark/landmark_base.cpp | 2 +- src/map/map_base.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/core/common/factory.h b/include/core/common/factory.h index 34c214bd6..d97810fe3 100644 --- a/include/core/common/factory.h +++ b/include/core/common/factory.h @@ -88,7 +88,7 @@ namespace wolf * \code * typedef Factory<ParamsSensorBase, std::string> FactoryParamsSensor; * typedef Factory<ParamsProcessorBase, std::string> FactoryParamsProcessor; - * typedef Factory<LandmarkBase, YAML::Node> LandmarkFactory; + * typedef Factory<LandmarkBase, YAML::Node> FactoryLandmark; * \endcode * * Second to know, the Factory class is a <a href="http://stackoverflow.com/questions/1008019/c-singleton-design-pattern#1008289">singleton</a>: it can only exist once in your application. @@ -103,7 +103,7 @@ namespace wolf * You can then call the methods you like, e.g. to create a landmark, you use: * * \code - * LandmarkFactory::get().create(...); // see below for creating objects ... + * FactoryLandmark::get().create(...); // see below for creating objects ... * \endcode * * #### Write creator methods (in your derived object classes) @@ -137,7 +137,7 @@ namespace wolf * that knows how to create your specific object, e.g.: * * \code - * LandmarkFactory::get().registerCreator("POLYLINE 2d", LandmarkPolyline2d::create); + * FactoryLandmark::get().registerCreator("POLYLINE 2d", LandmarkPolyline2d::create); * \endcode * * #### Automatic registration @@ -172,7 +172,7 @@ namespace wolf * or even better, make use of the convenient typedefs: * * \code - * LandmarkBasePtr lmk_ptr = LandmarkFactory::get().create("POLYLINE 2d", lmk_yaml_node); + * LandmarkBasePtr lmk_ptr = FactoryLandmark::get().create("POLYLINE 2d", lmk_yaml_node); * \endcode * * ### Examples @@ -212,7 +212,7 @@ namespace wolf * // Register landmark creator (put the register code inside an unnamed namespace): * namespace * { - * const bool registered_lmk_polyline_2d = LandmarkFactory::get().registerCreator("POLYLINE 2d", LandmarkPolyline2d::create); + * const bool registered_lmk_polyline_2d = FactoryLandmark::get().registerCreator("POLYLINE 2d", LandmarkPolyline2d::create); * } * * \endcode @@ -220,7 +220,7 @@ namespace wolf * ### More information * - FactoryParamsSensor: typedef of this template to create intrinsic structs deriving from ParamsSensorBase directly from YAML files. * - FactoryParamsProcessor: typedef of this template to create processor params structs deriving from ParamsProcessorBase directly from YAML files. - * - LandmarkFactory: typedef of this template to create landmarks deriving from LandmarkBase directly from YAML nodes. + * - FactoryLandmark: typedef of this template to create landmarks deriving from LandmarkBase directly from YAML nodes. * - Problem::loadMap() : to load a maps directly from YAML files. * - You can also check the code in the example file ````src/examples/test_map_yaml.cpp````. * @@ -317,11 +317,11 @@ namespace wolf // Landmarks from YAML class LandmarkBase; typedef Factory<LandmarkBase, - const YAML::Node&> LandmarkFactory; + const YAML::Node&> FactoryLandmark; template<> -inline std::string LandmarkFactory::getClass() +inline std::string FactoryLandmark::getClass() { - return "LandmarkFactory"; + return "FactoryLandmark"; } diff --git a/src/landmark/landmark_base.cpp b/src/landmark/landmark_base.cpp index bc57f2729..88626f266 100644 --- a/src/landmark/landmark_base.cpp +++ b/src/landmark/landmark_base.cpp @@ -182,7 +182,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node) // Register landmark creator namespace { -const bool WOLF_UNUSED registered_lmk_base = LandmarkFactory::get().registerCreator("LandmarkBase", LandmarkBase::create); +const bool WOLF_UNUSED registered_lmk_base = FactoryLandmark::get().registerCreator("LandmarkBase", LandmarkBase::create); } } // namespace wolf diff --git a/src/map/map_base.cpp b/src/map/map_base.cpp index 3a3d32f8a..e75e1147a 100644 --- a/src/map/map_base.cpp +++ b/src/map/map_base.cpp @@ -49,7 +49,7 @@ void MapBase::load(const std::string& _map_file_dot_yaml) for (unsigned int i = 0; i < nlandmarks; i++) { YAML::Node lmk_node = map["landmarks"][i]; - LandmarkBasePtr lmk_ptr = LandmarkFactory::get().create(lmk_node["type"].as<std::string>(), lmk_node); + LandmarkBasePtr lmk_ptr = FactoryLandmark::get().create(lmk_node["type"].as<std::string>(), lmk_node); lmk_ptr->link(shared_from_this()); } -- GitLab