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