1 #ifndef ZSERIO_TYPE_INFO_INC_H 2 #define ZSERIO_TYPE_INFO_INC_H 22 template <
typename ALLOC>
92 template <
typename ALLOC = std::allocator<u
int8_t>>
314 template <
typename ALLOC>
441 template <
typename ALLOC>
476 template <
typename ALLOC>
525 template <
typename ALLOC>
550 template <
typename ALLOC>
575 template <
typename ALLOC>
610 template <
typename ALLOC>
637 template <
typename ALLOC>
661 template <
typename ALLOC>
685 template <
typename ALLOC>
714 bool m_isWithoutRowId;
720 template <
typename ALLOC>
741 template <
typename ALLOC>
762 template <
typename ALLOC>
784 template <
typename ALLOC>
797 m_typeInfoFunc(typeInfoFunc)
849 TypeInfoFunc m_typeInfoFunc;
852 template <
typename ALLOC>
854 m_schemaName(schemaName), m_schemaType(schemaType), m_cppType(cppType)
857 template <
typename ALLOC>
860 template <
typename ALLOC>
866 template <
typename ALLOC>
872 template <
typename ALLOC>
878 template <
typename ALLOC>
884 template <
typename ALLOC>
890 template <
typename ALLOC>
896 template <
typename ALLOC>
902 template <
typename ALLOC>
908 template <
typename ALLOC>
914 template <
typename ALLOC>
920 template <
typename ALLOC>
926 template <
typename ALLOC>
932 template <
typename ALLOC>
938 template <
typename ALLOC>
944 template <
typename ALLOC>
950 template <
typename ALLOC>
956 template <
typename ALLOC>
962 template <
typename ALLOC>
968 template <
typename ALLOC>
974 template <
typename ALLOC>
980 template <
typename ALLOC>
986 template <
typename ALLOC>
992 template <
typename ALLOC>
998 template <
typename ALLOC>
1004 template <
typename ALLOC>
1009 template <
typename ALLOC>
1015 template <
typename ALLOC>
1021 template <
typename ALLOC>
1027 template <
typename ALLOC>
1033 template <
typename ALLOC>
1039 template <
typename ALLOC>
1045 template <
typename ALLOC>
1051 template <
typename ALLOC>
1057 template <
typename ALLOC>
1063 template <
typename ALLOC>
1072 template <
typename ALLOC>
1081 template <
typename ALLOC>
1090 template <
typename ALLOC>
1099 template <
typename ALLOC>
1108 template <
typename ALLOC>
1117 template <
typename ALLOC>
1126 template <
typename ALLOC>
1135 template <
typename ALLOC>
1144 template <
typename ALLOC>
1150 template <
typename ALLOC>
1156 template <
typename ALLOC>
1162 template <
typename ALLOC>
1171 template <
typename ALLOC>
1180 template <
typename ALLOC>
1189 template <
typename ALLOC>
1195 template <
typename ALLOC>
1201 template <
typename ALLOC>
1204 if (maxBitSize == 0 || maxBitSize > 64)
1206 throw CppRuntimeException(
"BuiltinTypeInfo::getDynamicSignedBitField: Invalid max bit size '") <<
1210 if (maxBitSize <= 8)
1217 else if (maxBitSize <= 16)
1224 else if (maxBitSize <= 32)
1240 template <
typename ALLOC>
1243 if (maxBitSize == 0 || maxBitSize > 64)
1245 throw CppRuntimeException(
"BuiltinTypeInfo::getDynamicUnsignedBitField: Invalid max bit size '") <<
1249 if (maxBitSize <= 8)
1256 else if (maxBitSize <= 16)
1263 else if (maxBitSize <= 32)
1279 template <
typename ALLOC>
1281 CppType cppType, uint8_t bitSize) :
1282 BuiltinTypeInfo<ALLOC>(schemaName, schemaType, cppType), m_bitSize(bitSize)
1285 template <
typename ALLOC>
1291 template <
typename ALLOC>
1300 template <
typename ALLOC>
1309 template <
typename ALLOC>
1318 template <
typename ALLOC>
1327 template <
typename ALLOC>
1336 template <
typename ALLOC>
1345 template <
typename ALLOC>
1354 template <
typename ALLOC>
1363 template <
typename ALLOC>
1372 template <
typename ALLOC>
1381 template <
typename ALLOC>
1390 template <
typename ALLOC>
1399 template <
typename ALLOC>
1402 if (bitSize == 0 || bitSize > 64)
1404 throw CppRuntimeException(
"FixedSizeBuiltinTypeInfo::getFixedSignedBitField: Invalid bit size '") <<
1408 static const std::array<FixedSizeBuiltinTypeInfo<ALLOC>, 64> bitFieldTypeInfoArray = {{
1475 return bitFieldTypeInfoArray[bitSize - 1];
1478 template <
typename ALLOC>
1481 if (bitSize == 0 || bitSize > 64)
1483 throw CppRuntimeException(
"FixedSizeBuiltinTypeInfo::getFixedUnsignedBitField: Invalid bit size '") <<
1487 static const std::array<FixedSizeBuiltinTypeInfo<ALLOC>, 64> bitFieldTypeInfoArray = {{
1554 return bitFieldTypeInfoArray[bitSize - 1];
1557 template <
typename ALLOC>
1562 m_templateName(templateName), m_templateArguments(templateArguments)
1565 template <
typename ALLOC>
1568 template <
typename ALLOC>
1571 return m_templateName;
1574 template <
typename ALLOC>
1577 return m_templateArguments;
1580 template <
typename ALLOC>
1587 m_createInstanceFunc(createInstanceFunc),
1588 m_fields(fields), m_parameters(parameters), m_functions(functions)
1591 template <
typename ALLOC>
1594 template <
typename ALLOC>
1600 template <
typename ALLOC>
1603 return m_parameters;
1606 template <
typename ALLOC>
1612 template <
typename ALLOC>
1615 if (!m_createInstanceFunc)
1618 "either '-withoutWriterCode' or '-withoutReflectionCode' zserio option is used!";
1620 return m_createInstanceFunc(allocator);
1623 template <
typename ALLOC>
1629 templateName, templateArguments, fields, parameters, functions)
1632 template <
typename ALLOC>
1638 templateName, templateArguments, fields, parameters, functions)
1641 template <
typename ALLOC>
1648 templateName, templateArguments, fields, parameters, functions),
1649 m_selector(selector), m_cases(cases)
1652 template <
typename ALLOC>
1658 template <
typename ALLOC>
1664 template <
typename ALLOC>
1670 templateName, templateArguments),
1671 m_columns(columns), m_sqlConstraint(sqlConstraint), m_virtualTableUsing(virtualTableUsing),
1672 m_isWithoutRowId(isWithoutRowId)
1675 template <
typename ALLOC>
1681 template <
typename ALLOC>
1684 return m_sqlConstraint;
1687 template <
typename ALLOC>
1690 return m_virtualTableUsing;
1693 template <
typename ALLOC>
1696 return m_isWithoutRowId;
1699 template <
typename ALLOC>
1706 template <
typename ALLOC>
1712 template <
typename ALLOC>
1717 m_underlyingType(underlyingType), m_underlyingTypeArguments(underlyingTypeArguments)
1720 template <
typename ALLOC>
1723 return m_underlyingType;
1726 template <
typename ALLOC>
1729 return m_underlyingTypeArguments;
1732 template <
typename ALLOC>
1736 underlyingType, underlyingTypeArguments),
1737 m_enumItems(enumItems)
1740 template <
typename ALLOC>
1746 template <
typename ALLOC>
1750 underlyingType, underlyingTypeArguments),
1751 m_bitmaskValues(bitmaskValues)
1754 template <
typename ALLOC>
1757 return m_bitmaskValues;
1760 template <
typename ALLOC>
1765 template <
typename ALLOC>
1771 template <
typename ALLOC>
1776 template <
typename ALLOC>
1782 template <
typename ALLOC>
1785 return m_typeInfoFunc().getSchemaName();
1788 template <
typename ALLOC>
1791 return m_typeInfoFunc().getSchemaType();
1794 template <
typename ALLOC>
1797 return m_typeInfoFunc().getCppType();
1800 template <
typename ALLOC>
1803 return m_typeInfoFunc().getBitSize();
1806 template <
typename ALLOC>
1809 return m_typeInfoFunc().getFields();
1812 template <
typename ALLOC>
1815 return m_typeInfoFunc().getParameters();
1818 template <
typename ALLOC>
1821 return m_typeInfoFunc().getFunctions();
1824 template <
typename ALLOC>
1827 return m_typeInfoFunc().getSelector();
1830 template <
typename ALLOC>
1833 return m_typeInfoFunc().getCases();
1836 template <
typename ALLOC>
1839 return m_typeInfoFunc().getUnderlyingType();
1842 template <
typename ALLOC>
1845 return m_typeInfoFunc().getUnderlyingTypeArguments();
1848 template <
typename ALLOC>
1851 return m_typeInfoFunc().getEnumItems();
1854 template <
typename ALLOC>
1857 return m_typeInfoFunc().getBitmaskValues();
1860 template <
typename ALLOC>
1863 return m_typeInfoFunc().getColumns();
1866 template <
typename ALLOC>
1869 return m_typeInfoFunc().getSqlConstraint();
1872 template <
typename ALLOC>
1875 return m_typeInfoFunc().getVirtualTableUsing();
1878 template <
typename ALLOC>
1881 return m_typeInfoFunc().isWithoutRowId();
1884 template <
typename ALLOC>
1887 return m_typeInfoFunc().getTables();
1890 template <
typename ALLOC>
1893 return m_typeInfoFunc().getTemplateName();
1896 template <
typename ALLOC>
1899 return m_typeInfoFunc().getTemplateArguments();
1902 template <
typename ALLOC>
1905 return m_typeInfoFunc().getMessages();
1908 template <
typename ALLOC>
1911 return m_typeInfoFunc().getMethods();
1914 template <
typename ALLOC>
1917 return m_typeInfoFunc().createInstance(allocator);
1920 template <
typename ALLOC>
1928 #endif // ZSERIO_TYPE_INFO_INC_H PubsubTypeInfo(StringView schemaName, Span< const BasicMessageInfo< ALLOC >> messages)
constexpr BasicStringView< CharT > makeStringView(const CharT(&str)[N])
static const IBasicTypeInfo< ALLOC > & getBool()
static const IBasicTypeInfo< ALLOC > & getVarInt16()
Span< const BasicFieldInfo< ALLOC > > getFields() const override
const IBasicTypeInfo< ALLOC > & getUnderlyingType() const override
StringView getTemplateName() const override
static const IBasicTypeInfo< ALLOC > & getInt32()
Span< const BasicColumnInfo< ALLOC > > getColumns() const override
StringView getSelector() const override
typename IBasicReflectable< ALLOC >::Ptr IBasicReflectablePtr
StringView getVirtualTableUsing() const override
Span< const BasicMethodInfo< ALLOC > > getMethods() const override
TypeInfoBase & operator=(const TypeInfoBase &)=delete
Span< const BasicMessageInfo< ALLOC > > getMessages() const override
StringView getSqlConstraint() const override
static const IBasicTypeInfo< ALLOC > & getFixedUnsignedBitField(uint8_t bitSize)
Span< const ItemInfo > getEnumItems() const override
EnumTypeInfo(StringView schemaName, const IBasicTypeInfo< ALLOC > &underlyingType, Span< const StringView > underlyingTypeArguments, Span< const ItemInfo > enumItems)
Span< const ItemInfo > getEnumItems() const override
StringView getSchemaName() const override
static const IBasicTypeInfo< ALLOC > & getVarUInt16()
static const IBasicTypeInfo< ALLOC > & getInt32()
StringView getVirtualTableUsing() const override
bool isWithoutRowId() const override
Span< const BasicColumnInfo< ALLOC > > getColumns() const override
Span< const BasicFunctionInfo< ALLOC > > getFunctions() const override
Span< const BasicTableInfo< ALLOC > > getTables() const override
const IBasicTypeInfo< ALLOC > & getUnderlyingType() const override
static const IBasicTypeInfo< ALLOC > & getUInt64()
Span< const StringView > getUnderlyingTypeArguments() const override
~TypeInfoBase() override=0
Span< const StringView > getUnderlyingTypeArguments() const override
~TemplatableTypeInfoBase() override=0
static const IBasicTypeInfo< ALLOC > & getFloat64()
static const IBasicTypeInfo< ALLOC > & getFloat16()
StringView getVirtualTableUsing() const override
static const IBasicTypeInfo< ALLOC > & getInt16()
Span< const BasicParameterInfo< ALLOC > > getParameters() const override
static const IBasicTypeInfo< ALLOC > & getUInt8()
CppType getCppType() const override
Span< const BasicParameterInfo< ALLOC > > getParameters() const override
FixedSizeBuiltinTypeInfo(StringView schemaName, SchemaType schemaType, CppType cppType, uint8_t bitSize)
static const IBasicTypeInfo< ALLOC > & getBytes()
Span< const BasicColumnInfo< ALLOC > > getColumns() const override
SqlTableTypeInfo(StringView schemaName, StringView templateName, Span< const BasicTemplateArgumentInfo< ALLOC >> templateArguments, Span< const BasicColumnInfo< ALLOC >> columns, StringView sqlConstraint, StringView virtualTableUsing, bool isWithoutRowId)
static const IBasicTypeInfo< ALLOC > & getUInt64()
Span< const ItemInfo > getBitmaskValues() const override
static const IBasicTypeInfo< ALLOC > & getUInt32()
ChoiceTypeInfo(StringView schemaName, CreateInstanceFunc createInstanceFunc, StringView templateName, Span< const BasicTemplateArgumentInfo< ALLOC >> templateArguments, Span< const BasicFieldInfo< ALLOC >> fields, Span< const BasicParameterInfo< ALLOC >> parameters, Span< const BasicFunctionInfo< ALLOC >> functions, StringView selector, Span< const BasicCaseInfo< ALLOC >> cases)
Span< const BasicTemplateArgumentInfo< ALLOC > > getTemplateArguments() const override
uint8_t getBitSize() const override
static const IBasicTypeInfo< ALLOC > & getFixedUnsignedBitField(uint8_t bitSize)
StringView getSqlConstraint() const override
StringView getSelector() const override
static const IBasicTypeInfo< ALLOC > & getDynamicSignedBitField(uint8_t maxBitSize)
static const IBasicTypeInfo< ALLOC > & getFloat64()
uint8_t getBitSize() const override
static const IBasicTypeInfo< ALLOC > & getFloat32()
StringView getTemplateName() const override
Span< const BasicTemplateArgumentInfo< ALLOC > > getTemplateArguments() const override
BitmaskTypeInfo(StringView schemaName, const IBasicTypeInfo< ALLOC > &underlyingType, Span< const StringView > underlyingTypeArguments, Span< const ItemInfo > bitmaskValues)
TemplatableTypeInfoBase(StringView schemaName, SchemaType schemaType, CppType cppType, StringView templateName, Span< const BasicTemplateArgumentInfo< ALLOC >> templateArguments)
Span< const BasicParameterInfo< ALLOC > > getParameters() const override
CppType getCppType() const override
TypeInfoWithUnderlyingTypeBase(StringView schemaName, SchemaType schemaType, CppType cppType, const IBasicTypeInfo< ALLOC > &underlyingType, Span< const StringView > underlyingTypeArguments)
static const IBasicTypeInfo< ALLOC > & getInt16()
Span< const BasicFunctionInfo< ALLOC > > getFunctions() const override
Span< const StringView > getUnderlyingTypeArguments() const override
static const IBasicTypeInfo< ALLOC > & getInt64()
static const IBasicTypeInfo< ALLOC > & getVarUInt()
static const IBasicTypeInfo< ALLOC > & getFixedSignedBitField(uint8_t bitSize)
RecursiveTypeInfo(TypeInfoFunc typeInfoFunc)
Span< const BasicTemplateArgumentInfo< ALLOC > > getTemplateArguments() const override
static const IBasicTypeInfo< ALLOC > & getVarInt64()
static const IBasicTypeInfo< ALLOC > & getFloat32()
bool isWithoutRowId() const override
StringView getSchemaName() const override
Span< const BasicMethodInfo< ALLOC > > getMethods() const override
Span< const BasicFieldInfo< ALLOC > > getFields() const override
static const IBasicTypeInfo< ALLOC > & getVarInt()
static const IBasicTypeInfo< ALLOC > & getDynamicUnsignedBitField(uint8_t maxBitSize)
Span< const ItemInfo > getBitmaskValues() const override
Span< const BasicCaseInfo< ALLOC > > getCases() const override
StringView getTemplateName() const override
SqlDatabaseTypeInfo(StringView schemaName, Span< const BasicTableInfo< ALLOC >> tables)
Span< const BasicTableInfo< ALLOC > > getTables() const override
Span< const BasicTableInfo< ALLOC > > getTables() const override
Span< const BasicCaseInfo< ALLOC > > getCases() const override
static const IBasicTypeInfo< ALLOC > & getVarSize()
Span< const BasicFunctionInfo< ALLOC > > getFunctions() const override
IBasicReflectablePtr< ALLOC > createInstance() const override
CompoundTypeInfoBase(StringView schemaName, CreateInstanceFunc createInstanceFunc, SchemaType schemaType, CppType cppType, StringView templateName, Span< const BasicTemplateArgumentInfo< ALLOC >> templateArguments, Span< const BasicFieldInfo< ALLOC >> fields, Span< const BasicParameterInfo< ALLOC >> parameters, Span< const BasicFunctionInfo< ALLOC >> functions)
static const IBasicTypeInfo< ALLOC > & getString()
Span< const BasicMethodInfo< ALLOC > > getMethods() const override
static const IBasicTypeInfo< ALLOC > & getUInt8()
static const IBasicTypeInfo< ALLOC > & getUInt16()
Span< const BasicMessageInfo< ALLOC > > getMessages() const override
static const IBasicTypeInfo< ALLOC > & getBool()
static const IBasicTypeInfo< ALLOC > & getInt8()
Span< const ItemInfo > getBitmaskValues() const override
static const IBasicTypeInfo< ALLOC > & getVarUInt32()
SchemaType getSchemaType() const override
static const IBasicTypeInfo< ALLOC > & getUInt16()
ServiceTypeInfo(StringView schemaName, Span< const BasicMethodInfo< ALLOC >> methods)
SchemaType getSchemaType() const override
StringView getSqlConstraint() const override
static const IBasicTypeInfo< ALLOC > & getUInt32()
IBasicReflectablePtr< ALLOC > createInstance() const override
~CompoundTypeInfoBase() override=0
TypeInfoBase(StringView schemaName, SchemaType schemaType, CppType cppType)
Span< const BasicMessageInfo< ALLOC > > getMessages() const override
static const IBasicTypeInfo< ALLOC > & getInt8()
static const IBasicTypeInfo< ALLOC > & getBitBuffer()
Span< const BasicFieldInfo< ALLOC > > getFields() const override
bool isWithoutRowId() const override
const IBasicTypeInfo< ALLOC > & getUnderlyingType() const override
StringView getSelector() const override
static const IBasicTypeInfo< ALLOC > & getInt64()
IBasicReflectablePtr< ALLOC >(*)(const ALLOC &) CreateInstanceFunc
static const IBasicTypeInfo< ALLOC > & getVarInt32()
UnionTypeInfo(StringView schemaName, CreateInstanceFunc createInstanceFunc, StringView templateName, Span< const BasicTemplateArgumentInfo< ALLOC >> templateArguments, Span< const BasicFieldInfo< ALLOC >> fields, Span< const BasicParameterInfo< ALLOC >> parameters, Span< const BasicFunctionInfo< ALLOC >> functions)
static const IBasicTypeInfo< ALLOC > & getFixedSignedBitField(uint8_t bitSize)
Span< const ItemInfo > getEnumItems() const override
StructTypeInfo(StringView schemaName, CreateInstanceFunc createInstanceFunc, StringView templateName, Span< const BasicTemplateArgumentInfo< ALLOC >> templateArguments, Span< const BasicFieldInfo< ALLOC >> fields, Span< const BasicParameterInfo< ALLOC >> parameters, Span< const BasicFunctionInfo< ALLOC >> functions)
Span< const BasicCaseInfo< ALLOC > > getCases() const override
static const IBasicTypeInfo< ALLOC > & getVarUInt64()
BuiltinTypeInfo(StringView schemaName, SchemaType schemaType, CppType cppType)
uint8_t getBitSize() const override
static const IBasicTypeInfo< ALLOC > & getFloat16()