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 | ||
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 | ||
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 | |
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 | ||
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 | ||
267 | BT_HIDDEN | |
268 | void bt_ctf_field_type_common_initialize(struct bt_ctf_field_type_common *ft, | |
e1e02a22 | 269 | bool init_bo, bt_ctf_object_release_func release_func, |
16ca5ff0 PP |
270 | struct bt_ctf_field_type_common_methods *methods); |
271 | ||
272 | BT_HIDDEN | |
273 | void bt_ctf_field_type_common_integer_initialize( | |
274 | struct bt_ctf_field_type_common *ft, | |
e1e02a22 | 275 | unsigned int size, bt_ctf_object_release_func release_func, |
16ca5ff0 PP |
276 | struct bt_ctf_field_type_common_methods *methods); |
277 | ||
278 | BT_HIDDEN | |
279 | void bt_ctf_field_type_common_floating_point_initialize( | |
280 | struct bt_ctf_field_type_common *ft, | |
e1e02a22 | 281 | bt_ctf_object_release_func release_func, |
16ca5ff0 PP |
282 | struct bt_ctf_field_type_common_methods *methods); |
283 | ||
284 | BT_HIDDEN | |
285 | void bt_ctf_field_type_common_enumeration_initialize( | |
286 | struct bt_ctf_field_type_common *ft, | |
287 | struct bt_ctf_field_type_common *container_ft, | |
e1e02a22 | 288 | bt_ctf_object_release_func release_func, |
16ca5ff0 PP |
289 | struct bt_ctf_field_type_common_methods *methods); |
290 | ||
291 | BT_HIDDEN | |
292 | void bt_ctf_field_type_common_string_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 | ||
297 | BT_HIDDEN | |
298 | void bt_ctf_field_type_common_structure_initialize( | |
299 | struct bt_ctf_field_type_common *ft, | |
e1e02a22 | 300 | bt_ctf_object_release_func release_func, |
16ca5ff0 PP |
301 | struct bt_ctf_field_type_common_methods *methods); |
302 | ||
303 | BT_HIDDEN | |
304 | void bt_ctf_field_type_common_array_initialize( | |
305 | struct bt_ctf_field_type_common *ft, | |
306 | struct bt_ctf_field_type_common *element_ft, | |
e1e02a22 | 307 | unsigned int length, bt_ctf_object_release_func release_func, |
16ca5ff0 PP |
308 | struct bt_ctf_field_type_common_methods *methods); |
309 | ||
310 | BT_HIDDEN | |
311 | void bt_ctf_field_type_common_sequence_initialize( | |
312 | struct bt_ctf_field_type_common *ft, | |
313 | struct bt_ctf_field_type_common *element_ft, | |
314 | const char *length_field_name, | |
e1e02a22 | 315 | bt_ctf_object_release_func release_func, |
16ca5ff0 PP |
316 | struct bt_ctf_field_type_common_methods *methods); |
317 | ||
318 | BT_HIDDEN | |
319 | void bt_ctf_field_type_common_variant_initialize( | |
320 | struct bt_ctf_field_type_common *ft, | |
321 | struct bt_ctf_field_type_common *tag_ft, | |
322 | const char *tag_name, | |
e1e02a22 | 323 | bt_ctf_object_release_func release_func, |
16ca5ff0 PP |
324 | struct bt_ctf_field_type_common_methods *methods); |
325 | ||
326 | BT_HIDDEN | |
e1e02a22 | 327 | void bt_ctf_field_type_common_integer_destroy(struct bt_ctf_object *obj); |
16ca5ff0 PP |
328 | |
329 | BT_HIDDEN | |
e1e02a22 | 330 | void bt_ctf_field_type_common_floating_point_destroy(struct bt_ctf_object *obj); |
16ca5ff0 PP |
331 | |
332 | BT_HIDDEN | |
e1e02a22 | 333 | void bt_ctf_field_type_common_enumeration_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 PP |
334 | |
335 | BT_HIDDEN | |
e1e02a22 | 336 | void bt_ctf_field_type_common_string_destroy(struct bt_ctf_object *obj); |
16ca5ff0 PP |
337 | |
338 | BT_HIDDEN | |
e1e02a22 | 339 | void bt_ctf_field_type_common_structure_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 PP |
340 | |
341 | BT_HIDDEN | |
e1e02a22 | 342 | void bt_ctf_field_type_common_array_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 PP |
343 | |
344 | BT_HIDDEN | |
e1e02a22 | 345 | void bt_ctf_field_type_common_sequence_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 PP |
346 | |
347 | BT_HIDDEN | |
e1e02a22 | 348 | void bt_ctf_field_type_common_variant_destroy_recursive(struct bt_ctf_object *obj); |
16ca5ff0 PP |
349 | |
350 | BT_HIDDEN | |
351 | int bt_ctf_field_type_common_integer_validate(struct bt_ctf_field_type_common *ft); | |
352 | ||
353 | BT_HIDDEN | |
354 | int bt_ctf_field_type_common_enumeration_validate_recursive( | |
355 | struct bt_ctf_field_type_common *ft); | |
356 | ||
357 | BT_HIDDEN | |
358 | int bt_ctf_field_type_common_sequence_validate_recursive( | |
359 | struct bt_ctf_field_type_common *ft); | |
360 | ||
361 | BT_HIDDEN | |
362 | int bt_ctf_field_type_common_array_validate_recursive( | |
363 | struct bt_ctf_field_type_common *ft); | |
364 | ||
365 | BT_HIDDEN | |
366 | int bt_ctf_field_type_common_structure_validate_recursive( | |
367 | struct bt_ctf_field_type_common *ft); | |
368 | ||
369 | BT_HIDDEN | |
370 | int bt_ctf_field_type_common_variant_validate_recursive( | |
371 | struct bt_ctf_field_type_common *type); | |
372 | ||
373 | BT_HIDDEN | |
374 | int bt_ctf_field_type_common_validate(struct bt_ctf_field_type_common *ft); | |
375 | ||
376 | BT_HIDDEN | |
377 | int bt_ctf_field_type_common_integer_get_size(struct bt_ctf_field_type_common *ft); | |
378 | ||
379 | BT_HIDDEN | |
00409097 | 380 | bt_ctf_bool bt_ctf_field_type_common_integer_is_signed(struct bt_ctf_field_type_common *ft); |
16ca5ff0 PP |
381 | |
382 | BT_HIDDEN | |
383 | int bt_ctf_field_type_common_integer_set_is_signed(struct bt_ctf_field_type_common *ft, | |
00409097 | 384 | bt_ctf_bool is_signed); |
16ca5ff0 PP |
385 | |
386 | BT_HIDDEN | |
387 | int bt_ctf_field_type_common_integer_set_size(struct bt_ctf_field_type_common *ft, | |
388 | unsigned int size); | |
389 | ||
390 | BT_HIDDEN | |
391 | enum bt_ctf_integer_base bt_ctf_field_type_common_integer_get_base( | |
392 | struct bt_ctf_field_type_common *ft); | |
393 | ||
394 | BT_HIDDEN | |
395 | int bt_ctf_field_type_common_integer_set_base(struct bt_ctf_field_type_common *ft, | |
396 | enum bt_ctf_integer_base base); | |
397 | ||
398 | BT_HIDDEN | |
399 | enum bt_ctf_string_encoding bt_ctf_field_type_common_integer_get_encoding( | |
400 | struct bt_ctf_field_type_common *ft); | |
401 | ||
402 | BT_HIDDEN | |
403 | int bt_ctf_field_type_common_integer_set_encoding(struct bt_ctf_field_type_common *ft, | |
404 | enum bt_ctf_string_encoding encoding); | |
405 | ||
406 | BT_HIDDEN | |
407 | struct bt_ctf_clock_class *bt_ctf_field_type_common_integer_borrow_mapped_clock_class( | |
408 | struct bt_ctf_field_type_common *ft); | |
409 | ||
410 | BT_HIDDEN | |
411 | int bt_ctf_field_type_common_integer_set_mapped_clock_class_no_check_frozen( | |
412 | struct bt_ctf_field_type_common *ft, | |
413 | struct bt_ctf_clock_class *clock_class); | |
414 | ||
415 | BT_HIDDEN | |
416 | int bt_ctf_field_type_common_integer_set_mapped_clock_class( | |
417 | struct bt_ctf_field_type_common *ft, | |
418 | struct bt_ctf_clock_class *clock_class); | |
419 | ||
420 | BT_HIDDEN | |
421 | struct bt_ctf_field_type_enumeration_mapping_iterator * | |
422 | bt_ctf_field_type_common_enumeration_find_mappings_by_name( | |
423 | struct bt_ctf_field_type_common *ft, const char *name); | |
424 | ||
425 | BT_HIDDEN | |
426 | struct bt_ctf_field_type_enumeration_mapping_iterator * | |
427 | bt_ctf_field_type_common_enumeration_signed_find_mappings_by_value( | |
428 | struct bt_ctf_field_type_common *ft, int64_t value); | |
429 | ||
430 | BT_HIDDEN | |
431 | struct bt_ctf_field_type_enumeration_mapping_iterator * | |
432 | bt_ctf_field_type_common_enumeration_unsigned_find_mappings_by_value( | |
433 | struct bt_ctf_field_type_common *ft, uint64_t value); | |
434 | ||
7c7301d5 SM |
435 | BT_HIDDEN |
436 | int bt_ctf_field_type_enumeration_mapping_iterator_next( | |
437 | struct bt_ctf_field_type_enumeration_mapping_iterator *iter); | |
438 | ||
439 | BT_HIDDEN | |
440 | int bt_ctf_field_type_enumeration_mapping_iterator_signed_get( | |
441 | struct bt_ctf_field_type_enumeration_mapping_iterator *iter, | |
442 | const char **mapping_name, int64_t *range_begin, | |
443 | int64_t *range_end); | |
444 | ||
445 | BT_HIDDEN | |
446 | int bt_ctf_field_type_enumeration_mapping_iterator_unsigned_get( | |
447 | struct bt_ctf_field_type_enumeration_mapping_iterator *iter, | |
448 | const char **mapping_name, uint64_t *range_begin, | |
449 | uint64_t *range_end); | |
450 | ||
16ca5ff0 PP |
451 | BT_HIDDEN |
452 | int bt_ctf_field_type_common_enumeration_signed_get_mapping_by_index( | |
453 | struct bt_ctf_field_type_common *ft, uint64_t index, | |
454 | const char **mapping_name, int64_t *range_begin, | |
455 | int64_t *range_end); | |
456 | ||
457 | BT_HIDDEN | |
458 | int bt_ctf_field_type_common_enumeration_unsigned_get_mapping_by_index( | |
459 | struct bt_ctf_field_type_common *ft, uint64_t index, | |
460 | const char **mapping_name, uint64_t *range_begin, | |
461 | uint64_t *range_end); | |
462 | ||
463 | BT_HIDDEN | |
464 | struct bt_ctf_field_type_common * | |
465 | bt_ctf_field_type_common_enumeration_borrow_container_field_type( | |
466 | struct bt_ctf_field_type_common *ft); | |
467 | ||
468 | BT_HIDDEN | |
469 | int bt_ctf_field_type_common_enumeration_signed_add_mapping( | |
470 | struct bt_ctf_field_type_common *ft, const char *string, | |
471 | int64_t range_start, int64_t range_end); | |
472 | ||
473 | BT_HIDDEN | |
474 | int bt_ctf_field_type_common_enumeration_unsigned_add_mapping( | |
475 | struct bt_ctf_field_type_common *ft, const char *string, | |
476 | uint64_t range_start, uint64_t range_end); | |
477 | ||
478 | BT_HIDDEN | |
479 | int64_t bt_ctf_field_type_common_enumeration_get_mapping_count( | |
480 | struct bt_ctf_field_type_common *ft); | |
481 | ||
482 | BT_HIDDEN | |
483 | int bt_ctf_field_type_common_floating_point_get_exponent_digits( | |
484 | struct bt_ctf_field_type_common *ft); | |
485 | ||
486 | BT_HIDDEN | |
487 | int bt_ctf_field_type_common_floating_point_set_exponent_digits( | |
488 | struct bt_ctf_field_type_common *ft, | |
489 | unsigned int exponent_digits); | |
490 | ||
491 | BT_HIDDEN | |
492 | int bt_ctf_field_type_common_floating_point_get_mantissa_digits( | |
493 | struct bt_ctf_field_type_common *type); | |
494 | ||
495 | BT_HIDDEN | |
496 | int bt_ctf_field_type_common_floating_point_set_mantissa_digits( | |
497 | struct bt_ctf_field_type_common *ft, unsigned int mantissa_digits); | |
498 | ||
499 | BT_HIDDEN | |
500 | int bt_ctf_field_type_common_structure_replace_field( | |
501 | struct bt_ctf_field_type_common *ft, | |
502 | const char *field_name, | |
503 | struct bt_ctf_field_type_common *field_type); | |
504 | ||
505 | BT_HIDDEN | |
506 | int bt_ctf_field_type_common_structure_add_field(struct bt_ctf_field_type_common *ft, | |
507 | struct bt_ctf_field_type_common *field_type, | |
508 | const char *field_name); | |
509 | ||
510 | BT_HIDDEN | |
511 | int64_t bt_ctf_field_type_common_structure_get_field_count( | |
512 | struct bt_ctf_field_type_common *ft); | |
513 | ||
514 | BT_HIDDEN | |
515 | int bt_ctf_field_type_common_structure_borrow_field_by_index( | |
516 | struct bt_ctf_field_type_common *ft, | |
517 | const char **field_name, | |
518 | struct bt_ctf_field_type_common **field_type, uint64_t index); | |
519 | ||
520 | BT_HIDDEN | |
521 | struct bt_ctf_field_type_common * | |
522 | bt_ctf_field_type_common_structure_borrow_field_type_by_name( | |
523 | struct bt_ctf_field_type_common *ft, const char *name); | |
524 | ||
525 | BT_HIDDEN | |
526 | struct bt_ctf_field_type_common * | |
527 | bt_ctf_field_type_common_variant_borrow_tag_field_type( | |
528 | struct bt_ctf_field_type_common *ft); | |
529 | ||
530 | BT_HIDDEN | |
531 | const char *bt_ctf_field_type_common_variant_get_tag_name( | |
532 | struct bt_ctf_field_type_common *ft); | |
533 | ||
534 | BT_HIDDEN | |
535 | int bt_ctf_field_type_common_variant_set_tag_name( | |
536 | struct bt_ctf_field_type_common *ft, const char *name); | |
537 | ||
538 | BT_HIDDEN | |
539 | int bt_ctf_field_type_common_variant_add_field(struct bt_ctf_field_type_common *ft, | |
540 | struct bt_ctf_field_type_common *field_type, | |
541 | const char *field_name); | |
542 | ||
543 | BT_HIDDEN | |
544 | int bt_ctf_field_type_common_variant_update_choices( | |
545 | struct bt_ctf_field_type_common *ft); | |
546 | ||
547 | BT_HIDDEN | |
548 | struct bt_ctf_field_type_common * | |
549 | bt_ctf_field_type_common_variant_borrow_field_type_by_name( | |
550 | struct bt_ctf_field_type_common *ft, | |
551 | const char *field_name); | |
552 | ||
553 | BT_HIDDEN | |
554 | int64_t bt_ctf_field_type_common_variant_get_field_count( | |
555 | struct bt_ctf_field_type_common *ft); | |
556 | ||
557 | BT_HIDDEN | |
558 | int bt_ctf_field_type_common_variant_borrow_field_by_index( | |
559 | struct bt_ctf_field_type_common *ft, | |
560 | const char **field_name, | |
561 | struct bt_ctf_field_type_common **field_type, uint64_t index); | |
562 | ||
563 | BT_HIDDEN | |
564 | struct bt_ctf_field_type_common * | |
565 | bt_ctf_field_type_common_array_borrow_element_field_type( | |
566 | struct bt_ctf_field_type_common *ft); | |
567 | ||
568 | BT_HIDDEN | |
569 | int bt_ctf_field_type_common_array_set_element_field_type( | |
570 | struct bt_ctf_field_type_common *ft, | |
571 | struct bt_ctf_field_type_common *element_ft); | |
572 | ||
573 | BT_HIDDEN | |
574 | int64_t bt_ctf_field_type_common_array_get_length(struct bt_ctf_field_type_common *ft); | |
575 | ||
576 | BT_HIDDEN | |
577 | struct bt_ctf_field_type_common * | |
578 | bt_ctf_field_type_common_sequence_borrow_element_field_type( | |
579 | struct bt_ctf_field_type_common *ft); | |
580 | ||
581 | BT_HIDDEN | |
582 | int bt_ctf_field_type_common_sequence_set_element_field_type( | |
583 | struct bt_ctf_field_type_common *ft, | |
584 | struct bt_ctf_field_type_common *element_ft); | |
585 | ||
586 | BT_HIDDEN | |
587 | const char *bt_ctf_field_type_common_sequence_get_length_field_name( | |
588 | struct bt_ctf_field_type_common *ft); | |
589 | ||
590 | BT_HIDDEN | |
591 | enum bt_ctf_string_encoding bt_ctf_field_type_common_string_get_encoding( | |
592 | struct bt_ctf_field_type_common *ft); | |
593 | ||
594 | BT_HIDDEN | |
595 | int bt_ctf_field_type_common_string_set_encoding(struct bt_ctf_field_type_common *ft, | |
596 | enum bt_ctf_string_encoding encoding); | |
597 | ||
598 | BT_HIDDEN | |
599 | int bt_ctf_field_type_common_get_alignment(struct bt_ctf_field_type_common *type); | |
600 | ||
601 | BT_HIDDEN | |
602 | int bt_ctf_field_type_common_set_alignment(struct bt_ctf_field_type_common *ft, | |
603 | unsigned int alignment); | |
604 | ||
605 | BT_HIDDEN | |
606 | enum bt_ctf_byte_order bt_ctf_field_type_common_get_byte_order( | |
607 | struct bt_ctf_field_type_common *ft); | |
608 | ||
609 | BT_HIDDEN | |
610 | int bt_ctf_field_type_common_set_byte_order(struct bt_ctf_field_type_common *ft, | |
611 | enum bt_ctf_byte_order byte_order); | |
612 | ||
613 | BT_HIDDEN | |
614 | enum bt_ctf_field_type_id bt_ctf_field_type_common_get_type_id( | |
615 | struct bt_ctf_field_type_common *ft); | |
616 | ||
617 | BT_HIDDEN | |
618 | void bt_ctf_field_type_common_freeze(struct bt_ctf_field_type_common *ft); | |
619 | ||
620 | BT_HIDDEN | |
621 | struct bt_ctf_field_type_common * | |
622 | bt_ctf_field_type_common_variant_borrow_field_type_signed( | |
623 | struct bt_ctf_field_type_common_variant *var_ft, | |
624 | int64_t tag_value); | |
625 | ||
626 | BT_HIDDEN | |
627 | struct bt_ctf_field_type_common * | |
628 | bt_ctf_field_type_common_variant_borrow_field_type_unsigned( | |
629 | struct bt_ctf_field_type_common_variant *var_ft, | |
630 | uint64_t tag_value); | |
631 | ||
632 | BT_HIDDEN | |
633 | struct bt_ctf_field_type_common *bt_ctf_field_type_common_copy( | |
634 | struct bt_ctf_field_type_common *ft); | |
635 | ||
636 | BT_HIDDEN | |
637 | int bt_ctf_field_type_common_structure_get_field_name_index( | |
638 | struct bt_ctf_field_type_common *ft, const char *name); | |
639 | ||
640 | BT_HIDDEN | |
641 | int bt_ctf_field_type_common_variant_get_field_name_index( | |
642 | struct bt_ctf_field_type_common *ft, const char *name); | |
643 | ||
644 | BT_HIDDEN | |
645 | int bt_ctf_field_type_common_sequence_set_length_field_path( | |
646 | struct bt_ctf_field_type_common *ft, struct bt_ctf_field_path *path); | |
647 | ||
648 | BT_HIDDEN | |
649 | int bt_ctf_field_type_common_variant_set_tag_field_path( | |
650 | struct bt_ctf_field_type_common *ft, | |
651 | struct bt_ctf_field_path *path); | |
652 | ||
653 | BT_HIDDEN | |
654 | int bt_ctf_field_type_common_variant_set_tag_field_type( | |
655 | struct bt_ctf_field_type_common *ft, | |
656 | struct bt_ctf_field_type_common *tag_ft); | |
657 | ||
658 | BT_HIDDEN | |
659 | void bt_ctf_field_type_common_generic_freeze(struct bt_ctf_field_type_common *ft); | |
660 | ||
661 | BT_HIDDEN | |
662 | void bt_ctf_field_type_common_enumeration_freeze_recursive( | |
663 | struct bt_ctf_field_type_common *ft); | |
664 | ||
665 | BT_HIDDEN | |
666 | void bt_ctf_field_type_common_structure_freeze_recursive( | |
667 | struct bt_ctf_field_type_common *ft); | |
668 | ||
669 | BT_HIDDEN | |
670 | void bt_ctf_field_type_common_variant_freeze_recursive( | |
671 | struct bt_ctf_field_type_common *ft); | |
672 | ||
673 | BT_HIDDEN | |
674 | void bt_ctf_field_type_common_array_freeze_recursive( | |
675 | struct bt_ctf_field_type_common *ft); | |
676 | ||
677 | BT_HIDDEN | |
678 | void bt_ctf_field_type_common_sequence_freeze_recursive( | |
679 | struct bt_ctf_field_type_common *type); | |
680 | ||
681 | BT_HIDDEN | |
682 | void bt_ctf_field_type_common_integer_set_byte_order( | |
683 | struct bt_ctf_field_type_common *ft, enum bt_ctf_byte_order byte_order); | |
684 | ||
685 | BT_HIDDEN | |
686 | void bt_ctf_field_type_common_enumeration_set_byte_order_recursive( | |
687 | struct bt_ctf_field_type_common *ft, enum bt_ctf_byte_order byte_order); | |
688 | ||
689 | BT_HIDDEN | |
690 | void bt_ctf_field_type_common_floating_point_set_byte_order( | |
691 | struct bt_ctf_field_type_common *ft, enum bt_ctf_byte_order byte_order); | |
692 | ||
693 | BT_HIDDEN | |
694 | void bt_ctf_field_type_common_structure_set_byte_order_recursive( | |
695 | struct bt_ctf_field_type_common *ft, | |
696 | enum bt_ctf_byte_order byte_order); | |
697 | ||
698 | BT_HIDDEN | |
699 | void bt_ctf_field_type_common_variant_set_byte_order_recursive( | |
700 | struct bt_ctf_field_type_common *ft, | |
701 | enum bt_ctf_byte_order byte_order); | |
702 | ||
703 | BT_HIDDEN | |
704 | void bt_ctf_field_type_common_array_set_byte_order_recursive( | |
705 | struct bt_ctf_field_type_common *ft, | |
706 | enum bt_ctf_byte_order byte_order); | |
707 | ||
708 | BT_HIDDEN | |
709 | void bt_ctf_field_type_common_sequence_set_byte_order_recursive( | |
710 | struct bt_ctf_field_type_common *ft, | |
711 | enum bt_ctf_byte_order byte_order); | |
712 | ||
713 | BT_HIDDEN | |
714 | int bt_ctf_field_type_common_integer_compare(struct bt_ctf_field_type_common *ft_a, | |
715 | struct bt_ctf_field_type_common *ft_b); | |
716 | ||
717 | BT_HIDDEN | |
718 | int bt_ctf_field_type_common_floating_point_compare( | |
719 | struct bt_ctf_field_type_common *ft_a, | |
720 | struct bt_ctf_field_type_common *ft_b); | |
721 | ||
722 | BT_HIDDEN | |
723 | int bt_ctf_field_type_common_enumeration_compare_recursive( | |
724 | struct bt_ctf_field_type_common *ft_a, | |
725 | struct bt_ctf_field_type_common *ft_b); | |
726 | ||
727 | BT_HIDDEN | |
728 | int bt_ctf_field_type_common_string_compare(struct bt_ctf_field_type_common *ft_a, | |
729 | struct bt_ctf_field_type_common *ft_b); | |
730 | ||
731 | BT_HIDDEN | |
732 | int bt_ctf_field_type_common_structure_compare_recursive( | |
733 | struct bt_ctf_field_type_common *ft_a, | |
734 | struct bt_ctf_field_type_common *ft_b); | |
735 | ||
736 | BT_HIDDEN | |
737 | int bt_ctf_field_type_common_variant_compare_recursive( | |
738 | struct bt_ctf_field_type_common *ft_a, | |
739 | struct bt_ctf_field_type_common *ft_b); | |
740 | ||
741 | BT_HIDDEN | |
742 | int bt_ctf_field_type_common_array_compare_recursive( | |
743 | struct bt_ctf_field_type_common *ft_a, | |
744 | struct bt_ctf_field_type_common *ft_b); | |
745 | ||
746 | BT_HIDDEN | |
747 | int bt_ctf_field_type_common_sequence_compare_recursive( | |
748 | struct bt_ctf_field_type_common *ft_a, | |
749 | struct bt_ctf_field_type_common *ft_b); | |
750 | ||
751 | BT_HIDDEN | |
752 | int bt_ctf_field_type_common_compare(struct bt_ctf_field_type_common *ft_a, | |
753 | struct bt_ctf_field_type_common *ft_b); | |
754 | ||
755 | BT_HIDDEN | |
756 | int64_t bt_ctf_field_type_common_get_field_count(struct bt_ctf_field_type_common *ft); | |
757 | ||
758 | BT_HIDDEN | |
759 | struct bt_ctf_field_type_common *bt_ctf_field_type_common_borrow_field_at_index( | |
760 | struct bt_ctf_field_type_common *ft, int index); | |
761 | ||
762 | BT_HIDDEN | |
763 | int bt_ctf_field_type_common_get_field_index(struct bt_ctf_field_type_common *ft, | |
764 | const char *name); | |
765 | ||
766 | BT_HIDDEN | |
767 | struct bt_ctf_field_path *bt_ctf_field_type_common_variant_borrow_tag_field_path( | |
768 | struct bt_ctf_field_type_common *ft); | |
769 | ||
770 | BT_HIDDEN | |
771 | struct bt_ctf_field_path *bt_ctf_field_type_common_sequence_borrow_length_field_path( | |
772 | struct bt_ctf_field_type_common *ft); | |
773 | ||
774 | BT_HIDDEN | |
775 | int bt_ctf_field_type_common_validate_single_clock_class( | |
776 | struct bt_ctf_field_type_common *ft, | |
777 | struct bt_ctf_clock_class **expected_clock_class); | |
778 | ||
779 | BT_HIDDEN | |
780 | int64_t bt_ctf_field_type_common_variant_find_choice_index( | |
781 | struct bt_ctf_field_type_common *ft, uint64_t uval, | |
782 | bool is_signed); | |
3dca2276 PP |
783 | |
784 | BT_HIDDEN | |
785 | int bt_ctf_field_type_serialize_recursive(struct bt_ctf_field_type *type, | |
786 | struct metadata_context *context); | |
787 | ||
788 | BT_HIDDEN | |
789 | struct bt_ctf_field_type *bt_ctf_field_type_copy(struct bt_ctf_field_type *ft); | |
790 | ||
791 | #endif /* BABELTRACE_CTF_WRITER_FIELD_TYPES_INTERNAL_H */ |