Control Libraries 7.4.0
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
state_representation::Parameter< T > Class Template Reference

Class to represent name-value pairs of different types. More...

#include <Parameter.hpp>

Inheritance diagram for state_representation::Parameter< T >:
state_representation::ParameterInterface state_representation::State

Public Member Functions

 Parameter (const std::string &name="")
 Constructor with the name of the parameter.
 
 Parameter (const std::string &name, const T &value)
 Constructor with a name and a value.
 
template<typename U >
 Parameter (const Parameter< U > &parameter)
 Copy constructor.
 
virtual ~Parameter ()=default
 Default virtual destructor.
 
template<typename U >
Parameter< T > & operator= (const Parameter< U > &parameter)
 Conversion equality.
 
template<typename U >
get_value () const
 Getter of the value attribute.
 
const T & get_value () const
 Getter of the value attribute.
 
T & get_value ()
 Getter of the value attribute.
 
virtual void set_value (const T &value)
 Setter of the value attribute.
 
void reset () override
 Reset the object to a post-construction state.
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const int &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const std::vector< int > &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const double &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const std::vector< double > &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const bool &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const std::vector< bool > &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const std::string &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const std::vector< std::string > &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const CartesianState &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const CartesianPose &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const JointState &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const JointPositions &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const Ellipsoid &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const Eigen::MatrixXd &value)
 
 Parameter (const std::string &name)
 
 Parameter (const std::string &name, const Eigen::VectorXd &value)
 
- Public Member Functions inherited from state_representation::ParameterInterface
 ParameterInterface (const std::string &name, const ParameterType &type, const StateType &parameter_state_type=StateType::NONE)
 Constructor with parameter name and type.
 
 ParameterInterface (const ParameterInterface &parameter)
 Copy constructor.
 
virtual ~ParameterInterface ()=default
 Default virtual destructor.
 
ParameterInterfaceoperator= (const ParameterInterface &state)
 Copy assignment operator that has to be defined to the custom assignment operator.
 
template<typename T >
std::shared_ptr< Parameter< T > > get_parameter (bool validate_pointer=true) const
 Get a pointer to a derived Parameter instance from a ParameterInterface pointer.
 
template<typename T >
get_parameter_value () const
 Get the parameter value of a derived Parameter instance through the ParameterInterface pointer.
 
template<typename T >
void set_parameter_value (const T &value)
 Set the parameter value of a derived Parameter instance through the ParameterInterface pointer.
 
ParameterType get_parameter_type () const
 Get the parameter type.
 
StateType get_parameter_state_type () const
 Get the state type of the parameter.
 
- Public Member Functions inherited from state_representation::State
 State ()
 Empty constructor.
 
 State (const std::string &name)
 Constructor with name specification.
 
 State (const State &state)
 Copy constructor from another state.
 
virtual ~State ()=default
 Virtual destructor.
 
Stateoperator= (const State &state)
 Copy assignment operator that has to be defined to the custom assignment operator.
 
const StateTypeget_type () const
 Getter of the type attribute.
 
const std::string & get_name () const
 Getter of the name attribute.
 
bool is_empty () const
 Getter of the empty attribute.
 
const std::chrono::time_point< std::chrono::steady_clock > & get_timestamp () const
 Getter of the timestamp attribute.
 
virtual void set_name (const std::string &name)
 Setter of the name attribute.
 
void reset_timestamp ()
 Reset the timestamp attribute to now.
 
virtual void set_data (const Eigen::VectorXd &data)
 Set the data of the state from an Eigen vector.
 
virtual void set_data (const std::vector< double > &data)
 Set the data of the state from a std vector.
 
virtual void set_data (const Eigen::MatrixXd &data)
 Set the data of the state from an Eigen matrix.
 
double get_age () const
 Get the age of the state, i.e. the time since the last modification.
 
virtual bool is_incompatible (const State &state) const
 Check if the state is incompatible for operations with the state given as argument.
 
bool is_deprecated (double time_delay) const
 Check if the state is deprecated given a certain time delay.
 
template<typename DurationT >
bool is_deprecated (const std::chrono::duration< int64_t, DurationT > &time_delay) const
 Check if the state is deprecated given a certain time delay.
 
 operator bool () const noexcept
 Boolean operator for the truthiness of a state.
 

Friends

template<typename U >
std::ostream & operator<< (std::ostream &os, const Parameter< U > &parameter)
 Overload the ostream operator for printing.
 

