43 template<
typename Message>
inline 46 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(length < minimalRequiredLength)
47 throwBinaryBlockIsTooSmall(length, minimalRequiredLength, Message::className());
62 template < class Container, class BlockLength >
68 return *static_cast <
const Container*> (
this);
81 assert(container().blockLength() >= (offset + size<Value>()) &&
82 "The requested field exceeds provided block boundaries.");
84 const void*
const location = advanceByBytes(container().block(), offset);
85 return getValue<Value>(location);
95 value = ordinary<Value>(offset);
97 return (null != value);
107 return (since <= container().version() && ordinary (value, offset, null ) );
114 typedef typename Enumeration::Base Base;
115 typedef typename Enumeration::Enum Enum;
117 return static_cast<Enum
>(ordinary<Base>(offset));
124 typedef typename Enumeration::Base Base;
125 typedef typename Enumeration::Enum Enum;
127 value = static_cast <Enum>(ordinary<Base>(offset));
128 return null != value;
135 return (since <= container().version() && enumeration<Enumeration>(value, offset, null) );
142 assert(container().blockLength() >= (offset + Length) &&
"The requested field exceeds provided block boundaries.");
144 const Char*
const text = reinterpret_cast <
const Char*> (advanceByBytes(container().block(), offset));
146 return StrRef(text, strnlen(text, Length));
156 value = fixedStr<Length>(offset);
157 return !value.empty();
167 return (since <= container().version() && fixedStr<Length>(value, offset));
175 template <
class Container,
class BlockLength >
185 template <
class BodySizeType>
245 const void* encoded_;
251 template <
class EntryType,
class BlockLength,
class NumInGroup,
class Length >
308 return Entry(entry_, size_, version_);
312 Entry operator *()
const 320 return entry_ == other.entry_;
326 return entry_ != other.entry_;
332 return entry_ < other.entry_;
338 return entry_ > other.entry_;
346 entry_ = advanceByBytes(entry_, size_);
356 entry_ = advanceBackByBytes(entry_, size_);
367 return Iterator(advanceByBytes(entry_, distance * size_), size_, version_);
376 return Iterator(advanceBackByBytes(entry_, distance * size_), size_, version_);
397 , blockLength_(blockLength)
402 assert(blockLength > 0);
403 assert(version != 0);
427 return Iterator(encoded(), blockLength_, version_);
433 return Iterator(advanceByBytes(encoded(), encodedLength()), blockLength_, version_);
439 Entry operator [](Size index)
const 441 assert(index < size_);
444 return Entry(advanceByBytes(encoded_, static_cast<ptrdiff_t>(index) * blockLength_), blockLength_, version_);
456 return (static_cast<EncodedLength>(blockLength_) * static_cast<EncodedLength>(size_) );
460 template<
class OtherEntry,
class OtherBlockLength,
class OtherNumInGroup,
class OtherLength >
462 : encoded_(other.encoded_)
463 , blockLength_(other.blockLength_)
465 , version_(other.version_)
470 assert(blockLength_ == other.blockLength_);
471 assert(size_ == other.size_);
474 template <
class OtherEntry,
class OtherBlockLength,
class OtherNumInGroup,
class OtherLength>
477 encoded_ = other.encoded_;
479 blockLength_ = other.blockLength_;
481 assert(blockLength_ == other.blockLength_);
485 assert(size_ == other.size_);
487 version_ = other.version_;
494 template <
class OtherEntry,
class OtherBlockLength,
class OtherNumInGroup,
class OtherLength>
friend class SbeGroupEntries;
496 const void* encoded_;
497 BlockLength blockLength_;
503 template <
class EntryType,
class DimensionType,
class GroupSizeType >
514 enum { EmptySize = Dimension::Size };
535 , entries_(ONIXS_EURONEXT_OPTIQMDG_NULLPTR)
543 : header_(static_cast <const Dimension*>(data))
544 , entries_(advanceByBytes(data, Dimension::Size))
549 assert(size >= Dimension::Size);
575 const Dimension*
const group =
static_cast<const Dimension*
>(header_);
577 return group->numInGroup();
586 return Iterator(entries_, numericCast<Size>(entrySize()), version_);
595 return Iterator(advanceByBytes(binary(), binarySize()), numericCast<Size>(entrySize()), version_);
602 Entry operator [](Size index)
const 605 assert(index < size());
607 return Entry(advanceByBytes(entries_, static_cast<ptrdiff_t>(index) * entrySize()), entrySize(), version_);
617 return Entries (entries_, header_->blockLength(), header_->numInGroup(), version_);
629 return advanceByBytes(toByteBlock(encoded()), binarySize());
643 return Dimension::Size + (
static_cast<BinarySize
>(entrySize()) * static_cast<BinarySize>(size()));
653 const Dimension*
const group =
static_cast<const Dimension*
>(header_);
654 return group->blockLength();
658 const Dimension* header_;
659 const void* entries_;
666 template <
class BinarySize>
691 return Group(binary_, size_, version_);
700 const BinarySize headSize = head<Group>().binarySize();
702 assert(headSize <= size_);
704 return SbeGroupList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
713 const BinarySize headSize = checkHead<Group>();
715 return SbeGroupList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
719 template<
class Group>
720 BinarySize checkHead()
const 722 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(size_ < Group::Dimension::Size)
724 throwBadBinaryBlock();
727 const Group group = head<Group>();
729 const BinarySize headSize = group.binarySize();
731 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(headSize > size_)
733 throwBadBinaryBlock();
738 const BinarySize entrySize = group.entrySize();
739 const BinarySize expectedEntrySize = Group::Entry::minimalBlockLength(version_);
741 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(entrySize < expectedEntrySize)
743 throwBadBinaryBlock();
756 template<
typename Traits>
759 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(version < Traits::MinimalVersion)
761 throwBadMessageVersion(version, Traits::MinimalVersion);
766 template<
typename Traits>
769 checkVersion<Traits>(version);
771 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(version < since)
773 throwBadMessageVersion(version, since);
778 template<
typename Traits>
781 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(
id != Traits::Id)
783 throwBadSchemaId(Traits::Id,
id);
788 template<
typename Traits>
791 checkSchemaId<Traits>(id);
792 checkVersion<Traits>(version);
824 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(size < MessageHeader::Size)
825 throwBinaryBlockIsTooSmall(size, MessageHeader::Size);
828 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(size < (MessageHeader::Size + header_->blockLength()))
829 throwBinaryBlockIsTooSmall(size, MessageHeader::Size + header_->blockLength());
843 assert(size >= MessageHeader::Size);
844 assert(size >= MessageHeader::Size + header_->blockLength());
865 return header_->templateId();
873 return header_->version();
881 return header_->schemaId();
897 return advanceByBytes(header_, size_);
911 return header_->blockLength();
919 return advanceByBytes(header_, MessageHeader::Size);
932 const void* list = advanceByBytes(block(), blockLength());
934 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
936 return GroupList(const_cast<void*>(list), listSize, header_->version());
940 template<
class Group,
class Callable,
class Owner>
943 ONIXS_EURONEXT_OPTIQMDG_CHECK_NOTHROW(callable(owner));
944 return callable(owner);
948 template<
class Group,
class Callable,
class Owner>
951 if ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(since > version())
954 return getGroup<Group>(callable, owner);
MessageSize bufferSize() const noexcept
#define ONIXS_EURONEXT_OPTIQMDG_UNUSED
bool fixedStr(StrRef &value, BlockLength offset) const noexcept
Provides access to an optional string field value.
ptrdiff_t difference_type
#define ONIXS_EURONEXT_OPTIQMDG_MESSAGING_NAMESPACE_END
bool operator==(const TimeSpan &left, const TimeSpan &right)
Compares with other instance for equality.
bool valid() const noexcept
bool valid() const noexcept
SbeGroupList< MessageSize > GroupList
Binary group list instantiation.
SbeGroupList checkTail() const
Checks the list consistency.
#define ONIXS_EURONEXT_OPTIQMDG_LTWT_CLASS
Iterator end() const noexcept
SbeGroupEntry()
Initializes a blank instance.
BodySizeType BlockLength
Type to present the length of binary data of the repeating group entry.
const void * tail() const noexcept
MessageHeader::SchemaId SchemaId
Size size() const noexcept
#define ONIXS_EURONEXT_OPTIQMDG_NOTHROW
Entries entries() const noexcept
SbeGroupEntries(const void *encoded, BlockLength blockLength, Size groupSize, SchemaVersion version) noexcept
Initializes the instance referencing to data.
Entries::Size Size
Number of entries in the group.
EncodedLength encodedLength() const noexcept
BlockLength blockLength() const noexcept
SbeMessage() noexcept
Initializes a blank instance.
Value ordinary(BlockLength offset) const noexcept
SbeGroupEntries(const SbeGroupEntries< OtherEntry, OtherBlockLength, OtherNumInGroup, OtherLength > &other) noexcept
Copy constructor.
Enumeration::Enum enumeration(BlockLength offset) const noexcept
Operations over a repeating group instance.
bool enumeration(typename Enumeration::Enum &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Provides access to an optional field value.
Timestamp operator-(const Timestamp ×tamp, const TimeSpan &timeSpan)
Subtracts time interval from given time point.
bool empty() const noexcept
Iterator() noexcept
Initializes the instance that refers to nothing.
MessageTemplateId templateId() const noexcept
Services to access fields stored in an SBE-encoded block of fixed-length fields.
MessageHeader::TemplateId MessageTemplateId
Message type (template) identification.
Group head() const noexcept
Group getGroup(Callable callable, Owner &owner) const noexcept
SbeGroup() noexcept
Initializes a blank instance referencing to nothing.
bool valid() const noexcept
SbeGroupEntries() noexcept
Initializes a blank instance referencing to nothing.
const void * blockEnd() const noexcept
std::random_access_iterator_tag iterator_category
Iterator end() const
Returns the iterator pointing to the entry behind the end of the group.
SbeGroupList tail() const noexcept
#define ONIXS_EURONEXT_OPTIQMDG_NODISCARD
#define ONIXS_EURONEXT_OPTIQMDG_DEFAULT
Length EncodedLength
The length of the binary data occupied by the group entries.
Iterator begin() const noexcept
#define ONIXS_EURONEXT_OPTIQMDG_MESSAGING_NAMESPACE_BEGIN
const void * binary() const noexcept
void clear() noexcept
Blank the instance.
bool operator!=(const TimeSpan &left, const TimeSpan &right)
Compares with other instance for in-equality.
bool empty() const noexcept
SbeGroupEntry(const void *encoded, BlockLength size, SchemaVersion version)
Initializes the instance from the memory block of the encoded message.
BlockLength blockLength() const noexcept
void checkSchema(SchemaId id, SchemaVersion version)
Checks the compatibility with the provided SBE Schema version.
bool fixedStr(StrRef &value, BlockLength offset, SchemaVersion since) const noexcept
Provides access to an optional string field value.
bool ordinary(Value &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Provides access to an optional field value.
bool enumeration(typename Enumeration::Enum &value, BlockLength offset, NullValue null) const noexcept
Provides access to an optional field value.
MessageSize BlockLength
Length of the message body representing a block of fixed-length fields.
BinarySize binarySize() const noexcept
SBE-encoded repeating group.
void checkSchemaId(SchemaId id)
Checks the compatibility with the provided SBE Schema ID.
Size size() const noexcept
bool operator<(const TimeSpan &left, const TimeSpan &right)
Checks whether left time interval less than right one.
SbeGroup(const void *data, BinarySize size, SchemaVersion version) noexcept
Initializes an instance referencing to a valid group of a given message.
bool valid() const noexcept
bool ordinary(Value &value, BlockLength offset, NullValue null) const noexcept
Provides access to an optional field value.
MessageSize EncodedLength
Length of the message binary data.
constexpr UInt16 MaxMessageSize
Maximum supported message size.
DimensionType::BlockLength EntrySize
Length of group entry data.
const void * encoded() const noexcept
const void * encoded() const noexcept
An iterator over SBE-encoded group entries.
#define ONIXS_EURONEXT_OPTIQMDG_HOTPATH
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
GroupList groups() const noexcept
SbeMessage(const void *data, MessageSize size)
Initializes the instance over the given memory block.
const void * binary() const noexcept
EntrySize entrySize() const noexcept
SchemaVersion version() const noexcept
const void * block() const noexcept
#define ONIXS_EURONEXT_OPTIQMDG_NULLPTR
Operations over SBE-encoded repeating group entries.
Group getGroup(Callable callable, SchemaVersion since, Owner &owner) const noexcept
SbeGroupEntries< EntryType, typename Dimension::BlockLength, typename Dimension::NumInGroup, GroupSizeType > Entries
Binary group blocks.
UInt16 MessageSize
Message length type.
SbeMessage(const void *data, MessageSize size, NoCheck) noexcept
Initializes the instance over the given memory block.
Iterator(const void *entry, Size size, SchemaVersion version) noexcept
Initializes the instance to the given repeating group.
const void * encoded() const noexcept
bool valid() const noexcept
EntryType Entry
The type of the repeating group entry.
SbeGroupList(const void *binary, BinarySize size, SchemaVersion version) noexcept
Initializes the list over the memory block.
bool empty() const noexcept
DimensionType Dimension
Repeating group dimension type.
NumInGroup Size
Number of entries in the collection.
const void * block() const noexcept
Base services to access fields stored in an SBE-encoded block of memory.
SchemaVersion version() const noexcept
SchemaId schemaId() const noexcept
GroupSizeType BinarySize
Length of group data.
bool operator>(const TimeSpan &left, const TimeSpan &right)
Checks whether left time interval greater than right one.
void checkVersion(SchemaVersion since, SchemaVersion version)
Checks the compatibility with the provided SBE Schema version.
Entries::Entry Entry
Group entry type.
Timestamp operator+(const Timestamp ×tamp, const TimeSpan &timeSpan)
Adds time interval to given time point.
char Char
Character type alias.
Entries::Iterator Iterator
The iterator type for group entries.
StrRef fixedStr(BlockLength offset) const noexcept
Provides access to a string field value.