Control Libraries 7.4.0
|
Public Member Functions | |
DigitalIOState () | |
Empty constructor for a digital IO state. | |
DigitalIOState (const std::string &name, unsigned int nb_ios=0) | |
Constructor with name and number of digital IOs provided. | |
DigitalIOState (const std::string &name, const std::vector< std::string > &io_names) | |
Constructor with name and list of digital IO names provided. | |
DigitalIOState (const DigitalIOState &state) | |
Copy constructor of a digital IO state. | |
DigitalIOState & | operator= (const DigitalIOState &state) |
Copy assignment operator that has to be defined to the custom assignment operator. | |
bool | is_true (const std::string &name) const |
Check if a digital IO is true by its name, if it exists. | |
bool | is_true (unsigned int io_index) const |
Check if a digital IO is true by its index, if it exists. | |
bool | is_false (const std::string &name) const |
Check if a digital IO is false by its name, if it exists. | |
bool | is_false (unsigned int io_index) const |
Check if a digital IO is false by its index, if it exists. | |
void | set_true (const std::string &name) |
Set the a digital IO to true by its name. | |
void | set_true (unsigned int io_index) |
Set the a digital IO to true by its index. | |
void | set_false (const std::string &name) |
Set the a digital IO to false by its name. | |
void | set_false (unsigned int io_index) |
Set the a digital IO to false by its index. | |
DigitalIOState | copy () const |
Return a copy of the digital IO state. | |
void | reset () override |
Reset the object to a post-construction state. | |
void | set_false () |
Set all digital IOs false. | |
Public Member Functions inherited from state_representation::IOState< bool > | |
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. | |
bool | get_value (const std::string &name) const |
Get the value of an IO by its name, if it exists. | |
bool | get_value (unsigned int io_index) const |
Get the value of an IO by its index, if it exists. | |
Eigen::Vector< bool, Eigen::Dynamic > | data () const |
Returns the values of the IO state as an Eigen vector. | |
Eigen::Array< bool, 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 (bool value, const std::string &name) |
Set the value of an IO by its name. | |
void | set_value (bool value, unsigned int io_index) |
Set the value of an IO by its index. | |
void | set_data (const Eigen::Vector< bool, Eigen::Dynamic > &data) |
Set the values of the IO state from a single Eigen vector. | |
void | set_data (const std::vector< bool > &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< bool > | 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. | |
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. | |
operator bool () const noexcept | |
Boolean operator for the truthiness of a state. | |
Static Public Member Functions | |
static DigitalIOState | Zero (const std::string &name, unsigned int nb_ios) |
Constructor for a zero digital IO state. | |
static DigitalIOState | Zero (const std::string &name, const std::vector< std::string > &names) |
Constructor for a zero digital IO state. | |
static DigitalIOState | Random (const std::string &name, unsigned int nb_ios) |
Constructor for a digital IO state with random data. | |
static DigitalIOState | Random (const std::string &name, const std::vector< std::string > &names) |
Constructor for a digital 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< bool > | |
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 DigitalIOState &state) |
Overload the ostream operator for printing. | |
void | swap (DigitalIOState &state1, DigitalIOState &state2) |
Swap the values of the IO states. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from state_representation::IOState< bool > | |
static void | assert_index_in_range (unsigned int io_index, unsigned int size) |
Protected Attributes inherited from state_representation::IOState< bool > | |
std::vector< std::string > | names_ |
names of the IOs | |
Eigen::Vector< bool, Eigen::Dynamic > | data_ |
IO values. | |
Definition at line 7 of file DigitalIOState.hpp.
state_representation::DigitalIOState::DigitalIOState | ( | ) |
Empty constructor for a digital IO state.
Definition at line 9 of file DigitalIOState.cpp.
|
explicit |
Constructor with name and number of digital IOs provided.
name | The name of the associated IO state |
nb_ios | The number of IOs for initialization |
Definition at line 13 of file DigitalIOState.cpp.
state_representation::DigitalIOState::DigitalIOState | ( | const std::string & | name, |
const std::vector< std::string > & | io_names | ||
) |
Constructor with name and list of digital IO names provided.
name | The name of the associated digital IO state |
io_name | List of IO names |
Definition at line 18 of file DigitalIOState.cpp.
state_representation::DigitalIOState::DigitalIOState | ( | const DigitalIOState & | state | ) |
Copy constructor of a digital IO state.
state | The digital IO state to copy from |
Definition at line 23 of file DigitalIOState.cpp.
DigitalIOState state_representation::DigitalIOState::copy | ( | ) | const |
Return a copy of the digital IO state.
Definition at line 97 of file DigitalIOState.cpp.
bool state_representation::DigitalIOState::is_false | ( | const std::string & | name | ) | const |
Check if a digital IO is false by its name, if it exists.
name | The name of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 73 of file DigitalIOState.cpp.
bool state_representation::DigitalIOState::is_false | ( | unsigned int | io_index | ) | const |
Check if a digital IO is false by its index, if it exists.
io_index | The index of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 77 of file DigitalIOState.cpp.
bool state_representation::DigitalIOState::is_true | ( | const std::string & | name | ) | const |
Check if a digital IO is true by its name, if it exists.
name | The name of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 63 of file DigitalIOState.cpp.
bool state_representation::DigitalIOState::is_true | ( | unsigned int | io_index | ) | const |
Check if a digital IO is true by its index, if it exists.
io_index | The index of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 67 of file DigitalIOState.cpp.
DigitalIOState & state_representation::DigitalIOState::operator= | ( | const DigitalIOState & | state | ) |
Copy assignment operator that has to be defined to the custom assignment operator.
state | The state with value to assign |
Definition at line 57 of file DigitalIOState.cpp.
|
static |
Constructor for a digital IO state with random data.
name | The name of the associated digital IO state |
names | List of IO names |
Definition at line 50 of file DigitalIOState.cpp.
|
static |
Constructor for a digital IO state with random data.
name | The name of the associated digital IO state |
nb_ios | The number of digital IOs for initialization |
Definition at line 43 of file DigitalIOState.cpp.
|
overridevirtual |
Reset the object to a post-construction state.
Reimplemented from state_representation::State.
Definition at line 102 of file DigitalIOState.cpp.
void state_representation::DigitalIOState::set_false | ( | ) |
Set all digital IOs false.
Definition at line 107 of file DigitalIOState.cpp.
void state_representation::DigitalIOState::set_false | ( | const std::string & | name | ) |
Set the a digital IO to false by its name.
name | The name of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 89 of file DigitalIOState.cpp.
void state_representation::DigitalIOState::set_false | ( | unsigned int | io_index | ) |
Set the a digital IO to false by its index.
io_index | The index of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 93 of file DigitalIOState.cpp.
void state_representation::DigitalIOState::set_true | ( | const std::string & | name | ) |
Set the a digital IO to true by its name.
name | The name of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 81 of file DigitalIOState.cpp.
void state_representation::DigitalIOState::set_true | ( | unsigned int | io_index | ) |
Set the a digital IO to true by its index.
io_index | The index of the IO |
IONotFoundException | if the desired IO doesn't exist |
Definition at line 85 of file DigitalIOState.cpp.
|
overrideprotectedvirtual |
Convert the state to its string representation.
Reimplemented from state_representation::State.
Definition at line 114 of file DigitalIOState.cpp.
|
static |
Constructor for a zero digital IO state.
name | The name of the associated digital IO state |
names | List of IO names |
Definition at line 36 of file DigitalIOState.cpp.
|
static |
Constructor for a zero digital IO state.
name | The name of the associated digital IO state |
nb_ios | The number of digital IOs for initialization |
Definition at line 29 of file DigitalIOState.cpp.
|
friend |
Overload the ostream operator for printing.
os | The ostream to append the string representing the state to |
state | The spatial state to print |
Definition at line 129 of file DigitalIOState.cpp.
|
friend |
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 170 of file DigitalIOState.hpp.