Grappa  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Grappa::FullEmpty< T > Class Template Reference

Wrapper class to provide full-bit semantics for arbitrary data. More...

#include <FullEmptyLocal.hpp>

Public Member Functions

void block_until (State desired_state)
 
 FullEmpty ()
 Construct a FullEmpty with an initial value, setting the state to empty. More...
 
 FullEmpty (T t)
 Construct a FullEmpty with an initial value, setting the state to full. More...
 
bool full () const
 returns true if the contents of the FullEmpty are valid. More...
 
bool empty () const
 returns true if the contents of the FullEmpty are not valid. More...
 
void reset ()
 Clears the state of the full bit to empty, marking the contents as invalid. More...
 
writeXF (T t)
 Write data to FullEmpty no matter what its current state, leaving it full. Any existing contents are overwritten. More...
 
writeEF (T t)
 Suspend until FullEmpty state is empty, and then store the argument in the contents and set the state to full. More...
 
writeFF (T t)
 Suspend until FullEmpty state is full, and then overwrites the current contents, leaving the state set as full. More...
 
readXX ()
 (DANGER: For debugging only.) More...
 
readFF ()
 Suspend until FullEmpty is full, and then return its contents, leaving it full. More...
 
readFE ()
 Suspend until FullEmpty is full, and then return its contents, leaving it empty. More...
 

Public Attributes

union {
   struct {
      State   state_: 1
 
      intptr_t   waiters_: 63
 
   } 
 
   intptr_t   raw_
 
}; 
 
t_
 

Detailed Description

template<typename T>
class Grappa::FullEmpty< T >

Wrapper class to provide full-bit semantics for arbitrary data.

Each FullEmpty object holds a data element of type T, as well as a state variable. The state may be "empty," indicating that the data is invalid, or "full," indicating that the data is valid.

Data is accessed with methods that specify the desired state before and after the operation, and operations block (suspend) until the FullEmpty has the desired precursor state. It is also possible to specify that no precursor state is required.

Definition at line 49 of file FullEmptyLocal.hpp.

Constructor & Destructor Documentation

template<typename T>
Grappa::FullEmpty< T >::FullEmpty ( )
inline

Construct a FullEmpty with an initial value, setting the state to empty.

Definition at line 76 of file FullEmptyLocal.hpp.

template<typename T>
Grappa::FullEmpty< T >::FullEmpty ( t)
inline

Construct a FullEmpty with an initial value, setting the state to full.

Definition at line 79 of file FullEmptyLocal.hpp.

Member Function Documentation

template<typename T>
void Grappa::FullEmpty< T >::block_until ( State  desired_state)
inline

Definition at line 65 of file FullEmptyLocal.hpp.

template<typename T>
bool Grappa::FullEmpty< T >::empty ( ) const
inline

returns true if the contents of the FullEmpty are not valid.

Definition at line 84 of file FullEmptyLocal.hpp.

template<typename T>
bool Grappa::FullEmpty< T >::full ( ) const
inline

returns true if the contents of the FullEmpty are valid.

Definition at line 82 of file FullEmptyLocal.hpp.

template<typename T>
T Grappa::FullEmpty< T >::readFE ( )
inline

Suspend until FullEmpty is full, and then return its contents, leaving it empty.

Definition at line 136 of file FullEmptyLocal.hpp.

template<typename T>
T Grappa::FullEmpty< T >::readFF ( )
inline

Suspend until FullEmpty is full, and then return its contents, leaving it full.

Returns

Definition at line 127 of file FullEmptyLocal.hpp.

template<typename T>
T Grappa::FullEmpty< T >::readXX ( )
inline

(DANGER: For debugging only.)

Return contents of FullEmpty no matter what its current state, leaving the state unchanged. This may return garbage.

Definition at line 120 of file FullEmptyLocal.hpp.

template<typename T>
void Grappa::FullEmpty< T >::reset ( )
inline

Clears the state of the full bit to empty, marking the contents as invalid.

Definition at line 87 of file FullEmptyLocal.hpp.

template<typename T>
T Grappa::FullEmpty< T >::writeEF ( t)
inline

Suspend until FullEmpty state is empty, and then store the argument in the contents and set the state to full.

Definition at line 102 of file FullEmptyLocal.hpp.

template<typename T>
T Grappa::FullEmpty< T >::writeFF ( t)
inline

Suspend until FullEmpty state is full, and then overwrites the current contents, leaving the state set as full.

Definition at line 109 of file FullEmptyLocal.hpp.

template<typename T>
T Grappa::FullEmpty< T >::writeXF ( t)
inline

Write data to FullEmpty no matter what its current state, leaving it full. Any existing contents are overwritten.

Definition at line 93 of file FullEmptyLocal.hpp.

Member Data Documentation

union { ... }
template<typename T>
intptr_t Grappa::FullEmpty< T >::raw_

Definition at line 59 of file FullEmptyLocal.hpp.

template<typename T>
State Grappa::FullEmpty< T >::state_

Definition at line 56 of file FullEmptyLocal.hpp.

template<typename T>
T Grappa::FullEmpty< T >::t_

Definition at line 63 of file FullEmptyLocal.hpp.

template<typename T>
intptr_t Grappa::FullEmpty< T >::waiters_

Definition at line 57 of file FullEmptyLocal.hpp.


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