Roomba App  1.0
FrameBuffer Class Reference

Class implementing circular buffer. More...

#include <frameBuffer.hh>

Public Member Functions

 FrameBuffer ()=default
 Construct a new FrameBuffer object. More...
 
 ~FrameBuffer ()=default
 Destroy the FrameBuffer object. More...
 
void addFrame (const std::string &frame)
 Add one frame at the end of list. More...
 
bool getFrame (std::string &frame)
 Get one frame from the top of the list. More...
 
bool isFrame () const
 Check if there is any frame in a circular buffer. More...
 

Private Attributes

std::list< std::string > _frameList
 List containing individual frames. More...
 
std::mutex _access
 Mutex that provides single access to the list. More...
 

Static Private Attributes

static constexpr int _MAX_LIST_SIZE = 10
 Max circular buffer size. More...
 

Detailed Description

Definition at line 28 of file frameBuffer.hh.

Constructor & Destructor Documentation

◆ FrameBuffer()

FrameBuffer::FrameBuffer ( )
default

Default constructor.

◆ ~FrameBuffer()

FrameBuffer::~FrameBuffer ( )
default

Default destructor.

Member Function Documentation

◆ addFrame()

void FrameBuffer::addFrame ( const std::string &  frame)
Parameters
[in]frameOne line of data from the serial device.

Definition at line 19 of file frameBuffer.cpp.

Here is the caller graph for this function:

◆ getFrame()

bool FrameBuffer::getFrame ( std::string &  frame)
Parameters
[out]frameString to which frame will be saved.
Returns
Identifier wether the frame was received.
Return values
trueFrame successfully received.
falseFrame list is empty. Can not receive any frame.

Definition at line 30 of file frameBuffer.cpp.

Here is the caller graph for this function:

◆ isFrame()

bool FrameBuffer::isFrame ( ) const
Returns
Identifier wether the list is empty.
Return values
trueThere are at least one frame in the list.
falseThe list is empty.

Definition at line 42 of file frameBuffer.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ _access

std::mutex FrameBuffer::_access
mutableprivate

Definition at line 31 of file frameBuffer.hh.

◆ _frameList

std::list<std::string> FrameBuffer::_frameList
private

Definition at line 30 of file frameBuffer.hh.

◆ _MAX_LIST_SIZE

constexpr int FrameBuffer::_MAX_LIST_SIZE = 10
staticconstexprprivate

Definition at line 32 of file frameBuffer.hh.


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