Lunchbox
1.6.0
|
A monitor primitive. More...
#include <monitor.h>
Public Member Functions | |
Monitor () | |
Construct a new monitor with a default value of 0. | |
Monitor (const T &value) | |
Construct a new monitor with a given default value. | |
Monitor (const Monitor< T > &from) | |
Ctor initializing with the given monitor value. | |
~Monitor () | |
Destructs the monitor. | |
template<> | |
Monitor< bool > & | operator++ () |
template<> | |
Monitor< bool > & | operator-- () |
template<> | |
Monitor< bool > & | operator|= (const bool &value) |
Changing the monitored value. | |
Monitor & | operator++ () |
Increment the monitored value, prefix only. | |
Monitor & | operator-- () |
Decrement the monitored value, prefix only. | |
Monitor & | operator= (const T &value) |
Assign a new value. | |
const Monitor & | operator= (const Monitor< T > &from) |
Assign a new value. | |
Monitor & | operator|= (const T &value) |
Perform an or operation on the value. | |
void | set (const T &value) |
Set a new value. | |
Monitor the value. | |
const T & | waitEQ (const T &value) const |
Block until the monitor has the given value. | |
const T | waitNE (const T &value) const |
Block until the monitor has not the given value. | |
const T | waitNE (const T &v1, const T &v2) const |
Block until the monitor has none of the given values. | |
const T | waitGE (const T &value) const |
Block until the monitor has a value greater or equal to the given value. | |
const T | waitLE (const T &value) const |
Block until the monitor has a value less or equal to the given value. | |
Monitor the value with a timeout. | |
bool | timedWaitEQ (const T &value, const uint32_t timeout) const |
Block until the monitor has the given value. | |
bool | timedWaitGE (const T &value, const uint32_t timeout) const |
Block until the monitor has a value greater or equal to the given value. | |
bool | timedWaitNE (const T &value, const uint32_t timeout) const |
Block until the monitor has not the given value. | |
Comparison Operators. @version 1.0 | |
bool | operator== (const T &value) const |
bool | operator!= (const T &value) const |
bool | operator< (const T &value) const |
bool | operator> (const T &value) const |
bool | operator<= (const T &value) const |
bool | operator>= (const T &value) const |
bool | operator== (const Monitor< T > &rhs) const |
bool | operator!= (const Monitor< T > &rhs) const |
bool | operator< (const Monitor< T > &rhs) const |
bool | operator> (const Monitor< T > &rhs) const |
bool | operator<= (const Monitor< T > &rhs) const |
bool | operator>= (const Monitor< T > &rhs) const |
Data Access. | |
const T & | operator-> () const |
const T & | get () const |
T | operator+ (const T &value) const |
T | operator| (const T &value) const |
T | operator& (const T &value) const |
A monitor primitive.
A monitor has a value, which can be monitored to reach a certain state. The caller is blocked until the condition is fulfilled. The concept is similar to a pthread condition, with more usage convenience.
lunchbox::Monitor< T >::Monitor | ( | ) | [inline] |
lunchbox::Monitor< T >::Monitor | ( | const T & | value | ) | [inline, explicit] |
lunchbox::Monitor< T >::Monitor | ( | const Monitor< T > & | from | ) | [inline] |
lunchbox::Monitor< T >::~Monitor | ( | ) | [inline] |
const T& lunchbox::Monitor< T >::get | ( | ) | const [inline] |
Definition at line 347 of file monitor.h.
Referenced by lunchbox::operator<<().
T lunchbox::Monitor< T >::operator& | ( | const T & | value | ) | const [inline] |
T lunchbox::Monitor< T >::operator+ | ( | const T & | value | ) | const [inline] |
Monitor& lunchbox::Monitor< T >::operator++ | ( | void | ) | [inline] |
Increment the monitored value, prefix only.
Definition at line 60 of file monitor.h.
References lunchbox::Condition::broadcast().
Monitor& lunchbox::Monitor< T >::operator-- | ( | void | ) | [inline] |
Decrement the monitored value, prefix only.
Definition at line 69 of file monitor.h.
References lunchbox::Condition::broadcast().
const T& lunchbox::Monitor< T >::operator-> | ( | ) | const [inline] |
Monitor& lunchbox::Monitor< T >::operator= | ( | const T & | value | ) | [inline] |
const Monitor& lunchbox::Monitor< T >::operator= | ( | const Monitor< T > & | from | ) | [inline] |
T lunchbox::Monitor< T >::operator| | ( | const T & | value | ) | const [inline] |
Monitor& lunchbox::Monitor< T >::operator|= | ( | const T & | value | ) | [inline] |
Perform an or operation on the value.
Definition at line 92 of file monitor.h.
References lunchbox::Condition::broadcast().
void lunchbox::Monitor< T >::set | ( | const T & | value | ) | [inline] |
Set a new value.
Definition at line 101 of file monitor.h.
References lunchbox::Condition::broadcast().
bool lunchbox::Monitor< T >::timedWaitEQ | ( | const T & | value, |
const uint32_t | timeout | ||
) | const [inline] |
Block until the monitor has the given value.
value | the exact value to monitor. |
timeout | the timeout in milliseconds to wait for the value. |
Definition at line 212 of file monitor.h.
References lunchbox::Condition::timedWait().
bool lunchbox::Monitor< T >::timedWaitGE | ( | const T & | value, |
const uint32_t | timeout | ||
) | const [inline] |
Block until the monitor has a value greater or equal to the given value.
value | the exact value to monitor. |
timeout | the timeout in milliseconds to wait for the value. |
Definition at line 236 of file monitor.h.
References lunchbox::Condition::timedWait().
bool lunchbox::Monitor< T >::timedWaitNE | ( | const T & | value, |
const uint32_t | timeout | ||
) | const [inline] |
Block until the monitor has not the given value.
value | the exact value to monitor. |
timeout | the timeout in milliseconds to wait for not the value. |
Definition at line 259 of file monitor.h.
References lunchbox::Condition::timedWait().
const T& lunchbox::Monitor< T >::waitEQ | ( | const T & | value | ) | const [inline] |
Block until the monitor has the given value.
Definition at line 116 of file monitor.h.
References lunchbox::Condition::wait().
const T lunchbox::Monitor< T >::waitGE | ( | const T & | value | ) | const [inline] |
Block until the monitor has a value greater or equal to the given value.
Definition at line 170 of file monitor.h.
References lunchbox::Condition::wait().
const T lunchbox::Monitor< T >::waitLE | ( | const T & | value | ) | const [inline] |
Block until the monitor has a value less or equal to the given value.
Definition at line 189 of file monitor.h.
References lunchbox::Condition::wait().
const T lunchbox::Monitor< T >::waitNE | ( | const T & | value | ) | const [inline] |
Block until the monitor has not the given value.
Definition at line 131 of file monitor.h.
References lunchbox::Condition::wait().
const T lunchbox::Monitor< T >::waitNE | ( | const T & | v1, |
const T & | v2 | ||
) | const [inline] |
Block until the monitor has none of the given values.
Definition at line 150 of file monitor.h.
References lunchbox::Condition::wait().