42 template <
class Block,
class BlockSize>
47 const Block& block()
const 49 return *
static_cast<const Block*
>(
this);
54 template <
class SubMessage>
55 const SubMessage
submessage(BlockSize offset, BlockSize size)
const 57 assert(static_cast<size_t>(block().binarySize()) >= (offset + size));
61 return SubMessage(data, size);
65 template <
class FieldValue>
66 const FieldValue&
ordinary(BlockSize offset)
const 68 assert(static_cast<size_t>(block().binarySize()) >= (offset +
sizeof(FieldValue)));
70 const void*
const fieldValue =
advanceByBytes(block().binary(), offset);
72 return *static_cast <
const FieldValue*>(fieldValue);
79 template <
class Enumeration>
80 typename Enumeration::Enum
enumeration(BlockSize offset)
const 82 typedef typename Enumeration::Base Base;
84 typedef typename Enumeration::Enum Enum;
86 return static_cast<Enum
>( ordinary<Base>(offset));
93 template <BlockSize Size>
96 typedef Char Str[Size];
98 const Str& str = ordinary<Str>(offset);
100 return StrRef(str, strnlen(str, Size));
131 assert(NULL != data);
143 operator bool()
const 145 return (NULL != data_);
173 ONIXS_TRADEWEB_APA_API
177 ONIXS_TRADEWEB_APA_API
BinaryMessage()
Initializes blank instance referencing to nothing.
MessageSize BinarySize
Length of message binary data.
Type * advanceByBytes(Type *pointer, ptrdiff_t distance)
Advances given pointer to a given offset (distance) in bytes.
char Char
Character type alias.
StrRef fixedStr(BlockSize offset) const
ONIXS_TRADEWEB_APA_API UInt32 toUInt32(StrRef)
conversion to UInt32
Enumeration::Enum enumeration(BlockSize offset) const
BinaryMessage(const void *data, MessageSize size)
Initializes instance over given memory block.
Encapsulates services for manipulating little endian encoded messages.
const void * binary() const
Message content.
Integer2 MessageSize
Aliases message length type.
const SubMessage submessage(BlockSize offset, BlockSize size) const
Returns sub message.
Provides efficient way of accessing text-based FIX field values.
ONIXS_TRADEWEB_APA_API UInt64 toUInt64(StrRef)
conversion to UInt64
const FieldValue & ordinary(BlockSize offset) const
Returns value of a field by its offset.
BinaryMessage(const BinaryMessage &other)
Initializes instance as copy of the other one.
MessageSize binarySize() const
Size of message.