avr-classes
Public Member Functions | List of all members
SynchronizedRingBuffer< BASETYPE, COUNT > Class Template Reference

#include <synchronizedringbuffer.h>

Inheritance diagram for SynchronizedRingBuffer< BASETYPE, COUNT >:
RingBuffer< BASETYPE, COUNT >

Public Member Functions

bool enqueue (BASETYPE item)
 
bool dequeue (BASETYPE *item)
 
bool isEmpty (void)
 
bool isFull (void)
 
- Public Member Functions inherited from RingBuffer< BASETYPE, COUNT >
bool enqueue (BASETYPE item)
 
bool dequeue (BASETYPE *item)
 
bool isEmpty (void)
 
bool isFull (void)
 

Detailed Description

template<class BASETYPE, uint16_t COUNT>
class SynchronizedRingBuffer< BASETYPE, COUNT >

Template class that extends the RingBuffer by locking interrupts globally for each action.

Parameters
BASETYPEType of elements in ring buffer
COUNTMaximum count of elements that can be placed in ring buffer

Member Function Documentation

◆ dequeue()

template<class BASETYPE, uint16_t COUNT>
bool SynchronizedRingBuffer< BASETYPE, COUNT >::dequeue ( BASETYPE *  item)
inline

Gets an element from the ring buffer.

Parameters
itemPointer to buffer to receive the element.
Returns
True if element could be retrieved, false otherwise.

◆ enqueue()

template<class BASETYPE, uint16_t COUNT>
bool SynchronizedRingBuffer< BASETYPE, COUNT >::enqueue ( BASETYPE  item)
inline

Adds an element into the ringer buffer.

Parameters
itemItem to add.
Returns
True if element could be added, false otherwise.

◆ isEmpty()

template<class BASETYPE, uint16_t COUNT>
bool SynchronizedRingBuffer< BASETYPE, COUNT >::isEmpty ( void  )
inline

Returns if buffer is empty.

Returns
True if buffer is empty, false otherwise.

◆ isFull()

template<class BASETYPE, uint16_t COUNT>
bool SynchronizedRingBuffer< BASETYPE, COUNT >::isFull ( void  )
inline

Returns if buffer is full.

Returns
True if buffer is full, false otherwise.