33 ONIXS_CMEMDH_DATA_PACKING_BEGIN(1)
66 : header_(static_cast<const Header*>(dataBegin))
70 assert(dataBegin <= dataEnd);
81 assert(header_ != end_);
83 return BinaryMessage(header_ + 1, header_->messageSize -
sizeof(Header));
106 return header_ == other.header_;
112 return header_ != other.header_;
122 const Header* header_;
124 const Packet* packet_;
126 void validate()
const 128 const size_t availableSize =
byteDistance(end_, header_);
130 if ONIXS_CMEMDH_LIKELY(availableSize != 0)
131 if ONIXS_CMEMDH_UNLIKELY(availableSize <
sizeof(Header) || availableSize < header_->messageSize)
142 : begin_(messagesBegin)
192 : header_(static_cast<const Header*>(data))
200 if ONIXS_CMEMDH_UNLIKELY(size < headerSize)
207 : header_(static_cast<const Header*>(data))
214 : header_(other.header_)
224 operator bool()
const 234 return static_cast<const void*
>(header_);
248 return header_->seqNumber;
256 return header_->sendingTime;
280 if ONIXS_CMEMDH_UNLIKELY(!data || size < headerSize)
283 header_ =
static_cast<const Header*
>(data);
291 header_ =
static_cast<const Header*
>(data);
300 header_ = other.header_;
313 const Header* header_;
318 void toStr(std::string& str,
const Packet& packet);
346 , receiveTime_(other.receiveTime_)
347 , source_(other.source_)
377 receiveTime_ = receiveTime;
393 static_cast<Packet&
>(*this) =
static_cast<const Packet&
>(other);
395 receiveTime_ = other.receiveTime_;
397 source_ = other.source_;
411 ONIXS_CMEMDH_DATA_PACKING_END
NetPacket(const void *data, PacketSize size)
Initializes with primary attributes.
value_type & reference
Defines reference to a value type.
~NetPacket()
Does actually nothing.
Packet(const void *data, PacketSize size)
Initializes binary packet over the given buffer.
BinaryMessages messages() const
Returns collection of messages stored by instance.
#define ONIXS_CMEMDH_NULLPTR
void source(const NetFeed &source)
Updates packet source attribute.
Represents time point without time-zone information.
const Timestamp & receiveTime() const
Data reception time (if applicable).
BinaryMessage operator*() const
Dereferences encoded message.
void reset()
Resets the instances to the blank state.
void receiveTime(const Timestamp &receiveTime)
Updates receive time attribute.
NetPacket()
Initializes as null packet.
BinaryMessageIterator & operator++()
Advances iterator to next message.
Packet(const Packet &other)
Initializes as a copy of the other instance.
bool operator!=(const BinaryMessageIterator &other) const
Checks whether two iterators are not equal.
Packet & operator=(const Packet &other)
Re-initializes the instance as the copy of the other one.
#define ONIXS_CMEMDH_LTWT
std::string toStr(const Packet &packet)
const Timestamp & sendingTime() const
Packet sending time.
Packet(const void *data, PacketSize size, const NoVerify &)
Initializes binary packet over the given buffer.
NetPacket PacketArgs
Alias for a type keeping collection of packet-related attributes.
UInt16 MessageSize
Aliases message length type.
Base attributes of market data feed.
value_type * pointer
Defines pointer to a value type.
UInt32 SequenceNumber
Integral type used to identify packets in a sequence transmitted by MDP.
Iterator over SBE-encoded messages.
NetPacket(const NetPacket &other)
Initializes as a copy of the other instance.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
BinaryMessage message() const
Gets reference to encoded message.
BinaryMessageIterator begin() const
Returns iterator pointing to first encoded message.
ptrdiff_t difference_type
Establishes instance difference type.
Type * advanceByBytes(Type *pointer, ptrdiff_t distance)
Advances given pointer to a given offset (distance) in bytes.
Encapsulates services for manipulating SBE-encoded messages.
#define ONIXS_CMEMDH_EXPORTED
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
bool operator==(const BinaryMessageIterator &other) const
Checks whether two iterators are equal.
BinaryMessageIterator end() const
Returns iterator pointing past last encoded message.
void reset(const void *data, PacketSize size, const NoVerify &)
Re-initializes the instance to refer to the other content.
NetPacket & operator=(const NetPacket &other)
Re-initializes as a copy of the other instance.
BinaryMessages(const void *messagesBegin, const void *messagesEnd, const Packet *packet=nullptr)
Initializes messages container.
void reset()
Resets the instance to the null state.
BinaryMessageIterator(const void *dataBegin, const void *dataEnd, const Packet *packet)
Constructs encoded message iterator from raw data pointers.
Represents CME binary packet containing SBE messages.
PacketSize size() const
Packet size.
const BinaryMessage value_type
Defines value type.
std::forward_iterator_tag iterator_category
SequenceNumber seqNumber() const
Packet sequence number.
const NetFeed & source() const
Identifies source of the packet.
Collection of encoded messages stored in single packet.
void reset(const void *data, PacketSize size)
Re-initializes the instance to refer to the other content.
Used to identify the necessity to omit verification where that's applicable.
~Packet()
Does actually nothing.
void throwBadMessage(const Packet *packet)
Raises exception on ill-formed message.
ptrdiff_t byteDistance(Left *left, Right *right)
Returns distance in bytes between two pointers.
UInt16 PacketSize
Integral type for measuring packets.
Packet()
Initializes blank instance.
const void * data() const
Packet bytes.
void throwBadPacket(PacketSize packetSize, PacketSize minimalSize, const void *data)
Raises exception on ill-formed packet.
#define ONIXS_CMEMDH_NAMESPACE_END