50 template <
typename SbeMessageType>
51 inline static SbeMessageType createMessage(
54 return SbeMessageType(data, length, version);
58 inline static const char* name() ONIXS_B3_BOE_NOTHROW
60 return "FieldsInitPolicy";
68 template <
typename SbeMessageType>
69 inline static SbeMessageType createMessage(
72 return SbeMessageType(
79 return "FieldsNoInitPolicy";
84 template <
typename MessageType>
87 ONIXS_B3_BOE_STATIC_ASSERT((
88 IsBaseOf<SbeMessage, MessageType>::value));
90 enum { isFix =
false };
95 SbeType::EncodedLength
102 EncodedLength length,
110 EncodedLength length,
119 EncodedLength length,
127 EncodedLength length,
141 template <
typename,
size_t,
typename>
144 template <
typename,
size_t,
typename>
class HolderType,
146 size_t MaxMessageSize,
147 typename MessageInitializer>
150 const HolderType<MsgType, MaxMessageSize, MessageInitializer>& holder)
152 str +=
"MessageHolder[";
154 str +=
"BufferSize=";
155 toStr(str, holder.BufferSize);
157 str +=
", MessageInitializer=";
158 str += MessageInitializer::name();
161 toStr(str, *holder.header());
164 toStr(str, holder.message());
179 typename MessageTypeT,
180 size_t MaxMessageSize =
185 typedef typename HeldAdapter<MessageTypeT>::SbeType SbeType;
187 ONIXS_B3_BOE_STATIC_ASSERT_MSG(
189 "MaxMessageSize template parameter is too small");
191 ONIXS_B3_BOE_STATIC_ASSERT_MSG(
192 (MaxMessageSize >= GetMinMessageSize<SbeType>::Size),
193 "The buffer can not fit the message");
195 ONIXS_B3_BOE_STATIC_ASSERT_MSG(
197 "The buffer is too large.");
239 return header()->size();
299 message().calculateBinarySize();
301 assert(calculatedMessageSize <= MaxMessageSize);
304 calculatedMessageSize >=
305 SbeType::blockLength(message().version()) +
307 SbeType::getMinimalVariableFieldsSize(message().version()));
309 messageSize(calculatedMessageSize);
310 return calculatedMessageSize;
334 #ifdef ONIXS_B3_BOE_MEMCHECK_DEBUG 335 std::memset(buffer_, magicDebugValue, BufferSize);
339 message_ = MessageInitializer::template createMessage<MessageType>(
351 #ifdef ONIXS_B3_BOE_MEMCHECK_DEBUG 352 std::memset(buffer_, magicDebugValue, BufferSize);
357 assert(r.message_.calculateBinarySize() <= MaxMessageSize);
373 MessageType message_;
374 unsigned char buffer_[BufferSize];
378 template <
typename,
size_t,
typename>
class HolderType,
380 size_t MaxMessageSize,
381 typename MessageInitializer>
383 const HolderType<MsgType, MaxMessageSize, MessageInitializer>& holder)
391 template <
typename,
size_t,
typename>
class HolderType,
393 size_t MaxMessageSize,
394 typename MessageInitializer>
396 std::ostream& stream,
397 const HolderType<MsgType, MaxMessageSize, MessageInitializer>& rhs)
399 return stream <<
toStr(rhs);
MessageHolder(SchemaVersion version=SbeType::Schema::Version)
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_END
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
The policy to create messages with null-initialized optional fields.
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
#define ONIXS_B3_BOE_NOTHROW
std::ostream & operator<<(std::ostream &o, SessionStateId::Enum state)
const MessageType * operator->() const noexcept
HeldAdapter< MessageTypeT > MessageType
Message type.
#define ONIXS_B3_BOE_EXPORTED
constexpr UInt8 DefaultMaxGroupItems
Default maximum number of repeating group items.
UInt16 bufferSize() const noexcept
MessageHolder(const MessageHolder &r)
UInt16 MessageSize
Message length type.
MessageType * operator->() noexcept
MessageHolder(const Session &session)
#define ONIXS_B3_BOE_NODISCARD
MessageSize setHeader() noexcept
Calculates the binary size of the message and updates the Simple Open Framing Header accordingly...
MessageType & message() noexcept
constexpr UInt16 MaxB3BOEMessageSize
Maximum supported message size.
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_BEGIN
SimpleOpenFramingHeader * header() noexcept
#define ONIXS_B3_BOE_DEFAULT
Messaging::SchemaVersion getMessagingVersion(const Session &) noexcept
#define ONIXS_B3_BOE_EXPORTED_CLASS
const unsigned char * buffer() const noexcept
const SimpleOpenFramingHeader * header() const noexcept
std::string toStr(const HolderType< MsgType, MaxMessageSize, MessageInitializer > &holder)
The policy to create messages without initialized optional fields.
MessageHolder & operator=(const MessageHolder &r)
const MessageType & message() const noexcept
#define ONIXS_B3_BOE_CONST_OR_CONSTEXPR
NetworkMessage toNetworkMessage() noexcept
std::string toString() const
UInt16 messageSize() const noexcept