Public Member Functions | Protected Member Functions | List of all members
cras::NodeletParamHelper< NodeletType > Class Template Reference

This mixin allows calling the getParam() helpers. More...

#include <param_helper.hpp>

Inheritance diagram for cras::NodeletParamHelper< NodeletType >:
Inheritance graph
[legend]

Public Member Functions

 NodeletParamHelper ()
 
 ~NodeletParamHelper () override
 
- Public Member Functions inherited from cras::ParamHelper
::cras::LogHelperPtr getLogger () const
 Return the log helper used for logging. More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
ResultType getParam (const ::cras::GetParamAdapter &param, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
ResultType getParam (const ::cras::GetParamAdapter &param, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
inline ::std::string getParam (const ::cras::GetParamAdapter &param, const ::std::string &name, const ::cras::optional< const char *> &defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::std::string getParam (const ::cras::GetParamAdapter &param, const ::std::string &name, const char *defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::cras::GetParamAdapter &param, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::cras::GetParamAdapter &param, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::cras::GetParamAdapter &param, const ::std::string &name, const ::cras::optional< const char *> &defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::cras::GetParamAdapter &param, const ::std::string &name, const char *defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
 ParamHelper (const ::cras::LogHelperPtr &log)
 
void setLogger (const ::cras::LogHelperPtr &logger)
 Set the log helper used for logging. More...
 
virtual ~ParamHelper ()=default
 
- Public Member Functions inherited from cras::HasLogger
::cras::LogHelperConstPtr getCrasLogger () const
 This is the function picked up by CRAS_* logging macros. More...
 
 HasLogger (const ::cras::LogHelperPtr &log)
 Associate the logger with this interface. More...
 
void setCrasLogger (const ::cras::LogHelperPtr &log)
 Set the logger to be used for logging. More...
 

Protected Member Functions

template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
ResultType getParam (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
ResultType getParam (const ::ros::NodeHandle &node, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
inline ::std::string getParam (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< const char *> &defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::std::string getParam (const ::ros::NodeHandle &node, const ::std::string &name, const char *defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< const char *> &defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const char *defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
::cras::BoundParamHelperPtr params (const ::ros::NodeHandle &node, const ::std::string &ns="") const
 Creates a version of this param helper "bound" to the given node handle, so that it is not needed to specify the node handle in the subsequent getParam() calls. More...
 
::cras::BoundParamHelperPtr paramsForNodeHandle (const ::ros::NodeHandle &node) const
 Creates a version of this param helper "bound" to the given node handle, so that it is not needed to specify the node handle in the subsequent getParam() calls. More...
 
::cras::BoundParamHelperPtr privateParams (const ::std::string &ns="") const
 Creates a version of this param helper "bound" to the private nodelet parameters, so that it is not needed to specify the node handle in the subsequent getParam() calls. More...
 
::cras::BoundParamHelperPtr publicParams (const ::std::string &ns="") const
 Creates a version of this param helper "bound" to the public nodelet parameters, so that it is not needed to specify the node handle in the subsequent getParam() calls. More...
 

Additional Inherited Members

- Protected Attributes inherited from cras::HasLogger
::cras::LogHelperPtr log
 Log helper. More...
 

Detailed Description

template<typename NodeletType>
class cras::NodeletParamHelper< NodeletType >

This mixin allows calling the getParam() helpers.

Template Parameters
NodeletTypeType of the base nodelet.

Definition at line 30 of file nodelet_utils/param_helper.hpp.

Constructor & Destructor Documentation

◆ NodeletParamHelper()

template<typename NodeletType>
cras::NodeletParamHelper< NodeletType >::NodeletParamHelper ( )

◆ ~NodeletParamHelper()

template<typename NodeletType>
cras::NodeletParamHelper< NodeletType >::~NodeletParamHelper ( )
override

Member Function Documentation

◆ getParam() [1/4]

template<typename NodeletType>
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
ResultType cras::NodeletParamHelper< NodeletType >::getParam ( const ::ros::NodeHandle node,
const ::std::string &  name,
const ::cras::optional< ResultType > &  defaultValue = ResultType(),
const ::std::string &  unit = "",
const ::cras::GetParamOptions< ResultType, ParamServerType > &  options = {} 
)
inlineprotected

Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified).

Template Parameters
ResultTypeParam type (the C++ type). It is converted from the intermediate ParamServerType using options.toResult function (which defaults to static_cast).
ParamServerTypeIntermediate type to which the XmlRpcValue read from parameter server is converted. The conversion is done using options.toParam function (which defaults to cras::convert). Most overloads of cras::convert are in xmlrpc_value_utils.hpp, but you can add your own.
Parameters
[in]nodeThe node handle from which parameters are read.
[in]nameName of the parameter.
[in]defaultValueThe default value to use. If std::nullopt, then the parameter is required. If a required param is not found, a GetParamException is thrown.
[in]unitOptional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
[in]optionsOptions specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g. {.throwIfConvertFails = true, .allowNestedParams = false}.
Returns
The loaded parameter value.

Definition at line 116 of file nodelet_utils/param_helper.hpp.

◆ getParam() [2/4]

template<typename NodeletType>
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
ResultType cras::NodeletParamHelper< NodeletType >::getParam ( const ::ros::NodeHandle node,
const ::std::string &  name,
const ResultType &  defaultValue = ResultType(),
const ::std::string &  unit = "",
const ::cras::GetParamOptions< ResultType, ParamServerType > &  options = {} 
)
inlineprotected

Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified).

Template Parameters
ResultTypeParam type (the C++ type). It is converted from the intermediate ParamServerType using options.toResult function (which defaults to static_cast).
ParamServerTypeIntermediate type to which the XmlRpcValue read from parameter server is converted. The conversion is done using options.toParam function (which defaults to cras::convert). Most overloads of cras::convert are in xmlrpc_value_utils.hpp, but you can add your own.
Parameters
[in]nodeThe node handle from which parameters are read.
[in]nameName of the parameter.
[in]defaultValueThe default value to use.
[in]unitOptional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
[in]optionsOptions specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g. {.throwIfConvertFails = true, .allowNestedParams = false}.
Returns
The loaded parameter value.

Definition at line 145 of file nodelet_utils/param_helper.hpp.

◆ getParam() [3/4]

template<typename NodeletType>
inline ::std::string cras::NodeletParamHelper< NodeletType >::getParam ( const ::ros::NodeHandle node,
const ::std::string &  name,
const ::cras::optional< const char *> &  defaultValue,
const ::std::string &  unit = "",
const ::cras::GetParamOptions<::std::string > &  options = {} 
)
inlineprotected

Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified).

This is a variant allowing use of C-string instead of std::string.

Parameters
[in]nodeThe node handle from which parameters are read.
[in]nameName of the parameter.
[in]defaultValueThe default value to use. If std::nullopt, then the parameter is required. If a required param is not found, a GetParamException is thrown.
[in]unitOptional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
[in]optionsOptions specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g. {.throwIfConvertFails = true, .allowNestedParams = false}.
Returns
The loaded parameter value.

Definition at line 216 of file nodelet_utils/param_helper.hpp.

◆ getParam() [4/4]

template<typename NodeletType>
inline ::std::string cras::NodeletParamHelper< NodeletType >::getParam ( const ::ros::NodeHandle node,
const ::std::string &  name,
const char *  defaultValue,
const ::std::string &  unit = "",
const ::cras::GetParamOptions<::std::string > &  options = {} 
)
inlineprotected

Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified).

This is a variant allowing use of C-string instead of std::string.

Parameters
[in]nodeThe node handle from which parameters are read.
[in]nameName of the parameter.
[in]defaultValueThe default value to use.
[in]unitOptional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
[in]optionsOptions specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g. {.throwIfConvertFails = true, .allowNestedParams = false}.
Returns
The loaded parameter value.

Definition at line 238 of file nodelet_utils/param_helper.hpp.

◆ getParamVerbose() [1/4]

template<typename NodeletType>
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
inline ::cras::GetParamResult<ResultType> cras::NodeletParamHelper< NodeletType >::getParamVerbose ( const ::ros::NodeHandle node,
const ::std::string &  name,
const ::cras::optional< ResultType > &  defaultValue = ResultType(),
const ::std::string &  unit = "",
const ::cras::GetParamOptions< ResultType, ParamServerType > &  options = {} 
)
inlineprotected

Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified).

Template Parameters
ResultTypeParam type (the C++ type). It is converted from the intermediate ParamServerType using options.toResult function (which defaults to static_cast).
ParamServerTypeIntermediate type to which the XmlRpcValue read from parameter server is converted. The conversion is done using options.toParam function (which defaults to cras::convert). Most overloads of cras::convert are in xmlrpc_value_utils.hpp, but you can add your own.
Parameters
[in]nodeThe node handle from which parameters are read.
[in]nameName of the parameter.
[in]defaultValueThe default value to use. If std::nullopt, then the parameter is required. If a required param is not found, a GetParamException is thrown.
[in]unitOptional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
[in]optionsOptions specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g. {.throwIfConvertFails = true, .allowNestedParams = false}.
Returns
A wrapper containing the loaded parameter value and details about the function execution.

Definition at line 57 of file nodelet_utils/param_helper.hpp.

◆ getParamVerbose() [2/4]

template<typename NodeletType>
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
inline ::cras::GetParamResult<ResultType> cras::NodeletParamHelper< NodeletType >::getParamVerbose ( const ::ros::NodeHandle node,
const ::std::string &  name,
const ResultType &  defaultValue = ResultType(),
const ::std::string &  unit = "",
const ::cras::GetParamOptions< ResultType, ParamServerType > &  options = {} 
)
inlineprotected

Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified).

Template Parameters
ResultTypeParam type (the C++ type). It is converted from the intermediate ParamServerType using options.toResult function (which defaults to static_cast).
ParamServerTypeIntermediate type to which the XmlRpcValue read from parameter server is converted. The conversion is done using options.toParam function (which defaults to cras::convert). Most overloads of cras::convert are in xmlrpc_value_utils.hpp, but you can add your own.
Parameters
[in]nodeThe node handle from which parameters are read.
[in]nameName of the parameter.
[in]defaultValueThe default value to use.
[in]unitOptional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
[in]optionsOptions specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g. {.throwIfConvertFails = true, .allowNestedParams = false}.
Returns
A wrapper containing the loaded parameter value and details about the function execution.

Definition at line 86 of file nodelet_utils/param_helper.hpp.

◆ getParamVerbose() [3/4]

template<typename NodeletType>
inline ::cras::GetParamResult<::std::string> cras::NodeletParamHelper< NodeletType >::getParamVerbose ( const ::ros::NodeHandle node,
const ::std::string &  name,
const ::cras::optional< const char *> &  defaultValue,
const ::std::string &  unit = "",
const ::cras::GetParamOptions<::std::string > &  options = {} 
)
inlineprotected

Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified).

This is a variant allowing use of C-string instead of std::string.

Parameters
[in]nodeThe node handle from which parameters are read.
[in]nameName of the parameter.
[in]defaultValueThe default value to use. If std::nullopt, then the parameter is required. If a required param is not found, a GetParamException is thrown.
[in]unitOptional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
[in]optionsOptions specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g. {.throwIfConvertFails = true, .allowNestedParams = false}.
Returns
A wrapper containing the loaded parameter value and details about the function execution.

Definition at line 171 of file nodelet_utils/param_helper.hpp.

◆ getParamVerbose() [4/4]

template<typename NodeletType>
inline ::cras::GetParamResult<::std::string> cras::NodeletParamHelper< NodeletType >::getParamVerbose ( const ::ros::NodeHandle node,
const ::std::string &  name,
const char *  defaultValue,
const ::std::string &  unit = "",
const ::cras::GetParamOptions<::std::string > &  options = {} 
)
inlineprotected

Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified).

