Control Libraries 7.4.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
state_representation::AnalogIOState Class Reference
Inheritance diagram for state_representation::AnalogIOState:
state_representation::IOState< double > state_representation::State

Public Member Functions

 AnalogIOState ()
 Empty constructor for an analog IO state.
 
 AnalogIOState (const std::string &name, unsigned int nb_ios=0)
 Constructor with name and number of analog IOs provided.
 
 AnalogIOState (const std::string &name, const std::vector< std::string > &io_names)
 Constructor with name and list of analog IO names provided.
 
 AnalogIOState (const AnalogIOState &state)
 Copy constructor of an analog IO state.
 
AnalogIOStateoperator= (const AnalogIOState &state)
 Copy assignment operator that has to be defined to the custom assignment operator.
 
AnalogIOState copy () const
 Return a copy of the analog IO state.
 
void reset () override
 Reset the object to a post-construction state.
 
void set_zero ()
 Set the analog IO state to zero data.
 
- Public Member Functions inherited from state_representation::IOState< double >
unsigned int get_size () const
 Getter of the size.
 
const std::vector< std::string > & get_names () const
 Getter of the names.
 
unsigned int get_io_index (const std::string &io_name) const
 Get IO index by the name of the IO, if it exists.
 
double get_value (const std::string &name) const
 Get the value of an IO by its name, if it exists.
 
double get_value (unsigned int io_index) const
 Get the value of an IO by its index, if it exists.
 
Eigen::Vector< double, Eigen::Dynamic > data () const
 Returns the values of the IO state as an Eigen vector.
 
Eigen::Array< double, Eigen::Dynamic, 1 > array () const
 Returns the values of the IO state an Eigen array.
 
void set_names (unsigned int nb_ios)
 Setter of the names from the number of IOs.
 
void set_names (const std::vector< std::string > &names)
 Setter of the names from a list of IO names.
 
void set_value (double value, const std::string &name)
 Set the value of an IO by its name.
 
void set_value (double value, unsigned int io_index)
 Set the value of an IO by its index.
 
void set_data (const Eigen::Vector< double, Eigen::Dynamic > &data)
 Set the values of the IO state from a single Eigen vector.
 
void set_data (const std::vector< double > &data)
 Set the values of the IO state from a single std vector.
 
void set_data (const std::vector< double > &data)
 Set the data of the state from a std vector.
 
void set_data (const std::vector< bool > &data)
 
bool is_incompatible (const State &state) const override
 Check if the IO group is incompatible for operations with the state given as argument.
 
std::vector< double > to_std_vector () const
 Return the IO values as a std vector.
 
std::vector< double > to_std_vector () const
 
std::vector< bool > to_std_vector () const
 
- 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 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.
 
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.
 

Static Public Member Functions

static AnalogIOState Zero (const std::string &name, unsigned int nb_ios)
 Constructor for a zero analog IO state.
 
static AnalogIOState Zero (const std::string &name, const std::vector< std::string > &names)
 Constructor for a zero analog IO state.
 
static AnalogIOState Random (const std::string &name, unsigned int nb_ios)
 Constructor for an analog IO state with random data.
 
static AnalogIOState Random (const std::string &name, const std::vector< std::string > &names)
 Constructor for an analog IO state with random data.
 

Protected Member Functions

std::string to_string () const override
 Convert the state to its string representation.
 
- Protected Member Functions inherited from state_representation::IOState< double >
 IOState ()=default
 Empty constructor for an IO state.
 
 IOState (const std::string &name, unsigned int nb_ios)
 Constructor with name and number of IOs provided.
 
 IOState (const std::string &name, const std::vector< std::string > &io_names)
 Constructor with name and list of IO names provided.
 
- 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.
 

Friends

std::ostream & operator<< (std::ostream &os, const AnalogIOState &state)
 Overload the ostream operator for printing.
 
void swap (AnalogIOState &state1, AnalogIOState &state2)
 Swap the values of the IO states.
 

Additional Inherited Members

- Static Protected Member Functions inherited from state_representation::IOState< double >
static void assert_index_in_range (unsigned int io_index, unsigned int size)
 
- Protected Attributes inherited from state_representation::IOState< double >
std::vector< std::string > names_
 names of the IOs
 
Eigen::Vector< double, Eigen::Dynamic > data_
 IO values.
 

Detailed Description

Definition at line 7 of file AnalogIOState.hpp.

