![]() |
Fledge
An open source edge computing platform for industrial users
|
A circular buffer of readings. More...
#include <reading_circularbuffer.h>
Public Member Functions | |
ReadingCircularBuffer (unsigned int size) | |
Create a circular buffer of readings. More... | |
~ReadingCircularBuffer () | |
Destructor for the circular buffer. | |
void | insert (Reading *) |
Insert a single reading into the shared buffer. More... | |
void | insert (const std::vector< Reading * > &readings) |
Insert a list of readings into the circular buffer. More... | |
void | insert (const std::vector< Reading * > *readings) |
Insert a list of readings into the circular buffer. More... | |
int | extract (std::vector< std::shared_ptr< Reading >> &vec) |
Return the buffered data into a supplied vector. More... | |
A circular buffer of readings.
The buffer size is set in the constructor, when it fills the oldest reading will be overwritten by new readings being appended.
The user can extract the current state at any point in historic order.
ReadingCircularBuffer::ReadingCircularBuffer | ( | unsigned int | size | ) |
Create a circular buffer of readings.
size | The number of items to retain in the circular buffer |
int ReadingCircularBuffer::extract | ( | std::vector< std::shared_ptr< Reading >> & | vec | ) |
Return the buffered data into a supplied vector.
vec | The vector to populate with the shared pointers |
void ReadingCircularBuffer::insert | ( | const std::vector< Reading * > & | readings | ) |
Insert a list of readings into the circular buffer.
readings | The set of readings to ingest |
void ReadingCircularBuffer::insert | ( | const std::vector< Reading * > * | readings | ) |
Insert a list of readings into the circular buffer.
readings | The set of readings to ingest |
void ReadingCircularBuffer::insert | ( | Reading * | reading | ) |
Insert a single reading into the shared buffer.
reading | The reading to insert |