This is a variant allowing use of C-string instead of std::string.

Parameters
[in]nodeThe node handle from which parameters are read.
[in]nameName of the parameter.
[in]defaultValueThe default value to use.
[in]unitOptional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
[in]optionsOptions specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g. {.throwIfConvertFails = true, .allowNestedParams = false}.
Returns
A wrapper containing the loaded parameter value and details about the function execution.

Definition at line 193 of file nodelet_utils/param_helper.hpp.

◆ params()

template<typename NodeletType>
::cras::BoundParamHelperPtr cras::NodeletParamHelper< NodeletType >::params ( const ::ros::NodeHandle node,
const ::std::string &  ns = "" 
) const
protected

Creates a version of this param helper "bound" to the given node handle, so that it is not needed to specify the node handle in the subsequent getParam() calls.

Parameters
[in]nodeThe node to bind to.
[in]nsIf nonempty, returns just the parameters in the given namespace.
Returns
The bound param helper.

◆ paramsForNodeHandle()

template<typename NodeletType>
::cras::BoundParamHelperPtr cras::NodeletParamHelper< NodeletType >::paramsForNodeHandle ( const ::ros::NodeHandle node) const
protected

Creates a version of this param helper "bound" to the given node handle, so that it is not needed to specify the node handle in the subsequent getParam() calls.

Parameters
[in]nodeThe node to bind to.
Returns
The bound param helper.

◆ privateParams()

template<typename NodeletType>
::cras::BoundParamHelperPtr cras::NodeletParamHelper< NodeletType >::privateParams ( const ::std::string &  ns = "") const
protected

Creates a version of this param helper "bound" to the private nodelet parameters, so that it is not needed to specify the node handle in the subsequent getParam() calls.

Parameters
[in]nsIf nonempty, returns just the parameters in the given namespace.
Returns
The bound param helper.

◆ publicParams()

template<typename NodeletType>
::cras::BoundParamHelperPtr cras::NodeletParamHelper< NodeletType >::publicParams ( const ::std::string &  ns = "") const
protected

Creates a version of this param helper "bound" to the public nodelet parameters, so that it is not needed to specify the node handle in the subsequent getParam() calls.

Parameters
[in]nsIf nonempty, returns just the parameters in the given namespace.
Returns
The bound param helper.

The documentation for this class was generated from the following file:


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sat Jun 17 2023 02:32:53