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 70 of file circularbuffer.h.
| typedef QSharedPointer<const CircularBuffer> UTILSLIB::CircularBuffer< T >::ConstSPtr |
Const shared pointer type for CircularBuffer.
Definition at line 74 of file circularbuffer.h.
| typedef QSharedPointer<CircularBuffer> UTILSLIB::CircularBuffer< T >::SPtr |
Shared pointer type for CircularBuffer.
Definition at line 73 of file circularbuffer.h.
|
explicit |
Constructs a CircularBuffer.
| [in] | uiMaxNumElements | length of buffer. |
Definition at line 176 of file circularbuffer.h.
| UTILSLIB::CircularBuffer< T >::~CircularBuffer | ( | ) |
Destroys the CircularBuffer.
Definition at line 191 of file circularbuffer.h.
|
inline |
Clears the buffer.
Definition at line 269 of file circularbuffer.h.
|
inline |
Returns the number of free elements for thread safe reading.
Definition at line 291 of file circularbuffer.h.
|
inline |
Returns the number of free elements for thread safe reading.
Definition at line 299 of file circularbuffer.h.
|
inline |
Pauses the buffer. Skpis any incoming matrices and only pops zero matrices.
| [in] | bPause | True to pause the buffer, false to resume it. |
Definition at line 283 of file circularbuffer.h.
|
inline |
Returns the first element (first in first out).
| [out] | element | Receives the first element; left unchanged on failure. |
Definition at line 241 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 222 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 201 of file circularbuffer.h.