Additional Inherited Members

- Protected Member Functions inherited from state_representation::State
void set_type (const StateType &type)
 Setter of the state type attribute.
 
void set_empty (bool empty=true)
 Setter of the empty attribute.
 
void assert_not_empty () const
 Throw an exception if the state is empty.
 
virtual std::string to_string () const
 Convert the state to its string representation.
 

Detailed Description

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

Class to represent name-value pairs of different types.

Template Parameters
TThe type of the value stored in the parameter

Definition at line 18 of file Parameter.hpp.

Constructor & Destructor Documentation

◆ Parameter() [1/33]

template<typename T >
state_representation::Parameter< T >::Parameter ( const std::string &  name = "")
explicit

Constructor with the name of the parameter.

Parameters
nameThe name of the parameter (default is empty)

◆ Parameter() [2/33]

template<typename T >
state_representation::Parameter< T >::Parameter ( const std::string &  name,
const T &  value 
)

Constructor with a name and a value.

Parameters
nameThe name of the parameter
valueThe value of the parameter

◆ Parameter() [3/33]

template<typename T >
template<typename U >
state_representation::Parameter< T >::Parameter ( const Parameter< U > &  parameter)
explicit

Copy constructor.

Parameters
parameterThe parameter to copy

Definition at line 97 of file Parameter.hpp.

◆ Parameter() [4/33]

state_representation::Parameter< int >::Parameter ( const std::string &  name)

Definition at line 6 of file Parameter.cpp.

◆ Parameter() [5/33]

state_representation::Parameter< int >::Parameter ( const std::string &  name,
const int &  value 
)

Definition at line 10 of file Parameter.cpp.

◆ Parameter() [6/33]

state_representation::Parameter< std::vector< int > >::Parameter ( const std::string &  name)

Definition at line 16 of file Parameter.cpp.

◆ Parameter() [7/33]

state_representation::Parameter< std::vector< int > >::Parameter ( const std::string &  name,
const std::vector< int > &  value 
)

Definition at line 20 of file Parameter.cpp.

◆ Parameter() [8/33]

state_representation::Parameter< double >::Parameter ( const std::string &  name)

Definition at line 26 of file Parameter.cpp.

◆ Parameter() [9/33]

state_representation::Parameter< double >::Parameter ( const std::string &  name,
const double &  value 
)

Definition at line 30 of file Parameter.cpp.

◆ Parameter() [10/33]

state_representation::Parameter< std::vector< double > >::Parameter ( const std::string &  name)

Definition at line 36 of file Parameter.cpp.

◆ Parameter() [11/33]

state_representation::Parameter< std::vector< double > >::Parameter ( const std::string &  name,
const std::vector< double > &  value 
)

Definition at line 40 of file Parameter.cpp.

◆ Parameter() [12/33]

state_representation::Parameter< bool >::Parameter ( const std::string &  name)

Definition at line 46 of file Parameter.cpp.

◆ Parameter() [13/33]

state_representation::Parameter< bool >::Parameter ( const std::string &  name,
const bool &  value 
)

Definition at line 50 of file Parameter.cpp.

◆ Parameter() [14/33]

state_representation::Parameter< std::vector< bool > >::Parameter ( const std::string &  name)

Definition at line 56 of file Parameter.cpp.

◆ Parameter() [15/33]

state_representation::Parameter< std::vector< bool > >::Parameter ( const std::string &  name,
const std::vector< bool > &  value 
)

Definition at line 61 of file Parameter.cpp.

◆ Parameter() [16/33]

state_representation::Parameter< std::string >::Parameter ( const std::string &  name)

Definition at line 67 of file Parameter.cpp.

◆ Parameter() [17/33]

state_representation::Parameter< std::string >::Parameter ( const std::string &  name,
const std::string &  value 
)

Definition at line 71 of file Parameter.cpp.

◆ Parameter() [18/33]

state_representation::Parameter< std::vector< std::string > >::Parameter ( const std::string &  name)

Definition at line 77 of file Parameter.cpp.

◆ Parameter() [19/33]

state_representation::Parameter< std::vector< std::string > >::Parameter ( const std::string &  name,
const std::vector< std::string > &  value 
)

Definition at line 81 of file Parameter.cpp.

◆ Parameter() [20/33]

