Skip to content
Snippets Groups Projects
Commit c16524ef authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

Rename LandmarkFactory -> FactoryLandmark

parent 0a402f61
No related branches found
No related tags found
No related merge requests found
Pipeline #5274 failed
...@@ -88,7 +88,7 @@ namespace wolf ...@@ -88,7 +88,7 @@ namespace wolf
* \code * \code
* typedef Factory<ParamsSensorBase, std::string> FactoryParamsSensor; * typedef Factory<ParamsSensorBase, std::string> FactoryParamsSensor;
* typedef Factory<ParamsProcessorBase, std::string> FactoryParamsProcessor; * typedef Factory<ParamsProcessorBase, std::string> FactoryParamsProcessor;
* typedef Factory<LandmarkBase, YAML::Node> LandmarkFactory; * typedef Factory<LandmarkBase, YAML::Node> FactoryLandmark;
* \endcode * \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. * 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 ...@@ -103,7 +103,7 @@ namespace wolf
* You can then call the methods you like, e.g. to create a landmark, you use: * You can then call the methods you like, e.g. to create a landmark, you use:
* *
* \code * \code
* LandmarkFactory::get().create(...); // see below for creating objects ... * FactoryLandmark::get().create(...); // see below for creating objects ...
* \endcode * \endcode
* *
* #### Write creator methods (in your derived object classes) * #### Write creator methods (in your derived object classes)
...@@ -137,7 +137,7 @@ namespace wolf ...@@ -137,7 +137,7 @@ namespace wolf
* that knows how to create your specific object, e.g.: * that knows how to create your specific object, e.g.:
* *
* \code * \code
* LandmarkFactory::get().registerCreator("POLYLINE 2d", LandmarkPolyline2d::create); * FactoryLandmark::get().registerCreator("POLYLINE 2d", LandmarkPolyline2d::create);
* \endcode * \endcode
* *
* #### Automatic registration * #### Automatic registration
...@@ -172,7 +172,7 @@ namespace wolf ...@@ -172,7 +172,7 @@ namespace wolf
* or even better, make use of the convenient typedefs: * or even better, make use of the convenient typedefs:
* *
* \code * \code
* LandmarkBasePtr lmk_ptr = LandmarkFactory::get().create("POLYLINE 2d", lmk_yaml_node); * LandmarkBasePtr lmk_ptr = FactoryLandmark::get().create("POLYLINE 2d", lmk_yaml_node);
* \endcode * \endcode
* *
* ### Examples * ### Examples
...@@ -212,7 +212,7 @@ namespace wolf ...@@ -212,7 +212,7 @@ namespace wolf
* // Register landmark creator (put the register code inside an unnamed namespace): * // Register landmark creator (put the register code inside an unnamed namespace):
* 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 * \endcode
...@@ -220,7 +220,7 @@ namespace wolf ...@@ -220,7 +220,7 @@ namespace wolf
* ### More information * ### More information
* - FactoryParamsSensor: typedef of this template to create intrinsic structs deriving from ParamsSensorBase directly from YAML files. * - 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. * - 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. * - 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````. * - You can also check the code in the example file ````src/examples/test_map_yaml.cpp````.
* *
...@@ -317,11 +317,11 @@ namespace wolf ...@@ -317,11 +317,11 @@ namespace wolf
// Landmarks from YAML // Landmarks from YAML
class LandmarkBase; class LandmarkBase;
typedef Factory<LandmarkBase, typedef Factory<LandmarkBase,
const YAML::Node&> LandmarkFactory; const YAML::Node&> FactoryLandmark;
template<> template<>
inline std::string LandmarkFactory::getClass() inline std::string FactoryLandmark::getClass()
{ {
return "LandmarkFactory"; return "FactoryLandmark";
} }
......
...@@ -182,7 +182,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node) ...@@ -182,7 +182,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node)
// Register landmark creator // Register landmark creator
namespace 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 } // namespace wolf
...@@ -49,7 +49,7 @@ void MapBase::load(const std::string& _map_file_dot_yaml) ...@@ -49,7 +49,7 @@ void MapBase::load(const std::string& _map_file_dot_yaml)
for (unsigned int i = 0; i < nlandmarks; i++) for (unsigned int i = 0; i < nlandmarks; i++)
{ {
YAML::Node lmk_node = map["landmarks"][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()); lmk_ptr->link(shared_from_this());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment