EnigmaIOT
0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Ring buffer class. Used to implement message buffer. More...
#include <EnigmaIOTRingBuffer.h>
Public Member Functions | |
EnigmaIOTRingBuffer (int range) | |
Creates a ring buffer to hold Telement objects. More... | |
~EnigmaIOTRingBuffer () | |
EnigmaIOTRingBuffer destructor. More... | |
int | size () |
Returns actual number of elements that buffer holds. More... | |
bool | isFull () |
Checks if buffer is full. More... | |
bool | empty () |
Checks if buffer is empty. More... | |
bool | push (Telement *item) |
Adds a new item to buffer, deleting older element if it is full. More... | |
bool | pop () |
Deletes older item from buffer, if buffer is not empty. More... | |
Telement * | front () |
Gets a pointer to older item in buffer, if buffer is not empty. More... | |
Protected Attributes | |
int | maxSize |
Buffer size. More... | |
int | numElements = 0 |
Number of elements that buffer currently has. More... | |
int | readIndex = 0 |
Pointer to next item to be read. More... | |
int | writeIndex = 0 |
Pointer to next position to write onto. More... | |
Telement * | buffer |
Actual buffer. More... | |
Ring buffer class. Used to implement message buffer.
Definition at line 24 of file EnigmaIOTRingBuffer.h.
|
inline |
Creates a ring buffer to hold Telement
objects.
range | Buffer depth |
Definition at line 30 of file EnigmaIOTRingBuffer.h.
|
inline |
EnigmaIOTRingBuffer destructor.
range | Free up buffer memory |
Definition at line 45 of file EnigmaIOTRingBuffer.h.
|
inline |
Checks if buffer is empty.
true
if buffer has no elements stored, false
otherwise Definition at line 66 of file EnigmaIOTRingBuffer.h.
|
inline |
Gets a pointer to older item in buffer, if buffer is not empty.
NULL
Definition at line 125 of file EnigmaIOTRingBuffer.h.
|
inline |
Checks if buffer is full.
true
if buffer is full, false
otherwise Definition at line 60 of file EnigmaIOTRingBuffer.h.
|
inline |
Deletes older item from buffer, if buffer is not empty.
false
if buffer was empty before trying to delete element, true
otherwise Definition at line 106 of file EnigmaIOTRingBuffer.h.
|
inline |
Adds a new item to buffer, deleting older element if it is full.
item | Element to add to buffer |
false
if buffer was full before inserting the new element, true
otherwise Definition at line 73 of file EnigmaIOTRingBuffer.h.
|
inline |
Returns actual number of elements that buffer holds.
Definition at line 54 of file EnigmaIOTRingBuffer.h.
|
protected |
Actual buffer.
Definition at line 30 of file EnigmaIOTRingBuffer.h.
|
protected |
Buffer size.
Definition at line 26 of file EnigmaIOTRingBuffer.h.
|
protected |
Number of elements that buffer currently has.
Definition at line 27 of file EnigmaIOTRingBuffer.h.
|
protected |
Pointer to next item to be read.
Definition at line 28 of file EnigmaIOTRingBuffer.h.
|
protected |
Pointer to next position to write onto.
Definition at line 29 of file EnigmaIOTRingBuffer.h.