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: