Zserio C++17 runtime library  0.5.0
Built for Zserio 2.17.0
TypeInfo.h
Go to the documentation of this file.
1 #ifndef ZSERIO_TYPE_INFO_INC_H
2 #define ZSERIO_TYPE_INFO_INC_H
3 
4 #include <algorithm>
5 #include <memory>
6 #include <string>
7 #include <string_view>
8 
9 #include "zserio/BitBuffer.h"
10 #include "zserio/Bytes.h"
12 #include "zserio/ITypeInfo.h"
13 #include "zserio/String.h"
14 
15 #include "Types.h"
16 
17 namespace zserio
18 {
19 
20 namespace detail
21 {
22 
29 template <typename ALLOC>
30 class TypeInfoBase : public IBasicTypeInfo<ALLOC>
31 {
32 public:
40  TypeInfoBase(std::string_view schemaName, SchemaType schemaType, CppType cppType);
41 
46  TypeInfoBase(const TypeInfoBase&) = delete;
47  TypeInfoBase& operator=(const TypeInfoBase&) = delete;
48 
49  TypeInfoBase(const TypeInfoBase&&) = delete;
50  TypeInfoBase& operator=(const TypeInfoBase&&) = delete;
55  ~TypeInfoBase() override = 0;
56 
57  std::string_view getSchemaName() const override;
58  SchemaType getSchemaType() const override;
59  CppType getCppType() const override;
60  uint8_t getBitSize() const override;
61 
62  Span<const BasicFieldInfo<ALLOC>> getFields() const override;
63  Span<const BasicParameterInfo<ALLOC>> getParameters() const override;
64  Span<const BasicFunctionInfo<ALLOC>> getFunctions() const override;
65 
66  std::string_view getSelector() const override;
67  Span<const BasicCaseInfo<ALLOC>> getCases() const override;
68 
69  const IBasicTypeInfo<ALLOC>& getUnderlyingType() const override;
70  Span<const ItemInfo> getEnumItems() const override;
71  Span<const ItemInfo> getBitmaskValues() const override;
72 
73  Span<const BasicColumnInfo<ALLOC>> getColumns() const override;
74  std::string_view getSqlConstraint() const override;
75  std::string_view getVirtualTableUsing() const override;
76  bool isWithoutRowId() const override;
77 
78  Span<const BasicTableInfo<ALLOC>> getTables() const override;
79 
80  std::string_view getTemplateName() const override;
81  Span<const BasicTemplateArgumentInfo<ALLOC>> getTemplateArguments() const override;
82 
83  Span<const BasicMessageInfo<ALLOC>> getMessages() const override;
84  Span<const BasicMethodInfo<ALLOC>> getMethods() const override;
85 
86  IBasicReflectableDataPtr<ALLOC> createInstance(const ALLOC& allocator) const override;
87  IBasicReflectableDataPtr<ALLOC> createInstance() const override;
88 
89 private:
90  std::string_view m_schemaName;
91  SchemaType m_schemaType;
92  CppType m_cppType;
93 };
94 
98 template <typename ALLOC = std::allocator<uint8_t>>
99 class BuiltinTypeInfo : public TypeInfoBase<ALLOC>
100 {
101 public:
109  BuiltinTypeInfo(std::string_view schemaName, SchemaType schemaType, CppType cppType);
110 
111  template <typename T>
112  static const BuiltinTypeInfo& getDynamicBitField();
113 };
114 
118 template <typename ALLOC>
119 class FixedSizeBuiltinTypeInfo : public BuiltinTypeInfo<ALLOC>
120 {
121 public:
130  FixedSizeBuiltinTypeInfo(
131  std::string_view schemaName, SchemaType schemaType, CppType cppType, uint8_t bitSize);
132 
133  uint8_t getBitSize() const override;
134 
135  template <BitSize BIT_SIZE, bool IS_SIGNED>
136  static const FixedSizeBuiltinTypeInfo& getFixedBitField();
137 
138 private:
139  uint8_t m_bitSize;
140 };
141 
145 template <typename ALLOC>
146 class TemplatableTypeInfoBase : public TypeInfoBase<ALLOC>
147 {
148 public:
158  TemplatableTypeInfoBase(std::string_view schemaName, SchemaType schemaType, CppType cppType,
159  std::string_view templateName, Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments);
160 
161  ~TemplatableTypeInfoBase() override = 0;
162 
163  TemplatableTypeInfoBase(const TemplatableTypeInfoBase&) = default;
164  TemplatableTypeInfoBase& operator=(const TemplatableTypeInfoBase&) = default;
165 
166  TemplatableTypeInfoBase(TemplatableTypeInfoBase&&) = default;
167  TemplatableTypeInfoBase& operator=(TemplatableTypeInfoBase&&) = default;
168 
169  std::string_view getTemplateName() const override;
170  Span<const BasicTemplateArgumentInfo<ALLOC>> getTemplateArguments() const override;
171 
172 private:
173  std::string_view m_templateName;
174  Span<const BasicTemplateArgumentInfo<ALLOC>> m_templateArguments;
175 };
176 
180 template <typename ALLOC>
181 class CompoundTypeInfoBase : public TemplatableTypeInfoBase<ALLOC>
182 {
183 public:
184  using TypeInfoBase<ALLOC>::getSchemaName;
185  using CreateInstanceFunc = IBasicReflectableDataPtr<ALLOC> (*)(const ALLOC&);
186 
199  CompoundTypeInfoBase(std::string_view schemaName, CreateInstanceFunc createInstanceFunc,
200  SchemaType schemaType, CppType cppType, std::string_view templateName,
201  Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
202  Span<const BasicFieldInfo<ALLOC>> fields, Span<const BasicParameterInfo<ALLOC>> parameters,
203  Span<const BasicFunctionInfo<ALLOC>> functions);
204 
205  ~CompoundTypeInfoBase() override = 0;
206 
207  CompoundTypeInfoBase(const CompoundTypeInfoBase&) = default;
208  CompoundTypeInfoBase& operator=(const CompoundTypeInfoBase&) = default;
209 
210  CompoundTypeInfoBase(CompoundTypeInfoBase&&) = default;
211  CompoundTypeInfoBase& operator=(CompoundTypeInfoBase&&) = default;
212 
213  Span<const BasicFieldInfo<ALLOC>> getFields() const override;
214  Span<const BasicParameterInfo<ALLOC>> getParameters() const override;
215  Span<const BasicFunctionInfo<ALLOC>> getFunctions() const override;
216 
217  IBasicReflectableDataPtr<ALLOC> createInstance(const ALLOC& allocator) const override;
218 
219 private:
220  CreateInstanceFunc m_createInstanceFunc;
221  Span<const BasicFieldInfo<ALLOC>> m_fields;
222  Span<const BasicParameterInfo<ALLOC>> m_parameters;
223  Span<const BasicFunctionInfo<ALLOC>> m_functions;
224 };
225 
229 template <typename ALLOC>
230 class StructTypeInfo : public detail::CompoundTypeInfoBase<ALLOC>
231 {
232 public:
233  using CreateInstanceFunc = typename CompoundTypeInfoBase<ALLOC>::CreateInstanceFunc;
234 
245  StructTypeInfo(std::string_view schemaName, CreateInstanceFunc createInstanceFunc,
246  std::string_view templateName, Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
247  Span<const BasicFieldInfo<ALLOC>> fields, Span<const BasicParameterInfo<ALLOC>> parameters,
248  Span<const BasicFunctionInfo<ALLOC>> functions);
249 };
250 
254 template <typename ALLOC>
255 class UnionTypeInfo : public CompoundTypeInfoBase<ALLOC>
256 {
257 public:
258  using CreateInstanceFunc = typename CompoundTypeInfoBase<ALLOC>::CreateInstanceFunc;
259 
270  UnionTypeInfo(std::string_view schemaName, CreateInstanceFunc createInstanceFunc,
271  std::string_view templateName, Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
272  Span<const BasicFieldInfo<ALLOC>> fields, Span<const BasicParameterInfo<ALLOC>> parameters,
273  Span<const BasicFunctionInfo<ALLOC>> functions);
274 };
275 
279 template <typename ALLOC>
280 class ChoiceTypeInfo : public CompoundTypeInfoBase<ALLOC>
281 {
282 public:
283  using CreateInstanceFunc = typename CompoundTypeInfoBase<ALLOC>::CreateInstanceFunc;
284 
297  ChoiceTypeInfo(std::string_view schemaName, CreateInstanceFunc createInstanceFunc,
298  std::string_view templateName, Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
299  Span<const BasicFieldInfo<ALLOC>> fields, Span<const BasicParameterInfo<ALLOC>> parameters,
300  Span<const BasicFunctionInfo<ALLOC>> functions, std::string_view selector,
301  Span<const BasicCaseInfo<ALLOC>> cases);
302 
303  std::string_view getSelector() const override;
304  Span<const BasicCaseInfo<ALLOC>> getCases() const override;
305 
306 private:
307  std::string_view m_selector;
308  Span<const BasicCaseInfo<ALLOC>> m_cases;
309 };
310 
314 template <typename ALLOC>
315 class TypeInfoWithUnderlyingTypeBase : public TypeInfoBase<ALLOC>
316 {
317 public:
326  TypeInfoWithUnderlyingTypeBase(std::string_view schemaName, SchemaType schemaType, CppType cppType,
327  const IBasicTypeInfo<ALLOC>& underlyingType);
328 
329  const IBasicTypeInfo<ALLOC>& getUnderlyingType() const override;
330 
331 private:
332  const IBasicTypeInfo<ALLOC>& m_underlyingType;
333 };
334 
338 template <typename ALLOC>
339 class EnumTypeInfo : public TypeInfoWithUnderlyingTypeBase<ALLOC>
340 {
341 public:
349  EnumTypeInfo(std::string_view schemaName, const IBasicTypeInfo<ALLOC>& underlyingType,
350  Span<const ItemInfo> enumItems);
351 
352  Span<const ItemInfo> getEnumItems() const override;
353 
354 private:
355  Span<const ItemInfo> m_enumItems;
356 };
357 
361 template <typename ALLOC>
362 class BitmaskTypeInfo : public TypeInfoWithUnderlyingTypeBase<ALLOC>
363 {
364 public:
372  BitmaskTypeInfo(std::string_view schemaName, const IBasicTypeInfo<ALLOC>& underlyingType,
373  Span<const ItemInfo> bitmaskValues);
374 
375  Span<const ItemInfo> getBitmaskValues() const override;
376 
377 private:
378  Span<const ItemInfo> m_bitmaskValues;
379 };
380 
384 template <typename ALLOC>
385 class SqlTableTypeInfo : public TemplatableTypeInfoBase<ALLOC>
386 {
387 public:
399  SqlTableTypeInfo(std::string_view schemaName, std::string_view templateName,
400  Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
401  Span<const BasicColumnInfo<ALLOC>> columns, std::string_view sqlConstraint,
402  std::string_view virtualTableUsing, bool isWithoutRowId);
403 
404  Span<const BasicColumnInfo<ALLOC>> getColumns() const override;
405  std::string_view getSqlConstraint() const override;
406  std::string_view getVirtualTableUsing() const override;
407  bool isWithoutRowId() const override;
408 
409 private:
410  Span<const BasicColumnInfo<ALLOC>> m_columns;
411  std::string_view m_sqlConstraint;
412  std::string_view m_virtualTableUsing;
413  bool m_isWithoutRowId;
414 };
415 
419 template <typename ALLOC>
420 class SqlDatabaseTypeInfo : public TypeInfoBase<ALLOC>
421 {
422 public:
429  SqlDatabaseTypeInfo(std::string_view schemaName, Span<const BasicTableInfo<ALLOC>> tables);
430 
431  Span<const BasicTableInfo<ALLOC>> getTables() const override;
432 
433 private:
434  Span<const BasicTableInfo<ALLOC>> m_tables;
435 };
436 
440 template <typename ALLOC>
441 class PubsubTypeInfo : public TypeInfoBase<ALLOC>
442 {
443 public:
450  PubsubTypeInfo(std::string_view schemaName, Span<const BasicMessageInfo<ALLOC>> messages);
451 
452  Span<const BasicMessageInfo<ALLOC>> getMessages() const override;
453 
454 private:
455  Span<const BasicMessageInfo<ALLOC>> m_messages;
456 };
457 
461 template <typename ALLOC>
462 class ServiceTypeInfo : public TypeInfoBase<ALLOC>
463 {
464 public:
471  ServiceTypeInfo(std::string_view schemaName, Span<const BasicMethodInfo<ALLOC>> methods);
472 
473  Span<const BasicMethodInfo<ALLOC>> getMethods() const override;
474 
475 private:
476  Span<const BasicMethodInfo<ALLOC>> m_methods;
477 };
478 
483 template <typename ALLOC>
484 class RecursiveTypeInfo : public IBasicTypeInfo<ALLOC>
485 {
486 public:
488  using TypeInfoFunc = const IBasicTypeInfo<ALLOC>& (*)();
489 
495  explicit RecursiveTypeInfo(TypeInfoFunc typeInfoFunc) :
496  m_typeInfoFunc(typeInfoFunc)
497  {}
498 
499  ~RecursiveTypeInfo() override = default;
500 
505  RecursiveTypeInfo(const RecursiveTypeInfo&) = delete;
506  RecursiveTypeInfo& operator=(const RecursiveTypeInfo&) = delete;
507 
508  RecursiveTypeInfo(const RecursiveTypeInfo&&) = delete;
509  RecursiveTypeInfo& operator=(const RecursiveTypeInfo&&) = delete;
514  std::string_view getSchemaName() const override;
515  SchemaType getSchemaType() const override;
516  CppType getCppType() const override;
517  uint8_t getBitSize() const override;
518 
519  Span<const BasicFieldInfo<ALLOC>> getFields() const override;
520  Span<const BasicParameterInfo<ALLOC>> getParameters() const override;
521  Span<const BasicFunctionInfo<ALLOC>> getFunctions() const override;
522 
523  std::string_view getSelector() const override;
524  Span<const BasicCaseInfo<ALLOC>> getCases() const override;
525 
526  const IBasicTypeInfo<ALLOC>& getUnderlyingType() const override;
527  Span<const ItemInfo> getEnumItems() const override;
528  Span<const ItemInfo> getBitmaskValues() const override;
529 
530  Span<const BasicColumnInfo<ALLOC>> getColumns() const override;
531  std::string_view getSqlConstraint() const override;
532  std::string_view getVirtualTableUsing() const override;
533  bool isWithoutRowId() const override;
534 
535  Span<const BasicTableInfo<ALLOC>> getTables() const override;
536 
537  std::string_view getTemplateName() const override;
538  Span<const BasicTemplateArgumentInfo<ALLOC>> getTemplateArguments() const override;
539 
540  Span<const BasicMessageInfo<ALLOC>> getMessages() const override;
541  Span<const BasicMethodInfo<ALLOC>> getMethods() const override;
542 
543  IBasicReflectableDataPtr<ALLOC> createInstance(const ALLOC& allocator) const override;
544  IBasicReflectableDataPtr<ALLOC> createInstance() const override;
545 
546 private:
547  TypeInfoFunc m_typeInfoFunc;
548 };
549 
550 template <typename ALLOC>
551 TypeInfoBase<ALLOC>::TypeInfoBase(std::string_view schemaName, SchemaType schemaType, CppType cppType) :
552  m_schemaName(schemaName),
553  m_schemaType(schemaType),
554  m_cppType(cppType)
555 {}
556 
557 template <typename ALLOC>
558 TypeInfoBase<ALLOC>::~TypeInfoBase() = default;
559 
560 template <typename ALLOC>
561 std::string_view TypeInfoBase<ALLOC>::getSchemaName() const
562 {
563  return m_schemaName;
564 }
565 
566 template <typename ALLOC>
567 SchemaType TypeInfoBase<ALLOC>::getSchemaType() const
568 {
569  return m_schemaType;
570 }
571 
572 template <typename ALLOC>
573 CppType TypeInfoBase<ALLOC>::getCppType() const
574 {
575  return m_cppType;
576 }
577 
578 template <typename ALLOC>
579 uint8_t TypeInfoBase<ALLOC>::getBitSize() const
580 {
581  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a fixed size type!";
582 }
583 
584 template <typename ALLOC>
585 Span<const BasicFieldInfo<ALLOC>> TypeInfoBase<ALLOC>::getFields() const
586 {
587  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a compound type!";
588 }
589 
590 template <typename ALLOC>
591 Span<const BasicParameterInfo<ALLOC>> TypeInfoBase<ALLOC>::getParameters() const
592 {
593  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a compound type!";
594 }
595 
596 template <typename ALLOC>
597 Span<const BasicFunctionInfo<ALLOC>> TypeInfoBase<ALLOC>::getFunctions() const
598 {
599  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a compound type!";
600 }
601 
602 template <typename ALLOC>
603 std::string_view TypeInfoBase<ALLOC>::getSelector() const
604 {
605  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a choice type!";
606 }
607 
608 template <typename ALLOC>
609 Span<const BasicCaseInfo<ALLOC>> TypeInfoBase<ALLOC>::getCases() const
610 {
611  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a choice type!";
612 }
613 
614 template <typename ALLOC>
615 const IBasicTypeInfo<ALLOC>& TypeInfoBase<ALLOC>::getUnderlyingType() const
616 {
617  throw CppRuntimeException("Type '") << getSchemaName() << "' does not have underlying type!";
618 }
619 
620 template <typename ALLOC>
621 Span<const ItemInfo> TypeInfoBase<ALLOC>::getEnumItems() const
622 {
623  throw CppRuntimeException("Type '") << getSchemaName() << "' is not an enum type!";
624 }
625 
626 template <typename ALLOC>
627 Span<const ItemInfo> TypeInfoBase<ALLOC>::getBitmaskValues() const
628 {
629  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a bitmask type!";
630 }
631 
632 template <typename ALLOC>
633 Span<const BasicColumnInfo<ALLOC>> TypeInfoBase<ALLOC>::getColumns() const
634 {
635  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a SQL table type!";
636 }
637 
638 template <typename ALLOC>
639 std::string_view TypeInfoBase<ALLOC>::getSqlConstraint() const
640 {
641  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a SQL table type!";
642 }
643 
644 template <typename ALLOC>
645 std::string_view TypeInfoBase<ALLOC>::getVirtualTableUsing() const
646 {
647  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a SQL table type!";
648 }
649 
650 template <typename ALLOC>
651 bool TypeInfoBase<ALLOC>::isWithoutRowId() const
652 {
653  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a SQL table type!";
654 }
655 
656 template <typename ALLOC>
657 Span<const BasicTableInfo<ALLOC>> TypeInfoBase<ALLOC>::getTables() const
658 {
659  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a SQL database type!";
660 }
661 
662 template <typename ALLOC>
663 std::string_view TypeInfoBase<ALLOC>::getTemplateName() const
664 {
665  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a templatable type!";
666 }
667 
668 template <typename ALLOC>
669 Span<const BasicTemplateArgumentInfo<ALLOC>> TypeInfoBase<ALLOC>::getTemplateArguments() const
670 {
671  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a templatable type!";
672 }
673 
674 template <typename ALLOC>
675 Span<const BasicMessageInfo<ALLOC>> TypeInfoBase<ALLOC>::getMessages() const
676 {
677  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a pubsub type!";
678 }
679 
680 template <typename ALLOC>
681 Span<const BasicMethodInfo<ALLOC>> TypeInfoBase<ALLOC>::getMethods() const
682 {
683  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a service type!";
684 }
685 
686 template <typename ALLOC>
687 IBasicReflectableDataPtr<ALLOC> TypeInfoBase<ALLOC>::createInstance(const ALLOC&) const
688 {
689  throw CppRuntimeException("Type '") << getSchemaName() << "' is not a compound type!";
690 }
691 
692 template <typename ALLOC>
693 IBasicReflectableDataPtr<ALLOC> TypeInfoBase<ALLOC>::createInstance() const
694 {
695  return createInstance(ALLOC());
696 }
697 
698 template <typename ALLOC>
699 BuiltinTypeInfo<ALLOC>::BuiltinTypeInfo(std::string_view schemaName, SchemaType schemaType, CppType cppType) :
700  TypeInfoBase<ALLOC>(schemaName, schemaType, cppType)
701 {}
702 
703 template <typename ALLOC>
704 template <typename T>
705 const BuiltinTypeInfo<ALLOC>& BuiltinTypeInfo<ALLOC>::getDynamicBitField()
706 {
707  static constexpr BitSize maxBitSize = sizeof(T) * 8;
708 
709  static_assert(maxBitSize <= 64, "Max bit size out of range!");
710 
711  if constexpr (std::is_signed_v<T>)
712  {
713  if (maxBitSize <= 8)
714  {
715  static const BuiltinTypeInfo<ALLOC> typeInfo = {
716  "int<>", SchemaType::DYNAMIC_SIGNED_BITFIELD, CppType::INT8};
717  return typeInfo;
718  }
719  else if (maxBitSize <= 16)
720  {
721  static const BuiltinTypeInfo<ALLOC> typeInfo = {
722  "int<>", SchemaType::DYNAMIC_SIGNED_BITFIELD, CppType::INT16};
723  return typeInfo;
724  }
725  else if (maxBitSize <= 32)
726  {
727  static const BuiltinTypeInfo<ALLOC> typeInfo = {
728  "int<>", SchemaType::DYNAMIC_SIGNED_BITFIELD, CppType::INT32};
729  return typeInfo;
730  }
731  else
732  {
733  static const BuiltinTypeInfo<ALLOC> typeInfo = {
734  "int<>", SchemaType::DYNAMIC_SIGNED_BITFIELD, CppType::INT64};
735  return typeInfo;
736  }
737  }
738  else
739  {
740  if (maxBitSize <= 8)
741  {
742  static const BuiltinTypeInfo<ALLOC> typeInfo = {
743  "bit<>", SchemaType::DYNAMIC_UNSIGNED_BITFIELD, CppType::UINT8};
744  return typeInfo;
745  }
746  else if (maxBitSize <= 16)
747  {
748  static const BuiltinTypeInfo<ALLOC> typeInfo = {
749  "bit<>", SchemaType::DYNAMIC_UNSIGNED_BITFIELD, CppType::UINT16};
750  return typeInfo;
751  }
752  else if (maxBitSize <= 32)
753  {
754  static const BuiltinTypeInfo<ALLOC> typeInfo = {
755  "bit<>", SchemaType::DYNAMIC_UNSIGNED_BITFIELD, CppType::UINT32};
756  return typeInfo;
757  }
758  else
759  {
760  static const BuiltinTypeInfo<ALLOC> typeInfo = {
761  "bit<>", SchemaType::DYNAMIC_UNSIGNED_BITFIELD, CppType::UINT64};
762  return typeInfo;
763  }
764  }
765 }
766 
767 template <typename ALLOC>
768 FixedSizeBuiltinTypeInfo<ALLOC>::FixedSizeBuiltinTypeInfo(
769  std::string_view schemaName, SchemaType schemaType, CppType cppType, uint8_t bitSize) :
770  BuiltinTypeInfo<ALLOC>(schemaName, schemaType, cppType),
771  m_bitSize(bitSize)
772 {}
773 
774 template <typename ALLOC>
775 uint8_t FixedSizeBuiltinTypeInfo<ALLOC>::getBitSize() const
776 {
777  return m_bitSize;
778 }
779 
780 template <typename ALLOC>
781 template <BitSize BIT_SIZE, bool IS_SIGNED>
782 const FixedSizeBuiltinTypeInfo<ALLOC>& FixedSizeBuiltinTypeInfo<ALLOC>::getFixedBitField()
783 {
784  static_assert(BIT_SIZE > 0 && BIT_SIZE <= 64, "Bit size out of range!");
785 
786  if constexpr (IS_SIGNED)
787  {
788  static const std::array<FixedSizeBuiltinTypeInfo<ALLOC>, 64> bitFieldTypeInfoArray = {
789  {{"int:1", SchemaType::INT1, CppType::INT8, 1}, //
790  {"int:2", SchemaType::INT2, CppType::INT8, 2},
791  {"int:3", SchemaType::INT3, CppType::INT8, 3},
792  {"int:4", SchemaType::INT4, CppType::INT8, 4},
793  {"int:5", SchemaType::INT5, CppType::INT8, 5},
794  {"int:6", SchemaType::INT6, CppType::INT8, 6},
795  {"int:7", SchemaType::INT7, CppType::INT8, 7},
796  {"int:8", SchemaType::INT8, CppType::INT8, 8},
797  {"int:9", SchemaType::INT9, CppType::INT16, 9},
798  {"int:10", SchemaType::INT10, CppType::INT16, 10},
799  {"int:11", SchemaType::INT11, CppType::INT16, 11},
800  {"int:12", SchemaType::INT12, CppType::INT16, 12},
801  {"int:13", SchemaType::INT13, CppType::INT16, 13},
802  {"int:14", SchemaType::INT14, CppType::INT16, 14},
803  {"int:15", SchemaType::INT15, CppType::INT16, 15},
804  {"int:16", SchemaType::INT16, CppType::INT16, 16},
805  {"int:17", SchemaType::INT17, CppType::INT32, 17},
806  {"int:18", SchemaType::INT18, CppType::INT32, 18},
807  {"int:19", SchemaType::INT19, CppType::INT32, 19},
808  {"int:20", SchemaType::INT20, CppType::INT32, 20},
809  {"int:21", SchemaType::INT21, CppType::INT32, 21},
810  {"int:22", SchemaType::INT22, CppType::INT32, 22},
811  {"int:23", SchemaType::INT23, CppType::INT32, 23},
812  {"int:24", SchemaType::INT24, CppType::INT32, 24},
813  {"int:25", SchemaType::INT25, CppType::INT32, 25},
814  {"int:26", SchemaType::INT26, CppType::INT32, 26},
815  {"int:27", SchemaType::INT27, CppType::INT32, 27},
816  {"int:28", SchemaType::INT28, CppType::INT32, 28},
817  {"int:29", SchemaType::INT29, CppType::INT32, 29},
818  {"int:30", SchemaType::INT30, CppType::INT32, 30},
819  {"int:31", SchemaType::INT31, CppType::INT32, 31},
820  {"int:32", SchemaType::INT32, CppType::INT32, 32},
821  {"int:33", SchemaType::INT33, CppType::INT64, 33},
822  {"int:34", SchemaType::INT34, CppType::INT64, 34},
823  {"int:35", SchemaType::INT35, CppType::INT64, 35},
824  {"int:36", SchemaType::INT36, CppType::INT64, 36},
825  {"int:37", SchemaType::INT37, CppType::INT64, 37},
826  {"int:38", SchemaType::INT38, CppType::INT64, 38},
827  {"int:39", SchemaType::INT39, CppType::INT64, 39},
828  {"int:40", SchemaType::INT40, CppType::INT64, 40},
829  {"int:41", SchemaType::INT41, CppType::INT64, 41},
830  {"int:42", SchemaType::INT42, CppType::INT64, 42},
831  {"int:43", SchemaType::INT43, CppType::INT64, 43},
832  {"int:44", SchemaType::INT44, CppType::INT64, 44},
833  {"int:45", SchemaType::INT45, CppType::INT64, 45},
834  {"int:46", SchemaType::INT46, CppType::INT64, 46},
835  {"int:47", SchemaType::INT47, CppType::INT64, 47},
836  {"int:48", SchemaType::INT48, CppType::INT64, 48},
837  {"int:49", SchemaType::INT49, CppType::INT64, 49},
838  {"int:50", SchemaType::INT50, CppType::INT64, 50},
839  {"int:51", SchemaType::INT51, CppType::INT64, 51},
840  {"int:52", SchemaType::INT52, CppType::INT64, 52},
841  {"int:53", SchemaType::INT53, CppType::INT64, 53},
842  {"int:54", SchemaType::INT54, CppType::INT64, 54},
843  {"int:55", SchemaType::INT55, CppType::INT64, 55},
844  {"int:56", SchemaType::INT56, CppType::INT64, 56},
845  {"int:57", SchemaType::INT57, CppType::INT64, 57},
846  {"int:58", SchemaType::INT58, CppType::INT64, 58},
847  {"int:59", SchemaType::INT59, CppType::INT64, 59},
848  {"int:60", SchemaType::INT60, CppType::INT64, 60},
849  {"int:61", SchemaType::INT61, CppType::INT64, 61},
850  {"int:62", SchemaType::INT62, CppType::INT64, 62},
851  {"int:63", SchemaType::INT63, CppType::INT64, 63},
852  {"int:64", SchemaType::INT64, CppType::INT64, 64}}};
853 
854  return bitFieldTypeInfoArray[BIT_SIZE - 1U];
855  }
856  else
857  {
858  static const std::array<FixedSizeBuiltinTypeInfo<ALLOC>, 64> bitFieldTypeInfoArray = {
859  {{"bit:1", SchemaType::UINT1, CppType::UINT8, 1},
860  {"bit:2", SchemaType::UINT2, CppType::UINT8, 2},
861  {"bit:3", SchemaType::UINT3, CppType::UINT8, 3},
862  {"bit:4", SchemaType::UINT4, CppType::UINT8, 4},
863  {"bit:5", SchemaType::UINT5, CppType::UINT8, 5},
864  {"bit:6", SchemaType::UINT6, CppType::UINT8, 6},
865  {"bit:7", SchemaType::UINT7, CppType::UINT8, 7},
866  {"bit:8", SchemaType::UINT8, CppType::UINT8, 8},
867  {"bit:9", SchemaType::UINT9, CppType::UINT16, 9},
868  {"bit:10", SchemaType::UINT10, CppType::UINT16, 10},
869  {"bit:11", SchemaType::UINT11, CppType::UINT16, 11},
870  {"bit:12", SchemaType::UINT12, CppType::UINT16, 12},
871  {"bit:13", SchemaType::UINT13, CppType::UINT16, 13},
872  {"bit:14", SchemaType::UINT14, CppType::UINT16, 14},
873  {"bit:15", SchemaType::UINT15, CppType::UINT16, 15},
874  {"bit:16", SchemaType::UINT16, CppType::UINT16, 16},
875  {"bit:17", SchemaType::UINT17, CppType::UINT32, 17},
876  {"bit:18", SchemaType::UINT18, CppType::UINT32, 18},
877  {"bit:19", SchemaType::UINT19, CppType::UINT32, 19},
878  {"bit:20", SchemaType::UINT20, CppType::UINT32, 20},
879  {"bit:21", SchemaType::UINT21, CppType::UINT32, 21},
880  {"bit:22", SchemaType::UINT22, CppType::UINT32, 22},
881  {"bit:23", SchemaType::UINT23, CppType::UINT32, 23},
882  {"bit:24", SchemaType::UINT24, CppType::UINT32, 24},
883  {"bit:25", SchemaType::UINT25, CppType::UINT32, 25},
884  {"bit:26", SchemaType::UINT26, CppType::UINT32, 26},
885  {"bit:27", SchemaType::UINT27, CppType::UINT32, 27},
886  {"bit:28", SchemaType::UINT28, CppType::UINT32, 28},
887  {"bit:29", SchemaType::UINT29, CppType::UINT32, 29},
888  {"bit:30", SchemaType::UINT30, CppType::UINT32, 30},
889  {"bit:31", SchemaType::UINT31, CppType::UINT32, 31},
890  {"bit:32", SchemaType::UINT32, CppType::UINT32, 32},
891  {"bit:33", SchemaType::UINT33, CppType::UINT64, 33},
892  {"bit:34", SchemaType::UINT34, CppType::UINT64, 34},
893  {"bit:35", SchemaType::UINT35, CppType::UINT64, 35},
894  {"bit:36", SchemaType::UINT36, CppType::UINT64, 36},
895  {"bit:37", SchemaType::UINT37, CppType::UINT64, 37},
896  {"bit:38", SchemaType::UINT38, CppType::UINT64, 38},
897  {"bit:39", SchemaType::UINT39, CppType::UINT64, 39},
898  {"bit:40", SchemaType::UINT40, CppType::UINT64, 40},
899  {"bit:41", SchemaType::UINT41, CppType::UINT64, 41},
900  {"bit:42", SchemaType::UINT42, CppType::UINT64, 42},
901  {"bit:43", SchemaType::UINT43, CppType::UINT64, 43},
902  {"bit:44", SchemaType::UINT44, CppType::UINT64, 44},
903  {"bit:45", SchemaType::UINT45, CppType::UINT64, 45},
904  {"bit:46", SchemaType::UINT46, CppType::UINT64, 46},
905  {"bit:47", SchemaType::UINT47, CppType::UINT64, 47},
906  {"bit:48", SchemaType::UINT48, CppType::UINT64, 48},
907  {"bit:49", SchemaType::UINT49, CppType::UINT64, 49},
908  {"bit:50", SchemaType::UINT50, CppType::UINT64, 50},
909  {"bit:51", SchemaType::UINT51, CppType::UINT64, 51},
910  {"bit:52", SchemaType::UINT52, CppType::UINT64, 52},
911  {"bit:53", SchemaType::UINT53, CppType::UINT64, 53},
912  {"bit:54", SchemaType::UINT54, CppType::UINT64, 54},
913  {"bit:55", SchemaType::UINT55, CppType::UINT64, 55},
914  {"bit:56", SchemaType::UINT56, CppType::UINT64, 56},
915  {"bit:57", SchemaType::UINT57, CppType::UINT64, 57},
916  {"bit:58", SchemaType::UINT58, CppType::UINT64, 58},
917  {"bit:59", SchemaType::UINT59, CppType::UINT64, 59},
918  {"bit:60", SchemaType::UINT60, CppType::UINT64, 60},
919  {"bit:61", SchemaType::UINT61, CppType::UINT64, 61},
920  {"bit:62", SchemaType::UINT62, CppType::UINT64, 62},
921  {"bit:63", SchemaType::UINT63, CppType::UINT64, 63},
922  {"bit:64", SchemaType::UINT64, CppType::UINT64, 64}}};
923 
924  return bitFieldTypeInfoArray[static_cast<size_t>(BIT_SIZE - 1)];
925  }
926 }
927 
928 template <typename ALLOC>
929 TemplatableTypeInfoBase<ALLOC>::TemplatableTypeInfoBase(std::string_view schemaName, SchemaType schemaType,
930  CppType cppType, std::string_view templateName,
931  Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments) :
932  TypeInfoBase<ALLOC>(schemaName, schemaType, cppType),
933  m_templateName(templateName),
934  m_templateArguments(templateArguments)
935 {}
936 
937 template <typename ALLOC>
938 TemplatableTypeInfoBase<ALLOC>::~TemplatableTypeInfoBase() = default;
939 
940 template <typename ALLOC>
941 std::string_view TemplatableTypeInfoBase<ALLOC>::getTemplateName() const
942 {
943  return m_templateName;
944 }
945 
946 template <typename ALLOC>
947 Span<const BasicTemplateArgumentInfo<ALLOC>> TemplatableTypeInfoBase<ALLOC>::getTemplateArguments() const
948 {
949  return m_templateArguments;
950 }
951 
952 template <typename ALLOC>
953 CompoundTypeInfoBase<ALLOC>::CompoundTypeInfoBase(std::string_view schemaName,
954  CreateInstanceFunc createInstanceFunc, SchemaType schemaType, CppType cppType,
955  std::string_view templateName, Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
956  Span<const BasicFieldInfo<ALLOC>> fields, Span<const BasicParameterInfo<ALLOC>> parameters,
957  Span<const BasicFunctionInfo<ALLOC>> functions) :
958  TemplatableTypeInfoBase<ALLOC>(schemaName, schemaType, cppType, templateName, templateArguments),
959  m_createInstanceFunc(createInstanceFunc),
960  m_fields(fields),
961  m_parameters(parameters),
962  m_functions(functions)
963 {}
964 
965 template <typename ALLOC>
966 CompoundTypeInfoBase<ALLOC>::~CompoundTypeInfoBase() = default;
967 
968 template <typename ALLOC>
969 Span<const BasicFieldInfo<ALLOC>> CompoundTypeInfoBase<ALLOC>::getFields() const
970 {
971  return m_fields;
972 }
973 
974 template <typename ALLOC>
975 Span<const BasicParameterInfo<ALLOC>> CompoundTypeInfoBase<ALLOC>::getParameters() const
976 {
977  return m_parameters;
978 }
979 
980 template <typename ALLOC>
981 Span<const BasicFunctionInfo<ALLOC>> CompoundTypeInfoBase<ALLOC>::getFunctions() const
982 {
983  return m_functions;
984 }
985 
986 template <typename ALLOC>
987 IBasicReflectableDataPtr<ALLOC> CompoundTypeInfoBase<ALLOC>::createInstance(const ALLOC& allocator) const
988 {
989  if (!m_createInstanceFunc)
990  {
991  throw CppRuntimeException("Reflectable '")
992  << getSchemaName() << "': Cannot create instance, not implemented!";
993  }
994  return m_createInstanceFunc(allocator);
995 }
996 
997 template <typename ALLOC>
998 StructTypeInfo<ALLOC>::StructTypeInfo(std::string_view schemaName, CreateInstanceFunc createInstanceFunc,
999  std::string_view templateName, Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
1000  Span<const BasicFieldInfo<ALLOC>> fields, Span<const BasicParameterInfo<ALLOC>> parameters,
1001  Span<const BasicFunctionInfo<ALLOC>> functions) :
1002  CompoundTypeInfoBase<ALLOC>(schemaName, createInstanceFunc, SchemaType::STRUCT, CppType::STRUCT,
1003  templateName, templateArguments, fields, parameters, functions)
1004 {}
1005 
1006 template <typename ALLOC>
1007 UnionTypeInfo<ALLOC>::UnionTypeInfo(std::string_view schemaName, CreateInstanceFunc createInstanceFunc,
1008  std::string_view templateName, Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
1009  Span<const BasicFieldInfo<ALLOC>> fields, Span<const BasicParameterInfo<ALLOC>> parameters,
1010  Span<const BasicFunctionInfo<ALLOC>> functions) :
1011  CompoundTypeInfoBase<ALLOC>(schemaName, createInstanceFunc, SchemaType::UNION, CppType::UNION,
1012  templateName, templateArguments, fields, parameters, functions)
1013 {}
1014 
1015 template <typename ALLOC>
1016 ChoiceTypeInfo<ALLOC>::ChoiceTypeInfo(std::string_view schemaName, CreateInstanceFunc createInstanceFunc,
1017  std::string_view templateName, Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
1018  Span<const BasicFieldInfo<ALLOC>> fields, Span<const BasicParameterInfo<ALLOC>> parameters,
1019  Span<const BasicFunctionInfo<ALLOC>> functions, std::string_view selector,
1020  Span<const BasicCaseInfo<ALLOC>> cases) :
1021  CompoundTypeInfoBase<ALLOC>(schemaName, createInstanceFunc, SchemaType::CHOICE, CppType::CHOICE,
1022  templateName, templateArguments, fields, parameters, functions),
1023  m_selector(selector),
1024  m_cases(cases)
1025 {}
1026 
1027 template <typename ALLOC>
1028 std::string_view ChoiceTypeInfo<ALLOC>::getSelector() const
1029 {
1030  return m_selector;
1031 }
1032 
1033 template <typename ALLOC>
1034 Span<const BasicCaseInfo<ALLOC>> ChoiceTypeInfo<ALLOC>::getCases() const
1035 {
1036  return m_cases;
1037 }
1038 
1039 template <typename ALLOC>
1040 SqlTableTypeInfo<ALLOC>::SqlTableTypeInfo(std::string_view schemaName, std::string_view templateName,
1041  Span<const BasicTemplateArgumentInfo<ALLOC>> templateArguments,
1042  Span<const BasicColumnInfo<ALLOC>> columns, std::string_view sqlConstraint,
1043  std::string_view virtualTableUsing, bool isWithoutRowId) :
1044  TemplatableTypeInfoBase<ALLOC>(
1045  schemaName, SchemaType::SQL_TABLE, CppType::SQL_TABLE, templateName, templateArguments),
1046  m_columns(columns),
1047  m_sqlConstraint(sqlConstraint),
1048  m_virtualTableUsing(virtualTableUsing),
1049  m_isWithoutRowId(isWithoutRowId)
1050 {}
1051 
1052 template <typename ALLOC>
1053 Span<const BasicColumnInfo<ALLOC>> SqlTableTypeInfo<ALLOC>::getColumns() const
1054 {
1055  return m_columns;
1056 }
1057 
1058 template <typename ALLOC>
1059 std::string_view SqlTableTypeInfo<ALLOC>::getSqlConstraint() const
1060 {
1061  return m_sqlConstraint;
1062 }
1063 
1064 template <typename ALLOC>
1065 std::string_view SqlTableTypeInfo<ALLOC>::getVirtualTableUsing() const
1066 {
1067  return m_virtualTableUsing;
1068 }
1069 
1070 template <typename ALLOC>
1071 bool SqlTableTypeInfo<ALLOC>::isWithoutRowId() const
1072 {
1073  return m_isWithoutRowId;
1074 }
1075 
1076 template <typename ALLOC>
1077 SqlDatabaseTypeInfo<ALLOC>::SqlDatabaseTypeInfo(
1078  std::string_view schemaName, Span<const BasicTableInfo<ALLOC>> tables) :
1079  TypeInfoBase<ALLOC>(schemaName, SchemaType::SQL_DATABASE, CppType::SQL_DATABASE),
1080  m_tables(tables)
1081 {}
1082 
1083 template <typename ALLOC>
1084 Span<const BasicTableInfo<ALLOC>> SqlDatabaseTypeInfo<ALLOC>::getTables() const
1085 {
1086  return m_tables;
1087 }
1088 
1089 template <typename ALLOC>
1090 TypeInfoWithUnderlyingTypeBase<ALLOC>::TypeInfoWithUnderlyingTypeBase(std::string_view schemaName,
1091  SchemaType schemaType, CppType cppType, const IBasicTypeInfo<ALLOC>& underlyingType) :
1092  TypeInfoBase<ALLOC>(schemaName, schemaType, cppType),
1093  m_underlyingType(underlyingType)
1094 {}
1095 
1096 template <typename ALLOC>
1097 const IBasicTypeInfo<ALLOC>& TypeInfoWithUnderlyingTypeBase<ALLOC>::getUnderlyingType() const
1098 {
1099  return m_underlyingType;
1100 }
1101 
1102 template <typename ALLOC>
1103 EnumTypeInfo<ALLOC>::EnumTypeInfo(std::string_view schemaName, const IBasicTypeInfo<ALLOC>& underlyingType,
1104  Span<const ItemInfo> enumItems) :
1105  TypeInfoWithUnderlyingTypeBase<ALLOC>(schemaName, SchemaType::ENUM, CppType::ENUM, underlyingType),
1106  m_enumItems(enumItems)
1107 {}
1108 
1109 template <typename ALLOC>
1110 Span<const ItemInfo> EnumTypeInfo<ALLOC>::getEnumItems() const
1111 {
1112  return m_enumItems;
1113 }
1114 
1115 template <typename ALLOC>
1116 BitmaskTypeInfo<ALLOC>::BitmaskTypeInfo(std::string_view schemaName,
1117  const IBasicTypeInfo<ALLOC>& underlyingType, Span<const ItemInfo> bitmaskValues) :
1118  TypeInfoWithUnderlyingTypeBase<ALLOC>(
1119  schemaName, SchemaType::BITMASK, CppType::BITMASK, underlyingType),
1120  m_bitmaskValues(bitmaskValues)
1121 {}
1122 
1123 template <typename ALLOC>
1124 Span<const ItemInfo> BitmaskTypeInfo<ALLOC>::getBitmaskValues() const
1125 {
1126  return m_bitmaskValues;
1127 }
1128 
1129 template <typename ALLOC>
1130 PubsubTypeInfo<ALLOC>::PubsubTypeInfo(
1131  std::string_view schemaName, Span<const BasicMessageInfo<ALLOC>> messages) :
1132  TypeInfoBase<ALLOC>(schemaName, SchemaType::PUBSUB, CppType::PUBSUB),
1133  m_messages(messages)
1134 {}
1135 
1136 template <typename ALLOC>
1137 Span<const BasicMessageInfo<ALLOC>> PubsubTypeInfo<ALLOC>::getMessages() const
1138 {
1139  return m_messages;
1140 }
1141 
1142 template <typename ALLOC>
1143 ServiceTypeInfo<ALLOC>::ServiceTypeInfo(
1144  std::string_view schemaName, Span<const BasicMethodInfo<ALLOC>> methods) :
1145  TypeInfoBase<ALLOC>(schemaName, SchemaType::SERVICE, CppType::SERVICE),
1146  m_methods(methods)
1147 {}
1148 
1149 template <typename ALLOC>
1150 Span<const BasicMethodInfo<ALLOC>> ServiceTypeInfo<ALLOC>::getMethods() const
1151 {
1152  return m_methods;
1153 }
1154 
1155 template <typename ALLOC>
1156 std::string_view RecursiveTypeInfo<ALLOC>::getSchemaName() const
1157 {
1158  return m_typeInfoFunc().getSchemaName();
1159 }
1160 
1161 template <typename ALLOC>
1162 SchemaType RecursiveTypeInfo<ALLOC>::getSchemaType() const
1163 {
1164  return m_typeInfoFunc().getSchemaType();
1165 }
1166 
1167 template <typename ALLOC>
1168 CppType RecursiveTypeInfo<ALLOC>::getCppType() const
1169 {
1170  return m_typeInfoFunc().getCppType();
1171 }
1172 
1173 template <typename ALLOC>
1174 uint8_t RecursiveTypeInfo<ALLOC>::getBitSize() const
1175 {
1176  return m_typeInfoFunc().getBitSize();
1177 }
1178 
1179 template <typename ALLOC>
1180 Span<const BasicFieldInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getFields() const
1181 {
1182  return m_typeInfoFunc().getFields();
1183 }
1184 
1185 template <typename ALLOC>
1186 Span<const BasicParameterInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getParameters() const
1187 {
1188  return m_typeInfoFunc().getParameters();
1189 }
1190 
1191 template <typename ALLOC>
1192 Span<const BasicFunctionInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getFunctions() const
1193 {
1194  return m_typeInfoFunc().getFunctions();
1195 }
1196 
1197 template <typename ALLOC>
1198 std::string_view RecursiveTypeInfo<ALLOC>::getSelector() const
1199 {
1200  return m_typeInfoFunc().getSelector();
1201 }
1202 
1203 template <typename ALLOC>
1204 Span<const BasicCaseInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getCases() const
1205 {
1206  return m_typeInfoFunc().getCases();
1207 }
1208 
1209 template <typename ALLOC>
1210 const IBasicTypeInfo<ALLOC>& RecursiveTypeInfo<ALLOC>::getUnderlyingType() const
1211 {
1212  return m_typeInfoFunc().getUnderlyingType();
1213 }
1214 
1215 template <typename ALLOC>
1216 Span<const ItemInfo> RecursiveTypeInfo<ALLOC>::getEnumItems() const
1217 {
1218  return m_typeInfoFunc().getEnumItems();
1219 }
1220 
1221 template <typename ALLOC>
1222 Span<const ItemInfo> RecursiveTypeInfo<ALLOC>::getBitmaskValues() const
1223 {
1224  return m_typeInfoFunc().getBitmaskValues();
1225 }
1226 
1227 template <typename ALLOC>
1228 Span<const BasicColumnInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getColumns() const
1229 {
1230  return m_typeInfoFunc().getColumns();
1231 }
1232 
1233 template <typename ALLOC>
1234 std::string_view RecursiveTypeInfo<ALLOC>::getSqlConstraint() const
1235 {
1236  return m_typeInfoFunc().getSqlConstraint();
1237 }
1238 
1239 template <typename ALLOC>
1240 std::string_view RecursiveTypeInfo<ALLOC>::getVirtualTableUsing() const
1241 {
1242  return m_typeInfoFunc().getVirtualTableUsing();
1243 }
1244 
1245 template <typename ALLOC>
1246 bool RecursiveTypeInfo<ALLOC>::isWithoutRowId() const
1247 {
1248  return m_typeInfoFunc().isWithoutRowId();
1249 }
1250 
1251 template <typename ALLOC>
1252 Span<const BasicTableInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getTables() const
1253 {
1254  return m_typeInfoFunc().getTables();
1255 }
1256 
1257 template <typename ALLOC>
1258 std::string_view RecursiveTypeInfo<ALLOC>::getTemplateName() const
1259 {
1260  return m_typeInfoFunc().getTemplateName();
1261 }
1262 
1263 template <typename ALLOC>
1264 Span<const BasicTemplateArgumentInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getTemplateArguments() const
1265 {
1266  return m_typeInfoFunc().getTemplateArguments();
1267 }
1268 
1269 template <typename ALLOC>
1270 Span<const BasicMessageInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getMessages() const
1271 {
1272  return m_typeInfoFunc().getMessages();
1273 }
1274 
1275 template <typename ALLOC>
1276 Span<const BasicMethodInfo<ALLOC>> RecursiveTypeInfo<ALLOC>::getMethods() const
1277 {
1278  return m_typeInfoFunc().getMethods();
1279 }
1280 
1281 template <typename ALLOC>
1282 IBasicReflectableDataPtr<ALLOC> RecursiveTypeInfo<ALLOC>::createInstance(const ALLOC& allocator) const
1283 {
1284  return m_typeInfoFunc().createInstance(allocator);
1285 }
1286 
1287 template <typename ALLOC>
1288 IBasicReflectableDataPtr<ALLOC> RecursiveTypeInfo<ALLOC>::createInstance() const
1289 {
1290  return createInstance(ALLOC());
1291 }
1292 
1293 template <typename ALLOC>
1294 struct TypeInfo<Bool, ALLOC>
1295 {
1296  static const IBasicTypeInfo<ALLOC>& get()
1297  {
1298  static const FixedSizeBuiltinTypeInfo<ALLOC> typeInfo = {"bool", SchemaType::BOOL, CppType::BOOL, 1};
1299  return typeInfo;
1300  }
1301 };
1302 
1303 template <BitSize BIT_SIZE, bool IS_SIGNED, typename ALLOC>
1304 struct TypeInfo<detail::FixedIntWrapper<BIT_SIZE, IS_SIGNED>, ALLOC>
1305 {
1306  static const IBasicTypeInfo<ALLOC>& get()
1307  {
1308  return FixedSizeBuiltinTypeInfo<ALLOC>::template getFixedBitField<BIT_SIZE, IS_SIGNED>();
1309  }
1310 };
1311 
1312 template <typename T, typename ALLOC>
1313 struct TypeInfo<detail::DynIntWrapper<T>, ALLOC>
1314 {
1315  static const IBasicTypeInfo<ALLOC>& get()
1316  {
1317  return BuiltinTypeInfo<ALLOC>::template getDynamicBitField<T>();
1318  }
1319 };
1320 
1321 template <typename ALLOC>
1322 struct TypeInfo<VarInt16, ALLOC>
1323 {
1324  static const IBasicTypeInfo<ALLOC>& get()
1325  {
1326  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varint16", SchemaType::VARINT16, CppType::INT16};
1327  return typeInfo;
1328  }
1329 };
1330 
1331 template <typename ALLOC>
1332 struct TypeInfo<VarInt32, ALLOC>
1333 {
1334  static const IBasicTypeInfo<ALLOC>& get()
1335  {
1336  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varint32", SchemaType::VARINT32, CppType::INT32};
1337  return typeInfo;
1338  }
1339 };
1340 
1341 template <typename ALLOC>
1342 struct TypeInfo<VarInt64, ALLOC>
1343 {
1344  static const IBasicTypeInfo<ALLOC>& get()
1345  {
1346  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varint64", SchemaType::VARINT64, CppType::INT64};
1347  return typeInfo;
1348  }
1349 };
1350 
1351 template <typename ALLOC>
1352 struct TypeInfo<VarInt, ALLOC>
1353 {
1354  static const IBasicTypeInfo<ALLOC>& get()
1355  {
1356  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varint", SchemaType::VARINT, CppType::INT64};
1357  return typeInfo;
1358  }
1359 };
1360 
1361 template <typename ALLOC>
1362 struct TypeInfo<VarUInt16, ALLOC>
1363 {
1364  static const IBasicTypeInfo<ALLOC>& get()
1365  {
1366  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varuint16", SchemaType::VARUINT16, CppType::UINT16};
1367  return typeInfo;
1368  }
1369 };
1370 
1371 template <typename ALLOC>
1372 struct TypeInfo<VarUInt32, ALLOC>
1373 {
1374  static const IBasicTypeInfo<ALLOC>& get()
1375  {
1376  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varuint32", SchemaType::VARUINT32, CppType::UINT32};
1377  return typeInfo;
1378  }
1379 };
1380 
1381 template <typename ALLOC>
1382 struct TypeInfo<VarUInt64, ALLOC>
1383 {
1384  static const IBasicTypeInfo<ALLOC>& get()
1385  {
1386  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varuint64", SchemaType::VARUINT64, CppType::UINT64};
1387  return typeInfo;
1388  }
1389 };
1390 
1391 template <typename ALLOC>
1392 struct TypeInfo<VarUInt, ALLOC>
1393 {
1394  static const IBasicTypeInfo<ALLOC>& get()
1395  {
1396  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varuint", SchemaType::VARUINT, CppType::UINT64};
1397  return typeInfo;
1398  }
1399 };
1400 
1401 template <typename ALLOC>
1402 struct TypeInfo<VarSize, ALLOC>
1403 {
1404  static const IBasicTypeInfo<ALLOC>& get()
1405  {
1406  static const BuiltinTypeInfo<ALLOC> typeInfo = {"varsize", SchemaType::VARSIZE, CppType::UINT32};
1407  return typeInfo;
1408  }
1409 };
1410 
1411 template <typename ALLOC>
1412 struct TypeInfo<Float16, ALLOC>
1413 {
1414  static const IBasicTypeInfo<ALLOC>& get()
1415  {
1416  static const FixedSizeBuiltinTypeInfo<ALLOC> typeInfo = {
1417  "float16", SchemaType::FLOAT16, CppType::FLOAT, 16};
1418  return typeInfo;
1419  }
1420 };
1421 
1422 template <typename ALLOC>
1423 struct TypeInfo<Float32, ALLOC>
1424 {
1425  static const IBasicTypeInfo<ALLOC>& get()
1426  {
1427  static const FixedSizeBuiltinTypeInfo<ALLOC> typeInfo = {
1428  "float32", SchemaType::FLOAT32, CppType::FLOAT, 32};
1429  return typeInfo;
1430  }
1431 };
1432 
1433 template <typename ALLOC>
1434 struct TypeInfo<Float64, ALLOC>
1435 {
1436  static const IBasicTypeInfo<ALLOC>& get()
1437  {
1438  static const FixedSizeBuiltinTypeInfo<ALLOC> typeInfo = {
1439  "float64", SchemaType::FLOAT64, CppType::DOUBLE, 64};
1440  return typeInfo;
1441  }
1442 };
1443 
1444 template <typename ALLOC>
1445 struct TypeInfo<BasicBytes<ALLOC>, ALLOC>
1446 {
1447  static const IBasicTypeInfo<ALLOC>& get()
1448  {
1449  static const BuiltinTypeInfo<ALLOC> typeInfo = {"bytes", SchemaType::BYTES, CppType::BYTES};
1450  return typeInfo;
1451  }
1452 };
1453 
1454 template <typename ALLOC>
1455 struct TypeInfo<BasicString<ALLOC>, RebindAlloc<ALLOC, uint8_t>>
1456 {
1457  static const IBasicTypeInfo<RebindAlloc<ALLOC, uint8_t>>& get()
1458  {
1459  static const BuiltinTypeInfo<RebindAlloc<ALLOC, uint8_t>> typeInfo = {
1460  "string", SchemaType::STRING, CppType::STRING};
1461  return typeInfo;
1462  }
1463 };
1464 
1465 template <typename ALLOC>
1466 struct TypeInfo<std::string_view, ALLOC>
1467 {
1468  static const IBasicTypeInfo<ALLOC>& get()
1469  {
1470  static const BuiltinTypeInfo<ALLOC> typeInfo = {"string", SchemaType::STRING, CppType::STRING};
1471  return typeInfo;
1472  }
1473 };
1474 
1475 template <typename ALLOC>
1476 struct TypeInfo<BasicBitBuffer<ALLOC>, ALLOC>
1477 {
1478  static const IBasicTypeInfo<ALLOC>& get()
1479  {
1480  static const BuiltinTypeInfo<ALLOC> typeInfo = {"extern", SchemaType::EXTERN, CppType::BIT_BUFFER};
1481  return typeInfo;
1482  }
1483 };
1484 
1485 } // namespace detail
1486 
1487 } // namespace zserio
1488 
1489 #endif // ZSERIO_TYPE_INFO_INC_H
virtual Span< const BasicMethodInfo< ALLOC > > getMethods() const=0
virtual Span< const BasicTemplateArgumentInfo< ALLOC > > getTemplateArguments() const=0
virtual Span< const BasicCaseInfo< ALLOC > > getCases() const=0
virtual Span< const BasicFieldInfo< ALLOC > > getFields() const=0
virtual std::string_view getVirtualTableUsing() const=0
virtual uint8_t getBitSize() const=0
virtual bool isWithoutRowId() const=0
virtual Span< const BasicParameterInfo< ALLOC > > getParameters() const=0
virtual IBasicReflectableDataPtr< ALLOC > createInstance(const ALLOC &allocator) const=0
virtual const IBasicTypeInfo< ALLOC > & getUnderlyingType() const=0
virtual std::string_view getSqlConstraint() const=0
virtual Span< const BasicMessageInfo< ALLOC > > getMessages() const=0
virtual Span< const BasicTableInfo< ALLOC > > getTables() const=0
virtual std::string_view getTemplateName() const=0
virtual Span< const BasicFunctionInfo< ALLOC > > getFunctions() const=0
virtual Span< const BasicColumnInfo< ALLOC > > getColumns() const=0
virtual CppType getCppType() const=0
virtual Span< const ItemInfo > getEnumItems() const=0
virtual SchemaType getSchemaType() const=0
virtual std::string_view getSelector() const=0
virtual Span< const ItemInfo > getBitmaskValues() const=0
virtual std::string_view getSchemaName() const=0
Definition: BitBuffer.h:602
detail::BoolWrapper Bool
Definition: Types.h:732
detail::VarIntWrapper< uint64_t, detail::VarIntType::VAR > VarUInt
Definition: Types.h:888
unsigned int BitSize
Definition: BitSize.h:8
std::basic_string< char, std::char_traits< char >, ALLOC > BasicString
Definition: String.h:17
detail::FloatWrapper< float, detail::FloatType::FLOAT16 > Float16
Definition: Types.h:892
std::vector< uint8_t, ALLOC > BasicBytes
Definition: Bytes.h:20
detail::FloatWrapper< float, detail::FloatType::FLOAT32 > Float32
Definition: Types.h:893
detail::VarIntWrapper< int32_t, detail::VarIntType::VAR32 > VarInt32
Definition: Types.h:881
typename std::allocator_traits< ALLOC >::template rebind_alloc< T > RebindAlloc
Definition: RebindAlloc.h:10
detail::VarIntWrapper< uint16_t, detail::VarIntType::VAR16 > VarUInt16
Definition: Types.h:885
decltype(auto) get(BasicVariant< ALLOC, INDEX, T... > &var)
Definition: Variant.h:812
SchemaType
Definition: ITypeInfo.h:45
detail::VarIntWrapper< uint64_t, detail::VarIntType::VAR64 > VarUInt64
Definition: Types.h:887
const IBasicTypeInfo< ALLOC > & typeInfo()
Definition: ITypeInfo.h:668
detail::VarIntWrapper< int16_t, detail::VarIntType::VAR16 > VarInt16
Definition: Types.h:880
detail::FloatWrapper< double, detail::FloatType::FLOAT64 > Float64
Definition: Types.h:894
detail::VarIntWrapper< uint32_t, detail::VarIntType::VAR32 > VarUInt32
Definition: Types.h:886
detail::VarIntWrapper< int64_t, detail::VarIntType::VAR > VarInt
Definition: Types.h:883
detail::VarIntWrapper< int64_t, detail::VarIntType::VAR64 > VarInt64
Definition: Types.h:882
detail::VarIntWrapper< uint32_t, detail::VarIntType::VARSIZE > VarSize
Definition: Types.h:890