1 |
|
|
#ifndef ZSERIO_I_TYPE_INFO_INC_H |
2 |
|
|
#define ZSERIO_I_TYPE_INFO_INC_H |
3 |
|
|
|
4 |
|
|
#include "zserio/Span.h" |
5 |
|
|
#include "zserio/StringView.h" |
6 |
|
|
#include "zserio/IReflectable.h" |
7 |
|
|
|
8 |
|
|
namespace zserio |
9 |
|
|
{ |
10 |
|
|
|
11 |
|
|
/** Enumeration which specifies C++ type used in type information. */ |
12 |
|
|
enum class CppType |
13 |
|
|
{ |
14 |
|
|
BOOL, /**< C++ bool type */ |
15 |
|
|
INT8, /**< C++ int8_t type */ |
16 |
|
|
INT16, /**< C++ int16_t type */ |
17 |
|
|
INT32, /**< C++ int32_t type */ |
18 |
|
|
INT64, /**< C++ int64_t type */ |
19 |
|
|
UINT8, /**< C++ uint8_t type */ |
20 |
|
|
UINT16, /**< C++ uint16_t type */ |
21 |
|
|
UINT32, /**< C++ int32_t type */ |
22 |
|
|
UINT64, /**< C++ int64_t type */ |
23 |
|
|
FLOAT, /**< C++ float type */ |
24 |
|
|
DOUBLE, /**< C++ double type */ |
25 |
|
|
BYTES, /**< C++ bytes type (mapped as std::vector<uint8_t>) */ |
26 |
|
|
STRING, /**< C++ string type */ |
27 |
|
|
BIT_BUFFER, /**< C++ zserio::BitBuffer type */ |
28 |
|
|
ENUM, /**< C++ enumeration generated from zserio enumeration type */ |
29 |
|
|
BITMASK, /**< C++ object generated from zserio bitmask type */ |
30 |
|
|
STRUCT, /**< C++ object generated from zserio structure type */ |
31 |
|
|
CHOICE, /**< C++ object generated from zserio choice type */ |
32 |
|
|
UNION, /**< C++ object generated from zserio union type */ |
33 |
|
|
SQL_TABLE, /**< C++ object generated from zserio SQL table type */ |
34 |
|
|
SQL_DATABASE, /**< C++ object generated from zserio SQL database type */ |
35 |
|
|
SERVICE, /**< C++ object generated from zserio service type */ |
36 |
|
|
PUBSUB /**< C++ object generated from zserio pubsub type */ |
37 |
|
|
}; |
38 |
|
|
|
39 |
|
|
/** Enumeration which specifies zserio type used in type information. */ |
40 |
|
|
enum class SchemaType |
41 |
|
|
{ |
42 |
|
|
BOOL, /**< zserio bool type */ |
43 |
|
|
INT8, /**< zserio int8 type */ |
44 |
|
|
INT16, /**< zserio int16 type */ |
45 |
|
|
INT32, /**< zserio int32 type */ |
46 |
|
|
INT64, /**< zserio int64 type */ |
47 |
|
|
UINT8, /**< zserio uint8 type */ |
48 |
|
|
UINT16, /**< zserio uint16 type */ |
49 |
|
|
UINT32, /**< zserio uint32 type */ |
50 |
|
|
UINT64, /**< zserio uint64 type */ |
51 |
|
|
VARINT16, /**< zserio varint16 type */ |
52 |
|
|
VARINT32, /**< zserio varint32 type */ |
53 |
|
|
VARINT64, /**< zserio varint64 type */ |
54 |
|
|
VARINT, /**< zserio varint type */ |
55 |
|
|
VARUINT16, /**< zserio varuint16 type */ |
56 |
|
|
VARUINT32, /**< zserio varuint32 type */ |
57 |
|
|
VARUINT64, /**< zserio varuint64 type */ |
58 |
|
|
VARUINT, /**< zserio varuint type */ |
59 |
|
|
VARSIZE, /**< zserio varsize type */ |
60 |
|
|
FIXED_SIGNED_BITFIELD, /**< zserio fixed signed bitfield type */ |
61 |
|
|
FIXED_UNSIGNED_BITFIELD, /**< zserio fixed unsigned bitfield type */ |
62 |
|
|
DYNAMIC_SIGNED_BITFIELD, /**< zserio dynamic signed bitfield type */ |
63 |
|
|
DYNAMIC_UNSIGNED_BITFIELD, /**< zserio dynamic unsigned bitfield type */ |
64 |
|
|
FLOAT16, /**< zserio float16 type */ |
65 |
|
|
FLOAT32, /**< zserio float32 type */ |
66 |
|
|
FLOAT64, /**< zserio float64 type */ |
67 |
|
|
BYTES, /**< zserio bytes type */ |
68 |
|
|
STRING, /**< zserio string type */ |
69 |
|
|
EXTERN, /**< zserio extern type */ |
70 |
|
|
ENUM, /**< zserio enumeration type */ |
71 |
|
|
BITMASK, /**< zserio bitmask type */ |
72 |
|
|
STRUCT, /**< zserio structure type */ |
73 |
|
|
CHOICE, /**< zserio choice type */ |
74 |
|
|
UNION, /**< zserio union type */ |
75 |
|
|
SQL_TABLE, /**< zserio SQL table type */ |
76 |
|
|
SQL_DATABASE, /**< zserio SQL database type */ |
77 |
|
|
SERVICE, /**< zserio service type */ |
78 |
|
|
PUBSUB /**< zserio pubsub type */ |
79 |
|
|
}; |
80 |
|
|
|
81 |
|
|
// forward declarations |
82 |
|
|
template <typename ALLOC> |
83 |
|
|
struct BasicFieldInfo; |
84 |
|
|
template <typename ALLOC> |
85 |
|
|
struct BasicParameterInfo; |
86 |
|
|
template <typename ALLOC> |
87 |
|
|
struct BasicFunctionInfo; |
88 |
|
|
template <typename ALLOC> |
89 |
|
|
struct BasicCaseInfo; |
90 |
|
|
template <typename ALLOC> |
91 |
|
|
struct BasicColumnInfo; |
92 |
|
|
template <typename ALLOC> |
93 |
|
|
struct BasicTableInfo; |
94 |
|
|
struct ItemInfo; |
95 |
|
|
template <typename ALLOC> |
96 |
|
|
struct BasicTemplateArgumentInfo; |
97 |
|
|
template <typename ALLOC> |
98 |
|
|
struct BasicMessageInfo; |
99 |
|
|
template <typename ALLOC> |
100 |
|
|
struct BasicMethodInfo; |
101 |
|
|
|
102 |
|
|
/** |
103 |
|
|
* Type information interface which is returned from the generated zserio objects. |
104 |
|
|
* |
105 |
|
|
* This interface provides additional schema information of the corresponded zserio object, like schema |
106 |
|
|
* name, schema type, etc... |
107 |
|
|
* |
108 |
|
|
* Not all methods are implemented for all zserio objects. For example, the method getFields() is implemented |
109 |
|
|
* for compound types only. To check the zserio object type consider to use TypeInfoUtil helper methods. |
110 |
|
|
*/ |
111 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
112 |
|
3085 |
class IBasicTypeInfo |
113 |
|
|
{ |
114 |
|
|
public: |
115 |
|
|
/** |
116 |
|
|
* Virtual destructor. |
117 |
|
|
*/ |
118 |
✗✓ |
3085 |
virtual ~IBasicTypeInfo() = default; |
119 |
|
|
|
120 |
|
|
/** |
121 |
|
|
* Gets the schema name. |
122 |
|
|
* |
123 |
|
|
* \return The zserio full name stored in schema. |
124 |
|
|
*/ |
125 |
|
|
virtual StringView getSchemaName() const = 0; |
126 |
|
|
|
127 |
|
|
/** |
128 |
|
|
* Gets the schema type. |
129 |
|
|
* |
130 |
|
|
* \return The zserio type stored in schema. |
131 |
|
|
*/ |
132 |
|
|
virtual SchemaType getSchemaType() const = 0; |
133 |
|
|
|
134 |
|
|
/** |
135 |
|
|
* Gets the C++ type. |
136 |
|
|
* |
137 |
|
|
* \return The C++ type to which zserio type is mapped. |
138 |
|
|
*/ |
139 |
|
|
virtual CppType getCppType() const = 0; |
140 |
|
|
|
141 |
|
|
// method for fixed size integral types |
142 |
|
|
|
143 |
|
|
/** |
144 |
|
|
* Gets the bit size of the fixed size integral schema type. |
145 |
|
|
* |
146 |
|
|
* \return The bit size of zserio type. |
147 |
|
|
* |
148 |
|
|
* \throw CppRuntimeException If the zserio type is not fixed size integral (e.g. varint). |
149 |
|
|
*/ |
150 |
|
|
virtual uint8_t getBitSize() const = 0; |
151 |
|
|
|
152 |
|
|
// methods for compound types |
153 |
|
|
|
154 |
|
|
/** |
155 |
|
|
* Gets the type information for compound type fields. |
156 |
|
|
* |
157 |
|
|
* \return Sequence of type informations for fields. |
158 |
|
|
* |
159 |
|
|
* \throw CppRuntimeException If the zserio type is not compound type. |
160 |
|
|
*/ |
161 |
|
|
virtual Span<const BasicFieldInfo<ALLOC>> getFields() const = 0; |
162 |
|
|
|
163 |
|
|
/** |
164 |
|
|
* Gets the type information for compound type parameters. |
165 |
|
|
* |
166 |
|
|
* \return Sequence of type informations for parameters. |
167 |
|
|
* |
168 |
|
|
* \throw CppRuntimeException If the zserio type is not compound type. |
169 |
|
|
*/ |
170 |
|
|
virtual Span<const BasicParameterInfo<ALLOC>> getParameters() const = 0; |
171 |
|
|
|
172 |
|
|
/** |
173 |
|
|
* Gets the type information for compound type functions. |
174 |
|
|
* |
175 |
|
|
* \return Sequence of type informations for functions. |
176 |
|
|
* |
177 |
|
|
* \throw CppRuntimeException If the zserio type is not compound type. |
178 |
|
|
*/ |
179 |
|
|
virtual Span<const BasicFunctionInfo<ALLOC>> getFunctions() const = 0; |
180 |
|
|
|
181 |
|
|
// methods for choice type |
182 |
|
|
|
183 |
|
|
/** |
184 |
|
|
* Gets the selector for choice type. |
185 |
|
|
* |
186 |
|
|
* \return Selector expression of choice type. |
187 |
|
|
* |
188 |
|
|
* \throw CppRuntimeException If the zserio type is not choice type. |
189 |
|
|
*/ |
190 |
|
|
virtual StringView getSelector() const = 0; |
191 |
|
|
|
192 |
|
|
/** |
193 |
|
|
* Gets the type information for choice type cases. |
194 |
|
|
* |
195 |
|
|
* \return Sequence of type informations for choice type cases. |
196 |
|
|
* |
197 |
|
|
* \throw CppRuntimeException If the zserio type is not choice type. |
198 |
|
|
*/ |
199 |
|
|
virtual Span<const BasicCaseInfo<ALLOC>> getCases() const = 0; |
200 |
|
|
|
201 |
|
|
// methods for enumeration and bitmask types |
202 |
|
|
|
203 |
|
|
/** |
204 |
|
|
* Gets the reference to type information of underlying zserio type. |
205 |
|
|
* |
206 |
|
|
* \return Reference to type information of underlying zserio type. |
207 |
|
|
* |
208 |
|
|
* \throw CppRuntimeException If the zserio type is not enumeration or bitmask type. |
209 |
|
|
*/ |
210 |
|
|
virtual const IBasicTypeInfo<ALLOC>& getUnderlyingType() const = 0; |
211 |
|
|
|
212 |
|
|
/** |
213 |
|
|
* Gets the reference to type information of underlying zserio type arguments. |
214 |
|
|
* |
215 |
|
|
* \return Underlying zserio type arguments. |
216 |
|
|
* |
217 |
|
|
* \throw CppRuntimeException If the zserio type is not enumeration or bitmask type. |
218 |
|
|
*/ |
219 |
|
|
virtual Span<const StringView> getUnderlyingTypeArguments() const = 0; |
220 |
|
|
|
221 |
|
|
/** |
222 |
|
|
* Gets the type information for enumeration type items. |
223 |
|
|
* |
224 |
|
|
* \return Sequence of type informations for enumeration type items. |
225 |
|
|
* |
226 |
|
|
* \throw CppRuntimeException If the zserio type is not enumeration type. |
227 |
|
|
*/ |
228 |
|
|
virtual Span<const ItemInfo> getEnumItems() const = 0; |
229 |
|
|
|
230 |
|
|
/** |
231 |
|
|
* Gets the type information for bitmask type values. |
232 |
|
|
* |
233 |
|
|
* \return Sequence of type informations for bitmask type values. |
234 |
|
|
* |
235 |
|
|
* \throw CppRuntimeException If the zserio type is not bitmask type. |
236 |
|
|
*/ |
237 |
|
|
virtual Span<const ItemInfo> getBitmaskValues() const = 0; |
238 |
|
|
|
239 |
|
|
// methods for SQL table types |
240 |
|
|
|
241 |
|
|
/** |
242 |
|
|
* Gets the type information for SQL table columns. |
243 |
|
|
* |
244 |
|
|
* \return Sequence of type informations for SQL table columns. |
245 |
|
|
* |
246 |
|
|
* \throw CppRuntimeException If the zserio type is not SQL table type. |
247 |
|
|
*/ |
248 |
|
|
virtual Span<const BasicColumnInfo<ALLOC>> getColumns() const = 0; |
249 |
|
|
|
250 |
|
|
/** |
251 |
|
|
* Gets the SQL table constraint. |
252 |
|
|
* |
253 |
|
|
* \return The SQL table constraint. |
254 |
|
|
* |
255 |
|
|
* \throw CppRuntimeException If the zserio type is not SQL table type. |
256 |
|
|
*/ |
257 |
|
|
virtual StringView getSqlConstraint() const = 0; |
258 |
|
|
|
259 |
|
|
/** |
260 |
|
|
* Gets the SQL virtual table using specification. |
261 |
|
|
* |
262 |
|
|
* \return The SQL virtual table using specification. |
263 |
|
|
* |
264 |
|
|
* \throw CppRuntimeException If the zserio type is not SQL table type. |
265 |
|
|
*/ |
266 |
|
|
virtual StringView getVirtualTableUsing() const = 0; |
267 |
|
|
|
268 |
|
|
/** |
269 |
|
|
* Checks if SQL table is without row id table. |
270 |
|
|
* |
271 |
|
|
* \return true if SQL table is without row id table, otherwise false. |
272 |
|
|
* |
273 |
|
|
* \throw CppRuntimeException If the zserio type is not SQL table type. |
274 |
|
|
*/ |
275 |
|
|
virtual bool isWithoutRowId() const = 0; |
276 |
|
|
|
277 |
|
|
// method for SQL database type |
278 |
|
|
|
279 |
|
|
/** |
280 |
|
|
* Gets the type information for SQL database tables. |
281 |
|
|
* |
282 |
|
|
* \return Sequence of type informations for SQL database tables. |
283 |
|
|
* |
284 |
|
|
* \throw CppRuntimeException If the zserio type is not SQL database type. |
285 |
|
|
*/ |
286 |
|
|
virtual Span<const BasicTableInfo<ALLOC>> getTables() const = 0; |
287 |
|
|
|
288 |
|
|
// methods for templatable types |
289 |
|
|
|
290 |
|
|
/** |
291 |
|
|
* Gets the full schema template name. |
292 |
|
|
* |
293 |
|
|
* \return The full schema template name. |
294 |
|
|
* |
295 |
|
|
* \throw CppRuntimeException If the zserio type is not templatable. |
296 |
|
|
*/ |
297 |
|
|
virtual StringView getTemplateName() const = 0; |
298 |
|
|
|
299 |
|
|
/** |
300 |
|
|
* Gets the type information for template arguments. |
301 |
|
|
* |
302 |
|
|
* \return Sequence of type informations for template arguments. |
303 |
|
|
* |
304 |
|
|
* \throw CppRuntimeException If the zserio type is not templatable. |
305 |
|
|
*/ |
306 |
|
|
virtual Span<const BasicTemplateArgumentInfo<ALLOC>> getTemplateArguments() const = 0; |
307 |
|
|
|
308 |
|
|
// method for pubsub type |
309 |
|
|
|
310 |
|
|
/** |
311 |
|
|
* Gets the type information for pubsub messages. |
312 |
|
|
* |
313 |
|
|
* \return Sequence of type informations for pubsub messages. |
314 |
|
|
* |
315 |
|
|
* \throw CppRuntimeException If the zserio type is not pubsub type. |
316 |
|
|
*/ |
317 |
|
|
virtual Span<const BasicMessageInfo<ALLOC>> getMessages() const = 0; |
318 |
|
|
|
319 |
|
|
// method for service type |
320 |
|
|
|
321 |
|
|
/** |
322 |
|
|
* Gets the type information for service methods. |
323 |
|
|
* |
324 |
|
|
* \return Sequence of type informations for service methods. |
325 |
|
|
* |
326 |
|
|
* \throw CppRuntimeException If the zserio type is not service type. |
327 |
|
|
*/ |
328 |
|
|
virtual Span<const BasicMethodInfo<ALLOC>> getMethods() const = 0; |
329 |
|
|
|
330 |
|
|
/** |
331 |
|
|
* Creates new instance of the zserio compound type. |
332 |
|
|
* |
333 |
|
|
* \param allocator Allocator to use for allocation of new instance. |
334 |
|
|
* |
335 |
|
|
* \return New instance of zserio compound type. |
336 |
|
|
* |
337 |
|
|
* \throw CppRuntimeException If the zserio type is not compound type. |
338 |
|
|
*/ |
339 |
|
|
virtual IBasicReflectablePtr<ALLOC> createInstance(const ALLOC& allocator) const = 0; |
340 |
|
|
|
341 |
|
|
/** |
342 |
|
|
* Creates new instance of the zserio compound type. |
343 |
|
|
* |
344 |
|
|
* \note Default constructed allocator is used for allocation of new instance. |
345 |
|
|
* |
346 |
|
|
* \return New instance of zserio compound type. |
347 |
|
|
* |
348 |
|
|
* \throw CppRuntimeException If the zserio type is not compound type. |
349 |
|
|
*/ |
350 |
|
|
virtual IBasicReflectablePtr<ALLOC> createInstance() const = 0; |
351 |
|
|
}; |
352 |
|
|
|
353 |
|
|
/** |
354 |
|
|
* Type information for compound type field. |
355 |
|
|
*/ |
356 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
357 |
|
|
struct BasicFieldInfo |
358 |
|
|
{ |
359 |
|
1562 |
BasicFieldInfo(StringView schemaName_, const IBasicTypeInfo<ALLOC>& typeInfo_, |
360 |
|
|
Span<const StringView> typeArguments_, bool isExtended_, StringView alignment_, StringView offset_, |
361 |
|
|
StringView initializer_, bool isOptional_, StringView optionalCondition_, |
362 |
|
|
StringView constraint_, bool isArray_, StringView arrayLength_, bool isPacked_ ,bool isImplicit_) : |
363 |
|
|
schemaName(schemaName_), typeInfo(typeInfo_), typeArguments(typeArguments_), |
364 |
|
|
isExtended(isExtended_), alignment(alignment_), offset(offset_), initializer(initializer_), |
365 |
|
|
isOptional(isOptional_), optionalCondition(optionalCondition_), constraint(constraint_), |
366 |
|
1562 |
isArray(isArray_), arrayLength(arrayLength_), isPacked(isPacked_), isImplicit(isImplicit_) |
367 |
|
1562 |
{} |
368 |
|
|
|
369 |
|
|
StringView schemaName; /**< field schema name */ |
370 |
|
|
const IBasicTypeInfo<ALLOC>& typeInfo; /**< reference to type information for a field type */ |
371 |
|
|
Span<const StringView> typeArguments; /**< sequence of field type arguments */ |
372 |
|
|
bool isExtended; /**< true if field is extended */ |
373 |
|
|
StringView alignment; /**< field alignment or empty in case of no alignment */ |
374 |
|
|
StringView offset; /**< field offset or empty in case of no alignment */ |
375 |
|
|
StringView initializer; /**< field initializer or empty in case of no alignment */ |
376 |
|
|
bool isOptional; /**< true if field is optional */ |
377 |
|
|
StringView optionalCondition; /**< optional condition or empty if field is not optional */ |
378 |
|
|
StringView constraint; /**< constraint or empty if field does not have constraint */ |
379 |
|
|
bool isArray; /**< true if field is array */ |
380 |
|
|
StringView arrayLength; /**< array length or empty if field is not array or is auto/implicit array */ |
381 |
|
|
bool isPacked; /**< true if field is array and packed */ |
382 |
|
|
bool isImplicit; /**< true if field is array and implicit */ |
383 |
|
|
}; |
384 |
|
|
|
385 |
|
|
/** |
386 |
|
|
* Type information for compound type parameter. |
387 |
|
|
*/ |
388 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
389 |
|
|
struct BasicParameterInfo |
390 |
|
|
{ |
391 |
|
|
StringView schemaName; /**< parameter schema name */ |
392 |
|
|
const IBasicTypeInfo<ALLOC>& typeInfo; /**< reference to type information for a parameter type */ |
393 |
|
|
}; |
394 |
|
|
|
395 |
|
|
/** |
396 |
|
|
* Type information for compound type function. |
397 |
|
|
*/ |
398 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
399 |
|
|
struct BasicFunctionInfo |
400 |
|
|
{ |
401 |
|
|
StringView schemaName; /**< function schema name */ |
402 |
|
|
const IBasicTypeInfo<ALLOC>& typeInfo; /**< reference to type information for a resulting function type */ |
403 |
|
|
StringView functionResult; /**< specifies the function result */ |
404 |
|
|
}; |
405 |
|
|
|
406 |
|
|
/** |
407 |
|
|
* Type information for choice type case. |
408 |
|
|
*/ |
409 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
410 |
|
|
struct BasicCaseInfo |
411 |
|
|
{ |
412 |
|
|
Span<const StringView> caseExpressions; /**< sequence of case expressions */ |
413 |
|
|
const BasicFieldInfo<ALLOC>* field; /**< pointer to type information for a case field */ |
414 |
|
|
}; |
415 |
|
|
|
416 |
|
|
/** |
417 |
|
|
* Type information for enumeration type item or for bitmask type value. |
418 |
|
|
*/ |
419 |
|
|
struct ItemInfo |
420 |
|
|
{ |
421 |
|
466 |
ItemInfo(StringView schemaName_, uint64_t value_, bool isDeprecated_, bool isRemoved_) : |
422 |
|
466 |
schemaName(schemaName_), value(value_), isDeprecated(isDeprecated_), isRemoved(isRemoved_) |
423 |
|
466 |
{} |
424 |
|
|
|
425 |
|
|
StringView schemaName; /**< enumeration item or bitmask value schema name */ |
426 |
|
|
uint64_t value; /**< enumeration item or bitmask value cast to uint64_t */ |
427 |
|
|
bool isDeprecated; /**< flag whether the item is deprecated */ |
428 |
|
|
bool isRemoved; /**< flag whether the item is removed */ |
429 |
|
|
}; |
430 |
|
|
|
431 |
|
|
/** |
432 |
|
|
* Type information for SQL table column. |
433 |
|
|
*/ |
434 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
435 |
|
|
struct BasicColumnInfo |
436 |
|
|
{ |
437 |
|
|
BasicColumnInfo(StringView schemaName_, const IBasicTypeInfo<ALLOC>& typeInfo_, |
438 |
|
|
Span<const StringView> typeArguments_, StringView sqlTypeName_, StringView sqlConstraint_, |
439 |
|
|
bool isVirtual_) : |
440 |
|
|
schemaName(schemaName_), typeInfo(typeInfo_), typeArguments(typeArguments_), |
441 |
|
|
sqlTypeName(sqlTypeName_), sqlConstraint(sqlConstraint_), isVirtual(isVirtual_) |
442 |
|
|
{} |
443 |
|
|
|
444 |
|
|
StringView schemaName; /**< column schema name */ |
445 |
|
|
const IBasicTypeInfo<ALLOC>& typeInfo; /**< reference to type information for a column type */ |
446 |
|
|
Span<const StringView> typeArguments; /**< sequence of column type arguments */ |
447 |
|
|
StringView sqlTypeName; /**< column SQL type name */ |
448 |
|
|
StringView sqlConstraint; /**< column constraint or empty if column does not have any constraint */ |
449 |
|
|
bool isVirtual; /**< true if SQL table is virtual */ |
450 |
|
|
}; |
451 |
|
|
|
452 |
|
|
/** |
453 |
|
|
* Type information for SQL database table. |
454 |
|
|
*/ |
455 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
456 |
|
|
struct BasicTableInfo |
457 |
|
|
{ |
458 |
|
|
StringView schemaName; /**< table schema name */ |
459 |
|
|
const IBasicTypeInfo<ALLOC>& typeInfo; /**< reference to type information for a table */ |
460 |
|
|
}; |
461 |
|
|
|
462 |
|
|
/** |
463 |
|
|
* Type information for template argument. |
464 |
|
|
*/ |
465 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
466 |
|
|
struct BasicTemplateArgumentInfo |
467 |
|
|
{ |
468 |
|
|
const IBasicTypeInfo<ALLOC>& typeInfo; /**< reference to type information for a template argument */ |
469 |
|
|
}; |
470 |
|
|
|
471 |
|
|
/** |
472 |
|
|
* Type information for pubsub message. |
473 |
|
|
*/ |
474 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
475 |
|
|
struct BasicMessageInfo |
476 |
|
|
{ |
477 |
|
|
BasicMessageInfo(StringView schemaName_, const IBasicTypeInfo<ALLOC>& typeInfo_, |
478 |
|
|
bool isPublished_, bool isSubscribed_, StringView topic_) : |
479 |
|
|
schemaName(schemaName_), typeInfo(typeInfo_), |
480 |
|
|
isPublished(isPublished_), isSubscribed(isSubscribed_), topic(topic_) |
481 |
|
|
{} |
482 |
|
|
|
483 |
|
|
StringView schemaName; /**< message schema name */ |
484 |
|
|
const IBasicTypeInfo<ALLOC>& typeInfo; /**< reference to type information for a message type */ |
485 |
|
|
bool isPublished; /**< true if the message is published */ |
486 |
|
|
bool isSubscribed; /**< true if the message is subscribed */ |
487 |
|
|
StringView topic; /**< pubsub topic for a message */ |
488 |
|
|
}; |
489 |
|
|
|
490 |
|
|
/** |
491 |
|
|
* Type information for service method. |
492 |
|
|
*/ |
493 |
|
|
template <typename ALLOC = std::allocator<uint8_t>> |
494 |
|
|
struct BasicMethodInfo |
495 |
|
|
{ |
496 |
|
|
/** service schema name */ |
497 |
|
|
StringView schemaName; |
498 |
|
|
/** reference to type information for a method response type */ |
499 |
|
|
const IBasicTypeInfo<ALLOC>& responseTypeInfo; |
500 |
|
|
/** reference to type information for a method request type */ |
501 |
|
|
const IBasicTypeInfo<ALLOC>& requestTypeInfo; |
502 |
|
|
}; |
503 |
|
|
|
504 |
|
|
/** |
505 |
|
|
* Gets type info for the given enum type. |
506 |
|
|
* |
507 |
|
|
* \return Enum type info. |
508 |
|
|
*/ |
509 |
|
|
template <typename T, typename ALLOC = std::allocator<uint8_t>> |
510 |
|
|
const IBasicTypeInfo<ALLOC>& enumTypeInfo(); |
511 |
|
|
|
512 |
|
|
/** Typedef provided for convenience - using default std::allocator<uint8_t>. */ |
513 |
|
|
/** \{ */ |
514 |
|
|
using ITypeInfo = IBasicTypeInfo<>; |
515 |
|
|
using FieldInfo = BasicFieldInfo<>; |
516 |
|
|
using ParameterInfo = BasicParameterInfo<>; |
517 |
|
|
using FunctionInfo = BasicFunctionInfo<>; |
518 |
|
|
using CaseInfo = BasicCaseInfo<>; |
519 |
|
|
using ColumnInfo = BasicColumnInfo<>; |
520 |
|
|
using TableInfo = BasicTableInfo<>; |
521 |
|
|
using TemplateArgumentInfo = BasicTemplateArgumentInfo<>; |
522 |
|
|
using MessageInfo = BasicMessageInfo<>; |
523 |
|
|
using MethodInfo = BasicMethodInfo<>; |
524 |
|
|
/** \} */ |
525 |
|
|
|
526 |
|
|
} // namespace zserio |
527 |
|
|
|
528 |
|
|
#endif // ZSERIO_I_TYPE_INFO_INC_H |