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

bitpack a value into an exact number of specified bits. If applied to an array it will be applied to each element of the array, not the total bits in the array More...

#include <serdes_format_modifiers.h>

Public Member Functions

 bitpack (T &&v, ST &&b) noexcept
 Construct a new bitpack object from a rvalue value, and rvalue bit length. More...
 
 bitpack (T &v, ST &&b) noexcept
 Construct a new bitpack object from a reference value, and rvalue bit length. More...
 
 bitpack (T &v, const ST &b) noexcept
 Construct a new bitpack object from a reference value, and reference bit length. More...
 
 bitpack (T &&v, const ST &b) noexcept
 Construct a new bitpack object from a rvalue value, and reference bit length. More...
 

Public Attributes

T & value
 a reference to the bitpacked value
 
const ST & bits
 a reference to the number of bits to use when storing/loading the referenced value
 

Detailed Description

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

bitpack a value into an exact number of specified bits. If applied to an array it will be applied to each element of the array, not the total bits in the array

Template Parameters
Tthe type of the value bitpacked
STthe size type of the bit length value
Examples:
01_simple_example.cpp, 03_serial_usage.cpp, 05_nested_object_oriented_serial.cpp, 06_variable_length_formats.cpp, and 09_runtime_edittable_formats.cpp.

Constructor & Destructor Documentation

template<typename T, typename ST>
serdes::bitpack< T, ST >::bitpack ( T &&  v,
ST &&  b 
)
inlinenoexcept

Construct a new bitpack object from a rvalue value, and rvalue bit length.

Parameters
vreferenced value
bnumber of bits to pack into
template<typename T, typename ST>
serdes::bitpack< T, ST >::bitpack ( T &  v,
ST &&  b 
)
inlinenoexcept

Construct a new bitpack object from a reference value, and rvalue bit length.

Parameters
vreferenced value
bnumber of bits to pack into
template<typename T, typename ST>
serdes::bitpack< T, ST >::bitpack ( T &  v,
const ST &  b 
)
inlinenoexcept

Construct a new bitpack object from a reference value, and reference bit length.

Parameters
vreferenced value
bnumber of bits to pack into
template<typename T, typename ST>
serdes::bitpack< T, ST >::bitpack ( T &&  v,
const ST &  b 
)
inlinenoexcept

Construct a new bitpack object from a rvalue value, and reference bit length.

Parameters
vreferenced value
bnumber of bits to pack into

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