66 : header_(static_cast<const Header*>(dataBegin))
70 assert(dataBegin <= dataEnd);
82 assert(header_ != end_);
98 header_ = Messaging::advanceByBytes(header_, header_->messageSize());
108 return header_ == other.header_;
114 return header_ != other.header_;
120 const Header* header_;
124 void validate()
const
126 const size_t availableSize = Messaging::byteDistance(end_, header_);
128 if ONIXS_CMEMDH_LIKELY(availableSize != 0)
129 if ONIXS_CMEMDH_UNLIKELY(availableSize < sizeof(Header) || availableSize < header_->messageSize())
140 : begin_(messagesBegin)
192 : header_(static_cast<const Header*>(
data))
195 assert(
nullptr != header_);
200 if ONIXS_CMEMDH_UNLIKELY(
size < headerSize)
207 : header_(
static_cast<const Header*
>(
data))
214 : header_(other.header_)
225 operator bool() const noexcept
232 const void*
data() const noexcept
234 assert(
nullptr != header_);
236 return static_cast<const void*
>(header_);
250 assert(
nullptr != header_);
252 return header_->seqNumber();
259 assert(
nullptr != header_);
261 return header_->sendingTime();
268 assert(
nullptr != header_);
270 return BinaryMessages(header_ + 1, Messaging::advanceByBytes(header_, size_),
this);
286 if ONIXS_CMEMDH_UNLIKELY(!
data ||
size < headerSize)
289 header_ =
static_cast<const Header*
>(
data);
298 header_ =
static_cast<const Header*
>(
data);
307 header_ = other.header_;
316 const Header* header_;
349 , receiveTime_(other.receiveTime_)
350 , source_(other.source_)
361 assert(
nullptr != source_);
400 static_cast<Packet&
>(*this) =
static_cast<const Packet&
>(other);
402 receiveTime_ = other.receiveTime_;
404 source_ = other.source_;
#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
Iterator over SBE-encoded messages.
BinaryMessageIterator(const void *dataBegin, const void *dataEnd, const Packet *packet)
value_type message() const
std::forward_iterator_tag iterator_category
bool operator!=(const BinaryMessageIterator &other) const
Checks whether two iterators are not equal.
BinaryMessageIterator & operator++()
bool operator==(const BinaryMessageIterator &other) const
Checks whether two iterators are equal.
const Messaging::SbeMessage value_type
Defines value type.
value_type & reference
Defines reference to a value type.
value_type operator*() const
Dereferences encoded message.
ptrdiff_t difference_type
Establishes instance difference type.
value_type * pointer
Defines pointer to a value type.
Collection of encoded messages stored in single packet.
BinaryMessages(const void *messagesBegin, const void *messagesEnd, const Packet *packet=nullptr)
Initializes messages container.
BinaryMessageIterator begin() const
Returns iterator pointing to first encoded message.
BinaryMessageIterator end() const
Returns iterator pointing past last encoded message.
Messages are prefixed with message header.
The time point without the time-zone information.
Base attributes of market data feed.
void receiveTime(const Messaging::Timestamp &receiveTime) noexcept
Updates receive time attribute.
const NetFeed & source() const noexcept
Identifies source of the packet.
void source(const NetFeed &source) noexcept
Updates packet source attribute.
~NetPacket()=default
Does actually nothing.
NetPacket(const void *data, PacketSize size)
Initializes with primary attributes.
NetPacket & operator=(const NetPacket &other)
Re-initializes as a copy of the other instance.
void reset()
Resets the instances to the blank state.
NetPacket() noexcept
Initializes as null packet.
NetPacket(const NetPacket &other)
Initializes as a copy of the other instance.
const Messaging::Timestamp & receiveTime() const noexcept
Data reception time (if applicable).
Represents CME binary packet containing SBE messages.
Packet(const void *data, PacketSize size)
void reset(const void *data, PacketSize size)
void reset() noexcept
Resets the instance to the null state.
void reset(const void *data, PacketSize size, const NoVerify &) noexcept
Packet(const Packet &other) noexcept
Initializes as a copy of the other instance.
Packet() noexcept
Initializes blank instance.
Packet & operator=(const Packet &other) noexcept
Packet(const void *data, PacketSize size, const NoVerify &) noexcept
SequenceNumber seqNumber() const noexcept
Packet sequence number.
const void * data() const noexcept
Packet bytes.
BinaryMessages messages() const
Returns collection of messages stored by instance.
PacketSize size() const noexcept
Packet size.
~Packet()=default
Does actually nothing.
Messaging::Timestamp sendingTime() const noexcept
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::UInt32 SequenceNumber
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
void throwBadMessage(const Packet *packet)
Raises exception on ill-formed message.
void throwBadPacket(PacketSize packetSize, PacketSize minimalSize, const void *data)
Raises exception on ill-formed packet.
Messaging::UInt16 PacketSize
Integral type for measuring packets.