Sygaldry
Loading...
Searching...
No Matches

Wrapper around a type T with optional-like semantics and persistent state. More...

Inheritance diagram for sygaldry::occasional< T >:
sygaldry::array_message< name, 3, "", float, -1.0f, 1.0f, float {}, Tags... > sygaldry::array_message<"sensor to global quaternion", 4, "quaternion representation of the orientation of the sensor in the global frame", float, -1.0f, 1.0f > sygaldry::array_message<"global to sensor quaternion", 4, "quaternion representation of the orientation of the global bases in the sensor frame", float, -1.0f, 1.0f > sygaldry::array_message<"sensor to global matrix", 9, "special orthogonal matrix of the sensor basis vectors expressed in the global frame", float, -1.0f, 1.0f > sygaldry::array_message<"global to sensor matrix", 9, "special orthogonal matrix of the global basis vectors expressed in the sensor frame", float, -1.0f, 1.0f > sygaldry::array_message< name, 3, desc, float, min, max, float {}, Tags... > sygaldry::array_message< name, 3, "", float, min, max, float {}, Tags... > sygaldry::array_message< name, 3, "", int, min, max, int {}, Tags... > sygaldry::slider_message<"capacity", "Design capacity of the battery (mAh)", int, 0, 32000, 0, sygaldry::tag_session_data > sygaldry::tag_session_data > sygaldry::slider_message<"poll rate", "Fuel gauge poll rate (ms)", int, 10000, 300000, 60000, sygaldry::tag_session_data > sygaldry::slider_message<"end-of-charge current", "End of charge current (mA)", int, 0, 300, 50, sygaldry::tag_session_data > sygaldry::slider_message<"Empty Voltage", "Empty voltage of the battery (V)", float, 0.0f, 4.2f, 3.0f, sygaldry::tag_session_data > sygaldry::slider_message<"Recovery voltage", "Recovery voltage of the battery (V)", float, 0.0f, 4.2f, 3.8f, sygaldry::tag_session_data > sygaldry::slider_message<"elapsed", "time in microseconds elapsed since last measurement", unsigned long, 0, 1000000, 0 > sygaldry::array_message< name_str, N, desc, T, min, max, init, Tags > sygaldry::slider_message< name_str, desc, T, min, max, init, Tags >

Public Types

using type = T
 The underlying type.
 

Public Member Functions

constexpr occasional () noexcept
 Default constructor; state is default initialized and updated is false.
 
constexpr occasional (occasional< T > &&other)
 Move constructor from another occasional.
 
constexpr occasional (const occasional< T > &other)
 Copy constructor from another occasional.
 
constexpr auto & operator= (occasional< T > &&other)
 Move assignment from another occasional.
 
constexpr auto & operator= (const occasional< T > &other)
 Copy assignment from another occasional.
 
constexpr operator T& () noexcept
 Mutable value access.
 
constexpr operator const T & () const noexcept
 Immutable value access.
 
constexpr occasional (T &&t) noexcept
 Move constructor from the underlying type.
 
constexpr occasional (const T &t) noexcept
 Copy constructor from the underlying type.
 
constexpr auto & operator= (T &&t) noexcept
 Move assignment from the underlying type.
 
constexpr auto & operator= (const T &t) noexcept
 Copy assignment from the underlying type.
 
constexpr T & operator* () noexcept
 Mutable dereference operator; provides access to the underlying state.
 
constexpr const T & operator* () const noexcept
 Constant dereference operator; provides access to the underlying state.
 
constexpr T * operator-> () noexcept
 Mutable member access operator; provides access to the members of the underlying state.
 
constexpr const T * operator-> () const noexcept
 Constant member access operator; provides access to the members of the underlying state.
 
constexpr T & value () noexcept
 Mutable value access.
 
constexpr const T & value () const noexcept
 Immutable value access.
 
constexpr void reset () noexcept
 Clear the updated flag. This can also be achieved by assignment from empty braces, e.g. x = {};
 

Public Attributes

state
 The wrapped state.
 
bool updated
 Flag indicating if the state has been changed.
 

Detailed Description

template<typename T>
struct sygaldry::occasional< T >

Wrapper around a type T with optional-like semantics and persistent state.

Intended to provide a means of developing message-like semantics while also allowing output messages to maintain state between loops, occasional provides a conversion to bool that indicates if the underlying wrapped state has been updated since the last time it was cleared. The runtime is meant to clear this flag between loops. However, the underlying state is not reset in this process.

Endpoints inheriting from this type should state using occasional<T>::operator= to explicitly inherit the assignment operators from occasional.


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