|
EnigmaIOT
0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Go to the documentation of this file.
9 #ifndef _ENIGMAIOTBUFFER_h
10 #define _ENIGMAIOTBUFFER_h
12 #if defined(ARDUINO) && ARDUINO >= 100
23 template <
typename Telement>
73 bool push (Telement* item) {
75 DEBUG_DBG (
"Add element. Buffer was %s", wasFull ?
"full" :
"not full");
78 portMUX_TYPE myMutex = portMUX_INITIALIZER_UNLOCKED;
79 portENTER_CRITICAL (&myMutex);
96 portEXIT_CRITICAL (&myMutex);
107 bool wasEmpty =
empty ();
108 DEBUG_DBG (
"Remove element. Buffer was %s", wasEmpty ?
"empty" :
"not empty");
int readIndex
Pointer to next item to be read.
~EnigmaIOTRingBuffer()
EnigmaIOTRingBuffer destructor.
Telement * buffer
Actual buffer.
Ring buffer class. Used to implement message buffer.
int size()
Returns actual number of elements that buffer holds.
bool push(Telement *item)
Adds a new item to buffer, deleting older element if it is full.
bool empty()
Checks if buffer is empty.
bool pop()
Deletes older item from buffer, if buffer is not empty.
Telement * front()
Gets a pointer to older item in buffer, if buffer is not empty.
bool isFull()
Checks if buffer is full.
Auxiliary function definition.
int numElements
Number of elements that buffer currently has.
int writeIndex
Pointer to next position to write onto.