OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
BinaryMessageIterator Class Reference

#include <OnixS/CME/MDH/Packet.h>

Public Types

using iterator_category = std::forward_iterator_tag
using difference_type = ptrdiff_t
using value_type = const Messaging::SbeMessage
using pointer = value_type*
using reference = value_type&

Public Member Functions

 BinaryMessageIterator (const void *dataBegin, const void *dataEnd, const Packet *packet)
value_type message () const
value_type operator* () const
BinaryMessageIterator & operator++ ()
bool operator== (const BinaryMessageIterator &other) const noexcept
bool operator!= (const BinaryMessageIterator &other) const noexcept

Detailed Description

The iterator is a non-owning view. The underlying buffer and optional packet context must remain valid for the iterator's lifetime.

Definition at line 50 of file Packet.h.

Member Typedef Documentation

◆ difference_type

using difference_type = ptrdiff_t

Represents the distance between iterators.

Definition at line 57 of file Packet.h.

◆ iterator_category

using iterator_category = std::forward_iterator_tag

Identifies this type as a forward iterator.

Definition at line 54 of file Packet.h.

◆ pointer

using pointer = value_type*

Defines a pointer to the iterator value type.

Definition at line 63 of file Packet.h.

◆ reference

Defines a reference to the iterator value type.

Definition at line 66 of file Packet.h.

◆ value_type

Represents an immutable SBE message view.

Definition at line 60 of file Packet.h.

Constructor & Destructor Documentation

◆ BinaryMessageIterator()

BinaryMessageIterator ( const void * dataBegin,
const void * dataEnd,
const Packet * packet )
inline

Constructs an iterator over a range of encoded message bytes.

Parameters
dataBeginAddress of the current message prefix, or dataEnd for a past-the-end iterator.
dataEndAddress one byte past the encoded message range.
packetPacket used to provide context in validation errors; may be nullptr.
Exceptions
std::runtime_errorIf the current message prefix or payload does not fit in the range, or the prefix declares a size smaller than the prefix itself.
Note
dataBegin must not follow dataEnd; both addresses must delimit the same valid buffer.

Definition at line 75 of file Packet.h.

Member Function Documentation

◆ message()

value_type message ( ) const
inline

Returns a non-owning view of the current encoded message.

Returns
Immutable message view whose storage remains owned by the underlying packet buffer.
Exceptions
std::runtime_errorIf the message payload is smaller than the SBE message header or its declared block length.
Note
The iterator must be dereferenceable; calling this function on a past-the-end iterator violates its precondition.

Definition at line 93 of file Packet.h.

◆ operator!=()

bool operator!= ( const BinaryMessageIterator & other) const
inlinenoexcept

Tests whether two iterators refer to different byte positions.

Parameters
otherIterator to compare with.
Returns
true if the iterators refer to different byte positions; otherwise false.

Definition at line 139 of file Packet.h.

◆ operator*()

value_type operator* ( ) const
inline

Returns a non-owning view of the current encoded message.

Returns
Immutable message view whose storage remains owned by the underlying packet buffer.
Exceptions
std::runtime_errorIf the message payload is smaller than the SBE message header or its declared block length.
Note
The iterator must be dereferenceable.

Definition at line 107 of file Packet.h.

◆ operator++()

BinaryMessageIterator & operator++ ( )
inline

Advances to the next encoded message.

Returns
Reference to this iterator after advancement.
Exceptions
std::runtime_errorIf the next message prefix or payload does not fit in the range, or the prefix declares a size smaller than the prefix itself.
Note
The iterator must be dereferenceable before this function is called.

Definition at line 117 of file Packet.h.

◆ operator==()

bool operator== ( const BinaryMessageIterator & other) const
inlinenoexcept

Tests whether two iterators refer to the same byte position.

Parameters
otherIterator to compare with.
Returns
true if both iterators refer to the same byte position; otherwise false.

Definition at line 130 of file Packet.h.