![]() |
ros2_control - jazzy
|
A handle used to get and set a value on a given interface. More...
#include <handle.hpp>


Public Member Functions | |
| Handle (const std::string &prefix_name, const std::string &interface_name, double *value_ptr) | |
| Handle (const std::string &prefix_name, const std::string &interface_name, const std::string &data_type="double", const std::string &initial_value="") | |
| Handle (const InterfaceDescription &interface_description) | |
| Handle (const std::string &interface_name) | |
| Handle (const char *interface_name) | |
| Handle (const Handle &other) noexcept | |
| Handle & | operator= (const Handle &other) |
| Handle (Handle &&other) noexcept | |
| Handle & | operator= (Handle &&other) |
| operator bool () const | |
| Returns true if handle references a value. | |
| const std::string & | get_name () const |
| const std::string & | get_interface_name () const |
| const std::string & | get_full_name () const |
| const std::string & | get_prefix_name () const |
| double | get_value () const |
| template<typename T = double> | |
| std::optional< T > | get_optional () const |
| Get the value of the handle. | |
| template<typename T = double> | |
| std::optional< T > | get_optional (std::shared_lock< std::shared_mutex > &lock) const |
| Get the value of the handle. | |
| template<typename T> | |
| bool | get_value (T &value) const |
| Get the value of the handle. | |
| template<typename T, typename = std::enable_if_t< !std::is_same_v<std::decay_t<T>, std::shared_lock<std::shared_mutex>>>> | |
| bool | get_value (T &value, bool wait_for_lock) const |
| Get the value of the handle. | |
| template<typename T> | |
| bool | set_value (const T &value, bool wait_for_lock) |
| Set the value of the handle. | |
| template<typename T> | |
| bool | set_value (const T &value) |
| Set the value of the handle. | |
| template<typename T> | |
| bool | set_value (std::unique_lock< std::shared_mutex > &lock, const T &value) |
| Set the value of the handle. | |
| std::shared_mutex & | get_mutex () const |
| HandleDataType | get_data_type () const |
| bool | is_castable_to_double () const |
| Returns true if the handle data type can be casted to double. | |
| bool | is_valid () const |
Protected Member Functions | |
| template<typename T> | |
| bool | get_value (std::shared_lock< std::shared_mutex > &lock, T &value) const |
| Get the value of the handle. | |
Protected Attributes | |
| std::string | prefix_name_ |
| std::string | interface_name_ |
| std::string | handle_name_ |
| HANDLE_DATATYPE | value_ = std::monostate{} |
| HandleDataType | data_type_ = HandleDataType::DOUBLE |
| double * | value_ptr_ = nullptr |
| std::shared_mutex | handle_mutex_ |
A handle used to get and set a value on a given interface.
|
inlinenodiscard |
Get the value of the handle.
| T | The type of the value to be retrieved. |
|
inlinenodiscard |
Get the value of the handle.
| T | The type of the value to be retrieved. |
| lock | The lock to access the value. |
|
inlinenodiscardprotected |
Get the value of the handle.
| T | The type of the value to be retrieved. |
| lock | The lock to access the value. |
| value | The variable to store the retrieved value. |
|
inlinenodiscard |
Get the value of the handle.
| T | The type of the value to be retrieved. |
| value | The value of the handle. |
|
inlinenodiscard |
Get the value of the handle.
| T | The type of the value to be retrieved. |
| value | The variable to store the retrieved value. |
| wait_for_lock | If true, the method will wait for the lock to be available, else it will try to get the lock without blocking. |
|
inlinenodiscard |
Set the value of the handle.
| T | The type of the value to be set. |
| value | The value to be set. |
|
inlinenodiscard |
Set the value of the handle.
| T | The type of the value to be set. |
| value | The value to be set. |
| wait_for_lock | If true, the method will wait for the lock to be available, else it will try to get the lock without blocking. |
|
inlinenodiscard |
Set the value of the handle.
| T | The type of the value to be set. |
| lock | The lock to set the value. |
| value | The value to be set. |
|
protected |