Resolve "Factory documentation"
Compare changes
Files
4+ 72
− 33
@@ -25,42 +25,68 @@ namespace wolf
@@ -25,42 +25,68 @@ namespace wolf
* > The reason for this is that the two cases above need a more elaborated API than the one in this template class.
* \param TypeInput type of the input argument. Typical cases are std::string for file names, and YAML::Node for YAML nodes.
* - LandmarkBase: the Factory creates landmarks deriving from LandmarkBase and returns base pointers ````LandmarkBasePtr```` to them
* - ParamsSensorBase: the Factory creates intrinsic parameters deriving from ParamsSensorBase and returns base pointers ````ParamsSensorBasePtr```` to them
* - XxxBase: the Factory creates objects deriving from XxxBase and returns pointers ````XxxBasePtr```` to them.
* - ````std::string```` is used when the input parameter is a file name from which to read data (typically a YAML file).
* > The specific type of landmark (e.g. LandmarkCorner2d, LandmarkAHP, LandmarkPolyline2d, etc) is indicated by a string that we call TYPE in this documentation.
@@ -75,23 +101,31 @@ namespace wolf
@@ -75,23 +101,31 @@ namespace wolf
* The rule to make new TYPE strings unique is that you skip the generic 'Type' prefix from your class name,
* The first thing to know is that we have defined typedefs for the templates that we are using. For example:
* 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,10 +137,11 @@ namespace wolf
@@ -103,10 +137,11 @@ namespace wolf
* The method LandmarkPolyline2d::create(...) exists in the LandmarkPolyline2d class as a static method.
* All these ````XxxXxx::create()```` methods need to have exactly the same API, regardless of the object type.
@@ -117,13 +152,13 @@ namespace wolf
@@ -117,13 +152,13 @@ namespace wolf
* This API includes an element of type TypeInput, which might be either a std::string, or a YAML::node:
* - ````std::string```` is used to indicate the name of a configuration file. These files are usually YAML files containing configuration data to create your object.
* - ````YAML::Node```` is used to access parts of a YAML file already encoded as nodes, such as when loading landmarks from a SLAM map stored as a YAML file.
@@ -137,7 +172,7 @@ namespace wolf
@@ -137,7 +172,7 @@ namespace wolf
@@ -145,7 +180,7 @@ namespace wolf
@@ -145,7 +180,7 @@ namespace wolf
* const bool registered_camera_intr = FactoryParamsSensor::get().registerCreator("CAMERA", createParamsSensorCamera);
* which is a static invocation (i.e., it is placed at global scope outside of the ParamsSensorCamera class).
@@ -156,7 +191,7 @@ namespace wolf
@@ -156,7 +191,7 @@ namespace wolf
* The method unregisterCreator() unregisters the ObjectXxx::create() method. It only needs to be passed the string of the object type.
@@ -166,13 +201,13 @@ namespace wolf
@@ -166,13 +201,13 @@ namespace wolf
* LandmarkBasePtr lmk_ptr = Factory<LandmarkBasePtr, YAML::Node>::get().create("POLYLINE 2d", lmk_yaml_node);
@@ -197,7 +232,7 @@ namespace wolf
@@ -197,7 +232,7 @@ namespace wolf
@@ -212,7 +247,7 @@ namespace wolf
@@ -212,7 +247,7 @@ namespace wolf
* const bool registered_lmk_polyline_2d = FactoryLandmark::get().registerCreator("POLYLINE 2d", LandmarkPolyline2d::create);
@@ -234,12 +269,16 @@ namespace wolf
@@ -234,12 +269,16 @@ namespace wolf