OnixS C++ B3 BOE Binary Order Entry 1.3.0
API Documentation
Loading...
Searching...
No Matches
SbeMessage.h
Go to the documentation of this file.
1// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2//
3// This software owned by Onix Solutions Limited [OnixS] and is
4// protected by copyright law and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable
7// OnixS Software Services Agreement (the Agreement) and Customer end user license
8// agreements granting a non-assignable, non-transferable and non-exclusive license
9// to use the software for it's own data processing purposes under the terms defined
10// in the Agreement.
11//
12// Except as otherwise granted within the terms of the Agreement, copying or
13// reproduction of any part of this source code or associated reference material
14// to any other location for further reproduction or redistribution, and any
15// amendments to this copyright notice, are expressly prohibited.
16//
17// Any reproduction or redistribution for sale or hiring of the Software not in
18// accordance with the terms of the Agreement is a violation of copyright law.
19//
20
21#pragma once
22
23#include <OnixS/B3/BOE/ABI.h>
31
32#include <cassert>
33#include <limits>
34#include <stdexcept>
35
37
39typedef
40MessageHeader::TemplateId MessageTemplateId;
41
43template<typename Message> inline
44void checkBinaryLength(const Message&, MessageSize length, MessageSize minimalRequiredLength)
45{
46 if ONIXS_B3_BOE_UNLIKELY(length < minimalRequiredLength)
47 throwBinaryBlockIsTooSmall(length, minimalRequiredLength, Message::className());
48}
49
51ONIXS_B3_BOE_LTWT_CLASS BinaryBlockBase
52{
53protected:
54 ~BinaryBlockBase() ONIXS_B3_BOE_DEFAULT;
55};
56
62template < class Container, class BlockLength >
63ONIXS_B3_BOE_LTWT_CLASS BinaryBlock : public BinaryBlockBase
64{
66 const Container& container() const ONIXS_B3_BOE_NOTHROW
67 {
68 return *static_cast <const Container*> (this);
69 }
70
71protected:
74
76
78 template < class Value > ONIXS_B3_BOE_HOTPATH
79 Value ordinary(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
80 {
81 assert(container().blockLength() >= (offset + size<Value>()) &&
82 "The requested field exceeds provided block boundaries.");
83
84 const void* const location = advanceByBytes(container().block(), offset);
85 return getValue<Value>(location);
86 }
87
89 template < class Value > ONIXS_B3_BOE_HOTPATH
90 const Value& accessOrdinary(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
91 {
92 assert(container().blockLength() >= (offset + size<Value>()) &&
93 "The requested field exceeds provided block boundaries.");
94
95 const void* location = advanceByBytes(container().block(), offset);
96 const Value* valuePtr = static_cast<const Value*>(location);
97 return *valuePtr;
98 }
99
101 template < class Value > ONIXS_B3_BOE_HOTPATH
102 Value& accessOrdinary(BlockLength offset) ONIXS_B3_BOE_NOTHROW
103 {
104 return const_cast<Value&>(static_cast<const BinaryBlock<Container, BlockLength> &>(*this).accessOrdinary<Value>(offset));
105 }
106
111 template <class Value, class NullValue > ONIXS_B3_BOE_HOTPATH
112 bool ordinary(Value& value, BlockLength offset, NullValue null) const ONIXS_B3_BOE_NOTHROW
113 {
114 value = ordinary<Value>(offset);
115
116 return (null != value);
117 }
118
123 template < class Value, class NullValue > ONIXS_B3_BOE_HOTPATH
124 bool ordinary(Value& value, BlockLength offset, NullValue null, SchemaVersion since) const ONIXS_B3_BOE_NOTHROW
125 {
126 return (since <= container().version() && ordinary (value, offset, null ) );
127 }
128
130 template < class Enumeration > ONIXS_B3_BOE_HOTPATH
131 typename Enumeration::Enum enumeration(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
132 {
133 typedef typename Enumeration::Base Base;
134 typedef typename Enumeration::Enum Enum;
135
136 return static_cast<Enum>(ordinary<Base>(offset));
137 }
138
140 template < class Enumeration, class NullValue > ONIXS_B3_BOE_HOTPATH
141 bool enumeration(typename Enumeration::Enum& value, BlockLength offset, NullValue null) const ONIXS_B3_BOE_NOTHROW
142 {
143 typedef typename Enumeration::Base Base;
144 typedef typename Enumeration::Enum Enum;
145
146 value = static_cast <Enum>(ordinary<Base>(offset));
147 return null != value;
148 }
149
151 template < class Enumeration, class NullValue > ONIXS_B3_BOE_HOTPATH
152 bool enumeration(typename Enumeration::Enum& value, BlockLength offset, NullValue null, SchemaVersion since) const ONIXS_B3_BOE_NOTHROW
153 {
154 return (since <= container().version() && enumeration<Enumeration>(value, offset, null) );
155 }
156
158 template < class Value > ONIXS_B3_BOE_HOTPATH
159 Value decimal(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
160 {
161 return ordinary<Value>(offset);
162 }
163
168 template < class Value, class NullValue > ONIXS_B3_BOE_HOTPATH
169 bool decimal(Value& value, BlockLength offset, NullValue null) const ONIXS_B3_BOE_NOTHROW
170 {
171 value = ordinary<Value>(offset);
172 return null != value;
173 }
174
179 template < class Value, class NullValue > ONIXS_B3_BOE_HOTPATH
180 bool decimal(Value& value, BlockLength offset, NullValue null, SchemaVersion since) const ONIXS_B3_BOE_NOTHROW
181 {
182 return (since <= container().version() && decimal(value, offset, null));
183 }
184
186 template < BlockLength Length > ONIXS_B3_BOE_HOTPATH
187 StrRef fixedStr(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
188 {
189 assert(container().blockLength() >= (offset + Length) && "The requested field exceeds provided block boundaries.");
190
191 const Char* const text = reinterpret_cast <const Char*> (advanceByBytes(container().block(), offset));
192
193 return StrRef(text, strnlen(text, Length));
194 }
195
200 template<BlockLength Length> ONIXS_B3_BOE_HOTPATH
201 bool fixedStr(StrRef& value, BlockLength offset) const ONIXS_B3_BOE_NOTHROW
202 {
203 value = fixedStr<Length>(offset);
204 return !value.empty();
205 }
206
211 template<BlockLength Length> ONIXS_B3_BOE_HOTPATH
212 bool fixedStr(StrRef& value, BlockLength offset, SchemaVersion since) const ONIXS_B3_BOE_NOTHROW
213 {
214 return (since <= container().version() && fixedStr<Length>(value, offset));
215 }
216};
217
222template <class Container, class BlockLength >
224{
225public:
228 {
229 return *static_cast<Container*>(this);
230 }
231
234 void zeroPaddingBytes(BlockLength offset) ONIXS_B3_BOE_NOTHROW
235 {
236 const BlockLength encodedBlockLength = container().blockLength();
237
238 assert(encodedBlockLength >= offset);
239
240 const size_t paddingLength = encodedBlockLength - offset;
241 std::memset(advanceByBytes(container().block(), offset), 0, paddingLength);
242 }
243
245 template<class FieldValue> ONIXS_B3_BOE_HOTPATH
246 void setOrdinary(BlockLength offset, FieldValue value) ONIXS_B3_BOE_NOTHROW
247 {
248 assert(container().blockLength() >= (offset + size<FieldValue>()) && "The requested field exceeds provided block boundaries.");
249
250 void* const fieldPos = advanceByBytes(container().block(), offset);
251 setValue(fieldPos, value);
252 }
253
255 template<class FieldValue> ONIXS_B3_BOE_HOTPATH
256 void setOrdinary(BlockLength offset, FieldValue value, SchemaVersion since)
257 {
258 if ONIXS_B3_BOE_UNLIKELY(since > container().version())
259 throwDisallowedField();
260
261 setOrdinary(offset, value);
262 }
263
265 template<class Enumeration> ONIXS_B3_BOE_HOTPATH
266 void setEnumeration(BlockLength offset, typename Enumeration::Enum value) ONIXS_B3_BOE_NOTHROW
267 {
268 typedef typename Enumeration::Base Base;
269 setOrdinary<Base>(offset, static_cast<Base>(value));
270 }
271
273 template<class Enumeration> ONIXS_B3_BOE_HOTPATH
274 void setEnumeration(BlockLength offset, typename Enumeration::Enum value, SchemaVersion since)
275 {
276 typedef typename Enumeration::Base Base;
277 setOrdinary(offset, static_cast<Base>(value), since);
278 }
279
281 template<BlockLength Size> ONIXS_B3_BOE_HOTPATH
282 void setFixedStr(BlockLength offset, StrRef value) ONIXS_B3_BOE_NOTHROW
283 {
284 assert(container().blockLength() >= (offset + Size) && "The requested field exceeds provided block boundaries.");
285 assert(value.size() <= Size && "The string is truncated.");
286
287 void* const fieldPos = advanceByBytes(container().block(), offset);
288 const size_t sizeToCopy = (std::min)(Size, static_cast<BlockLength>(value.size()));
289
290 if(sizeToCopy > 0)
291 std::memcpy(fieldPos, value.data(), sizeToCopy);
292
293 std::memset(advanceByBytes(fieldPos, sizeToCopy), 0, Size - sizeToCopy);
294 }
295
297 template<BlockLength Size> ONIXS_B3_BOE_HOTPATH
298 void setFixedStr(BlockLength offset, StrRef value, SchemaVersion since)
299 {
300 if ONIXS_B3_BOE_UNLIKELY(since > container().version())
301 throwDisallowedField();
302
303 setFixedStr<Size>(offset, value);
304 }
305
306protected:
309
311};
312
314template <class BodySizeType>
316{
317public:
319 typedef BodySizeType BlockLength;
320
323 : encoded_(ONIXS_B3_BOE_NULLPTR)
324 , size_(0)
325 , version_(0)
326 {
327 }
328
332 : encoded_(encoded)
333 , size_(size)
334 , version_(version)
335 {
336 assert(encoded);
337 }
338
341 {
342 return (encoded_ != ONIXS_B3_BOE_NULLPTR);
343 }
344
346 const void* encoded() const ONIXS_B3_BOE_NOTHROW
347 {
348 assert(valid());
349
350 return encoded_;
351 }
352
355 {
356 assert(valid());
357
358 return encoded_;
359 }
360
362 const void* block() const ONIXS_B3_BOE_NOTHROW
363 {
364 assert(valid());
365
366 return encoded_;
367 }
368
371 {
372 assert(valid());
373
374 return encoded_;
375 }
376
379 {
380 return size_;
381 }
382
385 {
386 return version_;
387 }
388
389 private:
390 void* encoded_;
391 BodySizeType size_;
392 SchemaVersion version_;
393};
394
396template <class EntryType, class BlockLength, class NumInGroup, class Length >
398{
399public:
401 typedef Length EncodedLength;
402
404 typedef EntryType Entry;
405
407 typedef NumInGroup Size;
408
411 {
412 public:
413 typedef EntryType Entry;
415
416 typedef Entry* pointer;
417 typedef Entry& reference;
418
419 typedef ptrdiff_t difference_type;
420
421 typedef std::random_access_iterator_tag iterator_category;
422
425 : entry_(ONIXS_B3_BOE_NULLPTR)
426 , size_(0)
427 , version_(0)
428 {
429 }
430
434 : entry_(entry)
435 , size_(size)
436 , version_(version)
437 {
438 assert(valid());
439 }
440
443 {
444 return (entry_ != ONIXS_B3_BOE_NULLPTR);
445 }
446
449 Entry get() const
450 {
451 assert(valid());
452
453 return Entry(entry_, size_, version_);
454 }
455
457 Entry operator *() const
458 {
459 return get();
460 }
461
463 bool operator == (const Iterator& other) const ONIXS_B3_BOE_NOTHROW
464 {
465 return entry_ == other.entry_;
466 }
467
469 bool operator !=(const Iterator& other) const ONIXS_B3_BOE_NOTHROW
470 {
471 return entry_ != other.entry_;
472 }
473
475 bool operator < (const Iterator& other) const ONIXS_B3_BOE_NOTHROW
476 {
477 return entry_ < other.entry_;
478 }
479
481 bool operator > (const Iterator& other) const ONIXS_B3_BOE_NOTHROW
482 {
483 return entry_ > other.entry_;
484 }
485
487 Iterator& operator ++()
488 {
489 assert(valid());
490
491 entry_ = advanceByBytes(entry_, size_);
492
493 return *this;
494 }
495
497 Iterator& operator --()
498 {
499 assert(valid());
500
501 entry_ = advanceBackByBytes(entry_, size_);
502
503 return *this;
504 }
505
508 Iterator operator +(difference_type distance) const
509 {
510 assert(valid());
511
512 return Iterator(advanceByBytes(entry_, distance * size_), size_, version_);
513 }
514
517 Iterator operator - (difference_type distance) const
518 {
519 assert(valid());
520
521 return Iterator(advanceBackByBytes(entry_, distance * size_), size_, version_);
522 }
523
524 private:
525 void* entry_;
526 EncodedLength size_;
527 SchemaVersion version_;
528 };
529
532 : encoded_(ONIXS_B3_BOE_NULLPTR)
533 , blockLength_(0)
534 , size_(0)
535 , version_(0)
536 {
537 }
538
540 SbeGroupEntries(void* encoded, BlockLength blockLength, Size groupSize, SchemaVersion version) ONIXS_B3_BOE_NOTHROW
541 : encoded_(encoded)
542 , blockLength_(blockLength)
543 , size_(groupSize)
544 , version_(version)
545 {
546 assert(encoded_);
547 assert(blockLength > 0);
548 assert(version != 0);
549 }
550
553 {
554 return (ONIXS_B3_BOE_NULLPTR != encoded_);
555 }
556
559 {
560 return (0 == size_);
561 }
562
565 {
566 return size_;
567 }
568
570 Iterator begin() const
571 {
572 return Iterator(encoded(), blockLength_, version_);
573 }
574
576 Iterator end() const
577 {
578 return Iterator(advanceByBytes(encoded(), encodedLength()), blockLength_, version_);
579 }
580
584 Entry operator [](Size index) const
585 {
586 assert(index < size_);
587 assert(encoded_);
588
589 return Entry(advanceByBytes(encoded_, static_cast<ptrdiff_t>(index) * blockLength_), blockLength_, version_);
590 }
591
594 {
595 return encoded_;
596 }
597
600 {
601 return (static_cast<EncodedLength>(blockLength_) * static_cast<EncodedLength>(size_) );
602 }
603
605 template<class OtherEntry, class OtherBlockLength, class OtherNumInGroup, class OtherLength >
607 : encoded_(other.encoded_)
608 , blockLength_(other.blockLength_)
609 , size_(other.size_)
610 , version_(other.version_)
611 {
612 // Dimension types may vary for the different instantiations of the template.
613 // Therefore, truncation of the dimensions must be avoided.
614
615 assert(blockLength_ == other.blockLength_);
616 assert(size_ == other.size_);
617 }
618
619 template <class OtherEntry, class OtherBlockLength, class OtherNumInGroup, class OtherLength>
620 SbeGroupEntries& operator = (const SbeGroupEntries <OtherEntry, OtherBlockLength, OtherNumInGroup, OtherLength>& other) ONIXS_B3_BOE_NOTHROW
621 {
622 encoded_ = other.encoded_;
623
624 blockLength_ = other.blockLength_;
625
626 assert(blockLength_ == other.blockLength_);
627
628 size_ = other.size_;
629
630 assert(size_ == other.size_);
631
632 version_ = other.version_;
633
634 return *this;
635 }
636
637private:
638 // Allows coping and cloning for different instantiations.
639 template <class OtherEntry, class OtherBlockLength, class OtherNumInGroup, class OtherLength> friend class SbeGroupEntries;
640
641 void* encoded_;
642 BlockLength blockLength_;
643 NumInGroup size_;
644 SchemaVersion version_;
645};
646
648template < class EntryType, class DimensionType, class GroupSizeType >
650{
651public:
653 typedef DimensionType Dimension;
654
656 typedef GroupSizeType BinarySize;
657
660
662 typedef typename DimensionType::BlockLength EntrySize;
663
665 typedef SbeGroupEntries <EntryType, typename Dimension::BlockLength, typename Dimension::NumInGroup, GroupSizeType > Entries;
666
668 typedef typename Entries::Iterator Iterator;
669
671 typedef typename Entries::Entry Entry;
672
674 typedef typename Entries::Size Size;
675
679 : header_(ONIXS_B3_BOE_NULLPTR)
680 , entries_(ONIXS_B3_BOE_NULLPTR)
681 , version_(0)
682 {
683 }
684
688 : header_(static_cast <Dimension*>(data))
689 , entries_(advanceByBytes(data, Dimension::Size))
690 , version_(version)
691 {
692 ONIXS_B3_BOE_ASSERT(size >= Dimension::Size);
693 assert(header_);
694 assert(entries_);
695
696 assert(valid());
697 }
698
701 {
702 return (entries_ != ONIXS_B3_BOE_NULLPTR);
703 }
704
707 {
708 assert(valid());
709
710 return 0 == size();
711 }
712
716 {
717 assert(valid());
718 assert(header_);
719
720 const Dimension* const group = static_cast<const Dimension*>(header_);
721
722 return group->numInGroup();
723 }
724
728 {
729 assert(valid());
730
731 return Iterator(entries_, numericCast<EntrySize>(entrySize()), version_);
732 }
733
737 {
738 assert(valid());
739
740 return Iterator(advanceByBytes(binary(), binarySize()), numericCast<EntrySize>(entrySize()), version_);
741 }
742
747 Entry operator [](Size index) const
748 {
749 assert(valid());
750 assert(index < size());
751
752 return Entry(advanceByBytes(entries_, static_cast<ptrdiff_t>(index) * entrySize()), entrySize(), version_);
753 }
754
758 {
759 assert(valid());
760 assert(header_);
761
762 return Entries (entries_, header_->blockLength(), header_->numInGroup(), version_);
763 }
764
766 const void* encoded() const ONIXS_B3_BOE_NOTHROW
767 {
768 return header_;
769 }
770
772 const void* tail() const ONIXS_B3_BOE_NOTHROW
773 {
774 return advanceByBytes(toByteBlock(encoded()), binarySize());
775 }
776
780 {
781 return header_;
782 }
783
787 {
788 return Dimension::Size + (static_cast<BinarySize>(entrySize()) * static_cast<BinarySize>(size()));
789 }
790
794 {
795 assert(valid());
796 assert(header_);
797
798 Dimension* const group = static_cast<Dimension*>(header_);
799 return group->blockLength();
800 }
801
802private:
804 void init(EntrySize entrySize) ONIXS_B3_BOE_NOTHROW
805 {
806 assert(valid());
807 assert(header_);
808
809 Dimension* const group = static_cast<Dimension*>(header_);
810 group->setBlockLength(entrySize);
811 group->setNumInGroup(0);
812 }
813
815 Size allocate(Size entryCount, const void* messageTail, const void* blockEnd)
816 {
817 assert(valid());
818 assert(blockEnd);
819 assert(messageTail);
820
821 Dimension* const group = static_cast<Dimension*>(header_);
822
823 const EntrySize entrySize = group->blockLength();
824
825 if ONIXS_B3_BOE_UNLIKELY(
826 entrySize < EntryType::blockLength(version_))
827 {
828 throwBadBinaryBlock();
829 }
830
831 const Size oldEntryCount = group->numInGroup();
832
833 if(oldEntryCount == entryCount)
834 return entryCount;
835
836 const ptrdiff_t memShift =
837 (entryCount - oldEntryCount) * static_cast<ptrdiff_t>(entrySize);
838
839 const void* const newMessageTail =
840 advanceByBytes(messageTail, memShift);
841
842 if ONIXS_B3_BOE_UNLIKELY(byteDistance(blockEnd, newMessageTail) < 0)
843 throwNotEnoughSpace();
844
845 const void* const oldEndOfGroup =
846 advanceByBytes(entries_, static_cast<ptrdiff_t>(entrySize) * oldEntryCount);
847
848 void* const newEndGroup =
849 advanceByBytes(entries_, static_cast<ptrdiff_t>(entrySize) * entryCount);
850
851 std::memmove(
852 newEndGroup,
853 oldEndOfGroup,
854 byteDistance(messageTail, oldEndOfGroup));
855
856 group->setNumInGroup(entryCount);
857
858 return oldEntryCount;
859 }
860
863 void setup(Size entryCount, const void* messageTail, const void* blockEnd)
864 {
865 assert(valid());
866 assert(blockEnd);
867 assert(messageTail);
868
869 const Size oldEntryCount = allocate(entryCount, messageTail, blockEnd);
870
871 for(Size index = oldEntryCount; index < entryCount; ++index)
872 zeroPaddingBytes((*this)[index].resetVariableFields());
873 }
874
877 void construct(Size entryCount, const void* messageTail, const void* blockEnd)
878 {
879 assert(valid());
880 assert(blockEnd);
881 assert(messageTail);
882
883 const Size oldEntryCount = allocate(entryCount, messageTail, blockEnd);
884
885 for(Size index = oldEntryCount; index < entryCount; ++index)
886 zeroPaddingBytes((*this)[index].reset());
887 }
888
890 static void zeroPaddingBytes(Entry& entry)
891 {
892 assert(entry.valid());
893 entry.zeroPaddingBytes(EntryType::minimalBlockLength(entry.version()));
894 }
895
896private:
897 Dimension* header_;
898 void* entries_;
899 SchemaVersion version_;
900
901 friend class SbeMessage;
902};
903
905template < class BinarySize >
907{
908public:
911 SbeVariableLengthFieldList(void* binary, BinarySize size, SchemaVersion version) ONIXS_B3_BOE_NOTHROW
912 : binary_(binary)
913 , size_(size)
914 , version_(version)
915 {
916 }
917
920 {
921 return (0 == size_);
922 }
923
925 template<class BinaryVariableLengthFieldType>
926 BinaryVariableLengthFieldType& head() const ONIXS_B3_BOE_NOTHROW
927 {
928 return *static_cast<BinaryVariableLengthFieldType*>(binary_);
929 }
930
932 template<class BinaryVariableLengthFieldType> ONIXS_B3_BOE_HOTPATH
934 {
935 assert(!empty());
936
937 const BinarySize headSize = head<BinaryVariableLengthFieldType>().binarySize();
938
939 assert(headSize <= size_);
940
941 return SbeVariableLengthFieldList(advanceByBytes( binary_, headSize), size_ - headSize, version_);
942 }
943
947 template<class BinaryVariableLengthFieldType> ONIXS_B3_BOE_HOTPATH
949 {
950 if ONIXS_B3_BOE_UNLIKELY(empty() || (size_ < BinaryVariableLengthFieldType::Size))
951 {
952 throwBadBinaryBlock();
953 }
954
955 const BinarySize headSize = head<BinaryVariableLengthFieldType>().binarySize();
956
957 if ONIXS_B3_BOE_UNLIKELY(headSize > size_)
958 {
959 throwBadBinaryBlock();
960 }
961
962 return SbeVariableLengthFieldList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
963 }
964
965 private:
966 void* binary_;
967 BinarySize size_;
968 SchemaVersion version_;
969
970};
971
973template <class BinarySize>
975{
976public:
979 SbeGroupList(void* binary, BinarySize size, SchemaVersion version) ONIXS_B3_BOE_NOTHROW
980 : binary_(binary)
981 , size_(size)
982 , version_(version)
983 {
984 }
985
988 {
989 return (0 == size_);
990 }
991
993 template<class Group> ONIXS_B3_BOE_HOTPATH
995 {
996 assert(!empty());
997
998 return Group(binary_, size_, version_);
999 }
1000
1002 template<class Group> ONIXS_B3_BOE_HOTPATH
1004 {
1005 assert(!empty());
1006
1007 const BinarySize headSize = head<Group>().binarySize();
1008
1009 assert(headSize <= size_);
1010
1011 return SbeGroupList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1012 }
1013
1015 template <class Group> ONIXS_B3_BOE_HOTPATH
1017 {
1018 assert(!empty());
1019
1020 const BinarySize headSize = head<Group>().binarySize();
1021
1022 assert(headSize <= size_);
1023
1024 return SbeVariableLengthFieldList<BinarySize>(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1025 }
1026
1030 template<class Group> ONIXS_B3_BOE_HOTPATH
1032 {
1033 const BinarySize headSize = checkHead<Group>();
1034
1035 return SbeGroupList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1036 }
1037
1041 template <class Group> ONIXS_B3_BOE_HOTPATH
1043 {
1044 const BinarySize headSize = checkHead<Group>();
1045
1046 return SbeVariableLengthFieldList<BinarySize>(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1047 }
1048
1049private:
1050 template<class Group>
1051 BinarySize checkHead() const
1052 {
1053 if ONIXS_B3_BOE_UNLIKELY(size_ < Group::Dimension::Size)
1054 {
1055 throwBadBinaryBlock();
1056 }
1057
1058 const Group group = head<Group>();
1059
1060 const BinarySize headSize = group.binarySize();
1061
1062 if ONIXS_B3_BOE_UNLIKELY(headSize > size_)
1063 {
1064 throwBadBinaryBlock();
1065 }
1066
1067 if(!group.empty())
1068 {
1069 const BinarySize entrySize = group.entrySize();
1070 const BinarySize expectedEntrySize = Group::Entry::minimalBlockLength(version_);
1071
1072 if ONIXS_B3_BOE_UNLIKELY(entrySize < expectedEntrySize)
1073 {
1074 throwBadBinaryBlock();
1075 }
1076 }
1077
1078 return headSize;
1079 }
1080
1081 void* binary_;
1082 BinarySize size_;
1083 SchemaVersion version_;
1084};
1085
1087template<typename Traits>
1089{
1090 if ONIXS_B3_BOE_UNLIKELY(version < Traits::MinimalVersion)
1091 {
1092 throwBadMessageVersion(version, Traits::MinimalVersion);
1093 }
1094}
1095
1097template<typename Traits>
1099{
1100 checkVersion<Traits>(version);
1101
1102 if ONIXS_B3_BOE_UNLIKELY(version < since)
1103 {
1104 throwBadMessageVersion(version, since);
1105 }
1106}
1107
1109template<typename Traits>
1111{
1112 if ONIXS_B3_BOE_UNLIKELY(id != Traits::Id)
1113 {
1114 throwBadSchemaId(Traits::Id, id);
1115 }
1116}
1117
1119template<typename Traits>
1121{
1123 checkVersion<Traits>(version);
1124}
1125
1128{
1129public:
1132 struct NoInit{};
1133 struct NoCheck{};
1134
1137
1140
1143 : header_(ONIXS_B3_BOE_NULLPTR)
1144 , size_(0)
1145 {
1146 }
1147
1151 : header_(static_cast<MessageHeader*>(data))
1152 , size_(size)
1153 {
1154 assert(data);
1155 assert(size <= MaxB3BOEMessageSize);
1156
1157 if ONIXS_B3_BOE_UNLIKELY(size < MessageHeader::Size)
1158 throwBinaryBlockIsTooSmall(size, MessageHeader::Size);
1159
1160 this->version(version);
1161 }
1162
1165 SbeMessage(void* data, MessageSize size)
1166 : header_(static_cast<MessageHeader*>(data))
1167 , size_(size)
1168 {
1169 assert(data);
1170 assert(size <= MaxB3BOEMessageSize);
1171
1172 if ONIXS_B3_BOE_UNLIKELY(size < MessageHeader::Size)
1173 throwBinaryBlockIsTooSmall(size, MessageHeader::Size);
1174
1175 // Now it is safe to read header_.
1176 if ONIXS_B3_BOE_UNLIKELY(size < (MessageHeader::Size + header_->blockLength()))
1177 throwBinaryBlockIsTooSmall(size, MessageHeader::Size + header_->blockLength());
1178 }
1179
1185 : header_(static_cast<MessageHeader*>(data))
1186 , size_(size)
1187 {
1188 assert(data);
1189 assert(size <= MaxB3BOEMessageSize);
1190
1191 assert(size >= MessageHeader::Size);
1192 assert(size >= MessageHeader::Size + header_->blockLength());
1193 }
1194
1197 {
1198 *this = SbeMessage();
1199 assert(!valid());
1200 }
1201
1204 {
1205 return (ONIXS_B3_BOE_NULLPTR != header_);
1206 }
1207
1210 {
1211 assert(valid());
1212
1213 return header_->templateId();
1214 }
1215
1218 {
1219 assert(valid());
1220
1221 return header_->version();
1222 }
1223
1226 {
1227 assert(valid());
1228
1229 return header_->schemaId();
1230 }
1231
1233 const void* binary() const ONIXS_B3_BOE_NOTHROW
1234 {
1235 assert(valid());
1236
1237 return header_;
1238 }
1239
1242 {
1243 assert(valid());
1244
1245 return header_;
1246 }
1247
1248 // \return the end of the memory block.
1250 {
1251 assert(valid());
1252
1253 return advanceByBytes(header_, size_);
1254 }
1255
1256 // \return the end of the memory block.
1257 const void* blockEnd() const ONIXS_B3_BOE_NOTHROW
1258 {
1259 assert(valid());
1260
1261 return advanceByBytes(header_, size_);
1262 }
1263
1266 {
1267 return size_;
1268 }
1269
1272 {
1273 assert(valid());
1274
1275 return advanceByBytes(header_, MessageHeader::Size);
1276 }
1277
1280 {
1281 assert(valid());
1282
1283 return header_->blockLength();
1284 }
1285
1287 const void* block() const ONIXS_B3_BOE_NOTHROW
1288 {
1289 assert(valid());
1290
1291 return advanceByBytes(header_, MessageHeader::Size);
1292 }
1293
1296 {
1297 assert(valid());
1298
1299 return advanceByBytes(header_, MessageHeader::Size);
1300 }
1301
1302protected:
1305
1308 {
1309 assert(valid());
1310
1311 header_->setVersion(version);
1312
1313 return *this;
1314 }
1315
1319 {
1320 assert(header_);
1321
1322 void* list = advanceByBytes<void>(body(), blockLength());
1323
1324 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
1325
1326 return GroupList(list, listSize, header_->version());
1327 }
1328
1332 {
1333 assert(header_);
1334
1335 const void* list = advanceByBytes(block(), blockLength());
1336
1337 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
1338
1339 return GroupList(const_cast<void*>(list), listSize, header_->version());
1340 }
1341
1343 template<typename Group>
1345 void initGroup(Group& group, typename Group::EntrySize entrySize) ONIXS_B3_BOE_NOTHROW
1346 {
1347 assert(group.valid());
1348 group.init(entrySize);
1349 }
1350
1352 template<typename Group>
1354 void setupGroup(Group& group, typename Group::Size entryCount, const void* messageTail)
1355 {
1356 assert(messageTail);
1357 assert(group.valid());
1358 group.setup(entryCount, messageTail, blockEnd());
1359 }
1360
1362 template<typename Group>
1364 void constructGroup(Group& group, typename Group::Size entryCount, const void* messageTail)
1365 {
1366 assert(messageTail);
1367 assert(group.valid());
1368 group.construct(entryCount, messageTail, blockEnd());
1369 }
1370
1372 template<typename DATA>
1373 void setVarDataField(DATA& data, StrRef value, const void* oldMessageTail)
1374 {
1375 assert(oldMessageTail);
1376
1377 const ptrdiff_t lengthChange = static_cast<ptrdiff_t>(value.length() - data.length());
1378
1379 const void* const newMessageTail = advanceByBytes(oldMessageTail, lengthChange);
1380
1381 if ONIXS_B3_BOE_UNLIKELY(byteDistance(blockEnd(), newMessageTail) < 0)
1382 throwNotEnoughSpace();
1383
1384 const void* const oldEndOfData = advanceByBytes(data.varData().data(), data.varData().size());
1385
1386 void* const newEndOfData = toOpaquePtr(advanceByBytes(&data, value.length() + DATA::Size));
1387
1388 std::memmove(newEndOfData, oldEndOfData, byteDistance(oldMessageTail, oldEndOfData));
1389
1390 data.varData(value);
1391 }
1392
1395
1399 {
1400 assert(header_);
1401
1402 void* list = advanceByBytes<void>(body(), blockLength());
1403
1404 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
1405
1406 return VariableLengthFieldList(list, listSize, header_->version());
1407 }
1408
1412 {
1413 assert(header_);
1414
1415 const void* list = advanceByBytes(block(), blockLength());
1416
1417 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
1418
1419 return VariableLengthFieldList(const_cast<void*>(list), listSize, header_->version());
1420 }
1421
1423 void init(
1425 MessageHeader::BlockLength minimalBlockLength,
1428 {
1429 assert(header_);
1430 assert(blockLength >= minimalBlockLength);
1431
1432 header_->setTemplateId(value);
1433 header_->setBlockLength(blockLength);
1434 header_->setSchemaId(id);
1435
1436 zeroPaddingBytes(minimalBlockLength);
1437 }
1438
1441 {
1442 assert(tail);
1443
1444 const ptrdiff_t distance = byteDistance(tail, binary());
1445
1446 assert(distance > 0);
1447
1448 assert(distance <= (std::numeric_limits<MessageSize>::max)());
1449
1450 const MessageSize size = static_cast<MessageSize>(distance);
1451
1452 assert(size <= size_);
1453
1454 return size;
1455 }
1456
1458 template<class Callable, class Owner>
1459 void setVariableLengthField(Callable callable, StrRef value, Owner& owner)
1460 {
1461 setVarDataField(callable(owner), value, owner.tail());
1462 }
1463
1465 template<class Callable, class Owner>
1466 void setVariableLengthField(Callable callable, StrRef value, SchemaVersion since, Owner& owner)
1467 {
1468 if ONIXS_B3_BOE_UNLIKELY(since > version())
1469 throwDisallowedField();
1470
1471 setVariableLengthField(callable, value, owner);
1472 }
1473
1475 template<class Callable, class Owner>
1476 StrRef getVariableLengthField(Callable callable, const Owner& owner) const ONIXS_B3_BOE_NOTHROW
1477 {
1478 ONIXS_B3_BOE_CHECK_NOTHROW(callable(owner));
1479 return callable(owner).varData();
1480 }
1481
1483 template<class Callable, class Owner>
1484 StrRef getVariableLengthField(Callable callable, SchemaVersion since, Owner& owner) const ONIXS_B3_BOE_NOTHROW
1485 {
1486 if ONIXS_B3_BOE_UNLIKELY(since > version())
1487 return StrRef();
1488
1489 return getVariableLengthField(callable, owner);
1490 }
1491
1493 template<class Callable, class Owner>
1494 void setVariableLengthFieldToNull(Callable callable, Owner& owner) ONIXS_B3_BOE_NOTHROW
1495 {
1496 ONIXS_B3_BOE_CHECK_NOTHROW(callable(owner));
1497 callable(owner).length(0);
1498 }
1499
1501 template<class Group, class Callable, class Owner>
1502 void resetGroup(Callable callable, Owner& owner) ONIXS_B3_BOE_NOTHROW
1503 {
1504 const typename Group::EntrySize entrySize = Group::Entry::blockLength(version());
1505
1506 Group grp = callable(owner);
1507
1508 initGroup(grp, entrySize);
1509 }
1510
1512 template<class Callable, class Owner>
1513 void setVariableLengthFieldToNull(Callable callable, SchemaVersion since, Owner& owner) ONIXS_B3_BOE_NOTHROW
1514 {
1515 if ONIXS_B3_BOE_UNLIKELY(since > version())
1516 return;
1517
1518 setVariableLengthFieldToNull(callable, owner);
1519 }
1520
1522 template<class Group, class Callable, class Owner>
1523 void resetGroup(Callable callable, SchemaVersion since, Owner& owner)
1524 {
1525 if ONIXS_B3_BOE_UNLIKELY(since > version())
1526 return;
1527
1528 resetGroup<Group>(callable, owner);
1529 }
1530
1532 template<class Group, class Callable, class Owner>
1533 Group getGroup(Callable callable, Owner& owner) const ONIXS_B3_BOE_NOTHROW
1534 {
1535 ONIXS_B3_BOE_CHECK_NOTHROW(callable(owner));
1536 return callable(owner);
1537 }
1538
1540 template<class Group, class Callable, class Owner>
1541 Group getGroup(Callable callable, SchemaVersion since, Owner& owner) const ONIXS_B3_BOE_NOTHROW
1542 {
1543 if ONIXS_B3_BOE_UNLIKELY(since > version())
1544 return Group();
1545
1546 return getGroup<Group>(callable, owner);
1547 }
1548
1550 template<class Group, class Callable, class Owner>
1551 Group constructGroup(Callable callable, typename Group::Size length, SchemaVersion since, Owner& owner)
1552 {
1553 if ONIXS_B3_BOE_UNLIKELY(since > version())
1554 return Group();
1555
1556 return constructGroup<Group>(callable, length, owner);
1557 }
1558
1560 template<class Group, class Callable, class Owner>
1561 Group constructGroup(Callable callable, typename Group::Size length, Owner& owner)
1562 {
1563 Group group = callable(owner);
1564
1565 constructGroup(group, length, owner.tail());
1566
1567 return group;
1568 }
1569
1571 template<class Group, class Callable, class Owner>
1572 Group setupGroup(Callable callable, typename Group::Size length, SchemaVersion since, Owner& owner)
1573 {
1574 if ONIXS_B3_BOE_UNLIKELY(since > version())
1575 return Group();
1576
1577 return setupGroup<Group>(callable, length, owner);
1578 }
1579
1581 template<class Group, class Callable, class Owner>
1582 Group setupGroup(Callable callable, typename Group::Size length, Owner& owner)
1583 {
1584 Group group = callable(owner);
1585
1586 setupGroup(group, length, owner.tail());
1587
1588 return group;
1589 }
1590
1600
1601private:
1602 MessageHeader* header_;
1603 MessageSize size_;
1604};
1605
#define ONIXS_B3_BOE_LTWT_EXPORTED
Definition ABI.h:92
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_END
Definition ABI.h:144
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_BEGIN
Definition ABI.h:140
#define ONIXS_B3_BOE_LTWT_CLASS
Definition ABI.h:84
#define ONIXS_B3_BOE_UNUSED
Definition Compiler.h:207
#define ONIXS_B3_BOE_CONSTEXPR
Definition Compiler.h:185
#define ONIXS_B3_BOE_NODISCARD
Definition Compiler.h:191
#define ONIXS_B3_BOE_DEFAULT
Definition Compiler.h:208
#define ONIXS_B3_BOE_NULLPTR
Definition Compiler.h:188
#define ONIXS_B3_BOE_NOTHROW
Definition Compiler.h:182
#define ONIXS_B3_BOE_HOTPATH
Definition Compiler.h:193
bool decimal(Value &value, BlockLength offset, NullValue null) const noexcept
Definition SbeMessage.h:169
bool fixedStr(StrRef &value, BlockLength offset) const noexcept
Provides access to an optional string field value.
Definition SbeMessage.h:201
Value ordinary(BlockLength offset) const noexcept
Definition SbeMessage.h:79
Value & accessOrdinary(BlockLength offset) noexcept
Definition SbeMessage.h:102
const Value & accessOrdinary(BlockLength offset) const noexcept
Definition SbeMessage.h:90
bool fixedStr(StrRef &value, BlockLength offset, SchemaVersion since) const noexcept
Provides access to an optional string field value.
Definition SbeMessage.h:212
bool ordinary(Value &value, BlockLength offset, NullValue null) const noexcept
Provides access to an optional field value.
Definition SbeMessage.h:112
bool decimal(Value &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Definition SbeMessage.h:180
Value decimal(BlockLength offset) const noexcept
Definition SbeMessage.h:159
Enumeration::Enum enumeration(BlockLength offset) const noexcept
Definition SbeMessage.h:131
bool enumeration(typename Enumeration::Enum &value, BlockLength offset, NullValue null) const noexcept
Provides access to an optional field value.
Definition SbeMessage.h:141
BinaryBlock()=default
Initializes a blank instance.
bool ordinary(Value &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Provides access to an optional field value.
Definition SbeMessage.h:124
StrRef fixedStr(BlockLength offset) const noexcept
Provides access to a string field value.
Definition SbeMessage.h:187
bool enumeration(typename Enumeration::Enum &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Provides access to an optional field value.
Definition SbeMessage.h:152
NumInGroup numInGroup() const noexcept
Counter representing the number of entries in a repeating group.
Definition Composites.h:158
BlockLength blockLength() const noexcept
Root block length.
Definition Composites.h:141
Message identifiers and length of message root.
Definition Composites.h:34
UInt16 BlockLength
Length of the root of the FIX message contained before repeating groups or variable/conditions fields...
Definition Composites.h:40
UInt16 TemplateId
Template ID used to encode the message.
Definition Composites.h:43
SbeFields()=default
Initializes a blank instance.
Container & container() noexcept
Definition SbeMessage.h:227
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...
Definition SbeMessage.h:234
void setFixedStr(BlockLength offset, StrRef value) noexcept
Sets the field value.
Definition SbeMessage.h:282
void setOrdinary(BlockLength offset, FieldValue value, SchemaVersion since)
Sets the field value.
Definition SbeMessage.h:256
void setEnumeration(BlockLength offset, typename Enumeration::Enum value, SchemaVersion since)
Sets the field value.
Definition SbeMessage.h:274
void setEnumeration(BlockLength offset, typename Enumeration::Enum value) noexcept
Sets the field value.
Definition SbeMessage.h:266
void setOrdinary(BlockLength offset, FieldValue value) noexcept
Sets the field value.
Definition SbeMessage.h:246
void setFixedStr(BlockLength offset, StrRef value, SchemaVersion since)
Sets the field value.
Definition SbeMessage.h:298
std::random_access_iterator_tag iterator_category
Definition SbeMessage.h:421
Iterator() noexcept
Initializes the instance that refers to nothing.
Definition SbeMessage.h:424
Iterator(void *entry, EncodedLength size, SchemaVersion version) noexcept
Initializes the instance to the given repeating group.
Definition SbeMessage.h:433
SbeGroupEntries() noexcept
Initializes a blank instance referencing to nothing.
Definition SbeMessage.h:531
SbeGroupEntries(void *encoded, BlockLength blockLength, Size groupSize, SchemaVersion version) noexcept
Initializes the instance referencing to data.
Definition SbeMessage.h:540
EntryType Entry
The type of the repeating group entry.
Definition SbeMessage.h:404
Iterator end() const
Returns the iterator pointing to the entry behind the end of the group.
Definition SbeMessage.h:576
SbeGroupEntries(const SbeGroupEntries< OtherEntry, OtherBlockLength, OtherNumInGroup, OtherLength > &other) noexcept
Copy constructor.
Definition SbeMessage.h:606
Length EncodedLength
The length of the binary data occupied by the group entries.
Definition SbeMessage.h:401
NumInGroup Size
Number of entries in the collection.
Definition SbeMessage.h:407
SbeGroupEntry()
Initializes a blank instance.
Definition SbeMessage.h:322
const void * block() const noexcept
Definition SbeMessage.h:362
SbeGroupEntry(void *encoded, BlockLength size, SchemaVersion version)
Initializes the instance from the memory block of the encoded message.
Definition SbeMessage.h:331
BlockLength blockLength() const noexcept
Definition SbeMessage.h:378
BodySizeType BlockLength
Type to present the length of binary data of the repeating group entry.
Definition SbeMessage.h:319
SbeVariableLengthFieldList< BinarySize > checkVariableLengthFields() const
Checks the variable length fields list consistency.
SbeGroupList tail() const noexcept
SbeGroupList checkTail() const
Checks the list consistency.
SbeVariableLengthFieldList< BinarySize > variableLengthFields() const noexcept
SbeGroupList(void *binary, BinarySize size, SchemaVersion version) noexcept
Initializes the list over the memory block.
Definition SbeMessage.h:979
const void * tail() const noexcept
Definition SbeMessage.h:772
SbeGroup() noexcept
Initializes a blank instance referencing to nothing.
Definition SbeMessage.h:677
Entries::Size Size
Number of entries in the group.
Definition SbeMessage.h:674
GroupSizeType BinarySize
Length of group data.
Definition SbeMessage.h:656
DimensionType::BlockLength EntrySize
Length of group entry data.
Definition SbeMessage.h:662
SbeGroup(void *data, BinarySize size, SchemaVersion version) noexcept
Initializes an instance referencing to a valid group of a given message.
Definition SbeMessage.h:687
Entries::Iterator Iterator
The iterator type for group entries.
Definition SbeMessage.h:668
Entries::Entry Entry
Group entry type.
Definition SbeMessage.h:671
Entries entries() const noexcept
Definition SbeMessage.h:757
Iterator end() const noexcept
Definition SbeMessage.h:736
const void * encoded() const noexcept
Definition SbeMessage.h:766
SbeGroupEntries< EntryType, typename Dimension::BlockLength, typename Dimension::NumInGroup, GroupSizeType > Entries
Binary group blocks.
Definition SbeMessage.h:665
DimensionType Dimension
Repeating group dimension type.
Definition SbeMessage.h:653
Iterator begin() const noexcept
Definition SbeMessage.h:727
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.
StrRef getVariableLengthField(Callable callable, SchemaVersion since, Owner &owner) const noexcept
const void * blockEnd() const noexcept
void setVariableLengthField(Callable callable, StrRef value, SchemaVersion since, Owner &owner)
Sets the value of the variable length field.
SbeMessage(void *data, MessageSize size)
Initializes the instance over the given memory block.
SbeVariableLengthFieldList< MessageSize > VariableLengthFieldList
Binary group list instantiation.
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
void setVarDataField(DATA &data, StrRef value, const void *oldMessageTail)
Sets the variable length field value.
SbeMessage(void *data, MessageSize size, NoCheck) noexcept
Initializes the instance over the given memory block.
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
static constexpr MessageSize getMaxMessageSize() noexcept
Maximal message size.
Group constructGroup(Callable callable, typename Group::Size length, Owner &owner)
Creates a repeating group with the given number of entries, sets all optional fields of the group ent...
Group constructGroup(Callable callable, typename Group::Size length, SchemaVersion since, Owner &owner)
Creates a repeating group with the given number of entries, sets all optional fields of the group ent...
void setVariableLengthFieldToNull(Callable callable, SchemaVersion since, Owner &owner) noexcept
Sets the variable length field to null.
BlockLength blockLength() const noexcept
void setVariableLengthFieldToNull(Callable callable, Owner &owner) noexcept
Resets the variable length field.
void resetGroup(Callable callable, SchemaVersion since, Owner &owner)
Resets the repeating group.
SbeMessage() noexcept
Initializes a blank instance.
void setVariableLengthField(Callable callable, StrRef value, Owner &owner)
Sets the value of the variable length field.
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.
StrRef getVariableLengthField(Callable callable, const Owner &owner) const noexcept
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.
SbeVariableLengthFieldList(void *binary, BinarySize size, SchemaVersion version) noexcept
Initializes the list over the given memory block.
Definition SbeMessage.h:911
SbeVariableLengthFieldList tail() const noexcept
Definition SbeMessage.h:933
BinaryVariableLengthFieldType & head() const noexcept
Definition SbeMessage.h:926
SbeVariableLengthFieldList checkTail() const
Checks the variable-length field list consistency.
Definition SbeMessage.h:948
constexpr UInt16 MaxB3BOEMessageSize
Maximum supported message size.
void checkSchemaId(SchemaId id)
Checks the compatibility with the provided SBE Schema ID.
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
char Char
Character type alias.
Definition String.h:30
UInt16 MessageSize
Message length type.
Definition Aliases.h:29
std::basic_string_view< Char > StrRef
Definition StrRef.h:46
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.
MessageHeader::TemplateId MessageTemplateId
Message type (template) identification.