astra_ros
Public Types | Public Member Functions | Static Public Member Functions | List of all members
astra_ros::Parameter< T > Class Template Reference

A "live" value that can be changed at runtime. Changes are broadcast to a listener. More...

#include <Parameter.hpp>

Public Types

typedef ParameterImpl< T >::ValueType ValueType
 
typedef ParameterImpl< T >::OnChange OnChange
 

Public Member Functions

 Parameter ()
 
 Parameter (const T &value)
 
bool set (const T &value)
 
const T & get () const
 
const T & operator* () const
 
void setOnChangeHandler (const boost::optional< OnChange > &on_change)
 
template<typename F , typename... Args>
void bindOnChangeHandler (F &&f, Args &&...args)
 
const boost::optional< OnChange > & getOnChangeHandler () const
 

Static Public Member Functions

template<typename F , typename... Args>
static OnChange bind (F &&f, Args &&...args)
 

Detailed Description

template<typename T>
class astra_ros::Parameter< T >

A "live" value that can be changed at runtime. Changes are broadcast to a listener.

Parameters can be copied cheaply. They are backed by ParameterImpl, which implements the actual logic.

Constructor & Destructor Documentation

◆ Parameter() [1/2]

template<typename T >
astra_ros::Parameter< T >::Parameter ( )
inline

Create a Parameter with the value T() (the default value for the type T)

◆ Parameter() [2/2]

template<typename T >
astra_ros::Parameter< T >::Parameter ( const T &  value)
inline

Create a Parameter with a given value

Member Function Documentation

◆ bind()

template<typename T >
template<typename F , typename... Args>
static OnChange astra_ros::Parameter< T >::bind ( F &&  f,
Args &&...  args 
)
inlinestatic

Helper method used by bindOnChangeHandler. Wraps std::bind in an OnChange.

◆ bindOnChangeHandler()

template<typename T >
template<typename F , typename... Args>
void astra_ros::Parameter< T >::bindOnChangeHandler ( F &&  f,
Args &&...  args 
)
inline

Convience method for setting the OnChange handler with semantics equivalent to std::bind.

◆ get()

template<typename T >
const T& astra_ros::Parameter< T >::get ( ) const
inline

Retrieve the value of the Parameter.

◆ getOnChangeHandler()

template<typename T >
const boost::optional<OnChange>& astra_ros::Parameter< T >::getOnChangeHandler ( ) const
inline

Retrieve the current onChange handler

Returns
boost::none if not set, otherwise the onChange handler

◆ operator*()

template<typename T >
const T& astra_ros::Parameter< T >::operator* ( ) const
inline

Convenience method. Equivalent to get().

◆ set()

template<typename T >
bool astra_ros::Parameter< T >::set ( const T &  value)
inline

Update the value of the Parameter. Changes are broadcast to the OnChange listener.

◆ setOnChangeHandler()

template<typename T >
void astra_ros::Parameter< T >::setOnChangeHandler ( const boost::optional< OnChange > &  on_change)
inline

Set the OnChange handler that is called when values change. This shouldn't be used by the Parameter "client".


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