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... | |
T | writeXF (T t) |
Write data to FullEmpty no matter what its current state, leaving it full. Any existing contents are overwritten. More... | |
T | writeEF (T t) |
Suspend until FullEmpty state is empty, and then store the argument in the contents and set the state to full. More... | |
T | writeFF (T t) |
Suspend until FullEmpty state is full, and then overwrites the current contents, leaving the state set as full. More... | |
T | readXX () |
(DANGER: For debugging only.) More... | |
T | readFF () |
Suspend until FullEmpty is full, and then return its contents, leaving it full. More... | |
T | 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 | 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 60 of file FullEmptyLocal.hpp.
|
inline |
Construct a FullEmpty with an initial value, setting the state to empty.
Definition at line 87 of file FullEmptyLocal.hpp.
|
inline |
Construct a FullEmpty with an initial value, setting the state to full.
Definition at line 90 of file FullEmptyLocal.hpp.
|
inline |
Definition at line 76 of file FullEmptyLocal.hpp.
|
inline |
returns true if the contents of the FullEmpty are not valid.
Definition at line 95 of file FullEmptyLocal.hpp.
|
inline |
returns true if the contents of the FullEmpty are valid.
Definition at line 93 of file FullEmptyLocal.hpp.
|
inline |
Suspend until FullEmpty is full, and then return its contents, leaving it empty.
Definition at line 147 of file FullEmptyLocal.hpp.
|
inline |
Suspend until FullEmpty is full, and then return its contents, leaving it full.
Definition at line 138 of file FullEmptyLocal.hpp.
|
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 131 of file FullEmptyLocal.hpp.
|
inline |
Clears the state of the full bit to empty, marking the contents as invalid.
Definition at line 98 of file FullEmptyLocal.hpp.
|
inline |
Suspend until FullEmpty state is empty, and then store the argument in the contents and set the state to full.
Definition at line 113 of file FullEmptyLocal.hpp.
|
inline |
Suspend until FullEmpty state is full, and then overwrites the current contents, leaving the state set as full.
Definition at line 120 of file FullEmptyLocal.hpp.
|
inline |
Write data to FullEmpty no matter what its current state, leaving it full. Any existing contents are overwritten.
Definition at line 104 of file FullEmptyLocal.hpp.
union { ... } |
intptr_t Grappa::FullEmpty< T >::raw_ |
Definition at line 70 of file FullEmptyLocal.hpp.
State Grappa::FullEmpty< T >::state_ |
Definition at line 67 of file FullEmptyLocal.hpp.
T Grappa::FullEmpty< T >::t_ |
Definition at line 74 of file FullEmptyLocal.hpp.
intptr_t Grappa::FullEmpty< T >::waiters_ |
Definition at line 68 of file FullEmptyLocal.hpp.