ITCHCPP 1.6.1
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
Loading...
Searching...
No Matches
itch::transport::SoupBinDecoder Class Reference

A stateful decoder for a SoupBinTCP byte stream. More...

#include <soupbintcp.hpp>

Public Types

using EventCallback = std::function< void(SoupBinPacketType type, std::span< const std::byte > payload)>
 Invoked for each non-data control packet, with its raw payload.
 

Public Member Functions

 SoupBinDecoder (MessageCallback callback)
 Constructs a decoder that calls callback for each ITCH message.
 
auto feed (std::span< const std::byte > bytes) -> void
 Feeds a chunk of the TCP byte stream, processing any complete packets it completes.
 
auto set_event_callback (EventCallback callback) -> void
 Installs the control-packet event callback (empty clears it).
 
auto tracker () noexcept -> SequenceTracker &
 The embedded sequence tracker (install gap callbacks here).
 
auto tracker () const noexcept -> const SequenceTracker &
 The embedded sequence tracker (install gap callbacks here).
 
auto current_session () const -> std::string_view
 The session id learned from Login Accepted (empty until then).
 
auto next_sequence () const noexcept -> std::uint64_t
 The next sequence number the decoder expects for a data packet.
 
auto messages_decoded () const noexcept -> std::uint64_t
 Total sequenced/unsequenced data messages decoded.
 

Detailed Description

A stateful decoder for a SoupBinTCP byte stream.

Because TCP delivers a byte stream rather than discrete packets, the decoder accumulates input across feed calls and emits messages only for complete packets. Sequenced (and, optionally, unsequenced) data packets each carry a single ITCH message, which is decoded through an internal Parser and handed to the MessageCallback. Control packets (login, heartbeat, logout, end of session) are surfaced through the optional event callback. The starting sequence number is learned from the Login Accepted packet and advanced per sequenced message, with gaps reported through the embedded SequenceTracker.

Definition at line 57 of file soupbintcp.hpp.

Member Typedef Documentation

◆ EventCallback

using itch::transport::SoupBinDecoder::EventCallback = std::function<void(SoupBinPacketType type, std::span<const std::byte> payload)>

Invoked for each non-data control packet, with its raw payload.

Definition at line 60 of file soupbintcp.hpp.

Constructor & Destructor Documentation

◆ SoupBinDecoder()

itch::transport::SoupBinDecoder::SoupBinDecoder ( MessageCallback  callback)
explicit

Constructs a decoder that calls callback for each ITCH message.

Parameters
callbackInvoked with each ITCH message decoded from a sequenced or unsequenced data packet.

Definition at line 47 of file soupbintcp.cpp.

Member Function Documentation

◆ feed()

auto itch::transport::SoupBinDecoder::feed ( std::span< const std::byte >  bytes) -> void

Feeds a chunk of the TCP byte stream, processing any complete packets it completes.

Parameters
bytesThe next contiguous chunk of bytes read from the TCP connection.

Definition at line 53 of file soupbintcp.cpp.

◆ set_event_callback()

auto itch::transport::SoupBinDecoder::set_event_callback ( EventCallback  callback) -> void

Installs the control-packet event callback (empty clears it).

Parameters
callbackInvoked for each non-data control packet decoded.

Definition at line 49 of file soupbintcp.cpp.

◆ tracker() [1/2]

auto itch::transport::SoupBinDecoder::tracker ( ) -> SequenceTracker&
inlinenoexcept

The embedded sequence tracker (install gap callbacks here).

Returns
Reference to the embedded SequenceTracker.

Definition at line 83 of file soupbintcp.hpp.

◆ tracker() [2/2]

auto itch::transport::SoupBinDecoder::tracker ( ) const -> const SequenceTracker&
inlinenoexcept

The embedded sequence tracker (install gap callbacks here).

Returns
Const reference to the embedded SequenceTracker.

Definition at line 86 of file soupbintcp.hpp.

◆ current_session()

auto itch::transport::SoupBinDecoder::current_session ( ) const -> std::string_view
inline

The session id learned from Login Accepted (empty until then).

Returns
The current session id, or an empty view before login.

Definition at line 90 of file soupbintcp.hpp.

◆ next_sequence()

auto itch::transport::SoupBinDecoder::next_sequence ( ) const -> std::uint64_t
inlinenoexcept

The next sequence number the decoder expects for a data packet.

Returns
The next expected sequence number.

Definition at line 94 of file soupbintcp.hpp.

◆ messages_decoded()

auto itch::transport::SoupBinDecoder::messages_decoded ( ) const -> std::uint64_t
inlinenoexcept

Total sequenced/unsequenced data messages decoded.

Returns
The total count of decoded data messages.

Definition at line 98 of file soupbintcp.hpp.


The documentation for this class was generated from the following files: