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