CppSerdes  1.0
A serialization/deserialization library designed with embedded systems in mind
serdes::array< T, ST > Struct Template Reference

a container for fixed or dynamically sized arrays, with an upper bounds limit for safety More...

#include <serdes_format_modifiers.h>

Public Member Functions

template<size_t max_elements>
 array (T(&v)[max_elements], const ST &s) noexcept
 Construct a new array object from an existing array and a referenced size. More...
 
template<size_t max_elements>
 array (T(&v)[max_elements], const ST &&s) noexcept
 Construct a new array object from an existing array and a rvalue size. More...
 
 array (T *v, ST &s, const size_t max_elements) noexcept
 Construct a new array object from a pointer to the head of the array, a referenced dynamic size, and a constant max size. More...
 
 array (T *v, const ST &&s, const size_t max_elements) noexcept
 Construct a new array object from a pointer to the head of the array, a rvalue dynamic size, and a constant max size. More...
 

Public Attributes

T * value
 a pointer to the array head
 
const ST & size
 a reference to a value that contains the dynamic size of the array
 
const size_t max_size
 maximum size of the array (used for bounds checking)
 

Detailed Description

template<typename T, typename ST>
struct serdes::array< T, ST >

a container for fixed or dynamically sized arrays, with an upper bounds limit for safety

Template Parameters
Tthe array element type
STthe type of the variable used by reference to adjust and report the array size
Examples:
06_variable_length_formats.cpp, and 13_arrays_of_packets.cpp.

Constructor & Destructor Documentation

template<typename T, typename ST>
template<size_t max_elements>
serdes::array< T, ST >::array ( T(&)  v[max_elements],
const ST &  s 
)
inlinenoexcept

Construct a new array object from an existing array and a referenced size.

Template Parameters
max_elementsmaximum number of elements in the array
Parameters
vreference to the underlying array
sreference to a value representing the dynamic array size
template<typename T, typename ST>
template<size_t max_elements>
serdes::array< T, ST >::array ( T(&)  v[max_elements],
const ST &&  s 
)
inlinenoexcept

Construct a new array object from an existing array and a rvalue size.

Template Parameters
max_elements
Parameters
vreference to the underlying array
sa rvalue representing the dynamic array size
template<typename T, typename ST>
serdes::array< T, ST >::array ( T *  v,
ST &  s,
const size_t  max_elements 
)
inlinenoexcept

Construct a new array object from a pointer to the head of the array, a referenced dynamic size, and a constant max size.

Parameters
vpointer to the head of the array
sreference to a value representing the dynamic array size
max_elementsmaximum size of the array
template<typename T, typename ST>
serdes::array< T, ST >::array ( T *  v,
const ST &&  s,
const size_t  max_elements 
)
inlinenoexcept

Construct a new array object from a pointer to the head of the array, a rvalue dynamic size, and a constant max size.

Parameters
vpointer to the head of the array
srvalue representing the dynamic array size
max_elementsmaximum size of the array

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