Lunchbox  1.8.0
Public Member Functions | List of all members
lunchbox::Monitor< T > Class Template Reference

A monitor primitive. More...

#include <monitor.h>

+ Collaboration diagram for lunchbox::Monitor< T >:

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.
Monitoroperator++ ()
 Increment the monitored value, prefix only.
Monitoroperator-- ()
 Decrement the monitored value, prefix only.
Monitoroperator= (const T &value)
 Assign a new value.
const Monitoroperator= (const Monitor< T > &from)
 Assign a new value.
Monitoroperator|= (const T &value)
 Perform an or operation on the value.
Monitoroperator&= (const T &value)
 Perform an and 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
operator+ (const T &value) const
operator| (const T &value) const
operator& (const T &value) const

Detailed Description

template<class T>
class lunchbox::Monitor< T >

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.

Definition at line 41 of file monitor.h.

Constructor & Destructor Documentation

template<class T>
lunchbox::Monitor< T >::Monitor ( )
inline

Construct a new monitor with a default value of 0.

Version
1.0

Definition at line 45 of file monitor.h.

template<class T>
lunchbox::Monitor< T >::Monitor ( const T &  value)
inlineexplicit

Construct a new monitor with a given default value.

Version
1.0

Definition at line 48 of file monitor.h.

template<class T>
lunchbox::Monitor< T >::Monitor ( const Monitor< T > &  from)
inline

Ctor initializing with the given monitor value.

Version
1.1.5

Definition at line 51 of file monitor.h.

template<class T>
lunchbox::Monitor< T >::~Monitor ( )
inline

Destructs the monitor.

Version
1.0

Definition at line 54 of file monitor.h.

Member Function Documentation

template<class T>
const T& lunchbox::Monitor< T >::get ( ) const
inline
Returns
the current value.
Version
1.0

Definition at line 355 of file monitor.h.

Referenced by lunchbox::operator<<().

+ Here is the caller graph for this function:

template<class T>
T lunchbox::Monitor< T >::operator& ( const T &  value) const
inline
Returns
the current and the given value.
Version
1.0

Definition at line 372 of file monitor.h.

template<class T>
Monitor& lunchbox::Monitor< T >::operator&= ( const T &  value)
inline

Perform an and operation on the value.

Version
1.7

Definition at line 100 of file monitor.h.

References lunchbox::Condition::broadcast().

+ Here is the call graph for this function:

template<class T>
T lunchbox::Monitor< T >::operator+ ( const T &  value) const
inline
Returns
the current plus the given value.
Version
1.0

Definition at line 358 of file monitor.h.

template<class T>
Monitor& lunchbox::Monitor< T >::operator++ ( void  )
inline

Increment the monitored value, prefix only.

Version
1.0

Definition at line 59 of file monitor.h.

References lunchbox::Condition::broadcast().

+ Here is the call graph for this function:

template<class T>
Monitor& lunchbox::Monitor< T >::operator-- ( void  )
inline

Decrement the monitored value, prefix only.

Version
1.0

Definition at line 68 of file monitor.h.

References lunchbox::Condition::broadcast().

+ Here is the call graph for this function:

template<class T>
const T& lunchbox::Monitor< T >::operator-> ( ) const
inline
Returns
the current value.
Version
1.0

Definition at line 352 of file monitor.h.

template<class T>
Monitor& lunchbox::Monitor< T >::operator= ( const T &  value)
inline

Assign a new value.

Version
1.0

Definition at line 77 of file monitor.h.

template<class T>
const Monitor& lunchbox::Monitor< T >::operator= ( const Monitor< T > &  from)
inline

Assign a new value.

Version
1.1.5

Definition at line 84 of file monitor.h.

template<class T>
T lunchbox::Monitor< T >::operator| ( const T &  value) const
inline
Returns
the current or'ed with the given value.
Version
1.0

Definition at line 365 of file monitor.h.

template<class T>
Monitor& lunchbox::Monitor< T >::operator|= ( const T &  value)
inline

Perform an or operation on the value.

Version
1.0

Definition at line 91 of file monitor.h.

References lunchbox::Condition::broadcast().

+ Here is the call graph for this function:

template<class T>
void lunchbox::Monitor< T >::set ( const T &  value)
inline

Set a new value.

Version
1.0

Definition at line 109 of file monitor.h.

References lunchbox::Condition::broadcast().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Monitor< T >::timedWaitEQ ( const T &  value,
const uint32_t  timeout 
) const
inline

Block until the monitor has the given value.

Parameters
valuethe exact value to monitor.
timeoutthe timeout in milliseconds to wait for the value.
Returns
true on success, false on timeout.
Version
1.1

Definition at line 220 of file monitor.h.

References lunchbox::Condition::timedWait().

+ Here is the call graph for this function:

template<class T>
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.

Parameters
valuethe exact value to monitor.
timeoutthe timeout in milliseconds to wait for the value.
Returns
true on success, false on timeout.
Version
1.1

Definition at line 244 of file monitor.h.

References lunchbox::Condition::timedWait().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Monitor< T >::timedWaitNE ( const T &  value,
const uint32_t  timeout 
) const
inline

Block until the monitor has not the given value.

Parameters
valuethe exact value to monitor.
timeoutthe timeout in milliseconds to wait for not the value.
Returns
true on success, false on timeout.
Version
1.3.3

Definition at line 267 of file monitor.h.

References lunchbox::Condition::timedWait().

+ Here is the call graph for this function:

template<class T>
const T& lunchbox::Monitor< T >::waitEQ ( const T &  value) const
inline

Block until the monitor has the given value.

Returns
the value when reaching the condition.
Version
1.0

Definition at line 124 of file monitor.h.

References lunchbox::Condition::wait().

+ Here is the call graph for this function:

template<class T>
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.

Returns
the value when reaching the condition.
Version
1.0

Definition at line 178 of file monitor.h.

References lunchbox::Condition::wait().

+ Here is the call graph for this function:

template<class T>
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.

Returns
the value when reaching the condition.
Version
1.0

Definition at line 197 of file monitor.h.

References lunchbox::Condition::wait().

+ Here is the call graph for this function:

template<class T>
const T lunchbox::Monitor< T >::waitNE ( const T &  value) const
inline

Block until the monitor has not the given value.

Returns
the value when reaching the condition.
Version
1.0

Definition at line 139 of file monitor.h.

References lunchbox::Condition::wait().

+ Here is the call graph for this function:

template<class T>
const T lunchbox::Monitor< T >::waitNE ( const T &  v1,
const T &  v2 
) const
inline

Block until the monitor has none of the given values.

Returns
the value when reaching the condition.
Version
1.0

Definition at line 158 of file monitor.h.

References lunchbox::Condition::wait().

+ Here is the call graph for this function:


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