lib: add internal object pool API and use it; adapt plugins/tests
[babeltrace.git] / include / babeltrace / ctf-ir / field-types-internal.h
CommitLineData
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
312c056a
PP
47#define BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(_ft, _index) \
48 (&g_array_index(((struct bt_field_type_common_structure *) (_ft))->fields, \
49 struct bt_field_type_common_structure_field, (_index)))
50
51#define BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(_ft, _index) \
52 (&g_array_index(((struct bt_field_type_common_variant *) (_ft))->choices, \
53 struct bt_field_type_common_variant_choice, (_index)))
54
3dca2276
PP
55struct bt_field_common;
56struct bt_field_type_common;
57struct bt_field_type;
58
59typedef void (*bt_field_type_common_method_freeze)(
60 struct bt_field_type_common *);
61typedef int (*bt_field_type_common_method_validate)(
62 struct bt_field_type_common *);
63typedef void (*bt_field_type_common_method_set_byte_order)(
64 struct bt_field_type_common *, enum bt_byte_order);
65typedef struct bt_field_type_common *(*bt_field_type_common_method_copy)(
66 struct bt_field_type_common *);
67typedef int (*bt_field_type_common_method_compare)(
68 struct bt_field_type_common *,
69 struct bt_field_type_common *);
70
71struct bt_field_type_common_methods {
72 bt_field_type_common_method_freeze freeze;
73 bt_field_type_common_method_validate validate;
74 bt_field_type_common_method_set_byte_order set_byte_order;
75 bt_field_type_common_method_copy copy;
76 bt_field_type_common_method_compare compare;
77};
273b65be 78
3dca2276 79struct bt_field_type_common {
83509119 80 struct bt_object base;
50842bdc 81 enum bt_field_type_id id;
dc3fffef 82 unsigned int alignment;
3dca2276
PP
83
84 /* Virtual table */
85 struct bt_field_type_common_methods *methods;
86
273b65be
JG
87 /*
88 * A type can't be modified once it is added to an event or after a
89 * a field has been instanciated from it.
90 */
91 int frozen;
81e36fac
PP
92
93 /*
94 * This flag indicates if the field type is valid. A valid
95 * field type is _always_ frozen. All the nested field types of
96 * a valid field type are also valid (and thus frozen).
97 */
98 int valid;
3dca2276
PP
99
100 /*
101 * Specialized data for either CTF IR or CTF writer APIs.
102 * Having this here ensures that:
103 *
104 * * The type-specific common data is always found at the same
105 * offset when the common API has a `struct
106 * bt_field_type_common *` so that you can cast it to `struct
107 * bt_field_type_common_integer *` for example and access the
108 * common integer field type fields.
109 *
110 * * The specific CTF IR and CTF writer APIs can access their
111 * specific field type fields in this union at an offset known
112 * at build time. This avoids a pointer to specific data so
113 * that all the fields, common or specific, of a CTF IR
114 * integer field type or of a CTF writer integer field type,
115 * for example, are contained within the same contiguous block
116 * of memory.
117 */
118 union {
119 struct {
120 } ir;
121 struct {
122 void *serialize_func;
123 } writer;
124 } spec;
273b65be
JG
125};
126
3dca2276
PP
127struct bt_field_type_common_integer {
128 struct bt_field_type_common common;
312c056a
PP
129
130 /* Owned by this */
3dca2276 131 struct bt_clock_class *mapped_clock_class;
312c056a 132
50842bdc 133 enum bt_byte_order user_byte_order;
c55a9f58 134 bt_bool is_signed;
dc3fffef 135 unsigned int size;
50842bdc
PP
136 enum bt_integer_base base;
137 enum bt_string_encoding encoding;
273b65be
JG
138};
139
140struct enumeration_mapping {
b92ddaaa
JG
141 union {
142 uint64_t _unsigned;
143 int64_t _signed;
144 } range_start;
b92ddaaa
JG
145 union {
146 uint64_t _unsigned;
147 int64_t _signed;
148 } range_end;
273b65be
JG
149 GQuark string;
150};
151
3dca2276
PP
152struct bt_field_type_common_enumeration {
153 struct bt_field_type_common common;
312c056a
PP
154
155 /* Owned by this */
3dca2276 156 struct bt_field_type_common_integer *container_ft;
312c056a
PP
157
158 /* Array of `struct enumeration_mapping *`, owned by this */
159 GPtrArray *entries;
160
161 /* Only set during validation */
c55a9f58 162 bt_bool has_overlapping_ranges;
96e8f959
MD
163};
164
50842bdc 165enum bt_field_type_enumeration_mapping_iterator_type {
96e8f959
MD
166 ITERATOR_BY_NAME,
167 ITERATOR_BY_SIGNED_VALUE,
168 ITERATOR_BY_UNSIGNED_VALUE,
169};
170
50842bdc 171struct bt_field_type_enumeration_mapping_iterator {
96e8f959 172 struct bt_object base;
312c056a
PP
173
174 /* Owned by this */
3dca2276 175 struct bt_field_type_common_enumeration *enumeration_ft;
312c056a 176
50842bdc 177 enum bt_field_type_enumeration_mapping_iterator_type type;
96e8f959
MD
178 int index;
179 union {
180 GQuark name_quark;
181 int64_t signed_value;
182 uint64_t unsigned_value;
183 } u;
273b65be
JG
184};
185
3dca2276
PP
186struct bt_field_type_common_floating_point {
187 struct bt_field_type_common common;
50842bdc 188 enum bt_byte_order user_byte_order;
dc3fffef
PP
189 unsigned int exp_dig;
190 unsigned int mant_dig;
273b65be
JG
191};
192
312c056a 193struct bt_field_type_common_structure_field {
273b65be 194 GQuark name;
312c056a
PP
195
196 /* Owned by this */
3dca2276 197 struct bt_field_type_common *type;
273b65be
JG
198};
199
3dca2276
PP
200struct bt_field_type_common_structure {
201 struct bt_field_type_common common;
273b65be 202 GHashTable *field_name_to_index;
312c056a
PP
203
204 /*
205 * Array of `struct bt_field_type_common_structure_field`,
206 * owned by this
207 */
208 GArray *fields;
209};
210
211struct bt_field_type_common_variant_choice_range {
212 union {
213 int64_t i;
214 uint64_t u;
215 } lower;
216 union {
217 int64_t i;
218 uint64_t u;
219 } upper;
220};
221
222struct bt_field_type_common_variant_choice {
223 GQuark name;
224
225 /* Owned by this */
226 struct bt_field_type_common *type;
227
228 /* Array of `struct bt_field_type_common_variant_choice_range` */
229 GArray *ranges;
273b65be
JG
230};
231
3dca2276
PP
232struct bt_field_type_common_variant {
233 struct bt_field_type_common common;
273b65be 234 GString *tag_name;
312c056a
PP
235 bool choices_up_to_date;
236
237 /* Owned by this */
3dca2276 238 struct bt_field_type_common_enumeration *tag_ft;
312c056a
PP
239
240 /* Owned by this */
50842bdc 241 struct bt_field_path *tag_field_path;
312c056a
PP
242
243 GHashTable *choice_name_to_index;
244
245 /*
246 * Array of `struct bt_field_type_common_variant_choice`,
247 * owned by this */
248 GArray *choices;
273b65be
JG
249};
250
3dca2276
PP
251struct bt_field_type_common_array {
252 struct bt_field_type_common common;
312c056a
PP
253
254 /* Owned by this */
3dca2276 255 struct bt_field_type_common *element_ft;
312c056a
PP
256
257 unsigned int length;
273b65be
JG
258};
259
3dca2276
PP
260struct bt_field_type_common_sequence {
261 struct bt_field_type_common common;
312c056a
PP
262
263 /* Owned by this */
3dca2276 264 struct bt_field_type_common *element_ft;
312c056a 265
273b65be 266 GString *length_field_name;
312c056a
PP
267
268 /* Owned by this */
50842bdc 269 struct bt_field_path *length_field_path;
273b65be
JG
270};
271
3dca2276
PP
272struct bt_field_type_common_string {
273 struct bt_field_type_common common;
50842bdc 274 enum bt_string_encoding encoding;
273b65be
JG
275};
276
f6ccaed9 277#ifdef BT_DEV_MODE
3dca2276
PP
278# define bt_field_type_freeze _bt_field_type_freeze
279# define bt_field_type_common_freeze _bt_field_type_common_freeze
f6ccaed9
PP
280#else
281# define bt_field_type_freeze(_ft)
3dca2276 282# define bt_field_type_common_freeze(_ft)
f6ccaed9
PP
283#endif
284
3dca2276
PP
285typedef struct bt_field_common *(* bt_field_common_create_func)(
286 struct bt_field_type_common *);
287
273b65be 288BT_HIDDEN
3dca2276
PP
289void bt_field_type_common_initialize(struct bt_field_type_common *ft,
290 bool init_bo, bt_object_release_func release_func,
291 struct bt_field_type_common_methods *methods);
273b65be
JG
292
293BT_HIDDEN
3dca2276
PP
294void bt_field_type_common_integer_initialize(
295 struct bt_field_type_common *ft,
296 unsigned int size, bt_object_release_func release_func,
297 struct bt_field_type_common_methods *methods);
273b65be
JG
298
299BT_HIDDEN
3dca2276
PP
300void bt_field_type_common_floating_point_initialize(
301 struct bt_field_type_common *ft,
302 bt_object_release_func release_func,
303 struct bt_field_type_common_methods *methods);
273b65be
JG
304
305BT_HIDDEN
3dca2276
PP
306void bt_field_type_common_enumeration_initialize(
307 struct bt_field_type_common *ft,
308 struct bt_field_type_common *container_ft,
309 bt_object_release_func release_func,
310 struct bt_field_type_common_methods *methods);
273b65be 311
9ce21c30 312BT_HIDDEN
3dca2276
PP
313void bt_field_type_common_string_initialize(
314 struct bt_field_type_common *ft,
315 bt_object_release_func release_func,
316 struct bt_field_type_common_methods *methods);
9ce21c30 317
39a5e0db 318BT_HIDDEN
3dca2276
PP
319void bt_field_type_common_structure_initialize(
320 struct bt_field_type_common *ft,
321 bt_object_release_func release_func,
322 struct bt_field_type_common_methods *methods);
736133f1
JG
323
324BT_HIDDEN
3dca2276
PP
325void bt_field_type_common_array_initialize(
326 struct bt_field_type_common *ft,
327 struct bt_field_type_common *element_ft,
328 unsigned int length, bt_object_release_func release_func,
329 struct bt_field_type_common_methods *methods);
79422a2b
PP
330
331BT_HIDDEN
3dca2276
PP
332void bt_field_type_common_sequence_initialize(
333 struct bt_field_type_common *ft,
334 struct bt_field_type_common *element_ft,
335 const char *length_field_name,
336 bt_object_release_func release_func,
337 struct bt_field_type_common_methods *methods);
aa4e271c
JG
338
339BT_HIDDEN
3dca2276
PP
340void bt_field_type_common_variant_initialize(
341 struct bt_field_type_common *ft,
342 struct bt_field_type_common *tag_ft,
343 const char *tag_name,
344 bt_object_release_func release_func,
345 struct bt_field_type_common_methods *methods);
4a1e8671
JG
346
347BT_HIDDEN
3dca2276 348void bt_field_type_common_integer_destroy(struct bt_object *obj);
3f39933a
JG
349
350BT_HIDDEN
3dca2276 351void bt_field_type_common_floating_point_destroy(struct bt_object *obj);
3f39933a 352
626e93aa 353BT_HIDDEN
3dca2276 354void bt_field_type_common_enumeration_destroy_recursive(struct bt_object *obj);
626e93aa
PP
355
356BT_HIDDEN
3dca2276 357void bt_field_type_common_string_destroy(struct bt_object *obj);
626e93aa 358
09840de5 359BT_HIDDEN
3dca2276 360void bt_field_type_common_structure_destroy_recursive(struct bt_object *obj);
09840de5
PP
361
362BT_HIDDEN
3dca2276 363void bt_field_type_common_array_destroy_recursive(struct bt_object *obj);
09840de5
PP
364
365BT_HIDDEN
3dca2276
PP
366void bt_field_type_common_sequence_destroy_recursive(struct bt_object *obj);
367
368BT_HIDDEN
369void bt_field_type_common_variant_destroy_recursive(struct bt_object *obj);
370
371BT_HIDDEN
372int bt_field_type_common_integer_validate(struct bt_field_type_common *ft);
373
374BT_HIDDEN
375int bt_field_type_common_enumeration_validate_recursive(
376 struct bt_field_type_common *ft);
377
378BT_HIDDEN
379int bt_field_type_common_sequence_validate_recursive(
380 struct bt_field_type_common *ft);
381
382BT_HIDDEN
383int bt_field_type_common_array_validate_recursive(
384 struct bt_field_type_common *ft);
385
386BT_HIDDEN
387int bt_field_type_common_structure_validate_recursive(
388 struct bt_field_type_common *ft);
389
390BT_HIDDEN
391int bt_field_type_common_variant_validate_recursive(
392 struct bt_field_type_common *type);
393
394BT_HIDDEN
395int bt_field_type_common_validate(struct bt_field_type_common *ft);
396
397BT_HIDDEN
398int bt_field_type_common_integer_get_size(struct bt_field_type_common *ft);
399
400BT_HIDDEN
401bt_bool bt_field_type_common_integer_is_signed(struct bt_field_type_common *ft);
402
403BT_HIDDEN
404int bt_field_type_common_integer_set_is_signed(struct bt_field_type_common *ft,
405 bt_bool is_signed);
406
407BT_HIDDEN
408int bt_field_type_common_integer_set_size(struct bt_field_type_common *ft,
409 unsigned int size);
410
411BT_HIDDEN
412enum bt_integer_base bt_field_type_common_integer_get_base(
413 struct bt_field_type_common *ft);
09840de5 414
e011d2c1 415BT_HIDDEN
3dca2276
PP
416int bt_field_type_common_integer_set_base(struct bt_field_type_common *ft,
417 enum bt_integer_base base);
418
419BT_HIDDEN
420enum bt_string_encoding bt_field_type_common_integer_get_encoding(
421 struct bt_field_type_common *ft);
422
423BT_HIDDEN
424int bt_field_type_common_integer_set_encoding(struct bt_field_type_common *ft,
425 enum bt_string_encoding encoding);
426
427BT_HIDDEN
094ff7c0 428struct bt_clock_class *bt_field_type_common_integer_borrow_mapped_clock_class(
3dca2276
PP
429 struct bt_field_type_common *ft);
430
431BT_HIDDEN
432int bt_field_type_common_integer_set_mapped_clock_class_no_check_frozen(
433 struct bt_field_type_common *ft,
50842bdc 434 struct bt_clock_class *clock_class);
e011d2c1 435
3dca2276
PP
436BT_HIDDEN
437int bt_field_type_common_integer_set_mapped_clock_class(
438 struct bt_field_type_common *ft,
439 struct bt_clock_class *clock_class);
b7a73f0f 440
3dca2276
PP
441BT_HIDDEN
442struct bt_field_type_enumeration_mapping_iterator *
443bt_field_type_common_enumeration_find_mappings_by_name(
444 struct bt_field_type_common *ft, const char *name);
b7a73f0f 445
3dca2276
PP
446BT_HIDDEN
447struct bt_field_type_enumeration_mapping_iterator *
448bt_field_type_common_enumeration_signed_find_mappings_by_value(
449 struct bt_field_type_common *ft, int64_t value);
450
451BT_HIDDEN
452struct bt_field_type_enumeration_mapping_iterator *
453bt_field_type_common_enumeration_unsigned_find_mappings_by_value(
454 struct bt_field_type_common *ft, uint64_t value);
455
456BT_HIDDEN
457int bt_field_type_common_enumeration_signed_get_mapping_by_index(
458 struct bt_field_type_common *ft, uint64_t index,
459 const char **mapping_name, int64_t *range_begin,
460 int64_t *range_end);
461
462BT_HIDDEN
463int bt_field_type_common_enumeration_unsigned_get_mapping_by_index(
464 struct bt_field_type_common *ft, uint64_t index,
465 const char **mapping_name, uint64_t *range_begin,
466 uint64_t *range_end);
467
468BT_HIDDEN
094ff7c0
PP
469struct bt_field_type_common *
470bt_field_type_common_enumeration_borrow_container_field_type(
3dca2276
PP
471 struct bt_field_type_common *ft);
472
473BT_HIDDEN
474int bt_field_type_common_enumeration_signed_add_mapping(
475 struct bt_field_type_common *ft, const char *string,
476 int64_t range_start, int64_t range_end);
477
478BT_HIDDEN
479int bt_field_type_common_enumeration_unsigned_add_mapping(
480 struct bt_field_type_common *ft, const char *string,
481 uint64_t range_start, uint64_t range_end);
482
483BT_HIDDEN
484int64_t bt_field_type_common_enumeration_get_mapping_count(
485 struct bt_field_type_common *ft);
486
487BT_HIDDEN
488int bt_field_type_common_floating_point_get_exponent_digits(
489 struct bt_field_type_common *ft);
490
491BT_HIDDEN
492int bt_field_type_common_floating_point_set_exponent_digits(
493 struct bt_field_type_common *ft,
494 unsigned int exponent_digits);
495
496BT_HIDDEN
497int bt_field_type_common_floating_point_get_mantissa_digits(
498 struct bt_field_type_common *type);
499
500BT_HIDDEN
501int bt_field_type_common_floating_point_set_mantissa_digits(
502 struct bt_field_type_common *ft, unsigned int mantissa_digits);
503
504BT_HIDDEN
505int bt_field_type_common_structure_replace_field(
506 struct bt_field_type_common *ft,
507 const char *field_name,
508 struct bt_field_type_common *field_type);
4e8304f7 509
3dca2276
PP
510BT_HIDDEN
511int bt_field_type_common_structure_add_field(struct bt_field_type_common *ft,
512 struct bt_field_type_common *field_type,
513 const char *field_name);
514
515BT_HIDDEN
516int64_t bt_field_type_common_structure_get_field_count(
517 struct bt_field_type_common *ft);
518
519BT_HIDDEN
094ff7c0 520int bt_field_type_common_structure_borrow_field_by_index(
3dca2276
PP
521 struct bt_field_type_common *ft,
522 const char **field_name,
523 struct bt_field_type_common **field_type, uint64_t index);
524
525BT_HIDDEN
094ff7c0
PP
526struct bt_field_type_common *
527bt_field_type_common_structure_borrow_field_type_by_name(
3dca2276
PP
528 struct bt_field_type_common *ft, const char *name);
529
530BT_HIDDEN
094ff7c0
PP
531struct bt_field_type_common *
532bt_field_type_common_variant_borrow_tag_field_type(
3dca2276
PP
533 struct bt_field_type_common *ft);
534
535BT_HIDDEN
536const char *bt_field_type_common_variant_get_tag_name(
537 struct bt_field_type_common *ft);
538
539BT_HIDDEN
540int bt_field_type_common_variant_set_tag_name(
541 struct bt_field_type_common *ft, const char *name);
542
543BT_HIDDEN
544int bt_field_type_common_variant_add_field(struct bt_field_type_common *ft,
545 struct bt_field_type_common *field_type,
546 const char *field_name);
547
548BT_HIDDEN
312c056a
PP
549int bt_field_type_common_variant_update_choices(
550 struct bt_field_type_common *ft);
3dca2276
PP
551
552BT_HIDDEN
094ff7c0 553struct bt_field_type_common *
312c056a 554bt_field_type_common_variant_borrow_field_type_by_name(
3dca2276 555 struct bt_field_type_common *ft,
312c056a 556 const char *field_name);
3dca2276
PP
557
558BT_HIDDEN
559int64_t bt_field_type_common_variant_get_field_count(
560 struct bt_field_type_common *ft);
561
562BT_HIDDEN
094ff7c0 563int bt_field_type_common_variant_borrow_field_by_index(
3dca2276
PP
564 struct bt_field_type_common *ft,
565 const char **field_name,
566 struct bt_field_type_common **field_type, uint64_t index);
567
568BT_HIDDEN
094ff7c0
PP
569struct bt_field_type_common *
570bt_field_type_common_array_borrow_element_field_type(
3dca2276
PP
571 struct bt_field_type_common *ft);
572
573BT_HIDDEN
574int bt_field_type_common_array_set_element_field_type(
575 struct bt_field_type_common *ft,
576 struct bt_field_type_common *element_ft);
577
578BT_HIDDEN
579int64_t bt_field_type_common_array_get_length(struct bt_field_type_common *ft);
580
581BT_HIDDEN
094ff7c0
PP
582struct bt_field_type_common *
583bt_field_type_common_sequence_borrow_element_field_type(
3dca2276
PP
584 struct bt_field_type_common *ft);
585
586BT_HIDDEN
587int bt_field_type_common_sequence_set_element_field_type(
588 struct bt_field_type_common *ft,
589 struct bt_field_type_common *element_ft);
590
591BT_HIDDEN
592const char *bt_field_type_common_sequence_get_length_field_name(
593 struct bt_field_type_common *ft);
594
595BT_HIDDEN
596enum bt_string_encoding bt_field_type_common_string_get_encoding(
597 struct bt_field_type_common *ft);
598
599BT_HIDDEN
600int bt_field_type_common_string_set_encoding(struct bt_field_type_common *ft,
601 enum bt_string_encoding encoding);
602
603BT_HIDDEN
604int bt_field_type_common_get_alignment(struct bt_field_type_common *type);
605
606BT_HIDDEN
607int bt_field_type_common_set_alignment(struct bt_field_type_common *ft,
608 unsigned int alignment);
609
610BT_HIDDEN
611enum bt_byte_order bt_field_type_common_get_byte_order(
612 struct bt_field_type_common *ft);
613
614BT_HIDDEN
615int bt_field_type_common_set_byte_order(struct bt_field_type_common *ft,
616 enum bt_byte_order byte_order);
617
618BT_HIDDEN
619enum bt_field_type_id bt_field_type_common_get_type_id(
620 struct bt_field_type_common *ft);
621
622BT_HIDDEN
623void _bt_field_type_common_freeze(struct bt_field_type_common *ft);
624
625BT_HIDDEN
626void _bt_field_type_freeze(struct bt_field_type *ft);
627
628BT_HIDDEN
094ff7c0
PP
629struct bt_field_type_common *
630bt_field_type_common_variant_borrow_field_type_signed(
3dca2276
PP
631 struct bt_field_type_common_variant *var_ft,
632 int64_t tag_value);
633
634BT_HIDDEN
094ff7c0
PP
635struct bt_field_type_common *
636bt_field_type_common_variant_borrow_field_type_unsigned(
3dca2276
PP
637 struct bt_field_type_common_variant *var_ft,
638 uint64_t tag_value);
639
640BT_HIDDEN
641struct bt_field_type_common *bt_field_type_common_copy(
642 struct bt_field_type_common *ft);
643
644BT_HIDDEN
645int bt_field_type_common_structure_get_field_name_index(
646 struct bt_field_type_common *ft, const char *name);
647
648BT_HIDDEN
649int bt_field_type_common_variant_get_field_name_index(
650 struct bt_field_type_common *ft, const char *name);
651
652BT_HIDDEN
653int bt_field_type_common_sequence_set_length_field_path(
654 struct bt_field_type_common *ft, struct bt_field_path *path);
655
656BT_HIDDEN
657int bt_field_type_common_variant_set_tag_field_path(
658 struct bt_field_type_common *ft,
659 struct bt_field_path *path);
660
661BT_HIDDEN
662int bt_field_type_common_variant_set_tag_field_type(
663 struct bt_field_type_common *ft,
664 struct bt_field_type_common *tag_ft);
665
666BT_HIDDEN
667void bt_field_type_common_generic_freeze(struct bt_field_type_common *ft);
668
669BT_HIDDEN
670void bt_field_type_common_enumeration_freeze_recursive(
671 struct bt_field_type_common *ft);
672
673BT_HIDDEN
674void bt_field_type_common_structure_freeze_recursive(
675 struct bt_field_type_common *ft);
676
677BT_HIDDEN
678void bt_field_type_common_variant_freeze_recursive(
679 struct bt_field_type_common *ft);
680
681BT_HIDDEN
682void bt_field_type_common_array_freeze_recursive(
683 struct bt_field_type_common *ft);
684
685BT_HIDDEN
686void bt_field_type_common_sequence_freeze_recursive(
687 struct bt_field_type_common *type);
688
689BT_HIDDEN
690void bt_field_type_common_integer_set_byte_order(
691 struct bt_field_type_common *ft, enum bt_byte_order byte_order);
692
693BT_HIDDEN
694void bt_field_type_common_enumeration_set_byte_order_recursive(
695 struct bt_field_type_common *ft, enum bt_byte_order byte_order);
696
697BT_HIDDEN
698void bt_field_type_common_floating_point_set_byte_order(
699 struct bt_field_type_common *ft, enum bt_byte_order byte_order);
700
701BT_HIDDEN
702void bt_field_type_common_structure_set_byte_order_recursive(
703 struct bt_field_type_common *ft,
704 enum bt_byte_order byte_order);
705
706BT_HIDDEN
707void bt_field_type_common_variant_set_byte_order_recursive(
708 struct bt_field_type_common *ft,
709 enum bt_byte_order byte_order);
710
711BT_HIDDEN
712void bt_field_type_common_array_set_byte_order_recursive(
713 struct bt_field_type_common *ft,
714 enum bt_byte_order byte_order);
715
716BT_HIDDEN
717void bt_field_type_common_sequence_set_byte_order_recursive(
718 struct bt_field_type_common *ft,
719 enum bt_byte_order byte_order);
720
721BT_HIDDEN
722int bt_field_type_common_integer_compare(struct bt_field_type_common *ft_a,
723 struct bt_field_type_common *ft_b);
724
725BT_HIDDEN
726int bt_field_type_common_floating_point_compare(
727 struct bt_field_type_common *ft_a,
728 struct bt_field_type_common *ft_b);
729
730BT_HIDDEN
731int bt_field_type_common_enumeration_compare_recursive(
732 struct bt_field_type_common *ft_a,
733 struct bt_field_type_common *ft_b);
734
735BT_HIDDEN
736int bt_field_type_common_string_compare(struct bt_field_type_common *ft_a,
737 struct bt_field_type_common *ft_b);
738
739BT_HIDDEN
740int bt_field_type_common_structure_compare_recursive(
741 struct bt_field_type_common *ft_a,
742 struct bt_field_type_common *ft_b);
743
744BT_HIDDEN
745int bt_field_type_common_variant_compare_recursive(
746 struct bt_field_type_common *ft_a,
747 struct bt_field_type_common *ft_b);
748
749BT_HIDDEN
750int bt_field_type_common_array_compare_recursive(
751 struct bt_field_type_common *ft_a,
752 struct bt_field_type_common *ft_b);
753
754BT_HIDDEN
755int bt_field_type_common_sequence_compare_recursive(
756 struct bt_field_type_common *ft_a,
757 struct bt_field_type_common *ft_b);
758
759BT_HIDDEN
760int bt_field_type_common_compare(struct bt_field_type_common *ft_a,
761 struct bt_field_type_common *ft_b);
762
763BT_HIDDEN
764int64_t bt_field_type_common_get_field_count(struct bt_field_type_common *ft);
765
766BT_HIDDEN
094ff7c0 767struct bt_field_type_common *bt_field_type_common_borrow_field_at_index(
3dca2276
PP
768 struct bt_field_type_common *ft, int index);
769
770BT_HIDDEN
771int bt_field_type_common_get_field_index(struct bt_field_type_common *ft,
772 const char *name);
773
774BT_HIDDEN
094ff7c0 775struct bt_field_path *bt_field_type_common_variant_borrow_tag_field_path(
3dca2276
PP
776 struct bt_field_type_common *ft);
777
778BT_HIDDEN
094ff7c0 779struct bt_field_path *bt_field_type_common_sequence_borrow_length_field_path(
3dca2276
PP
780 struct bt_field_type_common *ft);
781
782BT_HIDDEN
783int bt_field_type_common_validate_single_clock_class(
784 struct bt_field_type_common *ft,
785 struct bt_clock_class **expected_clock_class);
4e8304f7 786
312c056a
PP
787BT_HIDDEN
788int64_t bt_field_type_common_variant_find_choice_index(
789 struct bt_field_type_common *ft, uint64_t uval,
790 bool is_signed);
791
2e33ac5a 792#endif /* BABELTRACE_CTF_IR_FIELD_TYPES_INTERNAL_H */
This page took 0.079459 seconds and 4 git commands to generate.