CppSerdes  1.0
A serialization/deserialization library designed with embedded systems in mind
serdes::formatter Struct Reference

a lambda function wrapper that can describe any serialization/deserialization formatting process. While it does use more overhead (because of the lambda), it also can describe any format process as manipulatable runtime data, which the other hard coded interfaces don't allow.
More...

#include <serdes_formatter.h>

Public Attributes

std::function< void(packet &)> formatter_lambda
 the formatting function taking a packet process (and any captures) as instructions
 

Detailed Description

a lambda function wrapper that can describe any serialization/deserialization formatting process. While it does use more overhead (because of the lambda), it also can describe any format process as manipulatable runtime data, which the other hard coded interfaces don't allow.

Examples:

auto lvalue = serdes::init_formatter(x);
auto rvalue = serdes::init_formatter(123);
auto complex_object = serdes::init_formatter(serdes::bitpack(y, 16));
auto complex_object = serdes::init_formatter(serdes::bitpack(y, 16));
auto value_with_validation = serdes::init_formatter(x, [&]() { return x > 7 && y > 6; });
serdes::formatter complex_custom_process = {[&](serdes::packet &p){ p + x; }};
Examples
09_runtime_edittable_formats.cpp, and 10_virtual_fields.cpp.

The documentation for this struct was generated from the following file:
serdes::bitpack
bitpack a value into an exact number of specified bits. If applied to an array it will be applied to ...
Definition: serdes_format_modifiers.h:54
serdes::formatter
a lambda function wrapper that can describe any serialization/deserialization formatting process....
Definition: serdes_formatter.h:32
serdes::packet
a serialization/deserialization helper class, with load, store, and stream operators
Definition: serdes.h:54
init_formatter
#define init_formatter(...)
init_formatter() constructs a serdes::formatter object lambda without using dynamic memory allocation...
Definition: serdes_formatter.h:77