ITCHCPP 1.6.0
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
Loading...
Searching...
No Matches
encoder.hpp File Reference

Serializes parsed ITCH messages back to valid wire bytes. More...

#include <cstddef>
#include <vector>
#include "itch/messages.hpp"
+ Include dependency graph for encoder.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  itch
 

Functions

auto itch::encode_message (const Message &message) -> std::vector< std::byte >
 Encodes a message body and header without the 2-byte length prefix.
 
auto itch::encode_frame (const Message &message) -> std::vector< std::byte >
 Encodes a complete length-prefixed frame (2-byte big-endian length followed by the message bytes), ready to concatenate into a stream.
 

Detailed Description

Serializes parsed ITCH messages back to valid wire bytes.

The encoder is the inverse of the parser: it writes each message's fields in the spec's order and network (big-endian) byte order, including the 48-bit timestamp. It is used to synthesize valid ITCH streams for testing, scenario generation, and golden fixtures, and it guarantees the round-trip property parse(encode(msg)) == msg for every supported message type.

Author
Bertin Balouki SIMYELI

Definition in file encoder.hpp.