42#if defined(ONIXS_CMEMDH_CXX20)
52template <
typename Message>
53inline void checkBinaryLength(
const Message&, MessageSize length, MessageSize minimalRequiredLength)
55 if ONIXS_CMEMDH_UNLIKELY (length < minimalRequiredLength)
57 throwBinaryBlockIsTooSmall(length, minimalRequiredLength, Message::className());
72template <
class Container,
class BlockLength>
77 const Container& container()
const noexcept
79 return *
static_cast<const Container*
>(
this);
89 template <
class Value>
91 Value
ordinary(BlockLength offset)
const noexcept
94 container().blockLength() >= (offset + size<Value>())
95 &&
"The requested field exceeds provided block boundaries."
98 const void*
const location = advanceByBytes(container().block(), offset);
99 return getValue<Value>(location);
103 template <
class Value>
107 if ONIXS_CMEMDH_UNLIKELY (since > container().version())
108 throwDisallowedField();
117 template <
class Value,
class NullValue>
119 bool ordinary(Value& value, BlockLength offset, NullValue null)
const noexcept
123 return (null != value);
130 template <
class Value,
class NullValue>
134 return (since <= container().version() &&
ordinary(value, offset, null));
138 template <
class Enumeration>
140 typename Enumeration::Enum
enumeration(BlockLength offset)
const noexcept
142 typedef typename Enumeration::Base Base;
143 typedef typename Enumeration::Enum Enum;
149 template <
class Enumeration,
class NullValue>
151 bool enumeration(
typename Enumeration::Enum& value, BlockLength offset, NullValue null)
const noexcept
153 typedef typename Enumeration::Base Base;
154 typedef typename Enumeration::Enum Enum;
157 return null != value;
161 template <
class Enumeration,
class NullValue>
169 template <
class Value>
180 template <
class NullValue>
184 typedef typename NullValue::Value Value;
188 return null != optional;
195 template <
class Value,
class NullValue>
199 return (since <= container().version() &&
decimal(value, offset, null));
203 template <BlockLength Length>
208 container().blockLength() >= (offset + Length) &&
"The requested field exceeds provided block boundaries."
211 const Char*
const text =
reinterpret_cast<const Char*
>(advanceByBytes(container().block(), offset));
212 return StrRef(text, strnlen(text, Length));
219 template <BlockLength Length>
224 return !value.empty();
231 template <BlockLength Length>
243template <
class Container,
class BlockLength>
251 return *
static_cast<Container*
>(
this);
258 const BlockLength encodedBlockLength =
container().blockLength();
260 assert(encodedBlockLength >= offset);
262 const size_t paddingLength = encodedBlockLength - offset;
263 std::memset(advanceByBytes(
container().block(), offset), 0, paddingLength);
267 template <
class FieldValue>
272 container().blockLength() >= (offset + size<FieldValue>())
273 &&
"The requested field exceeds provided block boundaries."
276 void*
const fieldPos = advanceByBytes(
container().block(), offset);
277 setValue(fieldPos, value);
281 template <
class FieldValue>
285 if ONIXS_CMEMDH_UNLIKELY (since >
container().version())
287 throwDisallowedField();
294 template <
class Enumeration>
296 void setEnumeration(BlockLength offset,
typename Enumeration::Enum value)
noexcept
298 typedef typename Enumeration::Base Base;
303 template <
class Enumeration>
307 typedef typename Enumeration::Base Base;
308 setOrdinary(offset,
static_cast<Base
>(value), since);
312 template <BlockLength Size>
317 container().blockLength() >= (offset + Size) &&
"The requested field exceeds provided block boundaries."
319 assert(value.size() <= Size &&
"The string is truncated.");
321 void*
const fieldPos = advanceByBytes(
container().block(), offset);
322 const size_t sizeToCopy = (std::min)(Size,
static_cast<BlockLength
>(value.size()));
325 std::memcpy(fieldPos, value.data(), sizeToCopy);
327 std::memset(advanceByBytes(fieldPos, sizeToCopy), 0, Size - sizeToCopy);
331 template <BlockLength Size>
335 if ONIXS_CMEMDH_UNLIKELY (since >
container().version())
337 throwDisallowedField();
351template <
class BodySizeType>
380 return (encoded_ !=
nullptr);
439#if defined(ONIXS_CMEMDH_CXX20)
440template <
class EntryType,
class BlockLength,
class NumInGroup,
class Length>
class SbeGroupRange;
444template <
class EntryType,
class BlockLength,
class NumInGroup,
class Length>
492 return (entry_ !=
nullptr);
501 return Entry(entry_, size_, version_);
513 return entry_ == other.entry_;
519 return entry_ != other.entry_;
525 return entry_ < other.entry_;
531 return entry_ > other.entry_;
539 entry_ = advanceByBytes(entry_, size_);
549 entry_ = advanceBackByBytes(entry_, size_);
560 return Iterator(advanceByBytes(entry_, distance * size_), size_, version_);
569 return Iterator(advanceBackByBytes(entry_, distance * size_), size_, version_);
578#if defined(ONIXS_CMEMDH_CXX20)
595 , blockLength_(blockLength)
600 assert(blockLength > 0);
601 assert(version != 0);
607 return (
nullptr != encoded_);
625 return Iterator(
encoded(), blockLength_, version_);
634#if defined(ONIXS_CMEMDH_CXX20)
651 assert(index < size_);
654 return Entry(advanceByBytes(encoded_,
static_cast<ptrdiff_t
>(index) * blockLength_), blockLength_, version_);
670 template <
class OtherEntry,
class OtherBlockLength,
class OtherNumInGroup,
class OtherLength>
672 : encoded_(other.encoded_)
673 , blockLength_(other.blockLength_)
675 , version_(other.version_)
680 assert(blockLength_ == other.blockLength_);
681 assert(size_ == other.size_);
684 template <
class OtherEntry,
class OtherBlockLength,
class OtherNumInGroup,
class OtherLength>
688 encoded_ = other.encoded_;
690 blockLength_ = other.blockLength_;
692 assert(blockLength_ == other.blockLength_);
696 assert(size_ == other.size_);
698 version_ = other.version_;
705 template <
class OtherEntry,
class OtherBlockLength,
class OtherNumInGroup,
class OtherLength>
709 BlockLength blockLength_;
714#if defined(ONIXS_CMEMDH_CXX20)
726template <
class EntryType,
class BlockLength,
class NumInGroup,
class Length>
730 typedef NumInGroup Size;
787 : iterator_(iterator)
827 return iterator_ == other.iterator_;
835 return !(*
this == other);
866 std::size_t
size() const noexcept
881 SbeGroupRange(
typename Entries::Iterator begin,
typename Entries::Iterator end, Size size) noexcept
896template <
class EntryType,
class DimensionType,
class GroupSizeType>
922#if defined(ONIXS_CMEMDH_CXX20)
944 : header_(fromExistingBytes<Dimension>(data))
958 return (entries_ !=
nullptr);
1006 assert(index <
size());
1018 return Entries(entries_, header_->blockLength(), header_->numInGroup(), version_);
1021#if defined(ONIXS_CMEMDH_CXX20)
1072 void init(EntrySize entrySize)
noexcept
1077 Dimension*
const group = fromEmptyStorage<Dimension>(header_);
1078 group->setBlockLength(entrySize);
1079 group->setNumInGroup(0);
1083 Size allocate(Size entryCount,
const void* messageTail,
const void* blockEnd)
1087 assert(messageTail);
1089 Dimension*
const group =
static_cast<Dimension*
>(header_);
1091 const EntrySize entrySize = group->blockLength();
1093 if ONIXS_CMEMDH_UNLIKELY (entrySize < EntryType::blockLength(version_))
1095 throwBadBinaryBlock();
1098 const Size oldEntryCount = group->numInGroup();
1100 if (oldEntryCount == entryCount)
1103 const ptrdiff_t memShift = (entryCount - oldEntryCount) *
static_cast<ptrdiff_t
>(entrySize);
1105 const void*
const newMessageTail = advanceByBytes(messageTail, memShift);
1107 if ONIXS_CMEMDH_UNLIKELY (byteDistance(blockEnd, newMessageTail) < 0)
1109 throwNotEnoughSpace();
1112 const void*
const oldEndOfGroup = advanceByBytes(entries_,
static_cast<ptrdiff_t
>(entrySize) * oldEntryCount);
1114 void*
const newEndGroup = advanceByBytes(entries_,
static_cast<ptrdiff_t
>(entrySize) * entryCount);
1116 std::memmove(newEndGroup, oldEndOfGroup, byteDistance(messageTail, oldEndOfGroup));
1118 group->setNumInGroup(entryCount);
1120 return oldEntryCount;
1125 void setup(Size entryCount,
const void* messageTail,
const void* blockEnd)
1129 assert(messageTail);
1131 const Size oldEntryCount = allocate(entryCount, messageTail, blockEnd);
1133 for (Size index = oldEntryCount; index < entryCount; ++index)
1134 zeroPaddingBytes((*
this)[index].resetVariableFields());
1139 void construct(Size entryCount,
const void* messageTail,
const void* blockEnd)
1143 assert(messageTail);
1145 const Size oldEntryCount = allocate(entryCount, messageTail, blockEnd);
1147 for (Size index = oldEntryCount; index < entryCount; ++index)
1148 zeroPaddingBytes((*
this)[index].reset());
1152 static void zeroPaddingBytes(Entry& entry)
1154 assert(entry.valid());
1155 entry.zeroPaddingBytes(EntryType::minimalBlockLength(entry.version()));
1167template <
class BinarySize>
1183 return (0 == size_);
1187 template <
class BinaryVariableLengthFieldType>
1188 BinaryVariableLengthFieldType&
head() const noexcept
1190 return *
static_cast<BinaryVariableLengthFieldType*
>(binary_);
1194 template <
class BinaryVariableLengthFieldType>
1201 assert(headSize <= size_);
1209 template <
class BinaryVariableLengthFieldType>
1212 if ONIXS_CMEMDH_UNLIKELY (
empty() || (size_ < BinaryVariableLengthFieldType::Size))
1214 throwBadBinaryBlock();
1219 if ONIXS_CMEMDH_UNLIKELY (headSize > size_)
1221 throwBadBinaryBlock();
1234template <
class BinarySize>
1251 return (0 == size_);
1255 template <
class Group>
1261 return Group(binary_, size_, version_);
1265 template <
class Group>
1270 const BinarySize headSize =
head<Group>().binarySize();
1272 assert(headSize <= size_);
1274 return SbeGroupList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1278 template <
class Group>
1283 const BinarySize headSize =
head<Group>().binarySize();
1285 assert(headSize <= size_);
1293 template <
class Group>
1296 const BinarySize headSize = checkHead<Group>();
1298 return SbeGroupList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1304 template <
class Group>
1307 const BinarySize headSize = checkHead<Group>();
1313 template <
class Group>
1314 BinarySize checkHead()
const
1316 if ONIXS_CMEMDH_UNLIKELY (size_ < Group::Dimension::Size)
1318 throwBadBinaryBlock();
1321 const Group group = head<Group>();
1323 const BinarySize headSize = group.binarySize();
1325 if ONIXS_CMEMDH_UNLIKELY (headSize > size_)
1327 throwBadBinaryBlock();
1332 const BinarySize entrySize = group.entrySize();
1333 const BinarySize expectedEntrySize = Group::Entry::minimalBlockLength(version_);
1335 if ONIXS_CMEMDH_UNLIKELY (entrySize < expectedEntrySize)
1337 throwBadBinaryBlock();
1350template <
typename Traits>
1353 if ONIXS_CMEMDH_UNLIKELY (version < Traits::MinimalVersion)
1355 throwBadMessageVersion(version, Traits::MinimalVersion);
1360template <
typename Traits>
1365 if ONIXS_CMEMDH_UNLIKELY (version < since)
1367 throwBadMessageVersion(version, since);
1372template <
typename Traits>
1375 if ONIXS_CMEMDH_UNLIKELY (
id != Traits::Id)
1377 throwBadSchemaId(Traits::Id,
id);
1382template <
typename Traits>
1425 header_ = fromEmptyStorage<MessageHeader>(data);
1442 header_ = fromExistingBytes<MessageHeader>(data);
1456 : header_(fromExistingBytes<MessageHeader>(data))
1477 return (
nullptr != header_);
1486 return header_->templateId();
1495 return header_->version();
1504 return header_->schemaId();
1531 return advanceByBytes(header_, size_);
1540 return advanceByBytes(header_, size_);
1565 return header_->blockLength();
1611 return GroupList(list, listSize, header_->version());
1624 return GroupList(
const_cast<void*
>(list), listSize, header_->version());
1628 template <
typename Group>
1631 assert(group.valid());
1632 group.init(entrySize);
1636 template <
typename Group>
1639 assert(messageTail);
1640 assert(group.valid());
1641 group.setup(entryCount, messageTail,
blockEnd());
1645 template <
typename Group>
1648 assert(messageTail);
1649 assert(group.valid());
1650 group.construct(entryCount, messageTail,
blockEnd());
1693 header_->setTemplateId(value);
1695 header_->setSchemaId(
id);
1705 const ptrdiff_t distance = byteDistance(tail,
binary());
1707 assert(distance > 0);
1709 assert(distance <= (std::numeric_limits<MessageSize>::max)());
1713 assert(size <= size_);
1719 template <
class Group,
class Callable,
class Owner>
1722 const typename Group::EntrySize entrySize = Group::Entry::blockLength(
version());
1724 Group grp = callable(owner);
1730 template <
class Callable,
class Owner>
1733 if ONIXS_CMEMDH_UNLIKELY (since >
version())
1742 template <
class Group,
class Callable,
class Owner>
1745 if ONIXS_CMEMDH_UNLIKELY (since >
version())
1754 template <
class Group,
class Callable,
class Owner>
1755 Group
getGroup(Callable callable, Owner& owner)
const noexcept
1757 static_assert(
noexcept(callable(owner)),
"");
1758 return callable(owner);
1762 template <
class Group,
class Callable,
class Owner>
1765 if ONIXS_CMEMDH_UNLIKELY (since >
version())
1775 template <
class Group,
class Callable,
class Owner>
1778 if ONIXS_CMEMDH_UNLIKELY (since >
version())
1788 template <
class Group,
class Callable,
class Owner>
1791 Group group = callable(owner);
1799 template <
class Group,
class Callable,
class Owner>
1802 if ONIXS_CMEMDH_UNLIKELY (since >
version())
1811 template <
class Group,
class Callable,
class Owner>
1812 Group
setupGroup(Callable callable,
typename Group::Size length, Owner& owner)
1814 Group group = callable(owner);
1835template <
class Message>
1840 typename std::enable_if<std::is_same<
typename std::remove_cv<Message>::type,
SbeMessage>::value>::type* =
nullptr)
1846template <
class Message>
1851 typename std::enable_if<std::is_base_of<
SbeMessage,
typename std::remove_cv<Message>::type>::value && !std::is_same<
typename std::remove_cv<Message>::type,
SbeMessage>::value>::type* =
nullptr)
1857template <
class Message>
1862 typename std::enable_if<std::is_same<
typename std::remove_cv<Message>::type,
SbeMessage>::value>::type* =
nullptr) noexcept
1864 return SbeMessage(toMutable(data), size, noCheck);
1868template <
class Message>
1873 typename std::enable_if<std::is_base_of<
SbeMessage,
typename std::remove_cv<Message>::type>::value && !std::is_same<
typename std::remove_cv<Message>::type,
SbeMessage>::value>::type* =
nullptr) noexcept
1880#if defined(ONIXS_CMEMDH_CXX20)
1884template <
class EntryType,
class BlockLength,
class NumInGroup,
class Length>
1885inline constexpr bool enable_borrowed_range<
1886 ONIXS_CMEMDH_MESSAGING_NAMESPACE::SbeGroupRange<EntryType, BlockLength, NumInGroup, Length>> =
true;
#define ONIXS_CMEMDH_MESSAGING_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_MESSAGING_NAMESPACE_END
#define ONIXS_CMEMDH_LTWT_EXPORTED
#define ONIXS_CMEMDH_FORCEINLINE
#define ONIXS_CMEMDH_NODISCARD
#define ONIXS_CMEMDH_HOTPATH
#define ONIXS_CMEMDH_UNUSED
~BinaryBlockBase()=default
bool fixedStr(StrRef &value, BlockLength offset) const noexcept
Value ordinary(BlockLength offset) const noexcept
bool decimal(Decimal &value, BlockLength offset, NullValue null) const noexcept
Value ordinary(BlockLength offset, SchemaVersion since) const
bool fixedStr(StrRef &value, BlockLength offset, SchemaVersion since) const noexcept
bool ordinary(Value &value, BlockLength offset, NullValue null) const noexcept
bool decimal(Value &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Enumeration::Enum enumeration(BlockLength offset) const noexcept
bool enumeration(typename Enumeration::Enum &value, BlockLength offset, NullValue null) const noexcept
Provides access to an optional field value.
BinaryBlock()=default
Initializes a blank instance.
bool ordinary(Value &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
StrRef fixedStr(BlockLength offset) const noexcept
Provides access to a string field value.
Decimal decimal(BlockLength offset) const
bool enumeration(typename Enumeration::Enum &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Provides access to an optional field value.
NumInGroup numInGroup() const noexcept
BlockLength blockLength() const noexcept
SbeFields()=default
Initializes a blank instance.
Container & container() noexcept
void zeroPaddingBytes(BlockLength offset) noexcept
If specified, the extra space is padded at the end of each entry and should be set to zeroes by encod...
void setFixedStr(BlockLength offset, StrRef value) noexcept
Sets the field value.
void setOrdinary(BlockLength offset, FieldValue value, SchemaVersion since)
Sets the field value.
void setEnumeration(BlockLength offset, typename Enumeration::Enum value, SchemaVersion since)
Sets the field value.
void setEnumeration(BlockLength offset, typename Enumeration::Enum value) noexcept
Sets the field value.
void setOrdinary(BlockLength offset, FieldValue value) noexcept
Sets the field value.
void setFixedStr(BlockLength offset, StrRef value, SchemaVersion since)
Sets the field value.
An iterator over SBE-encoded group entries.
Iterator operator+(difference_type distance) const
Advances by given number of entries.
bool operator==(const Iterator &other) const noexcept
Compares iterators.
std::random_access_iterator_tag iterator_category
Iterator operator-(difference_type distance) const
Advances back by given number of entries.
Iterator() noexcept
Initializes the instance that refers to nothing.
bool valid() const noexcept
bool operator<(const Iterator &other) const noexcept
Established the order between two iterators.
bool operator!=(const Iterator &other) const noexcept
Compares iterators.
ptrdiff_t difference_type
Iterator & operator++()
Advances the next repeating group entry.
bool operator>(const Iterator &other) const noexcept
Established the order between two iterators.
Iterator & operator--()
Advances to the previous repeating group entry.
Iterator(void *entry, EncodedLength size, SchemaVersion version) noexcept
Initializes the instance to the given repeating group.
Operations over SBE-encoded repeating group entries.
SbeGroupEntries() noexcept
Initializes a blank instance referencing to nothing.
bool empty() const noexcept
SbeGroupEntries(void *encoded, BlockLength blockLength, Size groupSize, SchemaVersion version) noexcept
Initializes the instance referencing to data.
Range asRange() const noexcept
Adapts valid entries for standard input algorithms and C++20 forward-range algorithms.
EntryType Entry
The type of the repeating group entry.
Iterator end() const
Returns the iterator pointing to the entry behind the end of the group.
Entry operator[](Size index) const
Size size() const noexcept
EncodedLength encodedLength() const noexcept
SbeGroupEntries(const SbeGroupEntries< OtherEntry, OtherBlockLength, OtherNumInGroup, OtherLength > &other) noexcept
Copy constructor.
bool valid() const noexcept
friend class SbeGroupEntries
Length EncodedLength
The length of the binary data occupied by the group entries.
NumInGroup Size
Number of entries in the collection.
SbeGroupEntries & operator=(const SbeGroupEntries< OtherEntry, OtherBlockLength, OtherNumInGroup, OtherLength > &other) noexcept
SbeGroupRange< EntryType, BlockLength, NumInGroup, Length > Range
Standard-algorithm adapter borrowing this collection's entry storage.
void * encoded() const noexcept
SbeGroupEntry()
Initializes a blank instance.
const void * block() const noexcept
SbeGroupEntry(void *encoded, BlockLength size, SchemaVersion version)
Initializes the instance from the memory block of the encoded message.
SchemaVersion version() const noexcept
bool valid() const noexcept
const void * encoded() const noexcept
BlockLength blockLength() const noexcept
void * encoded() noexcept
BodySizeType BlockLength
Type to present the length of binary data of the repeating group entry.
SbeVariableLengthFieldList< BinarySize > checkVariableLengthFields() const
bool empty() const noexcept
SbeGroupList tail() const noexcept
SbeGroupList checkTail() const
Group head() const noexcept
SbeVariableLengthFieldList< BinarySize > variableLengthFields() const noexcept
SbeGroupList(void *binary, BinarySize size, SchemaVersion version) noexcept
Initializes the list over the memory block.
Holds an entry view for pointer-like access without owning its message bytes.
const EntryType * operator->() const noexcept
Provides read-only access to the captured entry view.
EntryType * operator->() noexcept
Provides mutable access to the captured entry view.
Pointer(EntryType entry)
Captures a view of the current entry.
Iterator returning an entry view by value.
Iterator() noexcept=default
Initializes a singular iterator that compares equal to another singular iterator.
std::forward_iterator_tag iterator_concept
C++20 algorithms may traverse independent iterator copies repeatedly.
bool operator==(const Iterator &other) const noexcept
Compares positions within the same repeating group.
std::input_iterator_tag iterator_category
Legacy algorithms use input traversal for entry views returned by value.
Pointer pointer
Proxy retaining the temporary entry view used by arrow expressions.
EntryType reference
Dereferencing produces a temporary view of the message bytes.
EntryType value_type
Entry view returned by dereferencing.
EntryType operator*() const
Reads an entry view without transferring ownership of its bytes.
Iterator operator++(int)
Advances while retaining the previous position.
bool operator!=(const Iterator &other) const noexcept
Compares positions within the same repeating group.
ptrdiff_t difference_type
Signed distance between iterator positions.
Iterator & operator++()
Advances to the next entry.
pointer operator->() const
Provides pointer-like access to the current entry view.
Standard-algorithm range over borrowed repeating group entries.
bool empty() const noexcept
Checks whether the range contains entries.
std::size_t size() const noexcept
Returns the number of entries captured when the adapter was created.
Iterator end() const noexcept
Returns the position following the last borrowed entry.
Iterator begin() const noexcept
Returns the first borrowed entry position.
SbeGroupRange() noexcept
Initializes an empty range that refers to no message storage.
const void * tail() const noexcept
SbeGroup() noexcept
Initializes a blank instance referencing to nothing.
Entries::Size Size
Number of entries in the group.
GroupSizeType BinarySize
Length of group data.
Entries::Range Range
Standard-algorithm adapter borrowing this group's entry storage.
EntrySize entrySize() const noexcept
BinarySize binarySize() const noexcept
bool empty() const noexcept
DimensionType::BlockLength EntrySize
Length of group entry data.
SbeGroup(void *data, BinarySize size, SchemaVersion version) noexcept
Initializes an instance referencing to a valid group of a given message.
Range asRange() const noexcept
Adapts a valid group for standard input algorithms and C++20 forward-range algorithms.
Entries::Iterator Iterator
The iterator type for group entries.
Entries::Entry Entry
Group entry type.
Entries entries() const noexcept
void * binary() const noexcept
Entry operator[](Size index) const
Size size() const noexcept
Iterator end() const noexcept
bool valid() const noexcept
const void * encoded() const noexcept
SbeGroupEntries< EntryType, typename Dimension::BlockLength, typename Dimension::NumInGroup, GroupSizeType > Entries
Binary group blocks.
DimensionType Dimension
Repeating group dimension type.
Iterator begin() const noexcept
void clear() noexcept
Blank the instance.
const void * binary() const noexcept
MessageTemplateId templateId() const noexcept
SchemaId schemaId() const noexcept
Group setupGroup(Callable callable, typename Group::Size length, SchemaVersion since, Owner &owner)
Setups the repeating group with the given number of entries.
const void * blockEnd() noexcept
GroupList groups() const noexcept
Group setupGroup(Callable callable, typename Group::Size length, Owner &owner)
Setups the repeating group with the given number of entries.
const void * blockEnd() const noexcept
SbeMessage(void *data, MessageSize size)
Initializes the instance over the given memory block.
SbeVariableLengthFieldList< MessageSize > VariableLengthFieldList
Binary group list instantiation.
GroupList groups() noexcept
SbeMessage & version(SchemaVersion version) noexcept
Sets the SBE Schema version.
Group getGroup(Callable callable, Owner &owner) const noexcept
Group getGroup(Callable callable, SchemaVersion since, Owner &owner) const noexcept
MessageSize EncodedLength
Length of the message binary data.
const void * block() const noexcept
SbeMessage(void *data, MessageSize size, NoCheck) noexcept
void initGroup(Group &group, typename Group::EntrySize entrySize) noexcept
Resets the group to the initial state.
void setupGroup(Group &group, typename Group::Size entryCount, const void *messageTail)
Initializes the group header.
VariableLengthFieldList variableLengthFields() const noexcept
SchemaVersion version() const noexcept
SbeGroupList< MessageSize > GroupList
Binary group list instantiation.
SbeMessage(void *data, MessageSize size, SchemaVersion version)
Initializes the instance over the given memory block.
MessageSize bufferSize() const noexcept
bool valid() const noexcept
static constexpr MessageSize getMaxMessageSize() noexcept
Maximal message size.
Group constructGroup(Callable callable, typename Group::Size length, Owner &owner)
Group constructGroup(Callable callable, typename Group::Size length, SchemaVersion since, Owner &owner)
void setVariableLengthFieldToNull(Callable callable, SchemaVersion since, Owner &owner) noexcept
Sets the variable length field to null.
BlockLength blockLength() const noexcept
void resetGroup(Callable callable, SchemaVersion since, Owner &owner)
Resets the repeating group.
SbeMessage() noexcept
Initializes a blank instance.
void init(MessageHeader::TemplateId value, MessageHeader::BlockLength minimalBlockLength, MessageHeader::BlockLength blockLength, SchemaId id) noexcept
VariableLengthFieldList variableLengthFields() noexcept
MessageSize BlockLength
Length of the message body representing a block of fixed-length fields.
void resetGroup(Callable callable, Owner &owner) noexcept
Sets the group to the initial state.
MessageSize calculateBinarySize(const void *tail) const noexcept
void constructGroup(Group &group, typename Group::Size entryCount, const void *messageTail)
Initializes the group header, sets all optional fields to null.
Variable-length fields list.
bool empty() const noexcept
SbeVariableLengthFieldList(void *binary, BinarySize size, SchemaVersion version) noexcept
Initializes the list over the given memory block.
SbeVariableLengthFieldList tail() const noexcept
BinaryVariableLengthFieldType & head() const noexcept
SbeVariableLengthFieldList checkTail() const
void checkSchemaId(SchemaId id)
Checks the compatibility with the provided SBE Schema ID.
constexpr MessageSize MaxMessageSize
Maximum supported message size.
const SbeMessage constructFromImmutableBlock(const void *data, MessageSize size, typename std::enable_if< std::is_same< typename std::remove_cv< Message >::type, SbeMessage >::value >::type *=nullptr)
Constructs the given message from an immutable memory block.
MessageHeader::Version SchemaVersion
Aliases SBE-encoded data version type.
char Char
Character type alias.
UInt16 MessageSize
Message length type.
std::basic_string_view< Char > StrRef
void checkVersion(SchemaVersion version)
Checks the compatibility with the provided SBE Schema version.
MessageHeader::SchemaId SchemaId
void checkSchema(SchemaId id, SchemaVersion version)
Checks the compatibility with the provided SBE Schema version.
FloatingPointDecimal< DecimalMantissa, DecimalExponent > Decimal
Universal decimal type.
MessageHeader::TemplateId MessageTemplateId
Message type (template) identification.