36 template <
template<
class>
class Block,
class FieldAccessor>
43 const Block<FieldAccessor>& block()
const 46 return *
static_cast<const Block<FieldAccessor>*
>(
this);
51 template <
class FieldValue>
55 assert(block().binarySize() >= (offset +
sizeof(FieldValue)));
57 return FieldAccessor::get(FieldValue(),
advanceByBytes(block().binary(), offset));
61 template <
class FieldValue>
65 assert(block().binarySize() >= (offset +
sizeof(FieldValue)));
67 return *static_cast <
const FieldValue*>(
advanceByBytes(block().binary(), offset));
74 template <
class Enumeration>
75 typename Enumeration::Enum
enumeration(BlockSize offset)
const 78 typedef typename Enumeration::Base Base;
80 typedef typename Enumeration::Enum Enum;
82 return static_cast<Enum
>(ordinaryRef<Base>(offset));
89 template <BlockSize Size>
93 typedef Char Str[Size];
95 assert(block().binarySize() >= (offset + Size));
98 StrRef(ordinaryRef<Str>(offset), strnlen(ordinaryRef<Str>(offset), Size));
103 template <
class Accessor>
125 ONIXS_ESPEED_ITCH_CONSTEXPR
160 #if defined(ONIXS_ESPEED_ITCH_COMPILER_CXX_RVALUE_REFERENCES) && ONIXS_ESPEED_ITCH_COMPILER_CXX_RVALUE_REFERENCES 164 : data_(std::move(other.data_))
165 , size_(std::move(other.size_))
177 data_ = std::move(other.data_);
178 size_ = std::move(other.size_);
186 ONIXS_ESPEED_ITCH_API
#define ONIXS_ESPEED_ITCH_NAMESPACE_END
#define ONIXS_ESPEED_ITCH_NAMESPACE_BEGIN
ONIXS_ESPEED_ITCH_API void throwIncorrectSize(const std::string &messageName, MessageSize receivedSize, MessageSize expectedSize)
Encapsulates services for manipulating encoded messages.
MessageSize BinarySize
Length of message binary data.
MessageSize binarySize() const ONIXS_ESPEED_ITCH_NOTHROW
Size of message.
const FieldValue & ordinaryRef(BlockSize offset) const ONIXS_ESPEED_ITCH_NOTHROW
Returns value of a field by its offset.
ONIXS_ESPEED_ITCH_NAMESPACE_BEGIN typedef char Char
Character type alias.
ONIXS_ESPEED_ITCH_NAMESPACE_BEGIN typedef UInt16 MessageSize
Aliases message length type.
Type * advanceByBytes(Type *pointer, ptrdiff_t distance)
Advances given pointer to a given offset (distance) in bytes.
const void * binary() const ONIXS_ESPEED_ITCH_NOTHROW
Message content.
BinaryMessage(const void *data, MessageSize size) ONIXS_ESPEED_ITCH_NOTHROW
Initializes instance over given memory block.
StrRef fixedStr(BlockSize offset) const ONIXS_ESPEED_ITCH_NOTHROW
Provides efficient way of accessing text-based FIX field values.
ONIXS_ESPEED_ITCH_CONSTEXPR BinaryMessage(const BinaryMessage &other) ONIXS_ESPEED_ITCH_NOTHROW
Initializes instance as copy of the other one.
#define ONIXS_ESPEED_ITCH_NOTHROW
Enumeration::Enum enumeration(BlockSize offset) const ONIXS_ESPEED_ITCH_NOTHROW
FieldValue ordinary(BlockSize offset) const ONIXS_ESPEED_ITCH_NOTHROW
Returns value of a field by its offset.