76 : header_(static_cast<const Header*>(dataBegin))
80 assert(dataBegin <= dataEnd);
95 assert(header_ != end_);
119 header_ = Messaging::advanceByBytes(header_, header_->messageSize());
132 return header_ == other.header_;
141 return header_ != other.header_;
147 const Header* header_;
151 void validate()
const
153 const auto availableSize = Messaging::byteDistance(end_, header_);
154 const auto headerSize =
static_cast<ptrdiff_t
>(
sizeof(Header));
156 if ONIXS_CMEMDH_UNLIKELY(availableSize == 0)
159 if ONIXS_CMEMDH_UNLIKELY(availableSize < headerSize)
162 const auto messageSize = header_->messageSize();
164 if ONIXS_CMEMDH_UNLIKELY(messageSize < headerSize || availableSize < messageSize)
181 : begin_(messagesBegin)
249 assert(
nullptr != header_);
253 if ONIXS_CMEMDH_UNLIKELY(
size < headerSize)
279 operator bool() const noexcept
289 const void*
data() const noexcept
291 assert(
nullptr != header_);
303 assert(
nullptr != header_);
324 assert(
nullptr != header_);
326 return header_->seqNumber();
336 assert(
nullptr != header_);
338 return header_->sendingTime();
348 assert(
nullptr != header_);
350 return BinaryMessages(header_ + 1, Messaging::advanceByBytes(header_, size_),
this);
369 if ONIXS_CMEMDH_UNLIKELY(!
data ||
size < headerSize)
395 const Header* header_ =
nullptr;
451 assert(
nullptr != source_);
498 const NetFeed* source_ =
nullptr;
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_LTWT
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
#define ONIXS_CMEMDH_NAMESPACE_END
#define ONIXS_CMEMDH_DATA_PACKING_END
#define ONIXS_CMEMDH_COLDPATH
#define ONIXS_CMEMDH_DATA_PACKING_BEGIN(alignment)
#define ONIXS_CMEMDH_FORCEINLINE
#define ONIXS_CMEMDH_EXPORTED
#define ONIXS_CMEMDH_NORETURN
#define ONIXS_CMEMDH_NODISCARD
#define ONIXS_CMEMDH_UNUSED
Provides forward iteration over the SBE-encoded messages in a packet buffer.
bool operator!=(const BinaryMessageIterator &other) const noexcept
Tests whether two iterators refer to different byte positions.
BinaryMessageIterator(const void *dataBegin, const void *dataEnd, const Packet *packet)
Constructs an iterator over a range of encoded message bytes.
value_type message() const
Returns a non-owning view of the current encoded message.
const Messaging::SbeMessage value_type
Represents an immutable SBE message view.
value_type * pointer
Defines a pointer to the iterator value type.
BinaryMessageIterator & operator++()
Advances to the next encoded message.
std::forward_iterator_tag iterator_category
Identifies this type as a forward iterator.
value_type & reference
Defines a reference to the iterator value type.
value_type operator*() const
Returns a non-owning view of the current encoded message.
bool operator==(const BinaryMessageIterator &other) const noexcept
Tests whether two iterators refer to the same byte position.
ptrdiff_t difference_type
Represents the distance between iterators.
Provides a non-owning iterable view of the encoded messages in a packet.
BinaryMessageIterator begin() const
Returns an iterator to the first encoded message.
BinaryMessages(const void *messagesBegin, const void *messagesEnd, const Packet *packet=nullptr) noexcept
Constructs a view over an encoded message range.
BinaryMessageIterator end() const
Returns an iterator past the last encoded message.
Represents the length prefix preceding each message in an MDP packet.
The time point without the time-zone information.
Base attributes of market data feed.
Extends a packet view with its network source and reception timestamp.
void reset() noexcept
Clears the packet view, source feed, and reception timestamp.
NetPacket() noexcept=default
Constructs a null network packet without a source.
void receiveTime(const Messaging::Timestamp &receiveTime) noexcept
Sets the packet reception time.
const NetFeed & source() const noexcept
Returns the network feed from which the packet was received.
void source(const NetFeed &source) noexcept
Associates the packet with its network feed.
NetPacket & operator=(const NetPacket &other) noexcept=default
Copies another packet view and its network metadata.
~NetPacket()=default
Destroys the view without releasing the referenced buffer or source feed.
NetPacket(const NetPacket &other) noexcept=default
Copies the packet view and its network metadata without copying referenced objects.
const Messaging::Timestamp & receiveTime() const noexcept
Returns the packet reception time.
Provides a non-owning view of a CME binary packet containing SBE messages.
Packet & operator=(const Packet &other) noexcept=default
Rebinds this view to the same buffer as another packet.
Packet() noexcept=default
Constructs a null packet that does not refer to a buffer.
PacketHeader Header
Defines the binary header type stored at the start of a packet.
void reset(const void *data, PacketSize size)
Rebinds this view to a buffer and validates its minimum size.
void reset() noexcept
Resets this object to the null packet state.
BinaryMessages messages() const noexcept
Returns an iterable view of the packet's encoded messages.
void reset(const void *data, PacketSize size, const NoVerify &noVerify) noexcept
Rebinds this view to a buffer without validating it.
Packet(const void *data, PacketSize size, const NoVerify &noVerify) noexcept
Constructs a packet view without validating the buffer.
SequenceNumber seqNumber() const noexcept
Returns the packet sequence number.
Packet(const Packet &other) noexcept=default
Copies a packet view without copying the referenced buffer.
const void * data() const noexcept
Returns the start of the packet bytes.
PacketSize size() const noexcept
Returns the packet size.
const Header * header() const noexcept
Returns the packet header.
~Packet()=default
Destroys the view without releasing the referenced buffer.
Messaging::Timestamp sendingTime() const noexcept
Returns the packet sending time.
const SbeMessage constructFromImmutableBlock(const void *data, MessageSize size, typename std::enable_if< std::is_same< typename std::remove_cv< Message >::type, SbeMessage >::value >::type *=nullptr)
Constructs the given message from an immutable memory block.
Messaging::UInt16 PacketSize
Represents a packet size in bytes.
Messaging::UInt32 SequenceNumber
Identifies a packet within an MDP packet sequence.
NetPacket PacketArgs
Provides the packet and network metadata passed to packet callbacks.
void toStr(std::string &str, BookState::Enum bookState)
Appends a string representation of a book state.
void throwBadMessage(const Packet *packet)
Reports that a packet does not contain a complete, well-formed message.
void throwBadPacket(PacketSize packetSize, PacketSize minimalSize, const void *data)
Reports that a buffer is too small to contain a packet.
Selects overloads that omit packet buffer validation.