38 template <
class FieldValue>
47 template<
class MantissaType,
class ExponentType>
61 template <
class Block,
class BlockSize>
66 const Block& block()
const
68 return *
static_cast<const Block*
>(
this);
73 template <
class SubMessage>
74 const SubMessage
submessage(BlockSize offset, BlockSize size)
const
76 assert(block().binarySize() >= (offset + size));
80 return SubMessage(data, size);
84 template <
class FieldValue>
87 assert(block().binarySize() >= (offset +
sizeof(FieldValue)));
89 const void*
const fieldValue =
advanceByBytes(block().binary(), offset);
90 return *
static_cast <const FieldValue*
>(fieldValue);
94 template <
class FieldValue>
97 assert(block().binarySize() >= (offset +
sizeof(FieldValue)));
106 template <
class Enumeration>
109 typedef typename Enumeration::Base Base;
111 typedef typename Enumeration::Enum Enum;
120 template <BlockSize Size>
123 typedef Char Str[Size];
127 return StrRef(str, strnlen(str, Size));
146 : data_(ONIXS_BATS_BOE_NULLPTR)
158 assert(ONIXS_BATS_BOE_NULLPTR != data);
170 operator bool()
const
172 return (ONIXS_BATS_BOE_NULLPTR != data_);
Enumeration::Enum enumeration(BlockSize offset) const
const FieldValue & ordinaryRef(BlockSize offset) const
Returns value of a field by its offset.
StrRef fixedStr(BlockSize offset) const
FieldValue ordinary(BlockSize offset) const
Returns value of a field by its offset.
const SubMessage submessage(BlockSize offset, BlockSize size) const
Returns sub message.
Encapsulates services for manipulating little endian encoded messages.
const void * binary() const
Message content.
BinaryMessage()
Initializes blank instance referencing to nothing.
MessageSize BinarySize
Length of message binary data.
BinaryMessage(const void *data, MessageSize size)
Initializes instance over given memory block.
MessageSize binarySize() const
Size of message.
BinaryMessage(const BinaryMessage &other)
Initializes instance as copy of the other one.
MantissaType Mantissa
Aliases mantissa component type.
Provides efficient way of accessing text-based field values.
Type * advanceByBytes(Type *pointer, ptrdiff_t distance)
Advances given pointer to a given offset (distance) in bytes.
Binary2 MessageSize
Aliases message length type.
char Char
Character type alias.
FieldValue unalignedCopy(const void *p) ONIXS_BATS_BOE_NOTHROW