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

constexpr bitpack (T &&v, const ST &&b) noexcept
 Construct a new bitpack object from a rvalue value, and rvalue bit length. More...
 
constexpr bitpack (T &v, const ST &&b) noexcept
 Construct a new bitpack object from a reference value, and rvalue bit length. More...
 
constexpr bitpack (T &v, const ST &b) noexcept
 Construct a new bitpack object from a reference value, and reference bit length. More...
 
constexpr 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, 09_runtime_edittable_formats.cpp, and 14_custom_types.cpp.

Constructor & Destructor Documentation

◆ bitpack() [1/4]

template<typename T , typename ST >
constexpr serdes::bitpack< T, ST >::bitpack ( T &&  v,
const ST &&  b 
)
inlineconstexprnoexcept

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

Parameters
vreferenced value
bnumber of bits to pack into

◆ bitpack() [2/4]

template<typename T , typename ST >
constexpr serdes::bitpack< T, ST >::bitpack ( T &  v,
const ST &&  b 
)
inlineconstexprnoexcept

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

Parameters
vreferenced value
bnumber of bits to pack into

◆ bitpack() [3/4]

template<typename T , typename ST >
constexpr serdes::bitpack< T, ST >::bitpack ( T &  v,
const ST &  b 
)
inlineconstexprnoexcept

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

Parameters
vreferenced value
bnumber of bits to pack into

◆ bitpack() [4/4]

template<typename T , typename ST >
constexpr serdes::bitpack< T, ST >::bitpack ( T &&  v,
const ST &  b 
)
inlineconstexprnoexcept

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: