Commit | Line | Data |
---|---|---|
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 | ||
ae2be88d SM |
10 | #ifndef BABELTRACE_CTF_WRITER_FIELD_TYPES_H |
11 | #define BABELTRACE_CTF_WRITER_FIELD_TYPES_H | |
0235b0db | 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) \ | |
d50d46f3 | 36 | (&bt_g_array_index(((struct bt_ctf_field_type_common_structure *) (_ft))->fields, \ |
16ca5ff0 PP |
37 | struct bt_ctf_field_type_common_structure_field, (_index))) |
38 | ||
39 | #define BT_CTF_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(_ft, _index) \ | |
d50d46f3 | 40 | (&bt_g_array_index(((struct bt_ctf_field_type_common_variant *) (_ft))->choices, \ |
16ca5ff0 PP |
41 | struct bt_ctf_field_type_common_variant_choice, (_index))) |
42 | ||
43 | struct bt_ctf_field_common; | |
44 | struct bt_ctf_field_type_common; | |
45 | ||
46 | typedef void (*bt_ctf_field_type_common_method_freeze)( | |
47 | struct bt_ctf_field_type_common *); | |
48 | typedef int (*bt_ctf_field_type_common_method_validate)( | |
49 | struct bt_ctf_field_type_common *); | |
50 | typedef void (*bt_ctf_field_type_common_method_set_byte_order)( | |
51 | struct bt_ctf_field_type_common *, enum bt_ctf_byte_order); | |
52 | typedef struct bt_ctf_field_type_common *(*bt_ctf_field_type_common_method_copy)( | |
53 | struct bt_ctf_field_type_common *); | |
54 | typedef int (*bt_ctf_field_type_common_method_compare)( | |
55 | struct bt_ctf_field_type_common *, | |
56 | struct bt_ctf_field_type_common *); | |
57 | ||
58 | struct 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 | ||
66 | struct 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 | |
e7401568 | 76 | * a field has been instantiated from it. |
16ca5ff0 PP |
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 | ||
114 | struct 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 | ||
127 | struct 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 | ||
139 | struct 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 | ||
152 | enum 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 | ||
158 | struct 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 | ||
173 | struct 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 | ||
180 | struct 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 | ||
187 | struct 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 | ||
198 | struct 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 | ||
209 | struct 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 | ||
219 | struct 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 | ||
238 | struct 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 | ||
247 | struct 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 | ||
259 | struct bt_ctf_field_type_common_string { | |
260 | struct bt_ctf_field_type_common common; | |
261 | enum bt_ctf_string_encoding encoding; | |
262 | }; | |
263 | ||
264 | typedef struct bt_ctf_field_common *(* bt_ctf_field_common_create_func)( | |
265 | struct bt_ctf_field_type_common *); | |
266 | ||
16ca5ff0 | 267 | void 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 |
271 | void 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 |
276 | void 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 |
281 | void 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 |
287 | void 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 |
292 | void 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 |
297 | void 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 |
303 | void 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 |
310 | void 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 | 317 | void bt_ctf_field_type_common_integer_destroy(struct bt_ctf_object *obj); |
16ca5ff0 | 318 | |
e1e02a22 | 319 | void bt_ctf_field_type_common_floating_point_destroy(struct bt_ctf_object *obj); |
16ca5ff0 | 320 | |
e1e02a22 | 321 | void bt_ctf_field_type_common_enumeration_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 | 322 | |
e1e02a22 | 323 | void bt_ctf_field_type_common_string_destroy(struct bt_ctf_object *obj); |
16ca5ff0 | 324 | |
e1e02a22 | 325 | void bt_ctf_field_type_common_structure_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 | 326 | |
e1e02a22 | 327 | void bt_ctf_field_type_common_array_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 | 328 | |
e1e02a22 | 329 | void bt_ctf_field_type_common_sequence_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 | 330 | |
e1e02a22 | 331 | void bt_ctf_field_type_common_variant_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 | 332 | |
16ca5ff0 PP |
333 | int bt_ctf_field_type_common_integer_validate(struct bt_ctf_field_type_common *ft); |
334 | ||
16ca5ff0 PP |
335 | int bt_ctf_field_type_common_enumeration_validate_recursive( |
336 | struct bt_ctf_field_type_common *ft); | |
337 | ||
16ca5ff0 PP |
338 | int bt_ctf_field_type_common_sequence_validate_recursive( |
339 | struct bt_ctf_field_type_common *ft); | |
340 | ||
16ca5ff0 PP |
341 | int bt_ctf_field_type_common_array_validate_recursive( |
342 | struct bt_ctf_field_type_common *ft); | |
343 | ||
16ca5ff0 PP |
344 | int bt_ctf_field_type_common_structure_validate_recursive( |
345 | struct bt_ctf_field_type_common *ft); | |
346 | ||
16ca5ff0 PP |
347 | int bt_ctf_field_type_common_variant_validate_recursive( |
348 | struct bt_ctf_field_type_common *type); | |
349 | ||
16ca5ff0 PP |
350 | int bt_ctf_field_type_common_validate(struct bt_ctf_field_type_common *ft); |
351 | ||
16ca5ff0 PP |
352 | int bt_ctf_field_type_common_integer_get_size(struct bt_ctf_field_type_common *ft); |
353 | ||
00409097 | 354 | bt_ctf_bool bt_ctf_field_type_common_integer_is_signed(struct bt_ctf_field_type_common *ft); |
16ca5ff0 | 355 | |
16ca5ff0 | 356 | int 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 |
359 | int bt_ctf_field_type_common_integer_set_size(struct bt_ctf_field_type_common *ft, |
360 | unsigned int size); | |
361 | ||
16ca5ff0 PP |
362 | enum bt_ctf_integer_base bt_ctf_field_type_common_integer_get_base( |
363 | struct bt_ctf_field_type_common *ft); | |
364 | ||
16ca5ff0 PP |
365 | int 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 |
368 | enum bt_ctf_string_encoding bt_ctf_field_type_common_integer_get_encoding( |
369 | struct bt_ctf_field_type_common *ft); | |
370 | ||
16ca5ff0 PP |
371 | int 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 |
374 | struct 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 |
377 | int 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 |
381 | int 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 |
385 | struct bt_ctf_field_type_enumeration_mapping_iterator * |
386 | bt_ctf_field_type_common_enumeration_find_mappings_by_name( | |
387 | struct bt_ctf_field_type_common *ft, const char *name); | |
388 | ||
16ca5ff0 PP |
389 | struct bt_ctf_field_type_enumeration_mapping_iterator * |
390 | bt_ctf_field_type_common_enumeration_signed_find_mappings_by_value( | |
391 | struct bt_ctf_field_type_common *ft, int64_t value); | |
392 | ||
16ca5ff0 PP |
393 | struct bt_ctf_field_type_enumeration_mapping_iterator * |
394 | bt_ctf_field_type_common_enumeration_unsigned_find_mappings_by_value( | |
395 | struct bt_ctf_field_type_common *ft, uint64_t value); | |
396 | ||
7c7301d5 SM |
397 | int bt_ctf_field_type_enumeration_mapping_iterator_next( |
398 | struct bt_ctf_field_type_enumeration_mapping_iterator *iter); | |
399 | ||
7c7301d5 SM |
400 | int 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 |
405 | int 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 |
410 | int 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 |
415 | int 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 |
420 | struct bt_ctf_field_type_common * |
421 | bt_ctf_field_type_common_enumeration_borrow_container_field_type( | |
422 | struct bt_ctf_field_type_common *ft); | |
423 | ||
16ca5ff0 PP |
424 | int 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 |
428 | int 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 |
432 | int64_t bt_ctf_field_type_common_enumeration_get_mapping_count( |
433 | struct bt_ctf_field_type_common *ft); | |
434 | ||
16ca5ff0 PP |
435 | int bt_ctf_field_type_common_floating_point_get_exponent_digits( |
436 | struct bt_ctf_field_type_common *ft); | |
437 | ||
16ca5ff0 PP |
438 | int 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 |
442 | int bt_ctf_field_type_common_floating_point_get_mantissa_digits( |
443 | struct bt_ctf_field_type_common *type); | |
444 | ||
16ca5ff0 PP |
445 | int 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 |
448 | int 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 |
453 | int 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 |
457 | int64_t bt_ctf_field_type_common_structure_get_field_count( |
458 | struct bt_ctf_field_type_common *ft); | |
459 | ||
16ca5ff0 PP |
460 | int 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 |
465 | struct bt_ctf_field_type_common * |
466 | bt_ctf_field_type_common_structure_borrow_field_type_by_name( | |
467 | struct bt_ctf_field_type_common *ft, const char *name); | |
468 | ||
16ca5ff0 PP |
469 | struct bt_ctf_field_type_common * |
470 | bt_ctf_field_type_common_variant_borrow_tag_field_type( | |
471 | struct bt_ctf_field_type_common *ft); | |
472 | ||
16ca5ff0 PP |
473 | const char *bt_ctf_field_type_common_variant_get_tag_name( |
474 | struct bt_ctf_field_type_common *ft); | |
475 | ||
16ca5ff0 PP |
476 | int bt_ctf_field_type_common_variant_set_tag_name( |
477 | struct bt_ctf_field_type_common *ft, const char *name); | |
478 | ||
16ca5ff0 PP |
479 | int 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 |
483 | int bt_ctf_field_type_common_variant_update_choices( |
484 | struct bt_ctf_field_type_common *ft); | |
485 | ||
16ca5ff0 PP |
486 | struct bt_ctf_field_type_common * |
487 | bt_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 |
491 | int64_t bt_ctf_field_type_common_variant_get_field_count( |
492 | struct bt_ctf_field_type_common *ft); | |
493 | ||
16ca5ff0 PP |
494 | int 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 |
499 | struct bt_ctf_field_type_common * |
500 | bt_ctf_field_type_common_array_borrow_element_field_type( | |
501 | struct bt_ctf_field_type_common *ft); | |
502 | ||
16ca5ff0 PP |
503 | int 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 |
507 | int64_t bt_ctf_field_type_common_array_get_length(struct bt_ctf_field_type_common *ft); |
508 | ||
16ca5ff0 PP |
509 | struct bt_ctf_field_type_common * |
510 | bt_ctf_field_type_common_sequence_borrow_element_field_type( | |
511 | struct bt_ctf_field_type_common *ft); | |
512 | ||
16ca5ff0 PP |
513 | int 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 |
517 | const char *bt_ctf_field_type_common_sequence_get_length_field_name( |
518 | struct bt_ctf_field_type_common *ft); | |
519 | ||
16ca5ff0 PP |
520 | enum bt_ctf_string_encoding bt_ctf_field_type_common_string_get_encoding( |
521 | struct bt_ctf_field_type_common *ft); | |
522 | ||
16ca5ff0 PP |
523 | int 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 |
526 | int bt_ctf_field_type_common_get_alignment(struct bt_ctf_field_type_common *type); |
527 | ||
16ca5ff0 PP |
528 | int bt_ctf_field_type_common_set_alignment(struct bt_ctf_field_type_common *ft, |
529 | unsigned int alignment); | |
530 | ||
16ca5ff0 PP |
531 | enum bt_ctf_byte_order bt_ctf_field_type_common_get_byte_order( |
532 | struct bt_ctf_field_type_common *ft); | |
533 | ||
16ca5ff0 PP |
534 | int 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 |
537 | enum bt_ctf_field_type_id bt_ctf_field_type_common_get_type_id( |
538 | struct bt_ctf_field_type_common *ft); | |
539 | ||
16ca5ff0 PP |
540 | void bt_ctf_field_type_common_freeze(struct bt_ctf_field_type_common *ft); |
541 | ||
16ca5ff0 PP |
542 | struct bt_ctf_field_type_common * |
543 | bt_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 |
547 | struct bt_ctf_field_type_common * |
548 | bt_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 |
552 | struct bt_ctf_field_type_common *bt_ctf_field_type_common_copy( |
553 | struct bt_ctf_field_type_common *ft); | |
554 | ||
16ca5ff0 PP |
555 | int bt_ctf_field_type_common_structure_get_field_name_index( |
556 | struct bt_ctf_field_type_common *ft, const char *name); | |
557 | ||
16ca5ff0 PP |
558 | int bt_ctf_field_type_common_variant_get_field_name_index( |
559 | struct bt_ctf_field_type_common *ft, const char *name); | |
560 | ||
16ca5ff0 PP |
561 | int 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 |
564 | int 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 |
568 | int 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 |
572 | void bt_ctf_field_type_common_generic_freeze(struct bt_ctf_field_type_common *ft); |
573 | ||
16ca5ff0 PP |
574 | void bt_ctf_field_type_common_enumeration_freeze_recursive( |
575 | struct bt_ctf_field_type_common *ft); | |
576 | ||
16ca5ff0 PP |
577 | void bt_ctf_field_type_common_structure_freeze_recursive( |
578 | struct bt_ctf_field_type_common *ft); | |
579 | ||
16ca5ff0 PP |
580 | void bt_ctf_field_type_common_variant_freeze_recursive( |
581 | struct bt_ctf_field_type_common *ft); | |
582 | ||
16ca5ff0 PP |
583 | void bt_ctf_field_type_common_array_freeze_recursive( |
584 | struct bt_ctf_field_type_common *ft); | |
585 | ||
16ca5ff0 PP |
586 | void bt_ctf_field_type_common_sequence_freeze_recursive( |
587 | struct bt_ctf_field_type_common *type); | |
588 | ||
16ca5ff0 PP |
589 | void 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 |
592 | void 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 |
595 | void 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 |
598 | void 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 |
602 | void 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 |
606 | void 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 |
610 | void 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 |
614 | int 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 |
617 | int 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 |
621 | int 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 |
625 | int 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 |
628 | int 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 |
632 | int 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 |
636 | int 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 |
640 | int 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 |
644 | int 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 |
647 | int64_t bt_ctf_field_type_common_get_field_count(struct bt_ctf_field_type_common *ft); |
648 | ||
16ca5ff0 PP |
649 | struct 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 |
652 | int bt_ctf_field_type_common_get_field_index(struct bt_ctf_field_type_common *ft, |
653 | const char *name); | |
654 | ||
16ca5ff0 PP |
655 | struct 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 |
658 | struct 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 |
661 | int 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 |
665 | int64_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 |
669 | int bt_ctf_field_type_serialize_recursive(struct bt_ctf_field_type *type, |
670 | struct metadata_context *context); | |
671 | ||
3dca2276 PP |
672 | struct bt_ctf_field_type *bt_ctf_field_type_copy(struct bt_ctf_field_type *ft); |
673 | ||
ae2be88d | 674 | #endif /* BABELTRACE_CTF_WRITER_FIELD_TYPES_H */ |