A wrapper class to contain a map of Parameter pointers by name and provide robust access methods.
More...
#include <ParameterMap.hpp>
A wrapper class to contain a map of Parameter pointers by name and provide robust access methods.
Definition at line 19 of file ParameterMap.hpp.
◆ ParameterMap() [1/2]
ParameterMap::ParameterMap |
( |
const ParameterInterfaceList & |
parameters | ) |
|
|
explicit |
Construct the parameter map with an initial list of parameters.
- Parameters
-
Definition at line 5 of file ParameterMap.cpp.
◆ ParameterMap() [2/2]
ParameterMap::ParameterMap |
( |
const ParameterInterfaceMap & |
parameters | ) |
|
|
explicit |
Construct the parameter map with an initial map of parameters.
- Parameters
-
Definition at line 9 of file ParameterMap.cpp.
◆ assert_parameter_valid()
void ParameterMap::assert_parameter_valid |
( |
const std::shared_ptr< ParameterInterface > & |
parameter | ) |
|
|
protected |
Check if a parameter has the expected type, throw an exception otherwise.
- Parameters
-
parameter | The parameter to be validated |
Definition at line 48 of file ParameterMap.cpp.
◆ get_parameter()
std::shared_ptr< ParameterInterface > ParameterMap::get_parameter |
( |
const std::string & |
name | ) |
const |
Get a parameter by its name.
- Parameters
-
name | The name of the parameter |
- Returns
- The parameter, if it exists
Definition at line 13 of file ParameterMap.cpp.
◆ get_parameter_list()
ParameterInterfaceList ParameterMap::get_parameter_list |
( |
| ) |
const |
Get a list of all the parameters.
- Returns
- The list of parameters
Definition at line 24 of file ParameterMap.cpp.
◆ get_parameter_value()
template<typename T >
T ParameterMap::get_parameter_value |
( |
const std::string & |
name | ) |
const |
|
inline |
Get a parameter value by its name.
- Template Parameters
-
T | Type of the parameter value |
- Parameters
-
name | The name of the parameter |
- Returns
- The value of the parameter, if the parameter exists
Definition at line 122 of file ParameterMap.hpp.
◆ get_parameters()
ParameterInterfaceMap ParameterMap::get_parameters |
( |
| ) |
const |
Get a map of all the <name, parameter> pairs.
- Returns
- The map of parameters
Definition at line 20 of file ParameterMap.cpp.
◆ remove_parameter()
void ParameterMap::remove_parameter |
( |
const std::string & |
name | ) |
|
Remove a parameter from the parameter map.
- Parameters
-
name | The name of the parameter that should be removed @raise InvalidParameterException if the parameter does not exist |
Definition at line 60 of file ParameterMap.cpp.
◆ set_parameter()
void ParameterMap::set_parameter |
( |
const std::shared_ptr< ParameterInterface > & |
parameter | ) |
|
Set a parameter.
- Parameters
-
parameter | The new parameter |
Definition at line 32 of file ParameterMap.cpp.
◆ set_parameter_value()
template<typename T >
void ParameterMap::set_parameter_value |
( |
const std::string & |
name, |
|
|
const T & |
value |
|
) |
| |
|
inline |
Set a parameter value by its name.
- Template Parameters
-
T | Type of the parameter value |
- Parameters
-
name | The name of the parameter |
value | The new value of the parameter |
Definition at line 127 of file ParameterMap.hpp.
◆ set_parameters() [1/2]
void ParameterMap::set_parameters |
( |
const ParameterInterfaceList & |
parameters | ) |
|
Set parameters from a list of parameters.
- Parameters
-
parameters | The list of parameters |
Definition at line 36 of file ParameterMap.cpp.
◆ set_parameters() [2/2]
void ParameterMap::set_parameters |
( |
const ParameterInterfaceMap & |
parameters | ) |
|
Set parameters from a map with <name, parameter> pairs.
- Parameters
-
parameters | The map of parameters |
Definition at line 42 of file ParameterMap.cpp.
◆ validate_and_set_parameter()
void ParameterMap::validate_and_set_parameter |
( |
const std::shared_ptr< ParameterInterface > & |
parameter | ) |
|
|
protectedvirtual |
Validate and set a parameter in the map.
This virtual function should be redefined in any base class to provide proper validation of parameters by name, value and type. In the base form, it allows any type of parameter name to be added to the map.
- Parameters
-
parameter | The parameter to be validated |
Definition at line 56 of file ParameterMap.cpp.
◆ parameters_
ParameterInterfaceMap state_representation::ParameterMap::parameters_ |
|
protected |
The documentation for this class was generated from the following files:
- /github/workspace/source/state_representation/include/state_representation/parameters/ParameterMap.hpp
- /github/workspace/source/state_representation/src/parameters/ParameterMap.cpp