Control Libraries 7.4.0
|
Public Member Functions | |
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. | |
T | get_value (const std::string &name) const |
Get the value of an IO by its name, if it exists. | |
T | get_value (unsigned int io_index) const |
Get the value of an IO by its index, if it exists. | |
Eigen::Vector< T, Eigen::Dynamic > | data () const |
Returns the values of the IO state as an Eigen vector. | |
Eigen::Array< T, 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 (T value, const std::string &name) |
Set the value of an IO by its name. | |
void | set_value (T value, unsigned int io_index) |
Set the value of an IO by its index. | |
void | set_data (const Eigen::Vector< T, Eigen::Dynamic > &data) |
Set the values of the IO state from a single Eigen vector. | |
void | set_data (const std::vector< T > &data) |
Set the values of the IO state from a single std vector. | |
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< T > | to_std_vector () const |
Return the IO values as a 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) |
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. | |
State & | operator= (const State &state) |
Copy assignment operator that has to be defined to the custom assignment operator. | |
const StateType & | get_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. | |
virtual void | reset () |
Reset the object to a post-construction state. | |
operator bool () const noexcept | |
Boolean operator for the truthiness of a state. | |
Protected Member Functions | |
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. | |
virtual std::string | to_string () const |
Convert the state to its string representation. | |
Static Protected Member Functions | |
static void | assert_index_in_range (unsigned int io_index, unsigned int size) |
Protected Attributes | |
std::vector< std::string > | names_ |
names of the IOs | |
Eigen::Vector< T, Eigen::Dynamic > | data_ |
IO values. | |
Friends | |
void | swap (IOState &state1, IOState &state2) |
Swap the values of the IO states. | |
Definition at line 12 of file IOState.hpp.
|
explicitprotected |
Constructor with name and number of IOs provided.
name | The name of the associated IO state |
nb_ios | The number of IOs for initialization |
Definition at line 149 of file IOState.hpp.
|
protected |
Constructor with name and list of IO names provided.
name | The name of the associated IO state |
io_name | List of IO names |
Definition at line 156 of file IOState.hpp.
Eigen::Array< T, Eigen::Dynamic, 1 > state_representation::IOState< T >::array | ( | ) | const |
Returns the values of the IO state an Eigen array.
Definition at line 199 of file IOState.hpp.
|
staticprotected |
Definition at line 269 of file IOState.hpp.
Eigen::Vector< T, Eigen::Dynamic > state_representation::IOState< T >::data | ( | ) | const |
Returns the values of the IO state as an Eigen vector.
Definition at line 193 of file IOState.hpp.
unsigned int state_representation::IOState< T >::get_io_index | ( | const std::string & | io_name | ) | const |
Get IO index by the name of the IO, if it exists.
io_name | The name of the desired IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 172 of file IOState.hpp.
const std::vector< std::string > & state_representation::IOState< T >::get_names | ( | ) | const |
Getter of the names.
Definition at line 167 of file IOState.hpp.
unsigned int state_representation::IOState< T >::get_size | ( | ) | const |
Getter of the size.
Definition at line 162 of file IOState.hpp.
T state_representation::IOState< T >::get_value | ( | const std::string & | name | ) | const |
Get the value of an IO by its name, if it exists.
name | The name of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 181 of file IOState.hpp.
T state_representation::IOState< T >::get_value | ( | unsigned int | io_index | ) | const |
Get the value of an IO by its index, if it exists.
io_index | The index of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 186 of file IOState.hpp.
|
overridevirtual |
Check if the IO group is incompatible for operations with the state given as argument.
state | The state to check compatibility with |
Reimplemented from state_representation::State.
Definition at line 251 of file IOState.hpp.
void state_representation::IOState< T >::set_data | ( | const Eigen::Vector< T, Eigen::Dynamic > & | data | ) |
Set the values of the IO state from a single Eigen vector.
The | data vector |
Definition at line 240 of file IOState.hpp.
void state_representation::IOState< bool >::set_data | ( | const std::vector< bool > & | data | ) |
Definition at line 11 of file IOState.cpp.
|
virtual |
Set the data of the state from a std vector.
Reimplemented from state_representation::State.
Definition at line 6 of file IOState.cpp.
void state_representation::IOState< T >::set_data | ( | const std::vector< T > & | data | ) |
Set the values of the IO state from a single std vector.
The | data vector |
void state_representation::IOState< T >::set_names | ( | const std::vector< std::string > & | names | ) |
Setter of the names from a list of IO names.
names | The vector of strings containing the IO names |
Definition at line 217 of file IOState.hpp.
void state_representation::IOState< T >::set_names | ( | unsigned int | nb_ios | ) |
Setter of the names from the number of IOs.
nb_ios | The number of IOs of the IO state |
Definition at line 204 of file IOState.hpp.
void state_representation::IOState< T >::set_value | ( | T | value, |
const std::string & | name | ||
) |
Set the value of an IO by its name.
value | The value of the IO |
name | The name of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 228 of file IOState.hpp.
void state_representation::IOState< T >::set_value | ( | T | value, |
unsigned int | io_index | ||
) |
Set the value of an IO by its index.
value | The value of the IO |
io_index | The index of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 233 of file IOState.hpp.
std::vector< T > state_representation::IOState< T >::to_std_vector | ( | ) | const |
Return the IO values as a std vector.
std::vector< double > state_representation::IOState< double >::to_std_vector | ( | ) | const |
Definition at line 21 of file IOState.cpp.
std::vector< bool > state_representation::IOState< bool >::to_std_vector | ( | ) | const |
Definition at line 26 of file IOState.cpp.
Swap the values of the IO states.
state1 | IO state to be swapped with 2 |
state2 | IO state to be swapped with 1 |
Definition at line 136 of file IOState.hpp.
|
protected |
IO values.
Definition at line 145 of file IOState.hpp.
|
protected |
names of the IOs
Definition at line 144 of file IOState.hpp.