OnixS C++ B3 BOE Binary Order Entry 1.4.0
Users' manual and 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};
57
63template < class Container, class BlockLength >
64ONIXS_B3_BOE_LTWT_CLASS BinaryBlock : public BinaryBlockBase
65{
67 const Container& container() const ONIXS_B3_BOE_NOTHROW
68 {
69 return *static_cast <const Container*> (this);
70 }
71
72protected:
75
77
79 template < class Value > ONIXS_B3_BOE_HOTPATH
80 Value ordinary(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
81 {
82 assert(container().blockLength() >= (offset + size<Value>()) &&
83 "The requested field exceeds provided block boundaries.");
84
85 const void* const location = advanceByBytes(container().block(), offset);
86 return getValue<Value>(location);
87 }
88
90 template < class Value > ONIXS_B3_BOE_HOTPATH
91 const Value& accessOrdinary(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
92 {
93 assert(container().blockLength() >= (offset + size<Value>()) &&
94 "The requested field exceeds provided block boundaries.");
95
96 const void* location = advanceByBytes(container().block(), offset);
97 const Value* valuePtr = static_cast<const Value*>(location);
98 return *valuePtr;
99 }
100
102 template < class Value > ONIXS_B3_BOE_HOTPATH
103 Value& accessOrdinary(BlockLength offset) ONIXS_B3_BOE_NOTHROW
104 {
105 return const_cast<Value&>(static_cast<const BinaryBlock<Container, BlockLength> &>(*this).accessOrdinary<Value>(offset));
106 }
107
112 template <class Value, class NullValue > ONIXS_B3_BOE_HOTPATH
113 bool ordinary(Value& value, BlockLength offset, NullValue null) const ONIXS_B3_BOE_NOTHROW
114 {
115 value = ordinary<Value>(offset);
116
117 return (null != value);
118 }
119
124 template < class Value, class NullValue > ONIXS_B3_BOE_HOTPATH
125 bool ordinary(Value& value, BlockLength offset, NullValue null, SchemaVersion since) const ONIXS_B3_BOE_NOTHROW
126 {
127 return (since <= container().version() && ordinary (value, offset, null ) );
128 }
129
131 template < class Enumeration > ONIXS_B3_BOE_HOTPATH
132 typename Enumeration::Enum enumeration(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
133 {
134 typedef typename Enumeration::Base Base;
135 typedef typename Enumeration::Enum Enum;
136
137 return static_cast<Enum>(ordinary<Base>(offset));
138 }
139
141 template < class Enumeration, class NullValue > ONIXS_B3_BOE_HOTPATH
142 bool enumeration(typename Enumeration::Enum& value, BlockLength offset, NullValue null) const ONIXS_B3_BOE_NOTHROW
143 {
144 typedef typename Enumeration::Base Base;
145 typedef typename Enumeration::Enum Enum;
146
147 value = static_cast <Enum>(ordinary<Base>(offset));
148 return null != value;
149 }
150
152 template < class Enumeration, class NullValue > ONIXS_B3_BOE_HOTPATH
153 bool enumeration(typename Enumeration::Enum& value, BlockLength offset, NullValue null, SchemaVersion since) const ONIXS_B3_BOE_NOTHROW
154 {
155 return (since <= container().version() && enumeration<Enumeration>(value, offset, null) );
156 }
157
159 template < class Value > ONIXS_B3_BOE_HOTPATH
160 Value decimal(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
161 {
162 return ordinary<Value>(offset);
163 }
164
169 template < class Value, class NullValue > ONIXS_B3_BOE_HOTPATH
170 bool decimal(Value& value, BlockLength offset, NullValue null) const ONIXS_B3_BOE_NOTHROW
171 {
172 value = ordinary<Value>(offset);
173 return null != value;
174 }
175
180 template < class Value, class NullValue > ONIXS_B3_BOE_HOTPATH
181 bool decimal(Value& value, BlockLength offset, NullValue null, SchemaVersion since) const ONIXS_B3_BOE_NOTHROW
182 {
183 return (since <= container().version() && decimal(value, offset, null));
184 }
185
187 template < BlockLength Length > ONIXS_B3_BOE_HOTPATH
188 StrRef fixedStr(BlockLength offset) const ONIXS_B3_BOE_NOTHROW
189 {
190 assert(container().blockLength() >= (offset + Length) && "The requested field exceeds provided block boundaries.");
191
192 const Char* const text = reinterpret_cast <const Char*> (advanceByBytes(container().block(), offset));
193
194 return StrRef(text, strnlen(text, Length));
195 }
196
201 template<BlockLength Length> ONIXS_B3_BOE_HOTPATH
202 bool fixedStr(StrRef& value, BlockLength offset) const ONIXS_B3_BOE_NOTHROW
203 {
204 value = fixedStr<Length>(offset);
205 return !value.empty();
206 }
207
212 template<BlockLength Length> ONIXS_B3_BOE_HOTPATH
213 bool fixedStr(StrRef& value, BlockLength offset, SchemaVersion since) const ONIXS_B3_BOE_NOTHROW
214 {
215 return (since <= container().version() && fixedStr<Length>(value, offset));
216 }
217};
218
223template <class Container, class BlockLength >
225{
226public:
229 {
230 return *static_cast<Container*>(this);
231 }
232
235 void zeroPaddingBytes(BlockLength offset) ONIXS_B3_BOE_NOTHROW
236 {
237 const BlockLength encodedBlockLength = container().blockLength();
238
239 assert(encodedBlockLength >= offset);
240
241 const size_t paddingLength = encodedBlockLength - offset;
242 std::memset(advanceByBytes(container().block(), offset), 0, paddingLength);
243 }
244
246 template<class FieldValue> ONIXS_B3_BOE_HOTPATH
247 void setOrdinary(BlockLength offset, FieldValue value) ONIXS_B3_BOE_NOTHROW
248 {
249 assert(container().blockLength() >= (offset + size<FieldValue>()) && "The requested field exceeds provided block boundaries.");
250
251 void* const fieldPos = advanceByBytes(container().block(), offset);
252 setValue(fieldPos, value);
253 }
254
256 template<class FieldValue> ONIXS_B3_BOE_HOTPATH
257 void setOrdinary(BlockLength offset, FieldValue value, SchemaVersion since)
258 {
259 if ONIXS_B3_BOE_UNLIKELY(since > container().version())
260 throwDisallowedField();
261
262 setOrdinary(offset, value);
263 }
264
266 template<class Enumeration> ONIXS_B3_BOE_HOTPATH
267 void setEnumeration(BlockLength offset, typename Enumeration::Enum value) ONIXS_B3_BOE_NOTHROW
268 {
269 typedef typename Enumeration::Base Base;
270 setOrdinary<Base>(offset, static_cast<Base>(value));
271 }
272
274 template<class Enumeration> ONIXS_B3_BOE_HOTPATH
275 void setEnumeration(BlockLength offset, typename Enumeration::Enum value, SchemaVersion since)
276 {
277 typedef typename Enumeration::Base Base;
278 setOrdinary(offset, static_cast<Base>(value), since);
279 }
280
282 template<BlockLength Size> ONIXS_B3_BOE_HOTPATH
283 void setFixedStr(BlockLength offset, StrRef value) ONIXS_B3_BOE_NOTHROW
284 {
285 assert(container().blockLength() >= (offset + Size) && "The requested field exceeds provided block boundaries.");
286 assert(value.size() <= Size && "The string is truncated.");
287
288 void* const fieldPos = advanceByBytes(container().block(), offset);
289 const size_t sizeToCopy = (std::min)(Size, static_cast<BlockLength>(value.size()));
290
291 if(sizeToCopy > 0)
292 std::memcpy(fieldPos, value.data(), sizeToCopy);
293
294 std::memset(advanceByBytes(fieldPos, sizeToCopy), 0, Size - sizeToCopy);
295 }
296
298 template<BlockLength Size> ONIXS_B3_BOE_HOTPATH
299 void setFixedStr(BlockLength offset, StrRef value, SchemaVersion since)
300 {
301 if ONIXS_B3_BOE_UNLIKELY(since > container().version())
302 throwDisallowedField();
303
304 setFixedStr<Size>(offset, value);
305 }
306
307protected:
310
312};
313
315template <class BodySizeType>
317{
318public:
320 typedef BodySizeType BlockLength;
321
324 : encoded_(ONIXS_B3_BOE_NULLPTR)
325 , size_(0)
326 , version_(0)
327 {
328 }
329
333 : encoded_(encoded)
334 , size_(size)
335 , version_(version)
336 {
337 assert(encoded);
338 }
339
342 {
343 return (encoded_ != ONIXS_B3_BOE_NULLPTR);
344 }
345
347 const void* encoded() const ONIXS_B3_BOE_NOTHROW
348 {
349 assert(valid());
350
351 return encoded_;
352 }
353
356 {
357 assert(valid());
358
359 return encoded_;
360 }
361
363 const void* block() const ONIXS_B3_BOE_NOTHROW
364 {
365 assert(valid());
366
367 return encoded_;
368 }
369
372 {
373 assert(valid());
374
375 return encoded_;
376 }
377
380 {
381 return size_;
382 }
383
386 {
387 return version_;
388 }
389
390 private:
391 void* encoded_;
392 BodySizeType size_;
393 SchemaVersion version_;
394};
395
397template <class EntryType, class BlockLength, class NumInGroup, class Length >
399{
400public:
402 typedef Length EncodedLength;
403
405 typedef EntryType Entry;
406
408 typedef NumInGroup Size;
409
412 {
413 public:
414 typedef EntryType Entry;
416
417 typedef Entry* pointer;
418 typedef Entry& reference;
419
420 typedef ptrdiff_t difference_type;
421
422 typedef std::random_access_iterator_tag iterator_category;
423
426 : entry_(ONIXS_B3_BOE_NULLPTR)
427 , size_(0)
428 , version_(0)
429 {
430 }
431
435 : entry_(entry)
436 , size_(size)
437 , version_(version)
438 {
439 assert(valid());
440 }
441
444 {
445 return (entry_ != ONIXS_B3_BOE_NULLPTR);
446 }
447
450 Entry get() const
451 {
452 assert(valid());
453
454 return Entry(entry_, size_, version_);
455 }
456
458 Entry operator *() const
459 {
460 return get();
461 }
462
464 bool operator == (const Iterator& other) const ONIXS_B3_BOE_NOTHROW
465 {
466 return entry_ == other.entry_;
467 }
468
470 bool operator !=(const Iterator& other) const ONIXS_B3_BOE_NOTHROW
471 {
472 return entry_ != other.entry_;
473 }
474
476 bool operator < (const Iterator& other) const ONIXS_B3_BOE_NOTHROW
477 {
478 return entry_ < other.entry_;
479 }
480
482 bool operator > (const Iterator& other) const ONIXS_B3_BOE_NOTHROW
483 {
484 return entry_ > other.entry_;
485 }
486
488 Iterator& operator ++()
489 {
490 assert(valid());
491
492 entry_ = advanceByBytes(entry_, size_);
493
494 return *this;
495 }
496
498 Iterator& operator --()
499 {
500 assert(valid());
501
502 entry_ = advanceBackByBytes(entry_, size_);
503
504 return *this;
505 }
506
509 Iterator operator +(difference_type distance) const
510 {
511 assert(valid());
512
513 return Iterator(advanceByBytes(entry_, distance * size_), size_, version_);
514 }
515
518 Iterator operator - (difference_type distance) const
519 {
520 assert(valid());
521
522 return Iterator(advanceBackByBytes(entry_, distance * size_), size_, version_);
523 }
524
525 private:
526 void* entry_;
527 EncodedLength size_;
528 SchemaVersion version_;
529 };
530
533 : encoded_(ONIXS_B3_BOE_NULLPTR)
534 , blockLength_(0)
535 , size_(0)
536 , version_(0)
537 {
538 }
539
541 SbeGroupEntries(void* encoded, BlockLength blockLength, Size groupSize, SchemaVersion version) ONIXS_B3_BOE_NOTHROW
542 : encoded_(encoded)
543 , blockLength_(blockLength)
544 , size_(groupSize)
545 , version_(version)
546 {
547 assert(encoded_);
548 assert(blockLength > 0);
549 assert(version != 0);
550 }
551
554 {
555 return (ONIXS_B3_BOE_NULLPTR != encoded_);
556 }
557
560 {
561 return (0 == size_);
562 }
563
566 {
567 return size_;
568 }
569
571 Iterator begin() const
572 {
573 return Iterator(encoded(), blockLength_, version_);
574 }
575
577 Iterator end() const
578 {
579 return Iterator(advanceByBytes(encoded(), encodedLength()), blockLength_, version_);
580 }
581
585 Entry operator [](Size index) const
586 {
587 assert(index < size_);
588 assert(encoded_);
589
590 return Entry(advanceByBytes(encoded_, static_cast<ptrdiff_t>(index) * blockLength_), blockLength_, version_);
591 }
592
595 {
596 return encoded_;
597 }
598
601 {
602 return (static_cast<EncodedLength>(blockLength_) * static_cast<EncodedLength>(size_) );
603 }
604
606 template<class OtherEntry, class OtherBlockLength, class OtherNumInGroup, class OtherLength >
608 : encoded_(other.encoded_)
609 , blockLength_(other.blockLength_)
610 , size_(other.size_)
611 , version_(other.version_)
612 {
613 // Dimension types may vary for the different instantiations of the template.
614 // Therefore, truncation of the dimensions must be avoided.
615
616 assert(blockLength_ == other.blockLength_);
617 assert(size_ == other.size_);
618 }
619
620 template <class OtherEntry, class OtherBlockLength, class OtherNumInGroup, class OtherLength>
621 SbeGroupEntries& operator = (const SbeGroupEntries <OtherEntry, OtherBlockLength, OtherNumInGroup, OtherLength>& other) ONIXS_B3_BOE_NOTHROW
622 {
623 encoded_ = other.encoded_;
624
625 blockLength_ = other.blockLength_;
626
627 assert(blockLength_ == other.blockLength_);
628
629 size_ = other.size_;
630
631 assert(size_ == other.size_);
632
633 version_ = other.version_;
634
635 return *this;
636 }
637
638private:
639 // Allows coping and cloning for different instantiations.
640 template <class OtherEntry, class OtherBlockLength, class OtherNumInGroup, class OtherLength> friend class SbeGroupEntries;
641
642 void* encoded_;
643 BlockLength blockLength_;
644 NumInGroup size_;
645 SchemaVersion version_;
646};
647
649template < class EntryType, class DimensionType, class GroupSizeType >
651{
652public:
654 typedef DimensionType Dimension;
655
657 typedef GroupSizeType BinarySize;
658
661
663 typedef typename DimensionType::BlockLength EntrySize;
664
666 typedef SbeGroupEntries <EntryType, typename Dimension::BlockLength, typename Dimension::NumInGroup, GroupSizeType > Entries;
667
669 typedef typename Entries::Iterator Iterator;
670
672 typedef typename Entries::Entry Entry;
673
675 typedef typename Entries::Size Size;
676
680 : header_(ONIXS_B3_BOE_NULLPTR)
681 , entries_(ONIXS_B3_BOE_NULLPTR)
682 , version_(0)
683 {
684 }
685
689 : header_(static_cast <Dimension*>(data))
690 , entries_(advanceByBytes(data, Dimension::Size))
691 , version_(version)
692 {
693 ONIXS_B3_BOE_ASSERT(size >= Dimension::Size);
694 assert(header_);
695 assert(entries_);
696
697 assert(valid());
698 }
699
702 {
703 return (entries_ != ONIXS_B3_BOE_NULLPTR);
704 }
705
708 {
709 assert(valid());
710
711 return 0 == size();
712 }
713
717 {
718 assert(valid());
719 assert(header_);
720
721 const Dimension* const group = static_cast<const Dimension*>(header_);
722
723 return group->numInGroup();
724 }
725
729 {
730 assert(valid());
731
732 return Iterator(entries_, numericCast<EntrySize>(entrySize()), version_);
733 }
734
738 {
739 assert(valid());
740
741 return Iterator(advanceByBytes(binary(), binarySize()), numericCast<EntrySize>(entrySize()), version_);
742 }
743
748 Entry operator [](Size index) const
749 {
750 assert(valid());
751 assert(index < size());
752
753 return Entry(advanceByBytes(entries_, static_cast<ptrdiff_t>(index) * entrySize()), entrySize(), version_);
754 }
755
759 {
760 assert(valid());
761 assert(header_);
762
763 return Entries (entries_, header_->blockLength(), header_->numInGroup(), version_);
764 }
765
767 const void* encoded() const ONIXS_B3_BOE_NOTHROW
768 {
769 return header_;
770 }
771
773 const void* tail() const ONIXS_B3_BOE_NOTHROW
774 {
775 return advanceByBytes(toByteBlock(encoded()), binarySize());
776 }
777
781 {
782 return header_;
783 }
784
788 {
789 return Dimension::Size + (static_cast<BinarySize>(entrySize()) * static_cast<BinarySize>(size()));
790 }
791
795 {
796 assert(valid());
797 assert(header_);
798
799 Dimension* const group = static_cast<Dimension*>(header_);
800 return group->blockLength();
801 }
802
803private:
805 void init(EntrySize entrySize) ONIXS_B3_BOE_NOTHROW
806 {
807 assert(valid());
808 assert(header_);
809
810 Dimension* const group = static_cast<Dimension*>(header_);
811 group->setBlockLength(entrySize);
812 group->setNumInGroup(0);
813 }
814
816 Size allocate(Size entryCount, const void* messageTail, const void* blockEnd)
817 {
818 assert(valid());
819 assert(blockEnd);
820 assert(messageTail);
821
822 Dimension* const group = static_cast<Dimension*>(header_);
823
824 const EntrySize entrySize = group->blockLength();
825
826 if ONIXS_B3_BOE_UNLIKELY(
827 entrySize < EntryType::blockLength(version_))
828 {
829 throwBadBinaryBlock();
830 }
831
832 const Size oldEntryCount = group->numInGroup();
833
834 if(oldEntryCount == entryCount)
835 return entryCount;
836
837 const ptrdiff_t memShift =
838 (entryCount - oldEntryCount) * static_cast<ptrdiff_t>(entrySize);
839
840 const void* const newMessageTail =
841 advanceByBytes(messageTail, memShift);
842
843 if ONIXS_B3_BOE_UNLIKELY(byteDistance(blockEnd, newMessageTail) < 0)
844 throwNotEnoughSpace();
845
846 const void* const oldEndOfGroup =
847 advanceByBytes(entries_, static_cast<ptrdiff_t>(entrySize) * oldEntryCount);
848
849 void* const newEndGroup =
850 advanceByBytes(entries_, static_cast<ptrdiff_t>(entrySize) * entryCount);
851
852 std::memmove(
853 newEndGroup,
854 oldEndOfGroup,
855 byteDistance(messageTail, oldEndOfGroup));
856
857 group->setNumInGroup(entryCount);
858
859 return oldEntryCount;
860 }
861
864 void setup(Size entryCount, const void* messageTail, const void* blockEnd)
865 {
866 assert(valid());
867 assert(blockEnd);
868 assert(messageTail);
869
870 const Size oldEntryCount = allocate(entryCount, messageTail, blockEnd);
871
872 for(Size index = oldEntryCount; index < entryCount; ++index)
873 zeroPaddingBytes((*this)[index].resetVariableFields());
874 }
875
878 void construct(Size entryCount, const void* messageTail, const void* blockEnd)
879 {
880 assert(valid());
881 assert(blockEnd);
882 assert(messageTail);
883
884 const Size oldEntryCount = allocate(entryCount, messageTail, blockEnd);
885
886 for(Size index = oldEntryCount; index < entryCount; ++index)
887 zeroPaddingBytes((*this)[index].reset());
888 }
889
891 static void zeroPaddingBytes(Entry& entry)
892 {
893 assert(entry.valid());
894 entry.zeroPaddingBytes(EntryType::minimalBlockLength(entry.version()));
895 }
896
897private:
898 Dimension* header_;
899 void* entries_;
900 SchemaVersion version_;
901
902 friend class SbeMessage;
903};
904
906template < class BinarySize >
908{
909public:
912 SbeVariableLengthFieldList(void* binary, BinarySize size, SchemaVersion version) ONIXS_B3_BOE_NOTHROW
913 : binary_(binary)
914 , size_(size)
915 , version_(version)
916 {
917 }
918
921 {
922 return (0 == size_);
923 }
924
926 template<class BinaryVariableLengthFieldType>
927 BinaryVariableLengthFieldType& head() const ONIXS_B3_BOE_NOTHROW
928 {
929 return *static_cast<BinaryVariableLengthFieldType*>(binary_);
930 }
931
933 template<class BinaryVariableLengthFieldType> ONIXS_B3_BOE_HOTPATH
935 {
936 assert(!empty());
937
938 const BinarySize headSize = head<BinaryVariableLengthFieldType>().binarySize();
939
940 assert(headSize <= size_);
941
942 return SbeVariableLengthFieldList(advanceByBytes( binary_, headSize), size_ - headSize, version_);
943 }
944
948 template<class BinaryVariableLengthFieldType> ONIXS_B3_BOE_HOTPATH
950 {
951 if ONIXS_B3_BOE_UNLIKELY(empty() || (size_ < BinaryVariableLengthFieldType::Size))
952 {
953 throwBadBinaryBlock();
954 }
955
956 const BinarySize headSize = head<BinaryVariableLengthFieldType>().binarySize();
957
958 if ONIXS_B3_BOE_UNLIKELY(headSize > size_)
959 {
960 throwBadBinaryBlock();
961 }
962
963 return SbeVariableLengthFieldList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
964 }
965
966 private:
967 void* binary_;
968 BinarySize size_;
969 SchemaVersion version_;
970
971};
972
974template <class BinarySize>
976{
977public:
980 SbeGroupList(void* binary, BinarySize size, SchemaVersion version) ONIXS_B3_BOE_NOTHROW
981 : binary_(binary)
982 , size_(size)
983 , version_(version)
984 {
985 }
986
989 {
990 return (0 == size_);
991 }
992
994 template<class Group> ONIXS_B3_BOE_HOTPATH
996 {
997 assert(!empty());
998
999 return Group(binary_, size_, version_);
1000 }
1001
1003 template<class Group> ONIXS_B3_BOE_HOTPATH
1005 {
1006 assert(!empty());
1007
1008 const BinarySize headSize = head<Group>().binarySize();
1009
1010 assert(headSize <= size_);
1011
1012 return SbeGroupList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1013 }
1014
1016 template <class Group> ONIXS_B3_BOE_HOTPATH
1018 {
1019 assert(!empty());
1020
1021 const BinarySize headSize = head<Group>().binarySize();
1022
1023 assert(headSize <= size_);
1024
1025 return SbeVariableLengthFieldList<BinarySize>(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1026 }
1027
1031 template<class Group> ONIXS_B3_BOE_HOTPATH
1033 {
1034 const BinarySize headSize = checkHead<Group>();
1035
1036 return SbeGroupList(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1037 }
1038
1042 template <class Group> ONIXS_B3_BOE_HOTPATH
1044 {
1045 const BinarySize headSize = checkHead<Group>();
1046
1047 return SbeVariableLengthFieldList<BinarySize>(advanceByBytes(binary_, headSize), size_ - headSize, version_);
1048 }
1049
1050private:
1051 template<class Group>
1052 BinarySize checkHead() const
1053 {
1054 if ONIXS_B3_BOE_UNLIKELY(size_ < Group::Dimension::Size)
1055 {
1056 throwBadBinaryBlock();
1057 }
1058
1059 const Group group = head<Group>();
1060
1061 const BinarySize headSize = group.binarySize();
1062
1063 if ONIXS_B3_BOE_UNLIKELY(headSize > size_)
1064 {
1065 throwBadBinaryBlock();
1066 }
1067
1068 if(!group.empty())
1069 {
1070 const BinarySize entrySize = group.entrySize();
1071 const BinarySize expectedEntrySize = Group::Entry::minimalBlockLength(version_);
1072
1073 if ONIXS_B3_BOE_UNLIKELY(entrySize < expectedEntrySize)
1074 {
1075 throwBadBinaryBlock();
1076 }
1077 }
1078
1079 return headSize;
1080 }
1081
1082 void* binary_;
1083 BinarySize size_;
1084 SchemaVersion version_;
1085};
1086
1088template<typename Traits>
1090{
1091 if ONIXS_B3_BOE_UNLIKELY(version < Traits::MinimalVersion)
1092 {
1093 throwBadMessageVersion(version, Traits::MinimalVersion);
1094 }
1095}
1096
1098template<typename Traits>
1100{
1101 checkVersion<Traits>(version);
1102
1103 if ONIXS_B3_BOE_UNLIKELY(version < since)
1104 {
1105 throwBadMessageVersion(version, since);
1106 }
1107}
1108
1110template<typename Traits>
1112{
1113 if ONIXS_B3_BOE_UNLIKELY(id != Traits::Id)
1114 {
1115 throwBadSchemaId(Traits::Id, id);
1116 }
1117}
1118
1120template<typename Traits>
1122{
1124 checkVersion<Traits>(version);
1125}
1126
1129{
1130public:
1133 struct NoInit{};
1134 struct NoCheck{};
1135
1138
1141
1144 : header_(ONIXS_B3_BOE_NULLPTR)
1145 , size_(0)
1146 {
1147 }
1148
1152 : header_(static_cast<MessageHeader*>(data))
1153 , size_(size)
1154 {
1155 assert(data);
1156 assert(size <= MaxB3BOEMessageSize);
1157
1158 if ONIXS_B3_BOE_UNLIKELY(size < MessageHeader::Size)
1159 throwBinaryBlockIsTooSmall(size, MessageHeader::Size);
1160
1161 this->version(version);
1162 }
1163
1166 SbeMessage(void* data, MessageSize size)
1167 : header_(static_cast<MessageHeader*>(data))
1168 , size_(size)
1169 {
1170 assert(data);
1171 assert(size <= MaxB3BOEMessageSize);
1172
1173 if ONIXS_B3_BOE_UNLIKELY(size < MessageHeader::Size)
1174 throwBinaryBlockIsTooSmall(size, MessageHeader::Size);
1175
1176 // Now it is safe to read header_.
1177 if ONIXS_B3_BOE_UNLIKELY(size < (MessageHeader::Size + header_->blockLength()))
1178 throwBinaryBlockIsTooSmall(size, MessageHeader::Size + header_->blockLength());
1179 }
1180
1186 : header_(static_cast<MessageHeader*>(data))
1187 , size_(size)
1188 {
1189 assert(data);
1190 assert(size <= MaxB3BOEMessageSize);
1191
1192 assert(size >= MessageHeader::Size);
1193 assert(size >= MessageHeader::Size + header_->blockLength());
1194 }
1195
1198 {
1199 *this = SbeMessage();
1200 assert(!valid());
1201 }
1202
1205 {
1206 return (ONIXS_B3_BOE_NULLPTR != header_);
1207 }
1208
1211 {
1212 assert(valid());
1213
1214 return header_->templateId();
1215 }
1216
1219 {
1220 assert(valid());
1221
1222 return header_->version();
1223 }
1224
1227 {
1228 assert(valid());
1229
1230 return header_->schemaId();
1231 }
1232
1234 const void* binary() const ONIXS_B3_BOE_NOTHROW
1235 {
1236 assert(valid());
1237
1238 return header_;
1239 }
1240
1243 {
1244 assert(valid());
1245
1246 return header_;
1247 }
1248
1249 // \return the end of the memory block.
1251 {
1252 assert(valid());
1253
1254 return advanceByBytes(header_, size_);
1255 }
1256
1257 // \return the end of the memory block.
1258 const void* blockEnd() const ONIXS_B3_BOE_NOTHROW
1259 {
1260 assert(valid());
1261
1262 return advanceByBytes(header_, size_);
1263 }
1264
1267 {
1268 return size_;
1269 }
1270
1273 {
1274 assert(valid());
1275
1276 return advanceByBytes(header_, MessageHeader::Size);
1277 }
1278
1281 {
1282 assert(valid());
1283
1284 return header_->blockLength();
1285 }
1286
1288 const void* block() const ONIXS_B3_BOE_NOTHROW
1289 {
1290 assert(valid());
1291
1292 return advanceByBytes(header_, MessageHeader::Size);
1293 }
1294
1297 {
1298 assert(valid());
1299
1300 return advanceByBytes(header_, MessageHeader::Size);
1301 }
1302
1303protected:
1306
1309 {
1310 assert(valid());
1311
1312 header_->setVersion(version);
1313
1314 return *this;
1315 }
1316
1320 {
1321 assert(header_);
1322
1323 void* list = advanceByBytes<void>(body(), blockLength());
1324
1325 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
1326
1327 return GroupList(list, listSize, header_->version());
1328 }
1329
1333 {
1334 assert(header_);
1335
1336 const void* list = advanceByBytes(block(), blockLength());
1337
1338 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
1339
1340 return GroupList(const_cast<void*>(list), listSize, header_->version());
1341 }
1342
1344 template<typename Group>
1346 void initGroup(Group& group, typename Group::EntrySize entrySize) ONIXS_B3_BOE_NOTHROW
1347 {
1348 assert(group.valid());
1349 group.init(entrySize);
1350 }
1351
1353 template<typename Group>
1355 void setupGroup(Group& group, typename Group::Size entryCount, const void* messageTail)
1356 {
1357 assert(messageTail);
1358 assert(group.valid());
1359 group.setup(entryCount, messageTail, blockEnd());
1360 }
1361
1363 template<typename Group>
1365 void constructGroup(Group& group, typename Group::Size entryCount, const void* messageTail)
1366 {
1367 assert(messageTail);
1368 assert(group.valid());
1369 group.construct(entryCount, messageTail, blockEnd());
1370 }
1371
1373 template<typename DATA>
1374 void setVarDataField(DATA& data, StrRef value, const void* oldMessageTail)
1375 {
1376 assert(oldMessageTail);
1377
1378 const ptrdiff_t lengthChange = static_cast<ptrdiff_t>(value.length() - data.length());
1379
1380 const void* const newMessageTail = advanceByBytes(oldMessageTail, lengthChange);
1381
1382 if ONIXS_B3_BOE_UNLIKELY(byteDistance(blockEnd(), newMessageTail) < 0)
1383 throwNotEnoughSpace();
1384
1385 const void* const oldEndOfData = advanceByBytes(data.varData().data(), data.varData().size());
1386
1387 void* const newEndOfData = toOpaquePtr(advanceByBytes(&data, value.length() + DATA::Size));
1388
1389 std::memmove(newEndOfData, oldEndOfData, byteDistance(oldMessageTail, oldEndOfData));
1390
1391 data.varData(value);
1392 }
1393
1396
1400 {
1401 assert(header_);
1402
1403 void* list = advanceByBytes<void>(body(), blockLength());
1404
1405 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
1406
1407 return VariableLengthFieldList(list, listSize, header_->version());
1408 }
1409
1413 {
1414 assert(header_);
1415
1416 const void* list = advanceByBytes(block(), blockLength());
1417
1418 const MessageSize listSize = size_ - MessageHeader::Size - header_->blockLength();
1419
1420 return VariableLengthFieldList(const_cast<void*>(list), listSize, header_->version());
1421 }
1422
1424 void init(
1426 MessageHeader::BlockLength minimalBlockLength,
1429 {
1430 assert(header_);
1431 assert(blockLength >= minimalBlockLength);
1432
1433 header_->setTemplateId(value);
1434 header_->setBlockLength(blockLength);
1435 header_->setSchemaId(id);
1436
1437 zeroPaddingBytes(minimalBlockLength);
1438 }
1439
1442 {
1443 assert(tail);
1444
1445 const ptrdiff_t distance = byteDistance(tail, binary());
1446
1447 assert(distance > 0);
1448
1449 assert(distance <= (std::numeric_limits<MessageSize>::max)());
1450
1451 const MessageSize size = static_cast<MessageSize>(distance);
1452
1453 assert(size <= size_);
1454
1455 return size;
1456 }
1457
1459 template<class Callable, class Owner>
1460 void setVariableLengthField(Callable callable, StrRef value, Owner& owner)
1461 {
1462 setVarDataField(callable(owner), value, owner.tail());
1463 }
1464
1466 template<class Callable, class Owner>
1467 void setVariableLengthField(Callable callable, StrRef value, SchemaVersion since, Owner& owner)
1468 {
1469 if ONIXS_B3_BOE_UNLIKELY(since > version())
1470 throwDisallowedField();
1471
1472 setVariableLengthField(callable, value, owner);
1473 }
1474
1476 template<class Callable, class Owner>
1477 StrRef getVariableLengthField(Callable callable, const Owner& owner) const ONIXS_B3_BOE_NOTHROW
1478 {
1479 ONIXS_B3_BOE_CHECK_NOTHROW(callable(owner));
1480 return callable(owner).varData();
1481 }
1482
1484 template<class Callable, class Owner>
1485 StrRef getVariableLengthField(Callable callable, SchemaVersion since, Owner& owner) const ONIXS_B3_BOE_NOTHROW
1486 {
1487 if ONIXS_B3_BOE_UNLIKELY(since > version())
1488 return StrRef();
1489
1490 return getVariableLengthField(callable, owner);
1491 }
1492
1494 template<class Callable, class Owner>
1495 void setVariableLengthFieldToNull(Callable callable, Owner& owner) ONIXS_B3_BOE_NOTHROW
1496 {
1497 ONIXS_B3_BOE_CHECK_NOTHROW(callable(owner));
1498 callable(owner).length(0);
1499 }
1500
1502 template<class Group, class Callable, class Owner>
1503 void resetGroup(Callable callable, Owner& owner) ONIXS_B3_BOE_NOTHROW
1504 {
1505 const typename Group::EntrySize entrySize = Group::Entry::blockLength(version());
1506
1507 Group grp = callable(owner);
1508
1509 initGroup(grp, entrySize);
1510 }
1511
1513 template<class Callable, class Owner>
1514 void setVariableLengthFieldToNull(Callable callable, SchemaVersion since, Owner& owner) ONIXS_B3_BOE_NOTHROW
1515 {
1516 if ONIXS_B3_BOE_UNLIKELY(since > version())
1517 return;
1518
1519 setVariableLengthFieldToNull(callable, owner);
1520 }
1521
1523 template<class Group, class Callable, class Owner>
1524 void resetGroup(Callable callable, SchemaVersion since, Owner& owner)
1525 {
1526 if ONIXS_B3_BOE_UNLIKELY(since > version())
1527 return;
1528
1529 resetGroup<Group>(callable, owner);
1530 }
1531
1533 template<class Group, class Callable, class Owner>
1534 Group getGroup(Callable callable, Owner& owner) const ONIXS_B3_BOE_NOTHROW
1535 {
1536 ONIXS_B3_BOE_CHECK_NOTHROW(callable(owner));
1537 return callable(owner);
1538 }
1539
1541 template<class Group, class Callable, class Owner>
1542 Group getGroup(Callable callable, SchemaVersion since, Owner& owner) const ONIXS_B3_BOE_NOTHROW
1543 {
1544 if ONIXS_B3_BOE_UNLIKELY(since > version())
1545 return Group();
1546
1547 return getGroup<Group>(callable, owner);
1548 }
1549
1551 template<class Group, class Callable, class Owner>
1552 Group constructGroup(Callable callable, typename Group::Size length, SchemaVersion since, Owner& owner)
1553 {
1554 if ONIXS_B3_BOE_UNLIKELY(since > version())
1555 return Group();
1556
1557 return constructGroup<Group>(callable, length, owner);
1558 }
1559
1561 template<class Group, class Callable, class Owner>
1562 Group constructGroup(Callable callable, typename Group::Size length, Owner& owner)
1563 {
1564 Group group = callable(owner);
1565
1566 constructGroup(group, length, owner.tail());
1567
1568 return group;
1569 }
1570
1572 template<class Group, class Callable, class Owner>
1573 Group setupGroup(Callable callable, typename Group::Size length, SchemaVersion since, Owner& owner)
1574 {
1575 if ONIXS_B3_BOE_UNLIKELY(since > version())
1576 return Group();
1577
1578 return setupGroup<Group>(callable, length, owner);
1579 }
1580
1582 template<class Group, class Callable, class Owner>
1583 Group setupGroup(Callable callable, typename Group::Size length, Owner& owner)
1584 {
1585 Group group = callable(owner);
1586
1587 setupGroup(group, length, owner.tail());
1588
1589 return group;
1590 }
1591
1601
1602private:
1603 MessageHeader* header_;
1604 MessageSize size_;
1605};
1606
#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:170
bool fixedStr(StrRef &value, BlockLength offset) const noexcept
Definition SbeMessage.h:202
Value ordinary(BlockLength offset) const noexcept
Definition SbeMessage.h:80
Value & accessOrdinary(BlockLength offset) noexcept
Definition SbeMessage.h:103
const Value & accessOrdinary(BlockLength offset) const noexcept
Definition SbeMessage.h:91
bool fixedStr(StrRef &value, BlockLength offset, SchemaVersion since) const noexcept
Definition SbeMessage.h:213
bool ordinary(Value &value, BlockLength offset, NullValue null) const noexcept
Definition SbeMessage.h:113
bool decimal(Value &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Definition SbeMessage.h:181
Value decimal(BlockLength offset) const noexcept
Definition SbeMessage.h:160
Enumeration::Enum enumeration(BlockLength offset) const noexcept
Definition SbeMessage.h:132
bool enumeration(typename Enumeration::Enum &value, BlockLength offset, NullValue null) const noexcept
Provides access to an optional field value.
Definition SbeMessage.h:142
BinaryBlock()=default
Initializes a blank instance.
bool ordinary(Value &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Definition SbeMessage.h:125
StrRef fixedStr(BlockLength offset) const noexcept
Provides access to a string field value.
Definition SbeMessage.h:188
bool enumeration(typename Enumeration::Enum &value, BlockLength offset, NullValue null, SchemaVersion since) const noexcept
Provides access to an optional field value.
Definition SbeMessage.h:153
NumInGroup numInGroup() const noexcept
Definition Composites.h:159
BlockLength blockLength() const noexcept
Root block length.
Definition Composites.h:142
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:228
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:235
void setFixedStr(BlockLength offset, StrRef value) noexcept
Sets the field value.
Definition SbeMessage.h:283
void setOrdinary(BlockLength offset, FieldValue value, SchemaVersion since)
Sets the field value.
Definition SbeMessage.h:257
void setEnumeration(BlockLength offset, typename Enumeration::Enum value, SchemaVersion since)
Sets the field value.
Definition SbeMessage.h:275
void setEnumeration(BlockLength offset, typename Enumeration::Enum value) noexcept
Sets the field value.
Definition SbeMessage.h:267
void setOrdinary(BlockLength offset, FieldValue value) noexcept
Sets the field value.
Definition SbeMessage.h:247
void setFixedStr(BlockLength offset, StrRef value, SchemaVersion since)
Sets the field value.
Definition SbeMessage.h:299
std::random_access_iterator_tag iterator_category
Definition SbeMessage.h:422
Iterator() noexcept
Initializes the instance that refers to nothing.
Definition SbeMessage.h:425
Iterator(void *entry, EncodedLength size, SchemaVersion version) noexcept
Initializes the instance to the given repeating group.
Definition SbeMessage.h:434
SbeGroupEntries() noexcept
Initializes a blank instance referencing to nothing.
Definition SbeMessage.h:532
SbeGroupEntries(void *encoded, BlockLength blockLength, Size groupSize, SchemaVersion version) noexcept
Initializes the instance referencing to data.
Definition SbeMessage.h:541
EntryType Entry
The type of the repeating group entry.
Definition SbeMessage.h:405
Iterator end() const
Returns the iterator pointing to the entry behind the end of the group.
Definition SbeMessage.h:577
SbeGroupEntries(const SbeGroupEntries< OtherEntry, OtherBlockLength, OtherNumInGroup, OtherLength > &other) noexcept
Copy constructor.
Definition SbeMessage.h:607
Length EncodedLength
The length of the binary data occupied by the group entries.
Definition SbeMessage.h:402
NumInGroup Size
Number of entries in the collection.
Definition SbeMessage.h:408
SbeGroupEntry()
Initializes a blank instance.
Definition SbeMessage.h:323
const void * block() const noexcept
Definition SbeMessage.h:363
SbeGroupEntry(void *encoded, BlockLength size, SchemaVersion version)
Initializes the instance from the memory block of the encoded message.
Definition SbeMessage.h:332
BlockLength blockLength() const noexcept
Definition SbeMessage.h:379
BodySizeType BlockLength
Type to present the length of binary data of the repeating group entry.
Definition SbeMessage.h:320
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:980
const void * tail() const noexcept
Definition SbeMessage.h:773
SbeGroup() noexcept
Initializes a blank instance referencing to nothing.
Definition SbeMessage.h:678
Entries::Size Size
Number of entries in the group.
Definition SbeMessage.h:675
GroupSizeType BinarySize
Length of group data.
Definition SbeMessage.h:657
DimensionType::BlockLength EntrySize
Length of group entry data.
Definition SbeMessage.h:663
SbeGroup(void *data, BinarySize size, SchemaVersion version) noexcept
Initializes an instance referencing to a valid group of a given message.
Definition SbeMessage.h:688
Entries::Iterator Iterator
The iterator type for group entries.
Definition SbeMessage.h:669
Entries::Entry Entry
Group entry type.
Definition SbeMessage.h:672
Entries entries() const noexcept
Definition SbeMessage.h:758
Iterator end() const noexcept
Definition SbeMessage.h:737
const void * encoded() const noexcept
Definition SbeMessage.h:767
SbeGroupEntries< EntryType, typename Dimension::BlockLength, typename Dimension::NumInGroup, GroupSizeType > Entries
Binary group blocks.
Definition SbeMessage.h:666
DimensionType Dimension
Repeating group dimension type.
Definition SbeMessage.h:654
Iterator begin() const noexcept
Definition SbeMessage.h:728
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:912
SbeVariableLengthFieldList tail() const noexcept
Definition SbeMessage.h:934
BinaryVariableLengthFieldType & head() const noexcept
Definition SbeMessage.h:927
SbeVariableLengthFieldList checkTail() const
Checks the variable-length field list consistency.
Definition SbeMessage.h:949
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.