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