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

Class template that specifies the interface of an arry with the data type. More...

#include <RepeatedField.h>

Inheritance diagram for EmbeddedProto::RepeatedField< DATA_TYPE >:
Inheritance graph
[legend]
Collaboration diagram for EmbeddedProto::RepeatedField< DATA_TYPE >:
Collaboration graph
[legend]

Public Member Functions

 RepeatedField ()=default
 
virtual ~RepeatedField ()=default
 
virtual uint32_t get_length () const =0
 Obtain the total number of DATA_TYPE items in the array. More...
 
virtual uint32_t get_max_length () const =0
 Obtain the maximum number of DATA_TYPE items which can at most be stored in the array. More...
 
virtual uint32_t get_size () const =0
 Obtain the total number of bytes currently stored in the array. More...
 
virtual uint32_t get_max_size () const =0
 Obtain the maximum number of bytes which can at most be stored in the array. More...
 
virtual DATA_TYPE & get (uint32_t index)=0
 Get a reference to the value at the given index. More...
 
virtual const DATA_TYPE & get_const (uint32_t index) const =0
 Get a constant reference to the value at the given index. More...
 
DATA_TYPE & operator[] (uint32_t index)
 Get a reference to the value at the given index. More...
 
const DATA_TYPE & operator[] (uint32_t index) const
 Get a reference to the value at the given index. But constant. More...
 
virtual void set (uint32_t index, const DATA_TYPE &value)=0
 Set the value at the given index. More...
 
virtual Error set_data (const DATA_TYPE *data, const uint32_t length)=0
 Given a different array of known length copy that data into this object. More...
 
virtual Error add (const DATA_TYPE &value)=0
 Append a value to the end of the array. More...
 
virtual void clear ()=0
 Remove all data in the array and set it to the default value. More...
 
Error serialize (WriteBufferInterface &buffer) const
 
Error serialize_with_id (uint32_t field_number, WriteBufferInterface &buffer) const final
 
Error deserialize (::EmbeddedProto::ReadBufferInterface &buffer) final
 Function to deserialize this array. More...
 
uint32_t serialized_size_packed (int32_t field_number) const
 Calculate the size of this field when serialized. More...
 
uint32_t serialized_size_unpacked (int32_t field_number) const
 Calculate the size of this field when serialized. More...
 
- Public Member Functions inherited from EmbeddedProto::Field
 Field ()=default
 
virtual ~Field ()=default
 
virtual Error deserialize (ReadBufferInterface &buffer)=0
 
uint32_t serialized_size () const
 Calculate the size of this message when serialized. More...
 

Detailed Description

template<class DATA_TYPE>
class EmbeddedProto::RepeatedField< DATA_TYPE >

Class template that specifies the interface of an arry with the data type.

Constructor & Destructor Documentation

◆ RepeatedField()

template<class DATA_TYPE >
EmbeddedProto::RepeatedField< DATA_TYPE >::RepeatedField ( )
default

◆ ~RepeatedField()

template<class DATA_TYPE >
virtual EmbeddedProto::RepeatedField< DATA_TYPE >::~RepeatedField ( )
virtualdefault

Member Function Documentation

◆ add()

template<class DATA_TYPE >
virtual Error EmbeddedProto::RepeatedField< DATA_TYPE >::add ( const DATA_TYPE &  value)
pure virtual

Append a value to the end of the array.

Parameters
[in]valueThe data to add.
Returns
Error::NO_ERRORS when every was successful. Error::ARRAY_FULL when there is no space left.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ clear()

template<class DATA_TYPE >
virtual void EmbeddedProto::RepeatedField< DATA_TYPE >::clear ( )
pure virtual

Remove all data in the array and set it to the default value.

Implements EmbeddedProto::Field.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ deserialize()

template<class DATA_TYPE >
Error EmbeddedProto::RepeatedField< DATA_TYPE >::deserialize ( ::EmbeddedProto::ReadBufferInterface buffer)
inlinefinal

Function to deserialize this array.

From a buffer of data fill this array with data.

Parameters
buffer[in] The memory from which the message is obtained.
Returns
Error::NO_ERRORS when every was successful.

◆ get()

template<class DATA_TYPE >
virtual DATA_TYPE& EmbeddedProto::RepeatedField< DATA_TYPE >::get ( uint32_t  index)
pure virtual

Get a reference to the value at the given index.

Parameters
[in]indexThe desired index to return.
Returns
The reference to the value at the given index.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ get_const()

template<class DATA_TYPE >
virtual const DATA_TYPE& EmbeddedProto::RepeatedField< DATA_TYPE >::get_const ( uint32_t  index) const
pure virtual

Get a constant reference to the value at the given index.

Parameters
[in]indexThe desired index to return.
Returns
The constant reference to the value at the given index.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ get_length()

template<class DATA_TYPE >
virtual uint32_t EmbeddedProto::RepeatedField< DATA_TYPE >::get_length ( ) const
pure virtual

Obtain the total number of DATA_TYPE items in the array.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ get_max_length()

template<class DATA_TYPE >
virtual uint32_t EmbeddedProto::RepeatedField< DATA_TYPE >::get_max_length ( ) const
pure virtual

Obtain the maximum number of DATA_TYPE items which can at most be stored in the array.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ get_max_size()

template<class DATA_TYPE >
virtual uint32_t EmbeddedProto::RepeatedField< DATA_TYPE >::get_max_size ( ) const
pure virtual

Obtain the maximum number of bytes which can at most be stored in the array.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ get_size()

template<class DATA_TYPE >
virtual uint32_t EmbeddedProto::RepeatedField< DATA_TYPE >::get_size ( ) const
pure virtual

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

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ operator[]() [1/2]

template<class DATA_TYPE >
DATA_TYPE& EmbeddedProto::RepeatedField< DATA_TYPE >::operator[] ( uint32_t  index)
inline

Get a reference to the value at the given index.

Parameters
[in]indexThe desired index to return.
Returns
The reference to the value at the given index.

◆ operator[]() [2/2]

template<class DATA_TYPE >
const DATA_TYPE& EmbeddedProto::RepeatedField< DATA_TYPE >::operator[] ( uint32_t  index) const
inline

Get a reference to the value at the given index. But constant.

Parameters
[in]indexThe desired index to return.
Returns
The constant reference to the value at the given index.

◆ serialize()

template<class DATA_TYPE >
Error EmbeddedProto::RepeatedField< DATA_TYPE >::serialize ( WriteBufferInterface buffer) const
inlinevirtual

Implements EmbeddedProto::Field.

◆ serialize_with_id()

template<class DATA_TYPE >
Error EmbeddedProto::RepeatedField< DATA_TYPE >::serialize_with_id ( uint32_t  field_number,
WriteBufferInterface buffer 
) const
inlinefinalvirtual

◆ serialized_size_packed()

template<class DATA_TYPE >
uint32_t EmbeddedProto::RepeatedField< DATA_TYPE >::serialized_size_packed ( int32_t  field_number) const
inline

Calculate the size of this field when serialized.

The calculation only includes the data, not the size required by the tag and

Returns
The number of bytes this field will require once serialized.

◆ serialized_size_unpacked()

template<class DATA_TYPE >
uint32_t EmbeddedProto::RepeatedField< DATA_TYPE >::serialized_size_unpacked ( int32_t  field_number) const
inline

Calculate the size of this field when serialized.

Returns
The number of bytes this field will require once serialized.

◆ set()

template<class DATA_TYPE >
virtual void EmbeddedProto::RepeatedField< DATA_TYPE >::set ( uint32_t  index,
const DATA_TYPE &  value 
)
pure virtual

Set the value at the given index.

Parameters
[in]indexThe desired index to change.
[in]valueThe value we would like to set.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.

◆ set_data()

template<class DATA_TYPE >
virtual Error EmbeddedProto::RepeatedField< DATA_TYPE >::set_data ( const DATA_TYPE *  data,
const uint32_t  length 
)
pure virtual

Given a different array of known length copy that data into this object.

Parameters
[in]dataA pointer the array to copy from.
[in]lengthThe number of value of DATA_TYPE in the array.
Returns
Error::NO_ERRORS when every was successful. Error::ARRAY_FULL when there is no space left.

Implemented in EmbeddedProto::RepeatedFieldFixedSize< DATA_TYPE, MAX_LENGTH >.


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