#include <AtomicMWSRQueue.hpp>
Classes | |
union | SIndexes |
Public Types | |
typedef unsigned int | size_type |
Public Member Functions | |
AtomicMWSRQueue (unsigned int size) | |
size_type | capacity () const |
void | clear () |
bool | dequeue (T &result) |
bool | enqueue (const T &value) |
const T | front () const |
bool | isEmpty () const |
bool | isFull () const |
size_type | size () const |
~AtomicMWSRQueue () | |
Private Types | |
typedef T | C |
typedef C *volatile | CacheObjType |
typedef volatile C * | CachePtrType |
typedef C * | PtrType |
typedef C | ValueType |
Private Member Functions | |
bool | advance_r (T &result) |
CachePtrType | advance_w () |
AtomicMWSRQueue (const AtomicMWSRQueue< T > &) | |
Private Attributes | |
CachePtrType | _buf |
volatile SIndexes | _indxes |
const int | _size |
Create an atomic, non-blocking Multi-Writer Single-Reader FIFO for storing a pointer T by value. Any number of writer threads may access the queue concurrently, but only one thread may read it.
T | The pointer type to be stored in the Queue. Example : AtomicMWSRQueue< A* > is a queue of pointers to A. |
Definition at line 59 of file AtomicMWSRQueue.hpp.
typedef T RTT::internal::AtomicMWSRQueue< T >::C [private] |
Definition at line 63 of file AtomicMWSRQueue.hpp.
typedef C* volatile RTT::internal::AtomicMWSRQueue< T >::CacheObjType [private] |
Definition at line 65 of file AtomicMWSRQueue.hpp.
typedef volatile C* RTT::internal::AtomicMWSRQueue< T >::CachePtrType [private] |
Definition at line 64 of file AtomicMWSRQueue.hpp.
typedef C* RTT::internal::AtomicMWSRQueue< T >::PtrType [private] |
Definition at line 67 of file AtomicMWSRQueue.hpp.
typedef unsigned int RTT::internal::AtomicMWSRQueue< T >::size_type |
Definition at line 161 of file AtomicMWSRQueue.hpp.
typedef C RTT::internal::AtomicMWSRQueue< T >::ValueType [private] |
Definition at line 66 of file AtomicMWSRQueue.hpp.
RTT::internal::AtomicMWSRQueue< T >::AtomicMWSRQueue | ( | const AtomicMWSRQueue< T > & | ) | [private] |
RTT::internal::AtomicMWSRQueue< T >::AtomicMWSRQueue | ( | unsigned int | size | ) | [inline] |
Create an AtomicMWSRQueue with queue size size.
size | The size of the queue, should be 1 or greater. |
Definition at line 167 of file AtomicMWSRQueue.hpp.
RTT::internal::AtomicMWSRQueue< T >::~AtomicMWSRQueue | ( | ) | [inline] |
Definition at line 174 of file AtomicMWSRQueue.hpp.
bool RTT::internal::AtomicMWSRQueue< T >::advance_r | ( | T & | result | ) | [inline, private] |
Advance and wrap of the Read pointer. Only one thread may call this.
Definition at line 128 of file AtomicMWSRQueue.hpp.
CachePtrType RTT::internal::AtomicMWSRQueue< T >::advance_w | ( | ) | [inline, private] |
Atomic advance and wrap of the Write pointer. Return the old position or zero if queue is full.
Definition at line 98 of file AtomicMWSRQueue.hpp.
size_type RTT::internal::AtomicMWSRQueue< T >::capacity | ( | ) | const [inline] |
Return the maximum number of items this queue can contain.
Definition at line 208 of file AtomicMWSRQueue.hpp.
void RTT::internal::AtomicMWSRQueue< T >::clear | ( | ) | [inline] |
Clear all contents of the Queue and thus make it empty.
Definition at line 268 of file AtomicMWSRQueue.hpp.
bool RTT::internal::AtomicMWSRQueue< T >::dequeue | ( | T & | result | ) | [inline] |
Dequeue an item.
value | Stores the dequeued value. It is unchanged when dequeue returns false and contains the dequeued value when it returns true. |
Definition at line 247 of file AtomicMWSRQueue.hpp.
bool RTT::internal::AtomicMWSRQueue< T >::enqueue | ( | const T & | value | ) | [inline] |
Enqueue an item.
value | The value to enqueue. |
Definition at line 229 of file AtomicMWSRQueue.hpp.
const T RTT::internal::AtomicMWSRQueue< T >::front | ( | ) | const [inline] |
Return the next to be read value.
Definition at line 260 of file AtomicMWSRQueue.hpp.
bool RTT::internal::AtomicMWSRQueue< T >::isEmpty | ( | ) | const [inline] |
Inspect if the Queue is empty.
Definition at line 197 of file AtomicMWSRQueue.hpp.
bool RTT::internal::AtomicMWSRQueue< T >::isFull | ( | ) | const [inline] |
Inspect if the Queue is full.
Definition at line 183 of file AtomicMWSRQueue.hpp.
size_type RTT::internal::AtomicMWSRQueue< T >::size | ( | ) | const [inline] |
Return the number of elements in the queue.
Definition at line 216 of file AtomicMWSRQueue.hpp.
CachePtrType RTT::internal::AtomicMWSRQueue< T >::_buf [private] |
The pointer to the buffer can be cached, the contents are volatile.
Definition at line 86 of file AtomicMWSRQueue.hpp.
volatile SIndexes RTT::internal::AtomicMWSRQueue< T >::_indxes [private] |
The indexes are packed into one double word. Therefore the read and write index can be read and written atomically.
Definition at line 92 of file AtomicMWSRQueue.hpp.
const int RTT::internal::AtomicMWSRQueue< T >::_size [private] |
Definition at line 62 of file AtomicMWSRQueue.hpp.