CppSerdes  1.0
A serialization/deserialization library designed with embedded systems in mind
serdes_formatter.h File Reference

defines the serdes::formatter class for recording arbitrary format lambda procedures More...

#include <functional>
#include "bitcpy_common.h"

Go to the source code of this file.

Classes

struct  serdes::formatter
 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...
 

Namespaces

 serdes
 CppSerdes library namespace.
 
 serdes::init_formatter
 init_formatter() constructs a serdes::formatter object lambda without using dynamic memory allocation. A number of different use cases are supported, see serdes::formatter for examples.
 
 serdes::init_this_formatter
 init_this_formatter() constructs a serdes::formatter object lambda without using dynamic memory allocation. Same as init_formatter but captures "this", only necessary for older compilers which don't capture "this" automatically.
 

Macros

#define init_formatter(...)
 init_formatter() constructs a serdes::formatter object lambda without using dynamic memory allocation. A number of different use cases are supported, see serdes::formatter for examples. More...
 
#define init_this_formatter(...)
 init_this_formatter() constructs a serdes::formatter object lambda without using dynamic memory allocation. Same as init_formatter but captures "this", only necessary for older compilers which don't capture "this" automatically. More...
 

Functions

void serdes::virtual_formatter (packet &)
 used to initialize a formatter object to be optionally overridable. the default behaviour if not overridden is to do nothing.
 

Variables

constexpr void(* serdes::pure_virtual_formatter )(packet &) = nullptr
 used to initialize a formatter object to be required but uninitialized. the default behaviour if not overridden is to give a status_e::FORMATTER_NOT_SET error
 

Detailed Description

defines the serdes::formatter class for recording arbitrary format lambda procedures

Author
Darren V Levine (Darre.nosp@m.nVLe.nosp@m.vine@.nosp@m.gmai.nosp@m.l.com)

Macro Definition Documentation

#define init_formatter (   ...)
Value:
formatter \
{ \
[&](serdes::packet &_p_k_t) { _p_k_t.add(__VA_ARGS__); } \
}
a serialization/deserialization helper class, with load, store, and stream operators ...
Definition: serdes.h:24

init_formatter() constructs a serdes::formatter object lambda without using dynamic memory allocation. A number of different use cases are supported, see serdes::formatter for examples.

Examples:
09_runtime_edittable_formats.cpp, and 10_virtual_fields.cpp.
#define init_this_formatter (   ...)
Value:
formatter \
{ \
[&, this](serdes::packet &_p_k_t) { _p_k_t.add(__VA_ARGS__); } \
}
a serialization/deserialization helper class, with load, store, and stream operators ...
Definition: serdes.h:24

init_this_formatter() constructs a serdes::formatter object lambda without using dynamic memory allocation. Same as init_formatter but captures "this", only necessary for older compilers which don't capture "this" automatically.