Sbepp
C++ implementation of the FIX Simple Binary Encoding
Install / Use
/learn @OleksandrKvl/SbeppREADME
sbepp
sbepp is a zero-overhead C++ implementation of Simple Binary Encoding (SBE). It consists of two parts:
sbeppc, schema compiler which generates header-only C++ codesbepp, header-only supporting library
This project was created in Ukraine during the invasion of Russian terrorist forces. Please consider donating to the UNITED24 platform to help us withstand.
Features
- fast, generates the same assembly as a hand-written code
- generated code needs only C++11 and has no dependencies beyond
sbeppitself - random access API to access fields in any order
- cursor-based API for efficient work with complex messages in a forward-only way
- lightweight, never allocates, most objects store only a single pointer
- convenient, STL-like interface
- supports
constexprencoding/decoding in C++20 - never changes schema names, no
get_FieldName()-like functions - provides all XML schema information via traits
Examples
Decoding example:
#include <schema_name/messages/msg1.hpp>
auto m = sbepp::make_view<schema_name::messages:msg1>(dataPtr, dataSize);
// read top-level fields
std::cout << *m.required();
if(m.optional())
{
std::cout << *m.field2();
}
if(m.bitset().A())
{
std::cout << "bitset.A";
}
// read composite field
std::cout << *m.composite().field();
// read group
for(auto entry : m.group())
{
std::cout << sbepp::to_underlying(entry.enum_field());
}
// read data
auto d = m.data();
std::cout.write(d.data(), d.size());
Encoding example:
#include <schema_name/messages/msg1.hpp>
std::array<char, 1024> buf{};
auto m = sbepp::make_view<schema_name::messages:msg1>(buf.data(), buf.size());
sbepp::fill_message_header(m);
// fill top-level fields
m.required(1);
m.optional(2);
m.bitset(schema_name::types::set{}.A(true));
// fill composite field
m.composite().field(1);
// fill group
auto g = m.group();
const auto group_size = 3;
sbepp::fill_group_header(g, group_size);
for(auto entry : g)
{
g.enum_field(schema_name::types::my_enum::A);
}
// fill data
auto d = m.data();
d.assign_string("hi");
const auto msg_size = sbepp::size_bytes(m); // get final message size
send(buf.data(), mgs_size);
Documentation
See full documentation here.
Feedback
Feel free to create an issue, send me an email, or contact me on Cpplang slack channel if you have questions or ideas related to this project.
License
Distributed under the MIT license.
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
