38 template <
class FieldValue>
43 return unalignedCopy<FieldValue>(p);
47 template<
class MantissaType,
class ExponentType>
53 unalignedCopy<typename FixedPointDecimal<MantissaType, ExponentType>::Mantissa>(p));
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;
113 return static_cast<Enum
>( ordinary<Base>(offset));
120 template <BlockSize Size>
123 typedef Char Str[Size];
125 const Str& str = ordinaryRef<Str>(offset);
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
Type * advanceByBytes(Type *pointer, ptrdiff_t distance)
Advances given pointer to a given offset (distance) in bytes.
BinaryMessage()
Initializes blank instance referencing to nothing.
Provides efficient way of accessing text-based field values.
StrRef fixedStr(BlockSize offset) const
Encapsulates services for manipulating little endian encoded messages.
const SubMessage submessage(BlockSize offset, BlockSize size) const
Returns sub message.
MessageSize binarySize() const
Size of message.
Binary2 MessageSize
Aliases message length type.
const FieldValue & ordinaryRef(BlockSize offset) const
Returns value of a field by its offset.
BinaryMessage(const BinaryMessage &other)
Initializes instance as copy of the other one.
BinaryMessage(const void *data, MessageSize size)
Initializes instance over given memory block.
MessageSize BinarySize
Length of message binary data.
const void * binary() const
Message content.
FieldValue ordinary(BlockSize offset) const
Returns value of a field by its offset.
char Char
Character type alias.