Visibility hidden by default
[babeltrace.git] / src / ctf-writer / field-types.h
CommitLineData
3dca2276 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
3dca2276 3 *
0235b0db 4 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3dca2276
PP
5 *
6 * The Common Trace Format (CTF) Specification is available at
7 * http://www.efficios.com/ctf
8 */
9
0235b0db
MJ
10#ifndef BABELTRACE_CTF_WRITER_FIELD_TYPES_INTERNAL_H
11#define BABELTRACE_CTF_WRITER_FIELD_TYPES_INTERNAL_H
12
c4f23e30 13#include <stdbool.h>
3dca2276
PP
14#include <stdint.h>
15#include <stddef.h>
16
217cf9d3
PP
17#include <babeltrace2-ctf-writer/field-types.h>
18#include <babeltrace2-ctf-writer/types.h>
16ca5ff0 19
91d81473 20#include "common/macros.h"
578e048b
MJ
21
22#include "assert-pre.h"
23#include "clock-class.h"
24#include "object.h"
25#include "writer.h"
26
67d2ce02
MJ
27#define BT_CTF_ASSERT_PRE_CTF_FT_COMMON_HAS_ID(_ft, _type_id, _name) \
28 BT_CTF_ASSERT_PRE(((struct bt_ctf_field_type_common *) (_ft))->id == (_type_id), \
16ca5ff0
PP
29 _name " has the wrong type ID: expected-type-id=%s, " \
30 "ft-addr=%p", bt_ctf_field_type_id_string(_type_id), (_ft))
31
67d2ce02
MJ
32#define BT_CTF_ASSERT_PRE_CTF_FT_HOT(_ft, _name) \
33 BT_CTF_ASSERT_PRE_HOT((_ft), (_name), ": ft-addr=%p", (_ft))
16ca5ff0
PP
34
35#define BT_CTF_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(_ft, _index) \
36 (&g_array_index(((struct bt_ctf_field_type_common_structure *) (_ft))->fields, \
37 struct bt_ctf_field_type_common_structure_field, (_index)))
38
39#define BT_CTF_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(_ft, _index) \
40 (&g_array_index(((struct bt_ctf_field_type_common_variant *) (_ft))->choices, \
41 struct bt_ctf_field_type_common_variant_choice, (_index)))
42
43struct bt_ctf_field_common;
44struct bt_ctf_field_type_common;
45
46typedef void (*bt_ctf_field_type_common_method_freeze)(
47 struct bt_ctf_field_type_common *);
48typedef int (*bt_ctf_field_type_common_method_validate)(
49 struct bt_ctf_field_type_common *);
50typedef void (*bt_ctf_field_type_common_method_set_byte_order)(
51 struct bt_ctf_field_type_common *, enum bt_ctf_byte_order);
52typedef struct bt_ctf_field_type_common *(*bt_ctf_field_type_common_method_copy)(
53 struct bt_ctf_field_type_common *);
54typedef int (*bt_ctf_field_type_common_method_compare)(
55 struct bt_ctf_field_type_common *,
56 struct bt_ctf_field_type_common *);
57
58struct bt_ctf_field_type_common_methods {
59 bt_ctf_field_type_common_method_freeze freeze;
60 bt_ctf_field_type_common_method_validate validate;
61 bt_ctf_field_type_common_method_set_byte_order set_byte_order;
62 bt_ctf_field_type_common_method_copy copy;
63 bt_ctf_field_type_common_method_compare compare;
64};
65
66struct bt_ctf_field_type_common {
e1e02a22 67 struct bt_ctf_object base;
16ca5ff0
PP
68 enum bt_ctf_field_type_id id;
69 unsigned int alignment;
70
71 /* Virtual table */
72 struct bt_ctf_field_type_common_methods *methods;
73
74 /*
75 * A type can't be modified once it is added to an event or after a
76 * a field has been instanciated from it.
77 */
78 int frozen;
79
80 /*
81 * This flag indicates if the field type is valid. A valid
82 * field type is _always_ frozen. All the nested field types of
83 * a valid field type are also valid (and thus frozen).
84 */
85 int valid;
86
87 /*
88 * Specialized data for either CTF IR or CTF writer APIs.
89 * Having this here ensures that:
90 *
91 * * The type-specific common data is always found at the same
92 * offset when the common API has a `struct
93 * bt_ctf_field_type_common *` so that you can cast it to `struct
94 * bt_ctf_field_type_common_integer *` for example and access the
95 * common integer field type fields.
96 *
97 * * The specific CTF IR and CTF writer APIs can access their
98 * specific field type fields in this union at an offset known
99 * at build time. This avoids a pointer to specific data so
100 * that all the fields, common or specific, of a CTF IR
101 * integer field type or of a CTF writer integer field type,
102 * for example, are contained within the same contiguous block
103 * of memory.
104 */
105 union {
106 struct {
107 } ir;
108 struct {
109 void *serialize_func;
110 } writer;
111 } spec;
112};
113
114struct bt_ctf_field_type_common_integer {
115 struct bt_ctf_field_type_common common;
116
117 /* Owned by this */
118 struct bt_ctf_clock_class *mapped_clock_class;
119
120 enum bt_ctf_byte_order user_byte_order;
00409097 121 bt_ctf_bool is_signed;
16ca5ff0
PP
122 unsigned int size;
123 enum bt_ctf_integer_base base;
124 enum bt_ctf_string_encoding encoding;
125};
126
127struct bt_ctf_enumeration_mapping {
128 union {
129 uint64_t _unsigned;
130 int64_t _signed;
131 } range_start;
132 union {
133 uint64_t _unsigned;
134 int64_t _signed;
135 } range_end;
136 GQuark string;
137};
138
139struct bt_ctf_field_type_common_enumeration {
140 struct bt_ctf_field_type_common common;
141
142 /* Owned by this */
143 struct bt_ctf_field_type_common_integer *container_ft;
144
145 /* Array of `struct bt_ctf_enumeration_mapping *`, owned by this */
146 GPtrArray *entries;
147
148 /* Only set during validation */
00409097 149 bt_ctf_bool has_overlapping_ranges;
16ca5ff0
PP
150};
151
152enum bt_ctf_field_type_enumeration_mapping_iterator_type {
153 CTF_ITERATOR_BY_NAME,
154 CTF_ITERATOR_BY_SIGNED_VALUE,
155 CTF_ITERATOR_BY_UNSIGNED_VALUE,
156};
157
158struct bt_ctf_field_type_enumeration_mapping_iterator {
e1e02a22 159 struct bt_ctf_object base;
16ca5ff0
PP
160
161 /* Owned by this */
162 struct bt_ctf_field_type_common_enumeration *enumeration_ft;
163
164 enum bt_ctf_field_type_enumeration_mapping_iterator_type type;
165 int index;
166 union {
167 GQuark name_quark;
168 int64_t signed_value;
169 uint64_t unsigned_value;
170 } u;
171};
172
173struct bt_ctf_field_type_common_floating_point {
174 struct bt_ctf_field_type_common common;
175 enum bt_ctf_byte_order user_byte_order;
176 unsigned int exp_dig;
177 unsigned int mant_dig;
178};
179
180struct bt_ctf_field_type_common_structure_field {
181 GQuark name;
182
183 /* Owned by this */
184 struct bt_ctf_field_type_common *type;
185};
186
187struct bt_ctf_field_type_common_structure {
188 struct bt_ctf_field_type_common common;
189 GHashTable *field_name_to_index;
190
191 /*
192 * Array of `struct bt_ctf_field_type_common_structure_field`,
193 * owned by this
194 */
195 GArray *fields;
196};
197
198struct bt_ctf_field_type_common_variant_choice_range {
199 union {
200 int64_t i;
201 uint64_t u;
202 } lower;
203 union {
204 int64_t i;
205 uint64_t u;
206 } upper;
207};
208
209struct bt_ctf_field_type_common_variant_choice {
210 GQuark name;
211
212 /* Owned by this */
213 struct bt_ctf_field_type_common *type;
214
215 /* Array of `struct bt_ctf_field_type_common_variant_choice_range` */
216 GArray *ranges;
217};
218
219struct bt_ctf_field_type_common_variant {
220 struct bt_ctf_field_type_common common;
221 GString *tag_name;
222 bool choices_up_to_date;
223
224 /* Owned by this */
225 struct bt_ctf_field_type_common_enumeration *tag_ft;
226
227 /* Owned by this */
228 struct bt_ctf_field_path *tag_field_path;
229
230 GHashTable *choice_name_to_index;
231
232 /*
233 * Array of `struct bt_ctf_field_type_common_variant_choice`,
234 * owned by this */
235 GArray *choices;
236};
237
238struct bt_ctf_field_type_common_array {
239 struct bt_ctf_field_type_common common;
240
241 /* Owned by this */
242 struct bt_ctf_field_type_common *element_ft;
243
244 unsigned int length;
245};
246
247struct bt_ctf_field_type_common_sequence {
248 struct bt_ctf_field_type_common common;
249
250 /* Owned by this */
251 struct bt_ctf_field_type_common *element_ft;
252
253 GString *length_field_name;
254
255 /* Owned by this */
256 struct bt_ctf_field_path *length_field_path;
257};
258
259struct bt_ctf_field_type_common_string {
260 struct bt_ctf_field_type_common common;
261 enum bt_ctf_string_encoding encoding;
262};
263
264typedef struct bt_ctf_field_common *(* bt_ctf_field_common_create_func)(
265 struct bt_ctf_field_type_common *);
266
16ca5ff0 267void bt_ctf_field_type_common_initialize(struct bt_ctf_field_type_common *ft,
e1e02a22 268 bool init_bo, bt_ctf_object_release_func release_func,
16ca5ff0
PP
269 struct bt_ctf_field_type_common_methods *methods);
270
16ca5ff0
PP
271void bt_ctf_field_type_common_integer_initialize(
272 struct bt_ctf_field_type_common *ft,
e1e02a22 273 unsigned int size, bt_ctf_object_release_func release_func,
16ca5ff0
PP
274 struct bt_ctf_field_type_common_methods *methods);
275
16ca5ff0
PP
276void bt_ctf_field_type_common_floating_point_initialize(
277 struct bt_ctf_field_type_common *ft,
e1e02a22 278 bt_ctf_object_release_func release_func,
16ca5ff0
PP
279 struct bt_ctf_field_type_common_methods *methods);
280
16ca5ff0
PP
281void bt_ctf_field_type_common_enumeration_initialize(
282 struct bt_ctf_field_type_common *ft,
283 struct bt_ctf_field_type_common *container_ft,
e1e02a22 284 bt_ctf_object_release_func release_func,
16ca5ff0
PP
285 struct bt_ctf_field_type_common_methods *methods);
286
16ca5ff0
PP
287void bt_ctf_field_type_common_string_initialize(
288 struct bt_ctf_field_type_common *ft,
e1e02a22 289 bt_ctf_object_release_func release_func,
16ca5ff0
PP
290 struct bt_ctf_field_type_common_methods *methods);
291
16ca5ff0
PP
292void bt_ctf_field_type_common_structure_initialize(
293 struct bt_ctf_field_type_common *ft,
e1e02a22 294 bt_ctf_object_release_func release_func,
16ca5ff0
PP
295 struct bt_ctf_field_type_common_methods *methods);
296
16ca5ff0
PP
297void bt_ctf_field_type_common_array_initialize(
298 struct bt_ctf_field_type_common *ft,
299 struct bt_ctf_field_type_common *element_ft,
e1e02a22 300 unsigned int length, bt_ctf_object_release_func release_func,
16ca5ff0
PP
301 struct bt_ctf_field_type_common_methods *methods);
302
16ca5ff0
PP
303void bt_ctf_field_type_common_sequence_initialize(
304 struct bt_ctf_field_type_common *ft,
305 struct bt_ctf_field_type_common *element_ft,
306 const char *length_field_name,
e1e02a22 307 bt_ctf_object_release_func release_func,
16ca5ff0
PP
308 struct bt_ctf_field_type_common_methods *methods);
309
16ca5ff0
PP
310void bt_ctf_field_type_common_variant_initialize(
311 struct bt_ctf_field_type_common *ft,
312 struct bt_ctf_field_type_common *tag_ft,
313 const char *tag_name,
e1e02a22 314 bt_ctf_object_release_func release_func,
16ca5ff0
PP
315 struct bt_ctf_field_type_common_methods *methods);
316
e1e02a22 317void bt_ctf_field_type_common_integer_destroy(struct bt_ctf_object *obj);
16ca5ff0 318
e1e02a22 319void bt_ctf_field_type_common_floating_point_destroy(struct bt_ctf_object *obj);
16ca5ff0 320
e1e02a22 321void bt_ctf_field_type_common_enumeration_destroy_recursive(struct bt_ctf_object *obj);
16ca5ff0 322
e1e02a22 323void bt_ctf_field_type_common_string_destroy(struct bt_ctf_object *obj);
16ca5ff0 324
e1e02a22 325void bt_ctf_field_type_common_structure_destroy_recursive(struct bt_ctf_object *obj);
16ca5ff0 326
e1e02a22 327void bt_ctf_field_type_common_array_destroy_recursive(struct bt_ctf_object *obj);
16ca5ff0 328
e1e02a22 329void bt_ctf_field_type_common_sequence_destroy_recursive(struct bt_ctf_object *obj);
16ca5ff0 330
e1e02a22 331void bt_ctf_field_type_common_variant_destroy_recursive(struct bt_ctf_object *obj);
16ca5ff0 332
16ca5ff0
PP
333int bt_ctf_field_type_common_integer_validate(struct bt_ctf_field_type_common *ft);
334
16ca5ff0
PP
335int bt_ctf_field_type_common_enumeration_validate_recursive(
336 struct bt_ctf_field_type_common *ft);
337
16ca5ff0
PP
338int bt_ctf_field_type_common_sequence_validate_recursive(
339 struct bt_ctf_field_type_common *ft);
340
16ca5ff0
PP
341int bt_ctf_field_type_common_array_validate_recursive(
342 struct bt_ctf_field_type_common *ft);
343
16ca5ff0
PP
344int bt_ctf_field_type_common_structure_validate_recursive(
345 struct bt_ctf_field_type_common *ft);
346
16ca5ff0
PP
347int bt_ctf_field_type_common_variant_validate_recursive(
348 struct bt_ctf_field_type_common *type);
349
16ca5ff0
PP
350int bt_ctf_field_type_common_validate(struct bt_ctf_field_type_common *ft);
351
16ca5ff0
PP
352int bt_ctf_field_type_common_integer_get_size(struct bt_ctf_field_type_common *ft);
353
00409097 354bt_ctf_bool bt_ctf_field_type_common_integer_is_signed(struct bt_ctf_field_type_common *ft);
16ca5ff0 355
16ca5ff0 356int bt_ctf_field_type_common_integer_set_is_signed(struct bt_ctf_field_type_common *ft,
00409097 357 bt_ctf_bool is_signed);
16ca5ff0 358
16ca5ff0
PP
359int bt_ctf_field_type_common_integer_set_size(struct bt_ctf_field_type_common *ft,
360 unsigned int size);
361
16ca5ff0
PP
362enum bt_ctf_integer_base bt_ctf_field_type_common_integer_get_base(
363 struct bt_ctf_field_type_common *ft);
364
16ca5ff0
PP
365int bt_ctf_field_type_common_integer_set_base(struct bt_ctf_field_type_common *ft,
366 enum bt_ctf_integer_base base);
367
16ca5ff0
PP
368enum bt_ctf_string_encoding bt_ctf_field_type_common_integer_get_encoding(
369 struct bt_ctf_field_type_common *ft);
370
16ca5ff0
PP
371int bt_ctf_field_type_common_integer_set_encoding(struct bt_ctf_field_type_common *ft,
372 enum bt_ctf_string_encoding encoding);
373
16ca5ff0
PP
374struct bt_ctf_clock_class *bt_ctf_field_type_common_integer_borrow_mapped_clock_class(
375 struct bt_ctf_field_type_common *ft);
376
16ca5ff0
PP
377int bt_ctf_field_type_common_integer_set_mapped_clock_class_no_check_frozen(
378 struct bt_ctf_field_type_common *ft,
379 struct bt_ctf_clock_class *clock_class);
380
16ca5ff0
PP
381int bt_ctf_field_type_common_integer_set_mapped_clock_class(
382 struct bt_ctf_field_type_common *ft,
383 struct bt_ctf_clock_class *clock_class);
384
16ca5ff0
PP
385struct bt_ctf_field_type_enumeration_mapping_iterator *
386bt_ctf_field_type_common_enumeration_find_mappings_by_name(
387 struct bt_ctf_field_type_common *ft, const char *name);
388
16ca5ff0
PP
389struct bt_ctf_field_type_enumeration_mapping_iterator *
390bt_ctf_field_type_common_enumeration_signed_find_mappings_by_value(
391 struct bt_ctf_field_type_common *ft, int64_t value);
392
16ca5ff0
PP
393struct bt_ctf_field_type_enumeration_mapping_iterator *
394bt_ctf_field_type_common_enumeration_unsigned_find_mappings_by_value(
395 struct bt_ctf_field_type_common *ft, uint64_t value);
396
7c7301d5
SM
397int bt_ctf_field_type_enumeration_mapping_iterator_next(
398 struct bt_ctf_field_type_enumeration_mapping_iterator *iter);
399
7c7301d5
SM
400int bt_ctf_field_type_enumeration_mapping_iterator_signed_get(
401 struct bt_ctf_field_type_enumeration_mapping_iterator *iter,
402 const char **mapping_name, int64_t *range_begin,
403 int64_t *range_end);
404
7c7301d5
SM
405int bt_ctf_field_type_enumeration_mapping_iterator_unsigned_get(
406 struct bt_ctf_field_type_enumeration_mapping_iterator *iter,
407 const char **mapping_name, uint64_t *range_begin,
408 uint64_t *range_end);
409
16ca5ff0
PP
410int bt_ctf_field_type_common_enumeration_signed_get_mapping_by_index(
411 struct bt_ctf_field_type_common *ft, uint64_t index,
412 const char **mapping_name, int64_t *range_begin,
413 int64_t *range_end);
414
16ca5ff0
PP
415int bt_ctf_field_type_common_enumeration_unsigned_get_mapping_by_index(
416 struct bt_ctf_field_type_common *ft, uint64_t index,
417 const char **mapping_name, uint64_t *range_begin,
418 uint64_t *range_end);
419
16ca5ff0
PP
420struct bt_ctf_field_type_common *
421bt_ctf_field_type_common_enumeration_borrow_container_field_type(
422 struct bt_ctf_field_type_common *ft);
423
16ca5ff0
PP
424int bt_ctf_field_type_common_enumeration_signed_add_mapping(
425 struct bt_ctf_field_type_common *ft, const char *string,
426 int64_t range_start, int64_t range_end);
427
16ca5ff0
PP
428int bt_ctf_field_type_common_enumeration_unsigned_add_mapping(
429 struct bt_ctf_field_type_common *ft, const char *string,
430 uint64_t range_start, uint64_t range_end);
431
16ca5ff0
PP
432int64_t bt_ctf_field_type_common_enumeration_get_mapping_count(
433 struct bt_ctf_field_type_common *ft);
434
16ca5ff0
PP
435int bt_ctf_field_type_common_floating_point_get_exponent_digits(
436 struct bt_ctf_field_type_common *ft);
437
16ca5ff0
PP
438int bt_ctf_field_type_common_floating_point_set_exponent_digits(
439 struct bt_ctf_field_type_common *ft,
440 unsigned int exponent_digits);
441
16ca5ff0
PP
442int bt_ctf_field_type_common_floating_point_get_mantissa_digits(
443 struct bt_ctf_field_type_common *type);
444
16ca5ff0
PP
445int bt_ctf_field_type_common_floating_point_set_mantissa_digits(
446 struct bt_ctf_field_type_common *ft, unsigned int mantissa_digits);
447
16ca5ff0
PP
448int bt_ctf_field_type_common_structure_replace_field(
449 struct bt_ctf_field_type_common *ft,
450 const char *field_name,
451 struct bt_ctf_field_type_common *field_type);
452
16ca5ff0
PP
453int bt_ctf_field_type_common_structure_add_field(struct bt_ctf_field_type_common *ft,
454 struct bt_ctf_field_type_common *field_type,
455 const char *field_name);
456
16ca5ff0
PP
457int64_t bt_ctf_field_type_common_structure_get_field_count(
458 struct bt_ctf_field_type_common *ft);
459
16ca5ff0
PP
460int bt_ctf_field_type_common_structure_borrow_field_by_index(
461 struct bt_ctf_field_type_common *ft,
462 const char **field_name,
463 struct bt_ctf_field_type_common **field_type, uint64_t index);
464
16ca5ff0
PP
465struct bt_ctf_field_type_common *
466bt_ctf_field_type_common_structure_borrow_field_type_by_name(
467 struct bt_ctf_field_type_common *ft, const char *name);
468
16ca5ff0
PP
469struct bt_ctf_field_type_common *
470bt_ctf_field_type_common_variant_borrow_tag_field_type(
471 struct bt_ctf_field_type_common *ft);
472
16ca5ff0
PP
473const char *bt_ctf_field_type_common_variant_get_tag_name(
474 struct bt_ctf_field_type_common *ft);
475
16ca5ff0
PP
476int bt_ctf_field_type_common_variant_set_tag_name(
477 struct bt_ctf_field_type_common *ft, const char *name);
478
16ca5ff0
PP
479int bt_ctf_field_type_common_variant_add_field(struct bt_ctf_field_type_common *ft,
480 struct bt_ctf_field_type_common *field_type,
481 const char *field_name);
482
16ca5ff0
PP
483int bt_ctf_field_type_common_variant_update_choices(
484 struct bt_ctf_field_type_common *ft);
485
16ca5ff0
PP
486struct bt_ctf_field_type_common *
487bt_ctf_field_type_common_variant_borrow_field_type_by_name(
488 struct bt_ctf_field_type_common *ft,
489 const char *field_name);
490
16ca5ff0
PP
491int64_t bt_ctf_field_type_common_variant_get_field_count(
492 struct bt_ctf_field_type_common *ft);
493
16ca5ff0
PP
494int bt_ctf_field_type_common_variant_borrow_field_by_index(
495 struct bt_ctf_field_type_common *ft,
496 const char **field_name,
497 struct bt_ctf_field_type_common **field_type, uint64_t index);
498
16ca5ff0
PP
499struct bt_ctf_field_type_common *
500bt_ctf_field_type_common_array_borrow_element_field_type(
501 struct bt_ctf_field_type_common *ft);
502
16ca5ff0
PP
503int bt_ctf_field_type_common_array_set_element_field_type(
504 struct bt_ctf_field_type_common *ft,
505 struct bt_ctf_field_type_common *element_ft);
506
16ca5ff0
PP
507int64_t bt_ctf_field_type_common_array_get_length(struct bt_ctf_field_type_common *ft);
508
16ca5ff0
PP
509struct bt_ctf_field_type_common *
510bt_ctf_field_type_common_sequence_borrow_element_field_type(
511 struct bt_ctf_field_type_common *ft);
512
16ca5ff0
PP
513int bt_ctf_field_type_common_sequence_set_element_field_type(
514 struct bt_ctf_field_type_common *ft,
515 struct bt_ctf_field_type_common *element_ft);
516
16ca5ff0
PP
517const char *bt_ctf_field_type_common_sequence_get_length_field_name(
518 struct bt_ctf_field_type_common *ft);
519
16ca5ff0
PP
520enum bt_ctf_string_encoding bt_ctf_field_type_common_string_get_encoding(
521 struct bt_ctf_field_type_common *ft);
522
16ca5ff0
PP
523int bt_ctf_field_type_common_string_set_encoding(struct bt_ctf_field_type_common *ft,
524 enum bt_ctf_string_encoding encoding);
525
16ca5ff0
PP
526int bt_ctf_field_type_common_get_alignment(struct bt_ctf_field_type_common *type);
527
16ca5ff0
PP
528int bt_ctf_field_type_common_set_alignment(struct bt_ctf_field_type_common *ft,
529 unsigned int alignment);
530
16ca5ff0
PP
531enum bt_ctf_byte_order bt_ctf_field_type_common_get_byte_order(
532 struct bt_ctf_field_type_common *ft);
533
16ca5ff0
PP
534int bt_ctf_field_type_common_set_byte_order(struct bt_ctf_field_type_common *ft,
535 enum bt_ctf_byte_order byte_order);
536
16ca5ff0
PP
537enum bt_ctf_field_type_id bt_ctf_field_type_common_get_type_id(
538 struct bt_ctf_field_type_common *ft);
539
16ca5ff0
PP
540void bt_ctf_field_type_common_freeze(struct bt_ctf_field_type_common *ft);
541
16ca5ff0
PP
542struct bt_ctf_field_type_common *
543bt_ctf_field_type_common_variant_borrow_field_type_signed(
544 struct bt_ctf_field_type_common_variant *var_ft,
545 int64_t tag_value);
546
16ca5ff0
PP
547struct bt_ctf_field_type_common *
548bt_ctf_field_type_common_variant_borrow_field_type_unsigned(
549 struct bt_ctf_field_type_common_variant *var_ft,
550 uint64_t tag_value);
551
16ca5ff0
PP
552struct bt_ctf_field_type_common *bt_ctf_field_type_common_copy(
553 struct bt_ctf_field_type_common *ft);
554
16ca5ff0
PP
555int bt_ctf_field_type_common_structure_get_field_name_index(
556 struct bt_ctf_field_type_common *ft, const char *name);
557
16ca5ff0
PP
558int bt_ctf_field_type_common_variant_get_field_name_index(
559 struct bt_ctf_field_type_common *ft, const char *name);
560
16ca5ff0
PP
561int bt_ctf_field_type_common_sequence_set_length_field_path(
562 struct bt_ctf_field_type_common *ft, struct bt_ctf_field_path *path);
563
16ca5ff0
PP
564int bt_ctf_field_type_common_variant_set_tag_field_path(
565 struct bt_ctf_field_type_common *ft,
566 struct bt_ctf_field_path *path);
567
16ca5ff0
PP
568int bt_ctf_field_type_common_variant_set_tag_field_type(
569 struct bt_ctf_field_type_common *ft,
570 struct bt_ctf_field_type_common *tag_ft);
571
16ca5ff0
PP
572void bt_ctf_field_type_common_generic_freeze(struct bt_ctf_field_type_common *ft);
573
16ca5ff0
PP
574void bt_ctf_field_type_common_enumeration_freeze_recursive(
575 struct bt_ctf_field_type_common *ft);
576
16ca5ff0
PP
577void bt_ctf_field_type_common_structure_freeze_recursive(
578 struct bt_ctf_field_type_common *ft);
579
16ca5ff0
PP
580void bt_ctf_field_type_common_variant_freeze_recursive(
581 struct bt_ctf_field_type_common *ft);
582
16ca5ff0
PP
583void bt_ctf_field_type_common_array_freeze_recursive(
584 struct bt_ctf_field_type_common *ft);
585
16ca5ff0
PP
586void bt_ctf_field_type_common_sequence_freeze_recursive(
587 struct bt_ctf_field_type_common *type);
588
16ca5ff0
PP
589void bt_ctf_field_type_common_integer_set_byte_order(
590 struct bt_ctf_field_type_common *ft, enum bt_ctf_byte_order byte_order);
591
16ca5ff0
PP
592void bt_ctf_field_type_common_enumeration_set_byte_order_recursive(
593 struct bt_ctf_field_type_common *ft, enum bt_ctf_byte_order byte_order);
594
16ca5ff0
PP
595void bt_ctf_field_type_common_floating_point_set_byte_order(
596 struct bt_ctf_field_type_common *ft, enum bt_ctf_byte_order byte_order);
597
16ca5ff0
PP
598void bt_ctf_field_type_common_structure_set_byte_order_recursive(
599 struct bt_ctf_field_type_common *ft,
600 enum bt_ctf_byte_order byte_order);
601
16ca5ff0
PP
602void bt_ctf_field_type_common_variant_set_byte_order_recursive(
603 struct bt_ctf_field_type_common *ft,
604 enum bt_ctf_byte_order byte_order);
605
16ca5ff0
PP
606void bt_ctf_field_type_common_array_set_byte_order_recursive(
607 struct bt_ctf_field_type_common *ft,
608 enum bt_ctf_byte_order byte_order);
609
16ca5ff0
PP
610void bt_ctf_field_type_common_sequence_set_byte_order_recursive(
611 struct bt_ctf_field_type_common *ft,
612 enum bt_ctf_byte_order byte_order);
613
16ca5ff0
PP
614int bt_ctf_field_type_common_integer_compare(struct bt_ctf_field_type_common *ft_a,
615 struct bt_ctf_field_type_common *ft_b);
616
16ca5ff0
PP
617int bt_ctf_field_type_common_floating_point_compare(
618 struct bt_ctf_field_type_common *ft_a,
619 struct bt_ctf_field_type_common *ft_b);
620
16ca5ff0
PP
621int bt_ctf_field_type_common_enumeration_compare_recursive(
622 struct bt_ctf_field_type_common *ft_a,
623 struct bt_ctf_field_type_common *ft_b);
624
16ca5ff0
PP
625int bt_ctf_field_type_common_string_compare(struct bt_ctf_field_type_common *ft_a,
626 struct bt_ctf_field_type_common *ft_b);
627
16ca5ff0
PP
628int bt_ctf_field_type_common_structure_compare_recursive(
629 struct bt_ctf_field_type_common *ft_a,
630 struct bt_ctf_field_type_common *ft_b);
631
16ca5ff0
PP
632int bt_ctf_field_type_common_variant_compare_recursive(
633 struct bt_ctf_field_type_common *ft_a,
634 struct bt_ctf_field_type_common *ft_b);
635
16ca5ff0
PP
636int bt_ctf_field_type_common_array_compare_recursive(
637 struct bt_ctf_field_type_common *ft_a,
638 struct bt_ctf_field_type_common *ft_b);
639
16ca5ff0
PP
640int bt_ctf_field_type_common_sequence_compare_recursive(
641 struct bt_ctf_field_type_common *ft_a,
642 struct bt_ctf_field_type_common *ft_b);
643
16ca5ff0
PP
644int bt_ctf_field_type_common_compare(struct bt_ctf_field_type_common *ft_a,
645 struct bt_ctf_field_type_common *ft_b);
646
16ca5ff0
PP
647int64_t bt_ctf_field_type_common_get_field_count(struct bt_ctf_field_type_common *ft);
648
16ca5ff0
PP
649struct bt_ctf_field_type_common *bt_ctf_field_type_common_borrow_field_at_index(
650 struct bt_ctf_field_type_common *ft, int index);
651
16ca5ff0
PP
652int bt_ctf_field_type_common_get_field_index(struct bt_ctf_field_type_common *ft,
653 const char *name);
654
16ca5ff0
PP
655struct bt_ctf_field_path *bt_ctf_field_type_common_variant_borrow_tag_field_path(
656 struct bt_ctf_field_type_common *ft);
657
16ca5ff0
PP
658struct bt_ctf_field_path *bt_ctf_field_type_common_sequence_borrow_length_field_path(
659 struct bt_ctf_field_type_common *ft);
660
16ca5ff0
PP
661int bt_ctf_field_type_common_validate_single_clock_class(
662 struct bt_ctf_field_type_common *ft,
663 struct bt_ctf_clock_class **expected_clock_class);
664
16ca5ff0
PP
665int64_t bt_ctf_field_type_common_variant_find_choice_index(
666 struct bt_ctf_field_type_common *ft, uint64_t uval,
667 bool is_signed);
3dca2276 668
3dca2276
PP
669int bt_ctf_field_type_serialize_recursive(struct bt_ctf_field_type *type,
670 struct metadata_context *context);
671
3dca2276
PP
672struct bt_ctf_field_type *bt_ctf_field_type_copy(struct bt_ctf_field_type *ft);
673
674#endif /* BABELTRACE_CTF_WRITER_FIELD_TYPES_INTERNAL_H */
This page took 0.11152 seconds and 4 git commands to generate.