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