Constructor & Destructor Documentation

◆ AnalogIOState() [1/4]

state_representation::AnalogIOState::AnalogIOState ( )

Empty constructor for an analog IO state.

Definition at line 9 of file AnalogIOState.cpp.

◆ AnalogIOState() [2/4]

state_representation::AnalogIOState::AnalogIOState ( const std::string &  name,
unsigned int  nb_ios = 0 
)
explicit

Constructor with name and number of analog IOs provided.

Parameters
nameThe name of the associated IO state
nb_iosThe number of IOs for initialization

Definition at line 13 of file AnalogIOState.cpp.

◆ AnalogIOState() [3/4]

state_representation::AnalogIOState::AnalogIOState ( const std::string &  name,
const std::vector< std::string > &  io_names 
)

Constructor with name and list of analog IO names provided.

Parameters
nameThe name of the associated analog IO state
io_nameList of IO names

Definition at line 18 of file AnalogIOState.cpp.

◆ AnalogIOState() [4/4]

state_representation::AnalogIOState::AnalogIOState ( const AnalogIOState state)

Copy constructor of an analog IO state.

Parameters
stateThe analog IO state to copy from

Definition at line 23 of file AnalogIOState.cpp.

Member Function Documentation

◆ copy()

AnalogIOState state_representation::AnalogIOState::copy ( ) const

Return a copy of the analog IO state.

Definition at line 63 of file AnalogIOState.cpp.

◆ operator=()

AnalogIOState & state_representation::AnalogIOState::operator= ( const AnalogIOState state)

Copy assignment operator that has to be defined to the custom assignment operator.

Parameters
stateThe state with value to assign
Returns
Reference to the current state with new values

Definition at line 57 of file AnalogIOState.cpp.

◆ Random() [1/2]

AnalogIOState state_representation::AnalogIOState::Random ( const std::string &  name,
const std::vector< std::string > &  names 
)
static

Constructor for an analog IO state with random data.

Parameters
nameThe name of the associated analog IO state
namesList of IO names
Returns
Analog IO state with random data

Definition at line 50 of file AnalogIOState.cpp.

◆ Random() [2/2]

AnalogIOState state_representation::AnalogIOState::Random ( const std::string &  name,
unsigned int  nb_ios 
)
static

Constructor for an analog IO state with random data.

Parameters
nameThe name of the associated analog IO state
nb_iosThe number of analog IOs for initialization
Returns
Analog IO state with random data

Definition at line 43 of file AnalogIOState.cpp.

◆ reset()

void state_representation::AnalogIOState::reset ( )
overridevirtual

Reset the object to a post-construction state.

Reimplemented from state_representation::State.

Definition at line 68 of file AnalogIOState.cpp.

◆ set_zero()

void state_representation::AnalogIOState::set_zero ( )

Set the analog IO state to zero data.

Definition at line 73 of file AnalogIOState.cpp.

◆ to_string()

std::string state_representation::AnalogIOState::to_string ( ) const
overrideprotectedvirtual

Convert the state to its string representation.

Reimplemented from state_representation::State.

Definition at line 80 of file AnalogIOState.cpp.

◆ Zero() [1/2]

AnalogIOState state_representation::AnalogIOState::Zero ( const std::string &  name,
const std::vector< std::string > &  names 
)
static

Constructor for a zero analog IO state.

Parameters
nameThe name of the associated analog IO state
namesList of IO names
Returns
Analog IO state with zero data

Definition at line 36 of file AnalogIOState.cpp.

◆ Zero() [2/2]

AnalogIOState state_representation::AnalogIOState::Zero ( const std::string &  name,
unsigned int  nb_ios 
)
static

Constructor for a zero analog IO state.

Parameters
nameThe name of the associated analog IO state
nb_iosThe number of analog IOs for initialization
Returns
Analog IO state with zero data

Definition at line 29 of file AnalogIOState.cpp.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const AnalogIOState state 
)
friend

Overload the ostream operator for printing.

Parameters
osThe ostream to append the string representing the state to
stateThe spatial state to print
Returns
The appended ostream

Definition at line 95 of file AnalogIOState.cpp.

◆ swap

void swap ( AnalogIOState state1,
AnalogIOState state2 
)
friend

Swap the values of the IO states.

Parameters
state1IO state to be swapped with 2
state2IO state to be swapped with 1

Definition at line 111 of file AnalogIOState.hpp.


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