51 template <
typename SbeMessageType>
52 inline static SbeMessageType createMessage(
55 return SbeMessageType(data, length, version);
59 inline static const char* name() ONIXS_ILINK3_NOTHROW
61 return "FieldsInitPolicy";
69 template <
typename SbeMessageType>
70 inline static SbeMessageType createMessage(
73 return SbeMessageType(
80 return "FieldsNoInitPolicy";
89 IsBaseOf<TagBased::Message, MessageType>::value
93 template <
typename MessageType>
97 ONIXS_ILINK3_STATIC_ASSERT((
98 IsBaseOf<TagBased::Message, MessageType>::value));
100 enum { isFix =
true };
107 SbeType::EncodedLength
116 : MessageType(
SbeType(data, length, version))
125 : MessageType(
SbeType(data, length, version))
133 : MessageType(
SbeType(data, length))
153 template <
typename MessageType>
157 ONIXS_ILINK3_STATIC_ASSERT((
158 IsBaseOf<SbeMessage, MessageType>::value));
160 enum { isFix =
false };
165 SbeType::EncodedLength
174 : MessageType(data, length, version)
183 : MessageType(data, length, version)
191 : MessageType(data, length)
211 template <
typename,
size_t,
typename>
214 template <
typename,
size_t,
typename>
class HolderType,
216 size_t MaxMessageSize,
217 typename MessageInitializer>
220 const HolderType<MsgType, MaxMessageSize, MessageInitializer>& holder)
222 str +=
"MessageHolder[";
224 str +=
"BufferSize=";
225 toStr(str, holder.BufferSize);
227 str +=
", MessageInitializer=";
228 str += MessageInitializer::name();
231 toStr(str, *holder.header());
234 toStr(str, holder.message());
249 typename MessageTypeT,
250 size_t MaxMessageSize =
255 typedef typename HeldAdapter<MessageTypeT>::SbeType SbeType;
257 ONIXS_ILINK3_STATIC_ASSERT_MSG(
259 "MaxMessageSize template parameter is too small");
261 ONIXS_ILINK3_STATIC_ASSERT_MSG(
262 (MaxMessageSize >= GetMinMessageSize<SbeType>::Size),
263 "The buffer can not fit the message");
265 ONIXS_ILINK3_STATIC_ASSERT_MSG(
267 "The buffer is too large.");
309 return header()->size();
369 message().calculateBinarySize();
371 assert(calculatedMessageSize <= MaxMessageSize);
374 calculatedMessageSize >=
375 SbeType::blockLength(message().version()) +
377 SbeType::getMinimalVariableFieldsSize(message().version()));
379 messageSize(calculatedMessageSize);
380 return calculatedMessageSize;
404 #ifdef ONIXS_ILINK3_MEMCHECK_DEBUG 405 std::memset(buffer_, magicDebugValue, BufferSize);
409 message_ = MessageInitializer::template createMessage<MessageType>(
421 #ifdef ONIXS_ILINK3_MEMCHECK_DEBUG 422 std::memset(buffer_, magicDebugValue, BufferSize);
427 assert(r.message_.calculateBinarySize() <= MaxMessageSize);
443 MessageType message_;
444 unsigned char buffer_[BufferSize];
448 template <
typename,
size_t,
typename>
class HolderType,
450 size_t MaxMessageSize,
451 typename MessageInitializer>
453 const HolderType<MsgType, MaxMessageSize, MessageInitializer>& holder)
461 template <
typename,
size_t,
typename>
class HolderType,
463 size_t MaxMessageSize,
464 typename MessageInitializer>
466 std::ostream& stream,
467 const HolderType<MsgType, MaxMessageSize, MessageInitializer>& rhs)
469 return stream <<
toStr(rhs);
HeldAdapter(void *data, EncodedLength length, SbeMessage::NoFieldsInit, SchemaVersion version)
The policy to create messages without initialized optional fields.
#define ONIXS_ILINK3_CONST_OR_CONSTEXPR
const unsigned char * buffer() const noexcept
HeldAdapter(void *data, EncodedLength length, SbeMessage::NoInit, SbeMessage::NoCheck) noexcept
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
std::string toStr(const HolderType< MsgType, MaxMessageSize, MessageInitializer > &holder)
UInt16 bufferSize() const noexcept
HeldAdapter< MessageTypeT > MessageType
Message type.
const MessageType & message() const noexcept
SimpleOpenFramingHeader * header() noexcept
const MessageType * operator->() const noexcept
HeldAdapter(void *data, EncodedLength length, SbeMessage::NoInit)
MessageType & message() noexcept
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
MessageHolder(const Session &session)
MessageType * operator->() noexcept
MessageType::Binary SbeType
HeldAdapter(void *data, EncodedLength length, SbeMessage::NoInit)
#define ONIXS_ILINK3_EXPORTED_CLASS
#define ONIXS_ILINK3_DEFAULT
A network iLink3 message.
SbeType::EncodedLength EncodedLength
SbeType::EncodedLength EncodedLength
MessageSize setHeader() noexcept
Calculates the binary size of the message and updates the Simple Open Framing Header accordingly...
constexpr UInt8 DefaultMaxGroupItems
Default maximum number of repeating group items.
Messaging::SchemaVersion getMessagingVersion(const Session &) noexcept
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_END
MessageHolder & operator=(const MessageHolder &r)
#define ONIXS_ILINK3_EXPORTED
std::ostream & operator<<(std::ostream &o, SessionStateId::Enum state)
#define ONIXS_ILINK3_FINAL
UInt16 MessageSize
Message length type.
constexpr UInt16 MaxILink3MessageSize
Maximum supported message size.
HeldAdapter(void *data, EncodedLength length, SbeMessage::NoFieldsInit, SchemaVersion version)
The policy to create messages with null-initialized optional fields.
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_BEGIN
std::string toString() const
MessageHolder(SchemaVersion version=SbeType::Schema::Version)
const SimpleOpenFramingHeader * header() const noexcept
UInt16 messageSize() const noexcept
MessageHolder(const MessageHolder &r)
#define ONIXS_ILINK3_NODISCARD
#define ONIXS_ILINK3_NOTHROW
NetworkMessage toNetworkMessage() noexcept
HeldAdapter(void *data, EncodedLength length, SbeMessage::NoInit, SbeMessage::NoCheck) noexcept