Simplify encoding/decoding tuples like C++ structures. It is might be useful for handling data coming from the wire. Such data usually needs to be packed/unpacked into platform specific object layout.
As well as byte-ordered due to endianness differences.
Once data is represented as a C++ tuple or has Boost.describe metadata available, it can be used as simply as this:
auto encoded_buffer = tc::encode(message);
auto begin = encoded_buffer.data();
auto decoded_message = tc::decode<Message>(begin, begin+encoded_buffer.size());
here for example, implementation of Nasdaq TotalView-ITCH 5.0 protocol using this library.
described structures: https://github.com/serge-klim/md_prsr/tree/main/nasdaq/itch_v5.0
and usage example: https://github.com/serge-klim/md_prsr/blob/main/tools/nasdaq_itch_v5.0/message_dump.cpp#L19
how is it better than coded/generated parcer?
- testing is simplier, once transformation works only data layout needs to be tested.
- different transformation can be run on for eg:
- parquet (usage e.g)
- hdf5 (usage e.g)
- TODO: odbc addapter (same idea, but for now only supports Boost.Fusion)
library avalible as vcpkg package transcoder via this vcpkg registry:
vcpkg-configuration.json example:
{
"default-registry": {
"kind": "git",
"repository": "https://github.com/microsoft/vcpkg",
"baseline": "80d54ff62d528339c626a6fbc3489a7f25956ade"
},
"registries": [
{
"kind": "git",
"repository": "https://github.com/serge-klim/pkgs",
"baseline": "ebfbf2ff2491e3728374b7e8524f755b110e3a4c",
"packages": [ "transcoder" ]
}
]
}