38 #include <util/atomic.h> 70 RingBuffer(
unsigned char *buffer,
unsigned short size );
87 int peek(
unsigned short index = 0 );
97 bool push(
unsigned char element );
120 {
return !
static_cast<bool>( mLength ); }
128 {
return static_cast<bool>( mLength ); }
138 unsigned char *mBuffer;
139 volatile unsigned short mSize;
140 volatile unsigned short mLength;
141 volatile unsigned short mIndex;
void clear()
Clear the ring buffer, leaving it empty.
Definition: RingBuffer.cpp:109
RingBuffer(unsigned char *buffer, unsigned short size)
Construct a ring buffer by providing the storage area for the ring buffer.
Definition: RingBuffer.cpp:30
int pull()
Extract the next (first) byte from the ring buffer.
Definition: RingBuffer.cpp:36
bool isEmpty()
Determine if the buffer is empty .
Definition: RingBuffer.h:119
bool isNotEmpty()
Determine if the buffer is not empty.
Definition: RingBuffer.h:127
bool isNotFull()
Determine if the buffer is not full and can accept more bytes.
Definition: RingBuffer.cpp:98
This class provides an efficient ring buffer implementation for storing bytes. Ring buffers are parti...
Definition: RingBuffer.h:60
bool isFull()
Determine if the buffer is full and cannot accept more bytes.
Definition: RingBuffer.cpp:89
int peek(unsigned short index=0)
Examine an element in the ring buffer.
Definition: RingBuffer.cpp:56
bool push(unsigned char element)
Push a byte into the ring buffer. The element is appended to the back of the buffer.
Definition: RingBuffer.cpp:70