37 template <
template<
class>
class Block,
class FieldAccessor>
44 const Block<FieldAccessor>& block()
const 45 ONIXS_SGX_OUCH_NOTHROW
47 return *
static_cast<const Block<FieldAccessor>*
>(
this);
52 template <
class FieldValue>
54 ONIXS_SGX_OUCH_NOTHROW
56 assert(block().binarySize() >= (offset +
sizeof(FieldValue)));
58 return FieldAccessor::get(FieldValue(),
advanceByBytes(block().binary(), offset));
62 template <
class FieldValue>
64 ONIXS_SGX_OUCH_NOTHROW
66 assert(block().binarySize() >= (offset +
sizeof(FieldValue)));
68 return *static_cast <
const FieldValue*>(
advanceByBytes(block().binary(), offset));
75 template <
class Enumeration>
76 typename Enumeration::Enum
enumeration(BlockSize offset)
const 77 ONIXS_SGX_OUCH_NOTHROW
79 typedef typename Enumeration::Base Base;
81 typedef typename Enumeration::Enum Enum;
83 return static_cast<Enum
>(ordinaryRef<Base>(offset));
90 template <BlockSize Size>
92 ONIXS_SGX_OUCH_NOTHROW
94 typedef Char Str[Size];
96 assert(block().binarySize() >= (offset + Size));
99 StrRef(ordinaryRef<Str>(offset), strnlen(ordinaryRef<Str>(offset), Size));
104 template <
class Accessor>
119 ONIXS_SGX_OUCH_NOTHROW
126 ONIXS_SGX_OUCH_CONSTEXPR
129 ONIXS_SGX_OUCH_NOTHROW
137 ONIXS_SGX_OUCH_NOTHROW
144 ONIXS_SGX_OUCH_NOTHROW
153 ONIXS_SGX_OUCH_NOTHROW
161 #if defined(ONIXS_SGX_OUCH_COMPILER_CXX_RVALUE_REFERENCES) && ONIXS_SGX_OUCH_COMPILER_CXX_RVALUE_REFERENCES 164 ONIXS_SGX_OUCH_NOTHROW
165 : data_(std::move(other.data_))
166 , size_(std::move(other.size_))
173 ONIXS_SGX_OUCH_NOTHROW
178 data_ = std::move(other.data_);
179 size_ = std::move(other.size_);
187 ONIXS_SGXTITAN_OUCH_API
FieldValue ordinary(BlockSize offset) const
Returns value of a field by its offset.
char Char
Character type alias.
const FieldValue & ordinaryRef(BlockSize offset) const
Returns value of a field by its offset.
ONIXS_SGX_OUCH_CONSTEXPR BinaryMessage(const BinaryMessage &other)
Initializes instance as copy of the other one.
Type * advanceByBytes(Type *pointer, ptrdiff_t distance)
Advances given pointer to a given offset (distance) in bytes.
Binary2 MessageSize
Aliases message length type.
ONIXS_SGXTITAN_OUCH_API void throwIncorrectSize(const std::string &messageName, MessageSize receivedSize, MessageSize expectedSize)
Provides efficient way of accessing text-based FIX field values.
#define ONIXS_SGXTITAN_OUCH_NAMESPACE_END
Enumeration::Enum enumeration(BlockSize offset) const
#define ONIXS_SGXTITAN_OUCH_NAMESPACE_BEGIN
Encapsulates services for manipulating encoded messages.
const void * binary() const
Message content.
StrRef fixedStr(BlockSize offset) const
MessageSize binarySize() const
Size of message.
BinaryMessage(const void *data, MessageSize size)
Initializes instance over given memory block.
MessageSize BinarySize
Length of message binary data.