Zserio C++ runtime library  1.3.0
Built for Zserio 2.18.0
TypeInfoUtil.cpp
Go to the documentation of this file.
1 #include "zserio/TypeInfoUtil.h"
2 
3 namespace zserio
4 {
5 
7 {
8  return schemaType == SchemaType::STRUCT || schemaType == SchemaType::CHOICE ||
9  schemaType == SchemaType::UNION;
10 }
11 
13 {
14  return cppType == CppType::STRUCT || cppType == CppType::CHOICE || cppType == CppType::UNION;
15 }
16 
18 {
19  return schemaType == SchemaType::CHOICE || schemaType == SchemaType::UNION;
20 }
21 
23 {
24  return cppType == CppType::CHOICE || cppType == CppType::UNION;
25 }
26 
28 {
29  switch (schemaType)
30  {
31  case SchemaType::BOOL:
32  case SchemaType::INT8:
33  case SchemaType::INT16:
34  case SchemaType::INT32:
35  case SchemaType::INT64:
36  case SchemaType::UINT8:
37  case SchemaType::UINT16:
38  case SchemaType::UINT32:
39  case SchemaType::UINT64:
45  return true;
49  case SchemaType::VARINT:
57  case SchemaType::BYTES:
58  case SchemaType::STRING:
59  case SchemaType::EXTERN:
60  case SchemaType::ENUM:
62  case SchemaType::STRUCT:
63  case SchemaType::CHOICE:
64  case SchemaType::UNION:
68  case SchemaType::PUBSUB:
69  default:
70  return false;
71  }
72 }
73 
75 {
76  switch (cppType)
77  {
78  case CppType::BOOL:
79  case CppType::INT8:
80  case CppType::INT16:
81  case CppType::INT32:
82  case CppType::INT64:
83  case CppType::UINT8:
84  case CppType::UINT16:
85  case CppType::UINT32:
86  case CppType::UINT64:
87  case CppType::FLOAT:
88  case CppType::DOUBLE:
89  return true;
90  case CppType::BYTES:
91  case CppType::STRING:
93  case CppType::ENUM:
94  case CppType::BITMASK:
95  case CppType::STRUCT:
96  case CppType::CHOICE:
97  case CppType::UNION:
98  case CppType::SQL_TABLE:
100  case CppType::SERVICE:
101  case CppType::PUBSUB:
102  default:
103  return false;
104  }
105 }
106 
108 {
109  switch (schemaType)
110  {
111  case SchemaType::BOOL:
112  case SchemaType::INT8:
113  case SchemaType::INT16:
114  case SchemaType::INT32:
115  case SchemaType::INT64:
116  case SchemaType::UINT8:
117  case SchemaType::UINT16:
118  case SchemaType::UINT32:
119  case SchemaType::UINT64:
123  case SchemaType::VARINT:
127  case SchemaType::VARUINT:
128  case SchemaType::VARSIZE:
133  return true;
134  case SchemaType::FLOAT16:
135  case SchemaType::FLOAT32:
136  case SchemaType::FLOAT64:
137  case SchemaType::BYTES:
138  case SchemaType::STRING:
139  case SchemaType::EXTERN:
140  case SchemaType::ENUM:
141  case SchemaType::BITMASK:
142  case SchemaType::STRUCT:
143  case SchemaType::CHOICE:
144  case SchemaType::UNION:
147  case SchemaType::SERVICE:
148  case SchemaType::PUBSUB:
149  default:
150  return false;
151  }
152 }
153 
155 {
156  switch (cppType)
157  {
158  case CppType::BOOL:
159  case CppType::INT8:
160  case CppType::INT16:
161  case CppType::INT32:
162  case CppType::INT64:
163  case CppType::UINT8:
164  case CppType::UINT16:
165  case CppType::UINT32:
166  case CppType::UINT64:
167  return true;
168  case CppType::FLOAT:
169  case CppType::DOUBLE:
170  case CppType::BYTES:
171  case CppType::STRING:
172  case CppType::BIT_BUFFER:
173  case CppType::ENUM:
174  case CppType::BITMASK:
175  case CppType::STRUCT:
176  case CppType::CHOICE:
177  case CppType::UNION:
178  case CppType::SQL_TABLE:
180  case CppType::SERVICE:
181  case CppType::PUBSUB:
182  default:
183  return false;
184  }
185 }
186 
188 {
189  switch (schemaType)
190  {
191  case SchemaType::INT8:
192  case SchemaType::INT16:
193  case SchemaType::INT32:
194  case SchemaType::INT64:
198  case SchemaType::VARINT:
201  case SchemaType::FLOAT16:
202  case SchemaType::FLOAT32:
203  case SchemaType::FLOAT64:
204  return true;
205  case SchemaType::BOOL:
206  case SchemaType::UINT8:
207  case SchemaType::UINT16:
208  case SchemaType::UINT32:
209  case SchemaType::UINT64:
213  case SchemaType::VARUINT:
214  case SchemaType::VARSIZE:
217  case SchemaType::BYTES:
218  case SchemaType::STRING:
219  case SchemaType::EXTERN:
220  case SchemaType::ENUM:
221  case SchemaType::BITMASK:
222  case SchemaType::STRUCT:
223  case SchemaType::CHOICE:
224  case SchemaType::UNION:
227  case SchemaType::SERVICE:
228  case SchemaType::PUBSUB:
229  default:
230  return false;
231  }
232 }
233 
235 {
236  return cppType == CppType::INT8 || cppType == CppType::INT16 || cppType == CppType::INT32 ||
237  cppType == CppType::INT64 || cppType == CppType::FLOAT || cppType == CppType::DOUBLE;
238 }
239 
241 {
242  return schemaType == SchemaType::FLOAT16 || schemaType == SchemaType::FLOAT32 ||
243  schemaType == SchemaType::FLOAT64;
244 }
245 
247 {
248  return cppType == CppType::FLOAT || cppType == CppType::DOUBLE;
249 }
250 
251 } // namespace zserio
SchemaType
Definition: ITypeInfo.h:42
static bool hasChoice(SchemaType schemaType)
static bool isIntegral(SchemaType schemaType)
static bool isCompound(SchemaType schemaType)
Definition: TypeInfoUtil.cpp:6
static bool isSigned(SchemaType schemaType)
static bool isFloatingPoint(SchemaType schemaType)
static bool isFixedSize(SchemaType schemaType)