EmbeddedProto  2.0.0
EmbeddedProto is a C++ Protocol Buffer implementation specifically suitable for microcontrollers.
Public Member Functions | List of all members
EmbeddedProto::ReadBufferInterface Class Referenceabstract

The pure virtual definition of a message buffer to read from. More...

#include <ReadBufferInterface.h>

Inheritance diagram for EmbeddedProto::ReadBufferInterface:
Inheritance graph
[legend]

Public Member Functions

 ReadBufferInterface ()=default
 
virtual ~ReadBufferInterface ()=default
 
virtual uint32_t get_size () const =0
 Obtain the total number of bytes currently stored in the buffer. More...
 
virtual uint32_t get_max_size () const =0
 Obtain the total number of bytes which can at most be stored in the buffer. More...
 
virtual bool peek (uint8_t &byte) const =0
 Obtain the value of the oldest byte in the buffer. More...
 
virtual void advance ()=0
 Advances the internal read index by one when the buffer is not empty. More...
 
virtual void advance (const uint32_t N)=0
 Advances the internal read index by the given value. More...
 
virtual bool pop (uint8_t &byte)=0
 Obtain the value of the oldest byte in the buffer and remove it from the buffer. More...
 

Detailed Description

The pure virtual definition of a message buffer to read from.

The buffer deals with bytes (uint8_t) only.

Constructor & Destructor Documentation

◆ ReadBufferInterface()

EmbeddedProto::ReadBufferInterface::ReadBufferInterface ( )
default

◆ ~ReadBufferInterface()

virtual EmbeddedProto::ReadBufferInterface::~ReadBufferInterface ( )
virtualdefault

Member Function Documentation

◆ advance() [1/2]

virtual void EmbeddedProto::ReadBufferInterface::advance ( )
pure virtual

Advances the internal read index by one when the buffer is not empty.

Implemented in EmbeddedProto::ReadBufferSection.

◆ advance() [2/2]

virtual void EmbeddedProto::ReadBufferInterface::advance ( const uint32_t  N)
pure virtual

Advances the internal read index by the given value.

The advance is limited to the number of bytes in the buffer.

Parameters
[in]NThe number of bytes to advance the read index.

Implemented in EmbeddedProto::ReadBufferSection.

◆ get_max_size()

virtual uint32_t EmbeddedProto::ReadBufferInterface::get_max_size ( ) const
pure virtual

Obtain the total number of bytes which can at most be stored in the buffer.

Implemented in EmbeddedProto::ReadBufferSection.

◆ get_size()

virtual uint32_t EmbeddedProto::ReadBufferInterface::get_size ( ) const
pure virtual

Obtain the total number of bytes currently stored in the buffer.

Implemented in EmbeddedProto::ReadBufferSection.

◆ peek()

virtual bool EmbeddedProto::ReadBufferInterface::peek ( uint8_t &  byte) const
pure virtual

Obtain the value of the oldest byte in the buffer.

This function will not alter the buffer read index.

The parameter byte will not be set if the buffer was empty.

Parameters
[out]byteWhen the buffer is not empty this variable will hold the oldest value.
Returns
True when the buffer was not empty.

Implemented in EmbeddedProto::ReadBufferSection.

◆ pop()

virtual bool EmbeddedProto::ReadBufferInterface::pop ( uint8_t &  byte)
pure virtual

Obtain the value of the oldest byte in the buffer and remove it from the buffer.

This function will alter the internal read index.

The parameter byte will not be set if the buffer was empty.

Parameters
[out]byteWhen the buffer is not empty this variable will hold the oldest value.
Returns
True when the buffer was not empty.

Implemented in EmbeddedProto::ReadBufferSection.


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