state_representation::Parameter< CartesianState >::Parameter ( const std::string &  name)

Definition at line 87 of file Parameter.cpp.

◆ Parameter() [21/33]

state_representation::Parameter< CartesianState >::Parameter ( const std::string &  name,
const CartesianState value 
)

Definition at line 91 of file Parameter.cpp.

◆ Parameter() [22/33]

state_representation::Parameter< CartesianPose >::Parameter ( const std::string &  name)

Definition at line 97 of file Parameter.cpp.

◆ Parameter() [23/33]

state_representation::Parameter< CartesianPose >::Parameter ( const std::string &  name,
const CartesianPose value 
)

Definition at line 101 of file Parameter.cpp.

◆ Parameter() [24/33]

state_representation::Parameter< JointState >::Parameter ( const std::string &  name)

Definition at line 107 of file Parameter.cpp.

◆ Parameter() [25/33]

state_representation::Parameter< JointState >::Parameter ( const std::string &  name,
const JointState value 
)

Definition at line 111 of file Parameter.cpp.

◆ Parameter() [26/33]

state_representation::Parameter< JointPositions >::Parameter ( const std::string &  name)

Definition at line 117 of file Parameter.cpp.

◆ Parameter() [27/33]

state_representation::Parameter< JointPositions >::Parameter ( const std::string &  name,
const JointPositions value 
)

Definition at line 121 of file Parameter.cpp.

◆ Parameter() [28/33]

state_representation::Parameter< Ellipsoid >::Parameter ( const std::string &  name)

Definition at line 127 of file Parameter.cpp.

◆ Parameter() [29/33]

state_representation::Parameter< Ellipsoid >::Parameter ( const std::string &  name,
const Ellipsoid value 
)

Definition at line 132 of file Parameter.cpp.

◆ Parameter() [30/33]

state_representation::Parameter< Eigen::MatrixXd >::Parameter ( const std::string &  name)

Definition at line 138 of file Parameter.cpp.

◆ Parameter() [31/33]

state_representation::Parameter< Eigen::MatrixXd >::Parameter ( const std::string &  name,
const Eigen::MatrixXd &  value 
)

Definition at line 142 of file Parameter.cpp.

◆ Parameter() [32/33]

state_representation::Parameter< Eigen::VectorXd >::Parameter ( const std::string &  name)

Definition at line 148 of file Parameter.cpp.

◆ Parameter() [33/33]

state_representation::Parameter< Eigen::VectorXd >::Parameter ( const std::string &  name,
const Eigen::VectorXd &  value 
)

Definition at line 152 of file Parameter.cpp.

Member Function Documentation

◆ get_value() [1/3]

template<typename T >
T & state_representation::Parameter< T >::get_value ( )
inline

Getter of the value attribute.

Returns
The value attribute

Definition at line 125 of file Parameter.hpp.

◆ get_value() [2/3]

template<typename T >
template<typename U >
U state_representation::Parameter< T >::get_value ( ) const
inline

Getter of the value attribute.

Template Parameters
UThe expected type of the parameter
Returns
The value attribute

Definition at line 113 of file Parameter.hpp.

◆ get_value() [3/3]

template<typename T >
const T & state_representation::Parameter< T >::get_value ( ) const
inline

Getter of the value attribute.

Returns
The value attribute

Definition at line 119 of file Parameter.hpp.

◆ operator=()

template<typename T >
template<typename U >
Parameter< T > & state_representation::Parameter< T >::operator= ( const Parameter< U > &  parameter)

Conversion equality.

Definition at line 105 of file Parameter.hpp.

◆ reset()

template<typename T >
void state_representation::Parameter< T >::reset ( )
inlineoverridevirtual

Reset the object to a post-construction state.

Reimplemented from state_representation::State.

Definition at line 137 of file Parameter.hpp.

◆ set_value()

template<typename T >
void state_representation::Parameter< T >::set_value ( const T &  value)
inlinevirtual

Setter of the value attribute.

Parameters
valueThe new value attribute

Definition at line 131 of file Parameter.hpp.

Friends And Related Symbol Documentation

◆ operator<<

template<typename T >
template<typename U >
std::ostream & operator<< ( std::ostream &  os,
const Parameter< U > &  parameter 
)
friend

Overload the ostream operator for printing.

Parameters
osThe ostream to append the string representing the state to
parameterThe parameter to print
Returns
The appended ostream

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