#include <LDK/LocklessQueue.h>
Public Member Functions | |
LocklessQueue (size_t size) | |
~LocklessQueue () | |
void | enqueue (const T &msg) |
void | enqueue (const T *msg) |
void | dequeue (T &msg) |
void | dequeue (T *msg) |
bool | full () const |
bool | empty () const |
const T * | peek () const |
void | clear () |
Data Structures | |
struct | QType |
WARNING: simply performs bitwise copy, does not use copy constructors or assignment operators, so not a deep copy. Care will be needed for objects containing pointers (generally a "thou shalt not"). Deep copies would be completely unsafe in multithreaded progs.
The template parameter T is the type of the message. This queue can only hold one size message.
Definition at line 62 of file LocklessQueue.h.
LDK::LocklessQueue< T >::LocklessQueue | ( | size_t | size | ) | [inline] |
Constructor.
size | the number of items the queue can hold |
BadAllocError | If there is not enough memory for the queue. |
Definition at line 105 of file LocklessQueue.h.
void LDK::LocklessQueue< T >::enqueue | ( | const T & | msg | ) | [inline] |
Push a message onto the head of the queue. Actually performs a bitwise copy of msg into the queue.
msg | A reference to the message to push. |
LengthError | if the queue is full. |
Definition at line 121 of file LocklessQueue.h.
References LDK_LENGTH_ERROR.
Referenced by LDK::LocklessQueue< T >::enqueue().
void LDK::LocklessQueue< T >::enqueue | ( | const T * | msg | ) | [inline] |
Push a message onto the head of the queue. Actually performs a bitwise copy of msg into the queue.
msg | A pointer to the message to push. |
LengthError | if the queue is full. |
Definition at line 140 of file LocklessQueue.h.
References LDK::LocklessQueue< T >::enqueue().
Here is the call graph for this function:
void LDK::LocklessQueue< T >::dequeue | ( | T & | msg | ) | [inline] |
Pops a message from the tail of the queue. Actually performs a bitwise copy of the message in the queue.
msg | A reference to the message to copy into. |
LengthError | if the queue is empty. |
Definition at line 149 of file LocklessQueue.h.
References LDK_LENGTH_ERROR.
Referenced by LDK::LocklessQueue< T >::dequeue().
void LDK::LocklessQueue< T >::dequeue | ( | T * | msg | ) | [inline] |
Pops a message from the tail of the queue. Actually performs a bitwise copy of the message in the queue.
msg | A pointer to the message to copy into. |
LengthError | if the queue is empty. |
Definition at line 172 of file LocklessQueue.h.
References LDK::LocklessQueue< T >::dequeue().
Here is the call graph for this function:
bool LDK::LocklessQueue< T >::full | ( | ) | const [inline] |
Tests if the queue is full.
Definition at line 179 of file LocklessQueue.h.
bool LDK::LocklessQueue< T >::empty | ( | ) | const [inline] |
Tests if the queue is empty.
Definition at line 189 of file LocklessQueue.h.
const T* LDK::LocklessQueue< T >::peek | ( | ) | const [inline] |
Get the first event in the queue without removing it.
Definition at line 196 of file LocklessQueue.h.
References NULL.