v2.0.0
Loading...
Searching...
No Matches
UTILSLIB::CircularBuffer< _Tp > Class Template Reference

The TEMPLATE CIRCULAR BUFFER provides a template for thread safe circular buffers. More...

#include <circularbuffer.h>

Public Types

typedef QSharedPointer< CircularBufferSPtr
typedef QSharedPointer< const CircularBufferConstSPtr

Public Member Functions

 CircularBuffer (unsigned int uiMaxNumElements)
 ~CircularBuffer ()
bool push (const _Tp *pArray, unsigned int size)
bool push (const _Tp &newElement)
bool pop (_Tp &element)
void clear ()
void pause (bool)
int getFreeElementsRead ()
int getFreeElementsWrite ()

Detailed Description

template<typename _Tp>
class UTILSLIB::CircularBuffer< _Tp >

The TEMPLATE CIRCULAR BUFFER provides a template for thread safe circular buffers.

TEMPLATE CIRCULAR BUFFER

Definition at line 73 of file circularbuffer.h.

Member Typedef Documentation

◆ ConstSPtr

template<typename _Tp>
typedef QSharedPointer<const CircularBuffer> UTILSLIB::CircularBuffer< _Tp >::ConstSPtr

Const shared pointer type for CircularBuffer.

Definition at line 77 of file circularbuffer.h.

◆ SPtr

template<typename _Tp>
typedef QSharedPointer<CircularBuffer> UTILSLIB::CircularBuffer< _Tp >::SPtr

Shared pointer type for CircularBuffer.

Definition at line 76 of file circularbuffer.h.

Constructor & Destructor Documentation

◆ CircularBuffer()

template<typename _Tp>
UTILSLIB::CircularBuffer< _Tp >::CircularBuffer ( unsigned int uiMaxNumElements)
explicit

Constructs a CircularBuffer.

Parameters
[in]uiMaxNumElementslength of buffer.

Definition at line 167 of file circularbuffer.h.

◆ ~CircularBuffer()

template<typename _Tp>
UTILSLIB::CircularBuffer< _Tp >::~CircularBuffer ( )

Destroys the CircularBuffer.

Definition at line 182 of file circularbuffer.h.

Member Function Documentation

◆ clear()

template<typename _Tp>
void UTILSLIB::CircularBuffer< _Tp >::clear ( )
inline

Clears the buffer.

Definition at line 252 of file circularbuffer.h.

◆ getFreeElementsRead()

template<typename _Tp>
int UTILSLIB::CircularBuffer< _Tp >::getFreeElementsRead ( )
inline

Returns the number of free elements for thread safe reading.

Definition at line 274 of file circularbuffer.h.

◆ getFreeElementsWrite()

template<typename _Tp>
int UTILSLIB::CircularBuffer< _Tp >::getFreeElementsWrite ( )
inline

Returns the number of free elements for thread safe reading.

Definition at line 282 of file circularbuffer.h.

◆ pause()

template<typename _Tp>
void UTILSLIB::CircularBuffer< _Tp >::pause ( bool bPause)
inline

Pauses the buffer. Skpis any incoming matrices and only pops zero matrices.

Definition at line 266 of file circularbuffer.h.

◆ pop()

template<typename _Tp>
bool UTILSLIB::CircularBuffer< _Tp >::pop ( _Tp & element)
inline

Returns the first element (first in first out).

Returns
the first element.

Definition at line 226 of file circularbuffer.h.

◆ push() [1/2]

template<typename _Tp>
bool UTILSLIB::CircularBuffer< _Tp >::push ( const _Tp & newElement)
inline

Adds an element at the end of the buffer.

Parameters
[in]newElementpointer to an Array which should be apend to the end.

Definition at line 211 of file circularbuffer.h.

◆ push() [2/2]

template<typename _Tp>
bool UTILSLIB::CircularBuffer< _Tp >::push ( const _Tp * pArray,
unsigned int size )
inline

Adds a whole array at the end buffer.

Parameters
[in]pArraypointer to an Array which should be apend to the end.
[in]sizenumber of elements containing the array.

Definition at line 192 of file circularbuffer.h.


The documentation for this class was generated from the following file: