Fledge
An open source edge computing platform for industrial users
ReadingCircularBuffer Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ReadingCircularBuffer()

ReadingCircularBuffer::ReadingCircularBuffer ( unsigned int  size)

Create a circular buffer of readings.

Parameters
sizeThe number of items to retain in the circular buffer

Member Function Documentation

◆ extract()

int ReadingCircularBuffer::extract ( std::vector< std::shared_ptr< Reading >> &  vec)

Return the buffered data into a supplied vector.

Parameters
vecThe vector to populate with the shared pointers
Returns
int The number of readings placed in the vector

◆ insert() [1/3]

void ReadingCircularBuffer::insert ( const std::vector< Reading * > &  readings)

Insert a list of readings into the circular buffer.

Parameters
readingsThe set of readings to ingest

◆ insert() [2/3]

void ReadingCircularBuffer::insert ( const std::vector< Reading * > *  readings)

Insert a list of readings into the circular buffer.

Parameters
readingsThe set of readings to ingest

◆ insert() [3/3]

void ReadingCircularBuffer::insert ( Reading reading)

Insert a single reading into the shared buffer.

Parameters
readingThe reading to insert

The documentation for this class was generated from the following files: