EmbeddedProto  2.0.0
EmbeddedProto is a C++ Protocol Buffer implementation specifically suitable for microcontrollers.
Public Member Functions | Protected Attributes | List of all members
EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE > Class Template Reference

#include <FieldStringBytes.h>

Inheritance diagram for EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >:
Inheritance graph
[legend]
Collaboration diagram for EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >:
Collaboration graph
[legend]

Public Member Functions

 FieldStringBytes ()
 
virtual ~FieldStringBytes ()
 
uint32_t get_length () const
 Obtain the number of characters in the string right now. More...
 
uint32_t get_max_length () const
 Obtain the maximum number characters in the string. More...
 
const DATA_TYPE * get_const () const
 Get a constant pointer to the first element in the array. More...
 
DATA_TYPE & get (uint32_t index)
 Get a reference to the value at the given index. More...
 
const DATA_TYPE & get_const (uint32_t index) const
 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 constant reference to the value at the given index. More...
 
Error set (const DATA_TYPE *data, const uint32_t length)
 
Error serialize_with_id (uint32_t field_number, WriteBufferInterface &buffer) const override
 
Error serialize (WriteBufferInterface &buffer) const override
 
Error deserialize (ReadBufferInterface &buffer) override
 
void clear () override
 Reset the field to it's initial value. More...
 
- Public Member Functions inherited from EmbeddedProto::Field
 Field ()=default
 
virtual ~Field ()=default
 
uint32_t serialized_size () const
 Calculate the size of this message when serialized. More...
 

Protected Attributes

uint32_t current_length_
 Number of item in the data array. More...
 
DATA_TYPE data_ [MAX_LENGTH]
 The text. More...
 

Constructor & Destructor Documentation

◆ FieldStringBytes()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::FieldStringBytes ( )
inline

◆ ~FieldStringBytes()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
virtual EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::~FieldStringBytes ( )
inlinevirtual

Member Function Documentation

◆ clear()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
void EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::clear ( )
inlineoverridevirtual

Reset the field to it's initial value.

Implements EmbeddedProto::Field.

◆ deserialize()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
Error EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::deserialize ( ReadBufferInterface buffer)
inlineoverridevirtual

Implements EmbeddedProto::Field.

◆ get()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
DATA_TYPE& EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::get ( uint32_t  index)
inline

Get a reference to the value at the given index.

This function will update the number of elements used in the array/string.

Parameters
[in]indexThe desired index to return.
Returns
The reference to the value at the given index. Will return the last element if the index is out of bounds

◆ get_const() [1/2]

template<uint32_t MAX_LENGTH, class DATA_TYPE >
const DATA_TYPE* EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::get_const ( ) const
inline

Get a constant pointer to the first element in the array.

◆ get_const() [2/2]

template<uint32_t MAX_LENGTH, class DATA_TYPE >
const DATA_TYPE& EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::get_const ( uint32_t  index) const
inline

Get a constant 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. Will return the last element if the index is out of bounds

◆ get_length()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
uint32_t EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::get_length ( ) const
inline

Obtain the number of characters in the string right now.

◆ get_max_length()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
uint32_t EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::get_max_length ( ) const
inline

Obtain the maximum number characters in the string.

◆ operator[]() [1/2]

template<uint32_t MAX_LENGTH, class DATA_TYPE >
DATA_TYPE& EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::operator[] ( uint32_t  index)
inline

Get a reference to the value at the given index.

This function will update the number of elements used in the array/string.

Parameters
[in]indexThe desired index to return.
Returns
The reference to the value at the given index. Will return the last element if the index is out of bounds

◆ operator[]() [2/2]

template<uint32_t MAX_LENGTH, class DATA_TYPE >
const DATA_TYPE& EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::operator[] ( uint32_t  index) const
inline

Get a constant 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. Will return the last element if the index is out of bounds

◆ serialize()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
Error EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::serialize ( WriteBufferInterface buffer) const
inlineoverridevirtual

Implements EmbeddedProto::Field.

◆ serialize_with_id()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
Error EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::serialize_with_id ( uint32_t  field_number,
WriteBufferInterface buffer 
) const
inlineoverridevirtual

Implements EmbeddedProto::Field.

◆ set()

template<uint32_t MAX_LENGTH, class DATA_TYPE >
Error EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::set ( const DATA_TYPE *  data,
const uint32_t  length 
)
inline

Member Data Documentation

◆ current_length_

template<uint32_t MAX_LENGTH, class DATA_TYPE >
uint32_t EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::current_length_
protected

Number of item in the data array.

◆ data_

template<uint32_t MAX_LENGTH, class DATA_TYPE >
DATA_TYPE EmbeddedProto::internal::FieldStringBytes< MAX_LENGTH, DATA_TYPE >::data_[MAX_LENGTH]
protected

The text.


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