Commit | Line | Data |
---|---|---|
2e33ac5a PP |
1 | #ifndef BABELTRACE_CTF_IR_FIELD_TYPES_INTERNAL_H |
2 | #define BABELTRACE_CTF_IR_FIELD_TYPES_INTERNAL_H | |
273b65be JG |
3 | |
4 | /* | |
2e33ac5a | 5 | * BabelTrace - CTF IR: Event field types internal |
273b65be | 6 | * |
de9dd397 | 7 | * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
273b65be JG |
8 | * |
9 | * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
10 | * | |
11 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
12 | * of this software and associated documentation files (the "Software"), to deal | |
13 | * in the Software without restriction, including without limitation the rights | |
14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
15 | * copies of the Software, and to permit persons to whom the Software is | |
16 | * furnished to do so, subject to the following conditions: | |
17 | * | |
18 | * The above copyright notice and this permission notice shall be included in | |
19 | * all copies or substantial portions of the Software. | |
20 | * | |
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
27 | * SOFTWARE. | |
28 | */ | |
29 | ||
3dca2276 | 30 | #include <babeltrace/assert-pre-internal.h> |
ac0c6bdd | 31 | #include <babeltrace/ctf-ir/clock-class.h> |
4e8304f7 | 32 | #include <babeltrace/ctf-ir/field-types.h> |
273b65be | 33 | #include <babeltrace/babeltrace-internal.h> |
83509119 | 34 | #include <babeltrace/object-internal.h> |
c55a9f58 | 35 | #include <babeltrace/types.h> |
3dca2276 | 36 | #include <stdint.h> |
273b65be JG |
37 | #include <glib.h> |
38 | ||
3dca2276 PP |
39 | #define BT_ASSERT_PRE_FT_COMMON_HAS_ID(_ft, _type_id, _name) \ |
40 | BT_ASSERT_PRE(((struct bt_field_type_common *) (_ft))->id == (_type_id), \ | |
41 | _name " has the wrong type ID: expected-type-id=%s, " \ | |
42 | "%![ft-]+_F", bt_common_field_type_id_string(_type_id), (_ft)) | |
43 | ||
44 | #define BT_ASSERT_PRE_FT_HOT(_ft, _name) \ | |
45 | BT_ASSERT_PRE_HOT((_ft), (_name), ": +%!+_F", (_ft)) | |
46 | ||
47 | struct bt_field_common; | |
48 | struct bt_field_type_common; | |
49 | struct bt_field_type; | |
50 | ||
51 | typedef void (*bt_field_type_common_method_freeze)( | |
52 | struct bt_field_type_common *); | |
53 | typedef int (*bt_field_type_common_method_validate)( | |
54 | struct bt_field_type_common *); | |
55 | typedef void (*bt_field_type_common_method_set_byte_order)( | |
56 | struct bt_field_type_common *, enum bt_byte_order); | |
57 | typedef struct bt_field_type_common *(*bt_field_type_common_method_copy)( | |
58 | struct bt_field_type_common *); | |
59 | typedef int (*bt_field_type_common_method_compare)( | |
60 | struct bt_field_type_common *, | |
61 | struct bt_field_type_common *); | |
62 | ||
63 | struct bt_field_type_common_methods { | |
64 | bt_field_type_common_method_freeze freeze; | |
65 | bt_field_type_common_method_validate validate; | |
66 | bt_field_type_common_method_set_byte_order set_byte_order; | |
67 | bt_field_type_common_method_copy copy; | |
68 | bt_field_type_common_method_compare compare; | |
69 | }; | |
273b65be | 70 | |
3dca2276 | 71 | struct bt_field_type_common { |
83509119 | 72 | struct bt_object base; |
50842bdc | 73 | enum bt_field_type_id id; |
dc3fffef | 74 | unsigned int alignment; |
3dca2276 PP |
75 | |
76 | /* Virtual table */ | |
77 | struct bt_field_type_common_methods *methods; | |
78 | ||
273b65be JG |
79 | /* |
80 | * A type can't be modified once it is added to an event or after a | |
81 | * a field has been instanciated from it. | |
82 | */ | |
83 | int frozen; | |
81e36fac PP |
84 | |
85 | /* | |
86 | * This flag indicates if the field type is valid. A valid | |
87 | * field type is _always_ frozen. All the nested field types of | |
88 | * a valid field type are also valid (and thus frozen). | |
89 | */ | |
90 | int valid; | |
3dca2276 PP |
91 | |
92 | /* | |
93 | * Specialized data for either CTF IR or CTF writer APIs. | |
94 | * Having this here ensures that: | |
95 | * | |
96 | * * The type-specific common data is always found at the same | |
97 | * offset when the common API has a `struct | |
98 | * bt_field_type_common *` so that you can cast it to `struct | |
99 | * bt_field_type_common_integer *` for example and access the | |
100 | * common integer field type fields. | |
101 | * | |
102 | * * The specific CTF IR and CTF writer APIs can access their | |
103 | * specific field type fields in this union at an offset known | |
104 | * at build time. This avoids a pointer to specific data so | |
105 | * that all the fields, common or specific, of a CTF IR | |
106 | * integer field type or of a CTF writer integer field type, | |
107 | * for example, are contained within the same contiguous block | |
108 | * of memory. | |
109 | */ | |
110 | union { | |
111 | struct { | |
112 | } ir; | |
113 | struct { | |
114 | void *serialize_func; | |
115 | } writer; | |
116 | } spec; | |
273b65be JG |
117 | }; |
118 | ||
3dca2276 PP |
119 | struct bt_field_type_common_integer { |
120 | struct bt_field_type_common common; | |
121 | struct bt_clock_class *mapped_clock_class; | |
50842bdc | 122 | enum bt_byte_order user_byte_order; |
c55a9f58 | 123 | bt_bool is_signed; |
dc3fffef | 124 | unsigned int size; |
50842bdc PP |
125 | enum bt_integer_base base; |
126 | enum bt_string_encoding encoding; | |
273b65be JG |
127 | }; |
128 | ||
129 | struct enumeration_mapping { | |
b92ddaaa JG |
130 | union { |
131 | uint64_t _unsigned; | |
132 | int64_t _signed; | |
133 | } range_start; | |
134 | ||
135 | union { | |
136 | uint64_t _unsigned; | |
137 | int64_t _signed; | |
138 | } range_end; | |
273b65be JG |
139 | GQuark string; |
140 | }; | |
141 | ||
3dca2276 PP |
142 | struct bt_field_type_common_enumeration { |
143 | struct bt_field_type_common common; | |
144 | struct bt_field_type_common_integer *container_ft; | |
db8ef253 | 145 | GPtrArray *entries; /* Array of ptrs to struct enumeration_mapping */ |
d49e1284 | 146 | /* Only set during validation. */ |
c55a9f58 | 147 | bt_bool has_overlapping_ranges; |
96e8f959 MD |
148 | }; |
149 | ||
50842bdc | 150 | enum bt_field_type_enumeration_mapping_iterator_type { |
96e8f959 MD |
151 | ITERATOR_BY_NAME, |
152 | ITERATOR_BY_SIGNED_VALUE, | |
153 | ITERATOR_BY_UNSIGNED_VALUE, | |
154 | }; | |
155 | ||
50842bdc | 156 | struct bt_field_type_enumeration_mapping_iterator { |
96e8f959 | 157 | struct bt_object base; |
3dca2276 | 158 | struct bt_field_type_common_enumeration *enumeration_ft; |
50842bdc | 159 | enum bt_field_type_enumeration_mapping_iterator_type type; |
96e8f959 MD |
160 | int index; |
161 | union { | |
162 | GQuark name_quark; | |
163 | int64_t signed_value; | |
164 | uint64_t unsigned_value; | |
165 | } u; | |
273b65be JG |
166 | }; |
167 | ||
3dca2276 PP |
168 | struct bt_field_type_common_floating_point { |
169 | struct bt_field_type_common common; | |
50842bdc | 170 | enum bt_byte_order user_byte_order; |
dc3fffef PP |
171 | unsigned int exp_dig; |
172 | unsigned int mant_dig; | |
273b65be JG |
173 | }; |
174 | ||
3dca2276 PP |
175 | struct structure_field_common { |
176 | struct bt_field_type_common common; | |
273b65be | 177 | GQuark name; |
3dca2276 | 178 | struct bt_field_type_common *type; |
273b65be JG |
179 | }; |
180 | ||
3dca2276 PP |
181 | struct bt_field_type_common_structure { |
182 | struct bt_field_type_common common; | |
273b65be | 183 | GHashTable *field_name_to_index; |
3dca2276 | 184 | GPtrArray *fields; /* Array of pointers to struct structure_field_common */ |
273b65be JG |
185 | }; |
186 | ||
3dca2276 PP |
187 | struct bt_field_type_common_variant { |
188 | struct bt_field_type_common common; | |
273b65be | 189 | GString *tag_name; |
3dca2276 | 190 | struct bt_field_type_common_enumeration *tag_ft; |
50842bdc | 191 | struct bt_field_path *tag_field_path; |
273b65be | 192 | GHashTable *field_name_to_index; |
3dca2276 | 193 | GPtrArray *fields; /* Array of pointers to struct structure_field_common */ |
273b65be JG |
194 | }; |
195 | ||
3dca2276 PP |
196 | struct bt_field_type_common_array { |
197 | struct bt_field_type_common common; | |
198 | struct bt_field_type_common *element_ft; | |
273b65be | 199 | unsigned int length; /* Number of elements */ |
273b65be JG |
200 | }; |
201 | ||
3dca2276 PP |
202 | struct bt_field_type_common_sequence { |
203 | struct bt_field_type_common common; | |
204 | struct bt_field_type_common *element_ft; | |
273b65be | 205 | GString *length_field_name; |
50842bdc | 206 | struct bt_field_path *length_field_path; |
273b65be JG |
207 | }; |
208 | ||
3dca2276 PP |
209 | struct bt_field_type_common_string { |
210 | struct bt_field_type_common common; | |
50842bdc | 211 | enum bt_string_encoding encoding; |
273b65be JG |
212 | }; |
213 | ||
f6ccaed9 | 214 | #ifdef BT_DEV_MODE |
3dca2276 PP |
215 | # define bt_field_type_freeze _bt_field_type_freeze |
216 | # define bt_field_type_common_freeze _bt_field_type_common_freeze | |
f6ccaed9 PP |
217 | #else |
218 | # define bt_field_type_freeze(_ft) | |
3dca2276 | 219 | # define bt_field_type_common_freeze(_ft) |
f6ccaed9 PP |
220 | #endif |
221 | ||
3dca2276 PP |
222 | typedef struct bt_field_common *(* bt_field_common_create_func)( |
223 | struct bt_field_type_common *); | |
224 | ||
273b65be | 225 | BT_HIDDEN |
3dca2276 PP |
226 | void bt_field_type_common_initialize(struct bt_field_type_common *ft, |
227 | bool init_bo, bt_object_release_func release_func, | |
228 | struct bt_field_type_common_methods *methods); | |
273b65be JG |
229 | |
230 | BT_HIDDEN | |
3dca2276 PP |
231 | void bt_field_type_common_integer_initialize( |
232 | struct bt_field_type_common *ft, | |
233 | unsigned int size, bt_object_release_func release_func, | |
234 | struct bt_field_type_common_methods *methods); | |
273b65be JG |
235 | |
236 | BT_HIDDEN | |
3dca2276 PP |
237 | void bt_field_type_common_floating_point_initialize( |
238 | struct bt_field_type_common *ft, | |
239 | bt_object_release_func release_func, | |
240 | struct bt_field_type_common_methods *methods); | |
273b65be JG |
241 | |
242 | BT_HIDDEN | |
3dca2276 PP |
243 | void bt_field_type_common_enumeration_initialize( |
244 | struct bt_field_type_common *ft, | |
245 | struct bt_field_type_common *container_ft, | |
246 | bt_object_release_func release_func, | |
247 | struct bt_field_type_common_methods *methods); | |
273b65be | 248 | |
9ce21c30 | 249 | BT_HIDDEN |
3dca2276 PP |
250 | void bt_field_type_common_string_initialize( |
251 | struct bt_field_type_common *ft, | |
252 | bt_object_release_func release_func, | |
253 | struct bt_field_type_common_methods *methods); | |
9ce21c30 | 254 | |
39a5e0db | 255 | BT_HIDDEN |
3dca2276 PP |
256 | void bt_field_type_common_structure_initialize( |
257 | struct bt_field_type_common *ft, | |
258 | bt_object_release_func release_func, | |
259 | struct bt_field_type_common_methods *methods); | |
736133f1 JG |
260 | |
261 | BT_HIDDEN | |
3dca2276 PP |
262 | void bt_field_type_common_array_initialize( |
263 | struct bt_field_type_common *ft, | |
264 | struct bt_field_type_common *element_ft, | |
265 | unsigned int length, bt_object_release_func release_func, | |
266 | struct bt_field_type_common_methods *methods); | |
79422a2b PP |
267 | |
268 | BT_HIDDEN | |
3dca2276 PP |
269 | void bt_field_type_common_sequence_initialize( |
270 | struct bt_field_type_common *ft, | |
271 | struct bt_field_type_common *element_ft, | |
272 | const char *length_field_name, | |
273 | bt_object_release_func release_func, | |
274 | struct bt_field_type_common_methods *methods); | |
aa4e271c JG |
275 | |
276 | BT_HIDDEN | |
3dca2276 PP |
277 | void bt_field_type_common_variant_initialize( |
278 | struct bt_field_type_common *ft, | |
279 | struct bt_field_type_common *tag_ft, | |
280 | const char *tag_name, | |
281 | bt_object_release_func release_func, | |
282 | struct bt_field_type_common_methods *methods); | |
4a1e8671 JG |
283 | |
284 | BT_HIDDEN | |
3dca2276 | 285 | void bt_field_type_common_integer_destroy(struct bt_object *obj); |
3f39933a JG |
286 | |
287 | BT_HIDDEN | |
3dca2276 | 288 | void bt_field_type_common_floating_point_destroy(struct bt_object *obj); |
3f39933a | 289 | |
626e93aa | 290 | BT_HIDDEN |
3dca2276 | 291 | void bt_field_type_common_enumeration_destroy_recursive(struct bt_object *obj); |
626e93aa PP |
292 | |
293 | BT_HIDDEN | |
3dca2276 | 294 | void bt_field_type_common_string_destroy(struct bt_object *obj); |
626e93aa | 295 | |
09840de5 | 296 | BT_HIDDEN |
3dca2276 | 297 | void bt_field_type_common_structure_destroy_recursive(struct bt_object *obj); |
09840de5 PP |
298 | |
299 | BT_HIDDEN | |
3dca2276 | 300 | void bt_field_type_common_array_destroy_recursive(struct bt_object *obj); |
09840de5 PP |
301 | |
302 | BT_HIDDEN | |
3dca2276 PP |
303 | void bt_field_type_common_sequence_destroy_recursive(struct bt_object *obj); |
304 | ||
305 | BT_HIDDEN | |
306 | void bt_field_type_common_variant_destroy_recursive(struct bt_object *obj); | |
307 | ||
308 | BT_HIDDEN | |
309 | int bt_field_type_common_integer_validate(struct bt_field_type_common *ft); | |
310 | ||
311 | BT_HIDDEN | |
312 | int bt_field_type_common_enumeration_validate_recursive( | |
313 | struct bt_field_type_common *ft); | |
314 | ||
315 | BT_HIDDEN | |
316 | int bt_field_type_common_sequence_validate_recursive( | |
317 | struct bt_field_type_common *ft); | |
318 | ||
319 | BT_HIDDEN | |
320 | int bt_field_type_common_array_validate_recursive( | |
321 | struct bt_field_type_common *ft); | |
322 | ||
323 | BT_HIDDEN | |
324 | int bt_field_type_common_structure_validate_recursive( | |
325 | struct bt_field_type_common *ft); | |
326 | ||
327 | BT_HIDDEN | |
328 | int bt_field_type_common_variant_validate_recursive( | |
329 | struct bt_field_type_common *type); | |
330 | ||
331 | BT_HIDDEN | |
332 | int bt_field_type_common_validate(struct bt_field_type_common *ft); | |
333 | ||
334 | BT_HIDDEN | |
335 | int bt_field_type_common_integer_get_size(struct bt_field_type_common *ft); | |
336 | ||
337 | BT_HIDDEN | |
338 | bt_bool bt_field_type_common_integer_is_signed(struct bt_field_type_common *ft); | |
339 | ||
340 | BT_HIDDEN | |
341 | int bt_field_type_common_integer_set_is_signed(struct bt_field_type_common *ft, | |
342 | bt_bool is_signed); | |
343 | ||
344 | BT_HIDDEN | |
345 | int bt_field_type_common_integer_set_size(struct bt_field_type_common *ft, | |
346 | unsigned int size); | |
347 | ||
348 | BT_HIDDEN | |
349 | enum bt_integer_base bt_field_type_common_integer_get_base( | |
350 | struct bt_field_type_common *ft); | |
09840de5 | 351 | |
e011d2c1 | 352 | BT_HIDDEN |
3dca2276 PP |
353 | int bt_field_type_common_integer_set_base(struct bt_field_type_common *ft, |
354 | enum bt_integer_base base); | |
355 | ||
356 | BT_HIDDEN | |
357 | enum bt_string_encoding bt_field_type_common_integer_get_encoding( | |
358 | struct bt_field_type_common *ft); | |
359 | ||
360 | BT_HIDDEN | |
361 | int bt_field_type_common_integer_set_encoding(struct bt_field_type_common *ft, | |
362 | enum bt_string_encoding encoding); | |
363 | ||
364 | BT_HIDDEN | |
094ff7c0 | 365 | struct bt_clock_class *bt_field_type_common_integer_borrow_mapped_clock_class( |
3dca2276 PP |
366 | struct bt_field_type_common *ft); |
367 | ||
368 | BT_HIDDEN | |
369 | int bt_field_type_common_integer_set_mapped_clock_class_no_check_frozen( | |
370 | struct bt_field_type_common *ft, | |
50842bdc | 371 | struct bt_clock_class *clock_class); |
e011d2c1 | 372 | |
3dca2276 PP |
373 | BT_HIDDEN |
374 | int bt_field_type_common_integer_set_mapped_clock_class( | |
375 | struct bt_field_type_common *ft, | |
376 | struct bt_clock_class *clock_class); | |
b7a73f0f | 377 | |
3dca2276 PP |
378 | BT_HIDDEN |
379 | struct bt_field_type_enumeration_mapping_iterator * | |
380 | bt_field_type_common_enumeration_find_mappings_by_name( | |
381 | struct bt_field_type_common *ft, const char *name); | |
b7a73f0f | 382 | |
3dca2276 PP |
383 | BT_HIDDEN |
384 | struct bt_field_type_enumeration_mapping_iterator * | |
385 | bt_field_type_common_enumeration_signed_find_mappings_by_value( | |
386 | struct bt_field_type_common *ft, int64_t value); | |
387 | ||
388 | BT_HIDDEN | |
389 | struct bt_field_type_enumeration_mapping_iterator * | |
390 | bt_field_type_common_enumeration_unsigned_find_mappings_by_value( | |
391 | struct bt_field_type_common *ft, uint64_t value); | |
392 | ||
393 | BT_HIDDEN | |
394 | int bt_field_type_common_enumeration_signed_get_mapping_by_index( | |
395 | struct bt_field_type_common *ft, uint64_t index, | |
396 | const char **mapping_name, int64_t *range_begin, | |
397 | int64_t *range_end); | |
398 | ||
399 | BT_HIDDEN | |
400 | int bt_field_type_common_enumeration_unsigned_get_mapping_by_index( | |
401 | struct bt_field_type_common *ft, uint64_t index, | |
402 | const char **mapping_name, uint64_t *range_begin, | |
403 | uint64_t *range_end); | |
404 | ||
405 | BT_HIDDEN | |
094ff7c0 PP |
406 | struct bt_field_type_common * |
407 | bt_field_type_common_enumeration_borrow_container_field_type( | |
3dca2276 PP |
408 | struct bt_field_type_common *ft); |
409 | ||
410 | BT_HIDDEN | |
411 | int bt_field_type_common_enumeration_signed_add_mapping( | |
412 | struct bt_field_type_common *ft, const char *string, | |
413 | int64_t range_start, int64_t range_end); | |
414 | ||
415 | BT_HIDDEN | |
416 | int bt_field_type_common_enumeration_unsigned_add_mapping( | |
417 | struct bt_field_type_common *ft, const char *string, | |
418 | uint64_t range_start, uint64_t range_end); | |
419 | ||
420 | BT_HIDDEN | |
421 | int64_t bt_field_type_common_enumeration_get_mapping_count( | |
422 | struct bt_field_type_common *ft); | |
423 | ||
424 | BT_HIDDEN | |
425 | int bt_field_type_common_floating_point_get_exponent_digits( | |
426 | struct bt_field_type_common *ft); | |
427 | ||
428 | BT_HIDDEN | |
429 | int bt_field_type_common_floating_point_set_exponent_digits( | |
430 | struct bt_field_type_common *ft, | |
431 | unsigned int exponent_digits); | |
432 | ||
433 | BT_HIDDEN | |
434 | int bt_field_type_common_floating_point_get_mantissa_digits( | |
435 | struct bt_field_type_common *type); | |
436 | ||
437 | BT_HIDDEN | |
438 | int bt_field_type_common_floating_point_set_mantissa_digits( | |
439 | struct bt_field_type_common *ft, unsigned int mantissa_digits); | |
440 | ||
441 | BT_HIDDEN | |
442 | int bt_field_type_common_structure_replace_field( | |
443 | struct bt_field_type_common *ft, | |
444 | const char *field_name, | |
445 | struct bt_field_type_common *field_type); | |
4e8304f7 | 446 | |
3dca2276 PP |
447 | BT_HIDDEN |
448 | int bt_field_type_common_structure_add_field(struct bt_field_type_common *ft, | |
449 | struct bt_field_type_common *field_type, | |
450 | const char *field_name); | |
451 | ||
452 | BT_HIDDEN | |
453 | int64_t bt_field_type_common_structure_get_field_count( | |
454 | struct bt_field_type_common *ft); | |
455 | ||
456 | BT_HIDDEN | |
094ff7c0 | 457 | int bt_field_type_common_structure_borrow_field_by_index( |
3dca2276 PP |
458 | struct bt_field_type_common *ft, |
459 | const char **field_name, | |
460 | struct bt_field_type_common **field_type, uint64_t index); | |
461 | ||
462 | BT_HIDDEN | |
094ff7c0 PP |
463 | struct bt_field_type_common * |
464 | bt_field_type_common_structure_borrow_field_type_by_name( | |
3dca2276 PP |
465 | struct bt_field_type_common *ft, const char *name); |
466 | ||
467 | BT_HIDDEN | |
094ff7c0 PP |
468 | struct bt_field_type_common * |
469 | bt_field_type_common_variant_borrow_tag_field_type( | |
3dca2276 PP |
470 | struct bt_field_type_common *ft); |
471 | ||
472 | BT_HIDDEN | |
473 | const char *bt_field_type_common_variant_get_tag_name( | |
474 | struct bt_field_type_common *ft); | |
475 | ||
476 | BT_HIDDEN | |
477 | int bt_field_type_common_variant_set_tag_name( | |
478 | struct bt_field_type_common *ft, const char *name); | |
479 | ||
480 | BT_HIDDEN | |
481 | int bt_field_type_common_variant_add_field(struct bt_field_type_common *ft, | |
482 | struct bt_field_type_common *field_type, | |
483 | const char *field_name); | |
484 | ||
485 | BT_HIDDEN | |
094ff7c0 PP |
486 | struct bt_field_type_common * |
487 | bt_field_type_common_variant_borrow_field_type_by_name( | |
3dca2276 PP |
488 | struct bt_field_type_common *ft, |
489 | const char *field_name); | |
490 | ||
491 | BT_HIDDEN | |
094ff7c0 PP |
492 | struct bt_field_type_common * |
493 | bt_field_type_common_variant_borrow_field_type_from_tag( | |
3dca2276 PP |
494 | struct bt_field_type_common *ft, |
495 | struct bt_field_common *tag_field, | |
496 | bt_field_common_create_func field_create_func); | |
497 | ||
498 | BT_HIDDEN | |
499 | int64_t bt_field_type_common_variant_get_field_count( | |
500 | struct bt_field_type_common *ft); | |
501 | ||
502 | BT_HIDDEN | |
094ff7c0 | 503 | int bt_field_type_common_variant_borrow_field_by_index( |
3dca2276 PP |
504 | struct bt_field_type_common *ft, |
505 | const char **field_name, | |
506 | struct bt_field_type_common **field_type, uint64_t index); | |
507 | ||
508 | BT_HIDDEN | |
094ff7c0 PP |
509 | struct bt_field_type_common * |
510 | bt_field_type_common_array_borrow_element_field_type( | |
3dca2276 PP |
511 | struct bt_field_type_common *ft); |
512 | ||
513 | BT_HIDDEN | |
514 | int bt_field_type_common_array_set_element_field_type( | |
515 | struct bt_field_type_common *ft, | |
516 | struct bt_field_type_common *element_ft); | |
517 | ||
518 | BT_HIDDEN | |
519 | int64_t bt_field_type_common_array_get_length(struct bt_field_type_common *ft); | |
520 | ||
521 | BT_HIDDEN | |
094ff7c0 PP |
522 | struct bt_field_type_common * |
523 | bt_field_type_common_sequence_borrow_element_field_type( | |
3dca2276 PP |
524 | struct bt_field_type_common *ft); |
525 | ||
526 | BT_HIDDEN | |
527 | int bt_field_type_common_sequence_set_element_field_type( | |
528 | struct bt_field_type_common *ft, | |
529 | struct bt_field_type_common *element_ft); | |
530 | ||
531 | BT_HIDDEN | |
532 | const char *bt_field_type_common_sequence_get_length_field_name( | |
533 | struct bt_field_type_common *ft); | |
534 | ||
535 | BT_HIDDEN | |
536 | enum bt_string_encoding bt_field_type_common_string_get_encoding( | |
537 | struct bt_field_type_common *ft); | |
538 | ||
539 | BT_HIDDEN | |
540 | int bt_field_type_common_string_set_encoding(struct bt_field_type_common *ft, | |
541 | enum bt_string_encoding encoding); | |
542 | ||
543 | BT_HIDDEN | |
544 | int bt_field_type_common_get_alignment(struct bt_field_type_common *type); | |
545 | ||
546 | BT_HIDDEN | |
547 | int bt_field_type_common_set_alignment(struct bt_field_type_common *ft, | |
548 | unsigned int alignment); | |
549 | ||
550 | BT_HIDDEN | |
551 | enum bt_byte_order bt_field_type_common_get_byte_order( | |
552 | struct bt_field_type_common *ft); | |
553 | ||
554 | BT_HIDDEN | |
555 | int bt_field_type_common_set_byte_order(struct bt_field_type_common *ft, | |
556 | enum bt_byte_order byte_order); | |
557 | ||
558 | BT_HIDDEN | |
559 | enum bt_field_type_id bt_field_type_common_get_type_id( | |
560 | struct bt_field_type_common *ft); | |
561 | ||
562 | BT_HIDDEN | |
563 | void _bt_field_type_common_freeze(struct bt_field_type_common *ft); | |
564 | ||
565 | BT_HIDDEN | |
566 | void _bt_field_type_freeze(struct bt_field_type *ft); | |
567 | ||
568 | BT_HIDDEN | |
094ff7c0 PP |
569 | struct bt_field_type_common * |
570 | bt_field_type_common_variant_borrow_field_type_signed( | |
3dca2276 PP |
571 | struct bt_field_type_common_variant *var_ft, |
572 | int64_t tag_value); | |
573 | ||
574 | BT_HIDDEN | |
094ff7c0 PP |
575 | struct bt_field_type_common * |
576 | bt_field_type_common_variant_borrow_field_type_unsigned( | |
3dca2276 PP |
577 | struct bt_field_type_common_variant *var_ft, |
578 | uint64_t tag_value); | |
579 | ||
580 | BT_HIDDEN | |
581 | struct bt_field_type_common *bt_field_type_common_copy( | |
582 | struct bt_field_type_common *ft); | |
583 | ||
584 | BT_HIDDEN | |
585 | int bt_field_type_common_structure_get_field_name_index( | |
586 | struct bt_field_type_common *ft, const char *name); | |
587 | ||
588 | BT_HIDDEN | |
589 | int bt_field_type_common_variant_get_field_name_index( | |
590 | struct bt_field_type_common *ft, const char *name); | |
591 | ||
592 | BT_HIDDEN | |
593 | int bt_field_type_common_sequence_set_length_field_path( | |
594 | struct bt_field_type_common *ft, struct bt_field_path *path); | |
595 | ||
596 | BT_HIDDEN | |
597 | int bt_field_type_common_variant_set_tag_field_path( | |
598 | struct bt_field_type_common *ft, | |
599 | struct bt_field_path *path); | |
600 | ||
601 | BT_HIDDEN | |
602 | int bt_field_type_common_variant_set_tag_field_type( | |
603 | struct bt_field_type_common *ft, | |
604 | struct bt_field_type_common *tag_ft); | |
605 | ||
606 | BT_HIDDEN | |
607 | void bt_field_type_common_generic_freeze(struct bt_field_type_common *ft); | |
608 | ||
609 | BT_HIDDEN | |
610 | void bt_field_type_common_enumeration_freeze_recursive( | |
611 | struct bt_field_type_common *ft); | |
612 | ||
613 | BT_HIDDEN | |
614 | void bt_field_type_common_structure_freeze_recursive( | |
615 | struct bt_field_type_common *ft); | |
616 | ||
617 | BT_HIDDEN | |
618 | void bt_field_type_common_variant_freeze_recursive( | |
619 | struct bt_field_type_common *ft); | |
620 | ||
621 | BT_HIDDEN | |
622 | void bt_field_type_common_array_freeze_recursive( | |
623 | struct bt_field_type_common *ft); | |
624 | ||
625 | BT_HIDDEN | |
626 | void bt_field_type_common_sequence_freeze_recursive( | |
627 | struct bt_field_type_common *type); | |
628 | ||
629 | BT_HIDDEN | |
630 | void bt_field_type_common_integer_set_byte_order( | |
631 | struct bt_field_type_common *ft, enum bt_byte_order byte_order); | |
632 | ||
633 | BT_HIDDEN | |
634 | void bt_field_type_common_enumeration_set_byte_order_recursive( | |
635 | struct bt_field_type_common *ft, enum bt_byte_order byte_order); | |
636 | ||
637 | BT_HIDDEN | |
638 | void bt_field_type_common_floating_point_set_byte_order( | |
639 | struct bt_field_type_common *ft, enum bt_byte_order byte_order); | |
640 | ||
641 | BT_HIDDEN | |
642 | void bt_field_type_common_structure_set_byte_order_recursive( | |
643 | struct bt_field_type_common *ft, | |
644 | enum bt_byte_order byte_order); | |
645 | ||
646 | BT_HIDDEN | |
647 | void bt_field_type_common_variant_set_byte_order_recursive( | |
648 | struct bt_field_type_common *ft, | |
649 | enum bt_byte_order byte_order); | |
650 | ||
651 | BT_HIDDEN | |
652 | void bt_field_type_common_array_set_byte_order_recursive( | |
653 | struct bt_field_type_common *ft, | |
654 | enum bt_byte_order byte_order); | |
655 | ||
656 | BT_HIDDEN | |
657 | void bt_field_type_common_sequence_set_byte_order_recursive( | |
658 | struct bt_field_type_common *ft, | |
659 | enum bt_byte_order byte_order); | |
660 | ||
661 | BT_HIDDEN | |
662 | int bt_field_type_common_integer_compare(struct bt_field_type_common *ft_a, | |
663 | struct bt_field_type_common *ft_b); | |
664 | ||
665 | BT_HIDDEN | |
666 | int bt_field_type_common_floating_point_compare( | |
667 | struct bt_field_type_common *ft_a, | |
668 | struct bt_field_type_common *ft_b); | |
669 | ||
670 | BT_HIDDEN | |
671 | int bt_field_type_common_enumeration_compare_recursive( | |
672 | struct bt_field_type_common *ft_a, | |
673 | struct bt_field_type_common *ft_b); | |
674 | ||
675 | BT_HIDDEN | |
676 | int bt_field_type_common_string_compare(struct bt_field_type_common *ft_a, | |
677 | struct bt_field_type_common *ft_b); | |
678 | ||
679 | BT_HIDDEN | |
680 | int bt_field_type_common_structure_compare_recursive( | |
681 | struct bt_field_type_common *ft_a, | |
682 | struct bt_field_type_common *ft_b); | |
683 | ||
684 | BT_HIDDEN | |
685 | int bt_field_type_common_variant_compare_recursive( | |
686 | struct bt_field_type_common *ft_a, | |
687 | struct bt_field_type_common *ft_b); | |
688 | ||
689 | BT_HIDDEN | |
690 | int bt_field_type_common_array_compare_recursive( | |
691 | struct bt_field_type_common *ft_a, | |
692 | struct bt_field_type_common *ft_b); | |
693 | ||
694 | BT_HIDDEN | |
695 | int bt_field_type_common_sequence_compare_recursive( | |
696 | struct bt_field_type_common *ft_a, | |
697 | struct bt_field_type_common *ft_b); | |
698 | ||
699 | BT_HIDDEN | |
700 | int bt_field_type_common_compare(struct bt_field_type_common *ft_a, | |
701 | struct bt_field_type_common *ft_b); | |
702 | ||
703 | BT_HIDDEN | |
704 | int64_t bt_field_type_common_get_field_count(struct bt_field_type_common *ft); | |
705 | ||
706 | BT_HIDDEN | |
094ff7c0 | 707 | struct bt_field_type_common *bt_field_type_common_borrow_field_at_index( |
3dca2276 PP |
708 | struct bt_field_type_common *ft, int index); |
709 | ||
710 | BT_HIDDEN | |
711 | int bt_field_type_common_get_field_index(struct bt_field_type_common *ft, | |
712 | const char *name); | |
713 | ||
714 | BT_HIDDEN | |
094ff7c0 | 715 | struct bt_field_path *bt_field_type_common_variant_borrow_tag_field_path( |
3dca2276 PP |
716 | struct bt_field_type_common *ft); |
717 | ||
718 | BT_HIDDEN | |
094ff7c0 | 719 | struct bt_field_path *bt_field_type_common_sequence_borrow_length_field_path( |
3dca2276 PP |
720 | struct bt_field_type_common *ft); |
721 | ||
722 | BT_HIDDEN | |
723 | int bt_field_type_common_validate_single_clock_class( | |
724 | struct bt_field_type_common *ft, | |
725 | struct bt_clock_class **expected_clock_class); | |
4e8304f7 | 726 | |
2e33ac5a | 727 | #endif /* BABELTRACE_CTF_IR_FIELD_TYPES_INTERNAL_H */ |