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