Gazebo Transport

API Reference

12.2.2
ParametersRegistry Class Reference

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...
 
gz::msgs::ParameterDeclarations ListParameters () const final
 List all parameters. More...
 
ParametersRegistryoperator= (const ParametersRegistry &)=delete
 No copy assignment. More...
 
ParametersRegistryoperator= (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]

ParametersRegistry ( const std::string _parametersServicesNamespace)
explicit

Constructor.

Parameters
[in]_parametersServicesNamespaceNamespace that will be used in all the created services names.

◆ ~ParametersRegistry()

Destructor.

◆ ParametersRegistry() [2/3]

ParametersRegistry ( const ParametersRegistry )
delete

No copy constructor.

◆ ParametersRegistry() [3/3]

Default move constructor.

Member Function Documentation

◆ DeclareParameter() [1/2]

ParameterResult DeclareParameter ( const std::string _parameterName,
const google::protobuf::Message &  _msg 
)
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]_parameterNameName of the parameter.
[in]_initialValueThe initial value of the parameter. The parameter type will be deduced from the type of the message.
Exceptions
std::invalid_argumentif _initialValue is nullptr.
ParameterAlreadyDeclaredExceptionif a parameter with the same name was declared before.

◆ ListParameters()

gz::msgs::ParameterDeclarations ListParameters ( ) const
finalvirtual

List all parameters.

Returns
Protobuf message with a list of all declared parameter names and their types.

Implements ParametersInterface.

◆ operator=() [1/2]

ParametersRegistry& operator= ( const ParametersRegistry )
delete

No copy assignment.

◆ operator=() [2/2]

Default move assignment.

◆ Parameter() [1/2]

ParameterResult Parameter ( const std::string _parameterName,
google::protobuf::Message &  _parameter 
) const
finalvirtual

Request the value of a parameter. See ParametersInterface::Parameter().

Implements ParametersInterface.

◆ Parameter() [2/2]

ParameterResult Parameter ( const std::string _parameterName,
std::unique_ptr< google::protobuf::Message > &  _parameter 
) const
finalvirtual

Request the value of a parameter. Similar to the other overload, but it allocates a message of the right type.

Parameters
[in]_parameterNameName of the parameter to be requested.
[out]_parameterOutput were the parameter value will be set.
Returns
A ParameterResult return code, can return error types:

Implements ParametersInterface.

◆ SetParameter() [1/2]

ParameterResult SetParameter ( const std::string _parameterName,
const google::protobuf::Message &  _msg 
)
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]_parameterNameName of the parameter to set.
[in]_valueThe value of the parameter.
Exceptions
ParameterNotDeclaredExceptionif a parameter of that name was not declared before.
ParameterInvalidTypeExceptionif 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: