Provides a parameter registry. Parameters can be declared, get or set in the registry. It also provides services, so the parameters can be get, set or listed from other processes. More...
#include <Registry.hh>
Public Member Functions | |
ParametersRegistry (const ParametersRegistry &)=delete | |
No copy constructor. More... | |
ParametersRegistry (const std::string &_parametersServicesNamespace) | |
Constructor. More... | |
ParametersRegistry (ParametersRegistry &&) | |
Default move constructor. More... | |
~ParametersRegistry () | |
Destructor. More... | |
ParameterResult | DeclareParameter (const std::string &_parameterName, const google::protobuf::Message &_msg) final |
Declare a new parameter. See ParametersInterface::DeclareParameter(). More... | |
ParameterResult | DeclareParameter (const std::string &_parameterName, std::unique_ptr< google::protobuf::Message > _initialValue) |
Declare a new parameter. More... | |
ignition::msgs::ParameterDeclarations | ListParameters () const final |
List all parameters. More... | |
ParametersRegistry & | operator= (const ParametersRegistry &)=delete |
No copy assignment. More... | |
ParametersRegistry & | operator= (ParametersRegistry &&) |
Default move assignment. More... | |
ParameterResult | Parameter (const std::string &_parameterName, google::protobuf::Message &_parameter) const final |
Request the value of a parameter. See ParametersInterface::Parameter(). More... | |
ParameterResult | Parameter (const std::string &_parameterName, std::unique_ptr< google::protobuf::Message > &_parameter) const final |
Request the value of a parameter. Similar to the other overload, but it allocates a message of the right type. More... | |
ParameterResult | SetParameter (const std::string &_parameterName, const google::protobuf::Message &_msg) final |
Set the value of a parameter. See ParametersInterface::SetParameter(). More... | |
ParameterResult | SetParameter (const std::string &_parameterName, std::unique_ptr< google::protobuf::Message > _value) |
Set the value of a parameter. More... | |
Public Member Functions inherited from ParametersInterface | |
virtual | ~ParametersInterface ()=default |
Default virtual destructor. More... | |
Detailed Description
Provides a parameter registry. Parameters can be declared, get or set in the registry. It also provides services, so the parameters can be get, set or listed from other processes.
Provided services:
- /${_parametersServicesNamespace}/get_parameter
- /${_parametersServicesNamespace}/list_parameters
- /${_parametersServicesNamespace}/set_parameter
- /${_parametersServicesNamespace}/declare_parameter
Constructor & Destructor Documentation
◆ ParametersRegistry() [1/3]
|
explicit |
Constructor.
- Parameters
-
[in] _parametersServicesNamespace Namespace that will be used in all the created services names.
◆ ~ParametersRegistry()
~ParametersRegistry | ( | ) |
Destructor.
◆ ParametersRegistry() [2/3]
|
delete |
No copy constructor.
◆ ParametersRegistry() [3/3]
Default move constructor.
Member Function Documentation
◆ DeclareParameter() [1/2]
|
finalvirtual |
Declare a new parameter. See ParametersInterface::DeclareParameter().
Implements ParametersInterface.
◆ DeclareParameter() [2/2]
ParameterResult DeclareParameter | ( | const std::string & | _parameterName, |
std::unique_ptr< google::protobuf::Message > | _initialValue | ||
) |
Declare a new parameter.
- Parameters
-
[in] _parameterName Name of the parameter. [in] _initialValue The initial value of the parameter. The parameter type will be deduced from the type of the message.
- Exceptions
-
std::invalid_argument if _initialValue
isnullptr
.ParameterAlreadyDeclaredException if a parameter with the same name was declared before.
◆ ListParameters()
|
finalvirtual |
List all parameters.
- Returns
- Protobuf message with a list of all declared parameter names and their types.
Implements ParametersInterface.
◆ operator=() [1/2]
|
delete |
No copy assignment.
◆ operator=() [2/2]
ParametersRegistry& operator= | ( | ParametersRegistry && | ) |
Default move assignment.
◆ Parameter() [1/2]
|
finalvirtual |
Request the value of a parameter. See ParametersInterface::Parameter().
Implements ParametersInterface.
◆ Parameter() [2/2]
|
finalvirtual |
Request the value of a parameter. Similar to the other overload, but it allocates a message of the right type.
- Parameters
-
[in] _parameterName Name of the parameter to be requested. [out] _parameter Output were the parameter value will be set.
- Returns
- A ParameterResult return code, can return error types:
- ParameterResultType::NotDeclared if the parameter was not declared.
- ParameterResultType::Unexpected, if an unexpected error happened.
Implements ParametersInterface.
◆ SetParameter() [1/2]
|
finalvirtual |
Set the value of a parameter. See ParametersInterface::SetParameter().
Implements ParametersInterface.
◆ SetParameter() [2/2]
ParameterResult SetParameter | ( | const std::string & | _parameterName, |
std::unique_ptr< google::protobuf::Message > | _value | ||
) |
Set the value of a parameter.
- Parameters
-
[in] _parameterName Name of the parameter to set. [in] _value The value of the parameter.
- Exceptions
-
ParameterNotDeclaredException if a parameter of that name was not declared before. ParameterInvalidTypeException if the type does not match the type of the parameter when it was declared.
The documentation for this class was generated from the following file: