Thread-safe lock-free circular (ring) buffer for producer-consumer data exchange between threads. More...
#include <circularbuffer.h>
Public Types | |
| typedef QSharedPointer< CircularBuffer > | SPtr |
| typedef QSharedPointer< const CircularBuffer > | ConstSPtr |
Public Member Functions | |
| CircularBuffer (unsigned int uiMaxNumElements) | |
| ~CircularBuffer () | |
| bool | push (const T *pArray, unsigned int size) |
| bool | push (const T &newElement) |
| bool | pop (T &element) |
| void | clear () |
| void | pause (bool) |
| int | getFreeElementsRead () |
| int | getFreeElementsWrite () |
Thread-safe lock-free circular (ring) buffer for producer-consumer data exchange between threads.
TEMPLATE CIRCULAR BUFFER
Definition at line 68 of file circularbuffer.h.
| typedef QSharedPointer<const CircularBuffer> UTILSLIB::CircularBuffer< T >::ConstSPtr |
Const shared pointer type for CircularBuffer.
Definition at line 72 of file circularbuffer.h.
| typedef QSharedPointer<CircularBuffer> UTILSLIB::CircularBuffer< T >::SPtr |
Shared pointer type for CircularBuffer.
Definition at line 71 of file circularbuffer.h.
|
explicit |
Constructs a CircularBuffer.
| [in] | uiMaxNumElements | length of buffer. |
Definition at line 162 of file circularbuffer.h.
| UTILSLIB::CircularBuffer< T >::~CircularBuffer | ( | ) |
Destroys the CircularBuffer.
Definition at line 177 of file circularbuffer.h.
|
inline |
Clears the buffer.
Definition at line 255 of file circularbuffer.h.
|
inline |
Returns the number of free elements for thread safe reading.
Definition at line 277 of file circularbuffer.h.
|
inline |
Returns the number of free elements for thread safe reading.
Definition at line 285 of file circularbuffer.h.
|
inline |
Pauses the buffer. Skpis any incoming matrices and only pops zero matrices.
Definition at line 269 of file circularbuffer.h.
|
inline |
Returns the first element (first in first out).
Definition at line 227 of file circularbuffer.h.
|
inline |
Adds an element at the end of the buffer.
| [in] | newElement | pointer to an Array which should be apend to the end. |
Definition at line 208 of file circularbuffer.h.
|
inline |
Adds a whole array at the end buffer.
| [in] | pArray | pointer to an Array which should be apend to the end. |
| [in] | size | number of elements containing the array. |
Definition at line 187 of file circularbuffer.h.