Register#
#include "navground/core/register.h"
Contains a register of sub-classes of
T, registered by name using register_type.- Template Parameters:
T – The base class of all to be registered sub-classes.
Subclassed by navground::sim::Scenario, navground::sim::StateEstimation, navground::sim::Task
Public Types
A shared pointer to an object of type
T.
Factory function to construct objects of type
T.
Public Functions
Gets the name associated to the type of an object in the register.
- Returns:
The associated name or empty if not registered.
Gets the registered properties.
- Returns:
The properties or empty if not registered.
Public Static Functions
The registered factories.
- Returns:
A map of registered factory functions
name -> factory.
The registered properties.
- Returns:
A map with the list of properties for all registered sub-classes
name -> properties.
The registered properties.
- Returns:
A map with the list of properties for all registered sub-classes
name -> properties.
Create a shared pointer of type
T, selecting the factory method by name.- Parameters:
type – [in] The associated sub-class name.
- Returns:
A pointer to an object of a registered sub-class. Returns
nullptr(C++) orNone(Python) in case the desired name is not found.
Check whether a type name has been registered.
- Parameters:
type – [in] The associated sub-class name.
- Returns:
True if the type name has been registered
Reads the names of all registered sub-classes.
- Returns:
A collection of names associated with registered sub-classes.
Register a sub-class of
T, associating it with a user-defined name.- Parameters:
type – [in] The user-defined name to be associated with the sub-class.
properties – [in] Registered properties
schema – [in] An optional schema for custom YAML decoders.
- Template Parameters:
S – The type of the sub-class
- Returns:
The associated name.
Gets name associated to the type in the register.
- Template Parameters:
S – The type
- Returns:
The associated name or empty if not registered.
Gets the registered properties for this type.
- Template Parameters:
S – The type
- Returns:
The properties or empty if not registered.
Macros#
-
DECLARE_TYPE#
Adds type declaration.
static const std::string type;
-
DECLARE_PROPERTIES#
Adds properties declaration.
static const std::map<std::string, navground::core::Property> properties;
-
DECLARE_TYPE_AND_PROPERTIES#
Combine DECLARE_TYPE and DECLARE_PROPERTIES.
static const std::string type; static const std::map<std::string, navground::core::Property> properties;