Definition at line 30 of file NetworkMessage.h.
◆ NetworkMessage() [1/3]
Constructs an empty instance.
Definition at line 34 of file NetworkMessage.h.
35 : data_(nullptr)
36 , size_(0)
37 {}
◆ NetworkMessage() [2/3]
Constructs NetworkMessage from a data block. Performs no checks.
Definition at line 40 of file NetworkMessage.h.
41 : data_(nullptr)
42 , size_(0)
43 {
44 assert(size >= sizeof(SimpleOpenFramingHeader));
45
46 const SimpleOpenFramingHeader* const header = reinterpret_cast<const SimpleOpenFramingHeader*>(data);
47
48 assert(header->encoding() == SbeEncodingType);
49 assert(header->size() <= size);
50
51#ifndef NDEBUG
52 SbeMessage(
toByteBlock(
toMutable(data)) +
sizeof(SimpleOpenFramingHeader), header->size() -
sizeof(SimpleOpenFramingHeader));
53#endif
54
55 data_ = data;
56 size_ = header->size();
57 }
ONIXS_ICEBOE_FORCEINLINE void * toMutable(const Type *ptr) noexcept
ONIXS_ICEBOE_FORCEINLINE Byte * toByteBlock(Type *ptr) noexcept
Reinterprets the pointer as a byte block one.
◆ NetworkMessage() [3/3]
Constructs NetworkMessage from a data block.
Definition at line 60 of file NetworkMessage.h.
61 : data_(nullptr)
62 , size_(0)
63 {
64 if ONIXS_ICEBOE_UNLIKELY(size < sizeof(SimpleOpenFramingHeader))
66
67 const SimpleOpenFramingHeader* const header = reinterpret_cast<const SimpleOpenFramingHeader*>(data);
68
69 if ONIXS_ICEBOE_UNLIKELY(header->encoding() != SbeEncodingType)
71
72 if ONIXS_ICEBOE_UNLIKELY(header->size() > size)
74
75 SbeMessage(
toByteBlock(
toMutable(data)) +
sizeof(SimpleOpenFramingHeader), header->size() -
sizeof(SimpleOpenFramingHeader));
76
77 data_ = data;
78 size_ = header->size();
79 }
void throwBinaryBlockIsTooSmall(MessageSize actual, MessageSize required)
Raises an exception when the given binary block is too small.
UInt16 MessageSize
Message length type.
void throwNetPacketIsTooSmall(MessageSize actual, MessageSize required)
void throwIncorrectEncoding(Messaging::UInt16 encoding, const void *data, MessageSize size)
◆ clear()
Blank the instance.
Definition at line 100 of file NetworkMessage.h.
101 {
102 *this = NetworkMessage();
103 assert(!valid());
104 }
◆ data()
| const void * data |
( |
| ) |
const |
|
inlinenoexcept |
◆ header()
Definition at line 82 of file NetworkMessage.h.
83 {
84 return reinterpret_cast<const SimpleOpenFramingHeader*>(data_);
85 }
◆ message()
Retrieves the underlying SBE message.
Definition at line 115 of file NetworkMessage.h.
116 {
117 assert(valid());
118
119#ifndef NDEBUG
120 SbeMessage(
toByteBlock(
toMutable(data_)) +
sizeof(SimpleOpenFramingHeader), size_ -
sizeof(SimpleOpenFramingHeader));
121#endif
122
123 return SbeMessage(
125 size_ - sizeof(SimpleOpenFramingHeader), SbeMessage::NoCheck());
126 }
◆ size()
◆ toString()
| std::string toString |
( |
| ) |
const |
|
inline |
Serializes into a string.
Definition at line 148 of file NetworkMessage.h.
149{
151}
std::string toStr(Order::PriceOptional value)
◆ valid()
- Returns
- true if the instance refers to a valid packet, otherwise - false.
Definition at line 108 of file NetworkMessage.h.
109 {
110 return (nullptr != data_);
111 }