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

This is a wrapper around a ReadBufferInterface only exposing a given number of bytes. More...

#include <ReadBufferSection.h>

Inheritance diagram for EmbeddedProto::ReadBufferSection:
Inheritance graph
[legend]
Collaboration diagram for EmbeddedProto::ReadBufferSection:
Collaboration graph
[legend]

Public Member Functions

 ReadBufferSection ()=delete
 Explicitly delete the default constructor in favor of the one with parameters. More...
 
 ReadBufferSection (ReadBufferInterface &buffer, const uint32_t size)
 The constructor of the class with the required parameters. More...
 
virtual ~ReadBufferSection ()=default
 
uint32_t get_size () const override
 Return the number of bytes remaining. More...
 
uint32_t get_max_size () const override
 Obtain the total number of bytes which can at most be stored in the buffer. More...
 
bool peek (uint8_t &byte) const override
 Expose the function of the parent buffer. More...
 
void advance () override
 Decrement the size and call advance on the parent buffer. More...
 
void advance (const uint32_t N) override
 Decrement the size by N bytes and call advance on the parent buffer. More...
 
bool pop (uint8_t &byte) override
 Decrement the size and pop the next byte from the parent buffer. More...
 
- Public Member Functions inherited from EmbeddedProto::ReadBufferInterface
 ReadBufferInterface ()=default
 
virtual ~ReadBufferInterface ()=default
 

Detailed Description

This is a wrapper around a ReadBufferInterface only exposing a given number of bytes.

This class is used when decoding a length delimited fields. It is constructed given a message buffer and a size. This class will return bytes from the buffer for the given number of bytes stated in the size parameter.

See also
ReadBufferInterface

Constructor & Destructor Documentation

◆ ReadBufferSection() [1/2]

EmbeddedProto::ReadBufferSection::ReadBufferSection ( )
delete

Explicitly delete the default constructor in favor of the one with parameters.

◆ ReadBufferSection() [2/2]

EmbeddedProto::ReadBufferSection::ReadBufferSection ( ReadBufferInterface buffer,
const uint32_t  size 
)

The constructor of the class with the required parameters.

Parameters
bufferThe actual data buffer from which the bytes are obtained.
sizeThe maximum number of bytes to return from buffer.

◆ ~ReadBufferSection()

virtual EmbeddedProto::ReadBufferSection::~ReadBufferSection ( )
virtualdefault

Member Function Documentation

◆ advance() [1/2]

void EmbeddedProto::ReadBufferSection::advance ( )
overridevirtual

Decrement the size and call advance on the parent buffer.

This will not do anything if size zero is reached.

Implements EmbeddedProto::ReadBufferInterface.

◆ advance() [2/2]

void EmbeddedProto::ReadBufferSection::advance ( const uint32_t  N)
overridevirtual

Decrement the size by N bytes and call advance on the parent buffer.

This will not do anything if size zero is reached.

Implements EmbeddedProto::ReadBufferInterface.

◆ get_max_size()

uint32_t EmbeddedProto::ReadBufferSection::get_max_size ( ) const
overridevirtual

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

In the case of this buffer section this will return the size of the section.

Implements EmbeddedProto::ReadBufferInterface.

◆ get_size()

uint32_t EmbeddedProto::ReadBufferSection::get_size ( ) const
overridevirtual

Return the number of bytes remaining.

Implements EmbeddedProto::ReadBufferInterface.

◆ peek()

bool EmbeddedProto::ReadBufferSection::peek ( uint8_t &  byte) const
overridevirtual

Expose the function of the parent buffer.

This will not do anything if size zero is reached.

Implements EmbeddedProto::ReadBufferInterface.

◆ pop()

bool EmbeddedProto::ReadBufferSection::pop ( uint8_t &  byte)
overridevirtual

Decrement the size and pop the next byte from the parent buffer.

This will not do anything if size zero is reached.

Implements EmbeddedProto::ReadBufferInterface.


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