FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::BookDeltaMsg Struct Reference

Bids then asks follow the fixed part as a flexible array of Level (bid_count + ask_count). More...

#include <fastmm/core/messages.hpp>

Public Member Functions

Level * levels () noexcept
 
const Level * levels () const noexcept
 
std::span< const Level > bids () const noexcept
 
std::span< const Level > asks () const noexcept
 
std::span< Level > bids () noexcept
 
std::span< Level > asks () noexcept
 
bool is_snapshot () const noexcept
 

Static Public Member Functions

static constexpr std::uint32_t size_for (std::uint32_t bids, std::uint32_t asks) noexcept
 

Public Attributes

EventHeader hdr
 
std::uint32_t bid_count
 
std::uint32_t ask_count
 
std::uint64_t first_update_id
 Binance U.
 
std::uint64_t last_update_id
 Binance u / Bybit u.
 
std::uint64_t prev_update_id
 Binance futures pu (0 if n/a)
 

Detailed Description

Bids then asks follow the fixed part as a flexible array of Level (bid_count + ask_count).

Used both for deltas (qty == 0 means delete) and full snapshots (flag kSnapshot).

Never construct a BookDeltaMsg by value, not even with zero levels. The fixed part is 96 bytes but hdr.len is rounded to the 64-byte message granule, so size_for(0, 0) == 128. Everything that forwards a message copies hdr.len bytes (MsgRing, journal, BookSyncer), so a stack or member BookDeltaMsg is read 32 bytes past its end. Build it in place instead: alignas(64) std::byte buf[BookDeltaMsg::size_for(bids, asks)]; or ring.try_reserve(len)

Member Function Documentation

◆ size_for()

static constexpr std::uint32_t fastmm::BookDeltaMsg::size_for ( std::uint32_t  bids,
std::uint32_t  asks 
)
inlinestaticconstexprnoexcept

◆ levels() [1/2]

Level * fastmm::BookDeltaMsg::levels ( )
inlinenoexcept

◆ levels() [2/2]

const Level * fastmm::BookDeltaMsg::levels ( ) const
inlinenoexcept

◆ bids() [1/2]

std::span< const Level > fastmm::BookDeltaMsg::bids ( ) const
inlinenoexcept

◆ asks() [1/2]

std::span< const Level > fastmm::BookDeltaMsg::asks ( ) const
inlinenoexcept

◆ bids() [2/2]

std::span< Level > fastmm::BookDeltaMsg::bids ( )
inlinenoexcept

◆ asks() [2/2]

std::span< Level > fastmm::BookDeltaMsg::asks ( )
inlinenoexcept

◆ is_snapshot()

bool fastmm::BookDeltaMsg::is_snapshot ( ) const
inlinenoexcept

Member Data Documentation

◆ hdr

EventHeader fastmm::BookDeltaMsg::hdr

◆ bid_count

std::uint32_t fastmm::BookDeltaMsg::bid_count

◆ ask_count

std::uint32_t fastmm::BookDeltaMsg::ask_count

◆ first_update_id

std::uint64_t fastmm::BookDeltaMsg::first_update_id

Binance U.

◆ last_update_id

std::uint64_t fastmm::BookDeltaMsg::last_update_id

Binance u / Bybit u.

◆ prev_update_id

std::uint64_t fastmm::BookDeltaMsg::prev_update_id

Binance futures pu (0 if n/a)