| 1 | #ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_H |
| 2 | #define BABELTRACE2_TRACE_IR_FIELD_CLASS_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation |
| 6 | * |
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | * of this software and associated documentation files (the "Software"), to deal |
| 9 | * in the Software without restriction, including without limitation the rights |
| 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | * copies of the Software, and to permit persons to whom the Software is |
| 12 | * furnished to do so, subject to the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice shall be included in |
| 15 | * all copies or substantial portions of the Software. |
| 16 | * |
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | * SOFTWARE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef __BT_IN_BABELTRACE_H |
| 27 | # error "Please include <babeltrace2/babeltrace.h> instead." |
| 28 | #endif |
| 29 | |
| 30 | #include <stdint.h> |
| 31 | #include <stddef.h> |
| 32 | |
| 33 | #include <babeltrace2/types.h> |
| 34 | |
| 35 | #ifdef __cplusplus |
| 36 | extern "C" { |
| 37 | #endif |
| 38 | |
| 39 | /*! |
| 40 | @defgroup api-tir-fc Field classes |
| 41 | @ingroup api-tir |
| 42 | |
| 43 | @brief |
| 44 | Classes of \bt_p_field. |
| 45 | |
| 46 | <strong><em>Field classes</em></strong> are the classes of \bt_p_field: |
| 47 | |
| 48 | @image html field-class-zoom.png |
| 49 | |
| 50 | Field classes are \ref api-tir "trace IR" metadata objects. |
| 51 | |
| 52 | There are many types of field classes. They can be divided into two main |
| 53 | categories: |
| 54 | |
| 55 | <dl> |
| 56 | <dt>Scalar</dt> |
| 57 | <dd> |
| 58 | Classes of fields which contain a simple value. |
| 59 | |
| 60 | The scalar field classes are: |
| 61 | |
| 62 | - \ref api-tir-fc-bool "Boolean" |
| 63 | - \ref api-tir-fc-ba "Bit array" |
| 64 | - \ref api-tir-fc-int "Integer" (unsigned and signed) |
| 65 | - \ref api-tir-fc-enum "Enumeration" (unsigned and signed) |
| 66 | - \ref api-tir-fc-real "Real" (single-precision and double-precision) |
| 67 | - \ref api-tir-fc-string "String" |
| 68 | </dd> |
| 69 | |
| 70 | <dt>Container</dt> |
| 71 | <dd> |
| 72 | Classes of fields which contain other fields. |
| 73 | |
| 74 | The container field classes are: |
| 75 | |
| 76 | - \ref api-tir-fc-array "Array" (static and dynamic) |
| 77 | - \ref api-tir-fc-struct "Structure" |
| 78 | - \ref api-tir-fc-opt "Option" |
| 79 | - \ref api-tir-fc-var "Variant" |
| 80 | </dd> |
| 81 | </dl> |
| 82 | |
| 83 | @image html fc-to-field.png "Fields (green) are instances of field classes (orange)." |
| 84 | |
| 85 | Some field classes conceptually inherit other field classes, eventually |
| 86 | making an inheritance hierarchy. For example, a \bt_sarray_fc |
| 87 | \em is an array field class. Therefore, a static array field class has |
| 88 | any property that an array field class has. |
| 89 | |
| 90 | The complete field class inheritance hierarchy is: |
| 91 | |
| 92 | @image html all-field-classes.png |
| 93 | |
| 94 | In the illustration above: |
| 95 | |
| 96 | - You can create any field class with a dark background with |
| 97 | a dedicated <code>bt_field_class_*_create()</code> function. |
| 98 | |
| 99 | - A field class with a pale background is an \em abstract field class: |
| 100 | you cannot create it, but it has properties, therefore there are |
| 101 | functions which apply to it. |
| 102 | |
| 103 | For example, bt_field_class_integer_set_preferred_display_base() |
| 104 | applies to any \bt_int_fc. |
| 105 | |
| 106 | Field classes are \ref api-fund-shared-object "shared objects": get a |
| 107 | new reference with bt_field_class_get_ref() and put an existing |
| 108 | reference with bt_field_class_put_ref(). |
| 109 | |
| 110 | Some library functions \ref api-fund-freezing "freeze" field classes on |
| 111 | success. The documentation of those functions indicate this |
| 112 | postcondition. |
| 113 | |
| 114 | All the field class types share the same C type, #bt_field_class. |
| 115 | |
| 116 | Get the type enumerator of a field class with bt_field_class_get_type(). |
| 117 | Get whether or not a field class type conceptually \em is a given type |
| 118 | with the inline bt_field_class_type_is() function. |
| 119 | |
| 120 | The following table shows the available type enumerators and creation |
| 121 | functions for each type of \em concrete (non-abstract) field class: |
| 122 | |
| 123 | <table> |
| 124 | <tr> |
| 125 | <th>Name |
| 126 | <th>Type enumerator |
| 127 | <th>Creation function |
| 128 | <tr> |
| 129 | <td><em>\ref api-tir-fc-bool "Boolean"</em> |
| 130 | <td>#BT_FIELD_CLASS_TYPE_BOOL |
| 131 | <td>bt_field_class_bool_create() |
| 132 | <tr> |
| 133 | <td><em>\ref api-tir-fc-ba "Bit array"</em> |
| 134 | <td>#BT_FIELD_CLASS_TYPE_BIT_ARRAY |
| 135 | <td>bt_field_class_bit_array_create() |
| 136 | <tr> |
| 137 | <td><em>Unsigned \ref api-tir-fc-int "integer"</em> |
| 138 | <td>#BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER |
| 139 | <td>bt_field_class_integer_unsigned_create() |
| 140 | <tr> |
| 141 | <td><em>Signed \ref api-tir-fc-int "integer"</em> |
| 142 | <td>#BT_FIELD_CLASS_TYPE_SIGNED_INTEGER |
| 143 | <td>bt_field_class_integer_signed_create() |
| 144 | <tr> |
| 145 | <td><em>Unsigned \ref api-tir-fc-enum "enumeration"</em> |
| 146 | <td>#BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION |
| 147 | <td>bt_field_class_enumeration_unsigned_create() |
| 148 | <tr> |
| 149 | <td><em>Signed \ref api-tir-fc-enum "enumeration"</em> |
| 150 | <td>#BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION |
| 151 | <td>bt_field_class_enumeration_signed_create() |
| 152 | <tr> |
| 153 | <td><em>Single-precision \ref api-tir-fc-real "real"</em> |
| 154 | <td>#BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL |
| 155 | <td>bt_field_class_real_single_precision_create() |
| 156 | <tr> |
| 157 | <td><em>Double-precision \ref api-tir-fc-real "real"</em> |
| 158 | <td>#BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL |
| 159 | <td>bt_field_class_real_double_precision_create() |
| 160 | <tr> |
| 161 | <td><em>\ref api-tir-fc-string "String"</em> |
| 162 | <td>#BT_FIELD_CLASS_TYPE_STRING |
| 163 | <td>bt_field_class_string_create() |
| 164 | <tr> |
| 165 | <td><em>Static \ref api-tir-fc-array "array"</em> |
| 166 | <td>#BT_FIELD_CLASS_TYPE_STATIC_ARRAY |
| 167 | <td>bt_field_class_array_static_create() |
| 168 | <tr> |
| 169 | <td><em>Dynamic \ref api-tir-fc-array "array" (no length field)</em> |
| 170 | <td>#BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD |
| 171 | <td>bt_field_class_array_dynamic_create() |
| 172 | <tr> |
| 173 | <td><em>Dynamic \ref api-tir-fc-array "array" (with length field)</em> |
| 174 | <td>#BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD |
| 175 | <td>bt_field_class_array_dynamic_create() |
| 176 | <tr> |
| 177 | <td><em>\ref api-tir-fc-struct "Structure"</em> |
| 178 | <td>#BT_FIELD_CLASS_TYPE_STRUCTURE |
| 179 | <td>bt_field_class_structure_create() |
| 180 | <tr> |
| 181 | <td><em>\ref api-tir-fc-opt "Option" (no selector field)</em> |
| 182 | <td>#BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD |
| 183 | <td>bt_field_class_option_without_selector_create() |
| 184 | <tr> |
| 185 | <td><em>\ref api-tir-fc-opt "Option" (boolean selector field)</em> |
| 186 | <td>#BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD |
| 187 | <td>bt_field_class_option_with_selector_field_bool_create() |
| 188 | <tr> |
| 189 | <td><em>\ref api-tir-fc-opt "Option" (unsigned integer selector field)</em> |
| 190 | <td>#BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD |
| 191 | <td>bt_field_class_option_with_selector_field_integer_unsigned_create() |
| 192 | <tr> |
| 193 | <td><em>\ref api-tir-fc-opt "Option" (signed integer selector field)</em> |
| 194 | <td>#BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD |
| 195 | <td>bt_field_class_option_with_selector_field_integer_signed_create() |
| 196 | <tr> |
| 197 | <td><em>\ref api-tir-fc-var "Variant" (no selector field)</em> |
| 198 | <td>#BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD |
| 199 | <td>bt_field_class_variant_create() |
| 200 | <tr> |
| 201 | <td><em>\ref api-tir-fc-var "Variant" (unsigned integer selector field)</em> |
| 202 | <td>#BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD |
| 203 | <td>bt_field_class_variant_create() |
| 204 | <tr> |
| 205 | <td><em>\ref api-tir-fc-var "Variant" (signed integer selector field)</em> |
| 206 | <td>#BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD |
| 207 | <td>bt_field_class_variant_create() |
| 208 | </table> |
| 209 | |
| 210 | You need a \bt_trace_cls to create a field class: create one from a |
| 211 | \bt_self_comp with bt_trace_class_create(). |
| 212 | |
| 213 | Outside the field class API, you can use field classes at four |
| 214 | locations, called <em>scopes</em>, within the trace IR API: |
| 215 | |
| 216 | - To set the packet context field class of a \bt_stream_cls with |
| 217 | bt_stream_class_set_packet_context_field_class(). |
| 218 | |
| 219 | - To set the event common context field class of a stream class with |
| 220 | bt_stream_class_set_event_common_context_field_class(). |
| 221 | |
| 222 | - To set the specific context field class of an \bt_ev_cls with |
| 223 | bt_event_class_set_specific_context_field_class(). |
| 224 | |
| 225 | - To set the payload field class of an event class with |
| 226 | bt_event_class_set_payload_field_class(). |
| 227 | |
| 228 | When you call one of the four functions above: |
| 229 | |
| 230 | - The passed field class must be a \bt_struct_fc. |
| 231 | |
| 232 | - You must \em not have already called any of the four functions above |
| 233 | with the passed field class or with any of its contained field |
| 234 | classes. |
| 235 | |
| 236 | - If any of the field classes recursively contained in the passed |
| 237 | field class has a \ref api-tir-fc-link "link to another field class", |
| 238 | it must honor the field class link rules. |
| 239 | |
| 240 | Once you have called one of the four functions above, the passed field |
| 241 | class becomes \ref api-fund-freezing "frozen". |
| 242 | |
| 243 | <h1>Common field class property</h1> |
| 244 | |
| 245 | A field class has the following common property: |
| 246 | |
| 247 | <dl> |
| 248 | <dt> |
| 249 | \anchor api-tir-fc-prop-user-attrs |
| 250 | \bt_dt_opt User attributes |
| 251 | </dt> |
| 252 | <dd> |
| 253 | User attributes of the field class. |
| 254 | |
| 255 | User attributes are custom attributes attached to a field class. |
| 256 | |
| 257 | Use bt_field_class_set_user_attributes(), |
| 258 | bt_field_class_borrow_user_attributes(), and |
| 259 | bt_field_class_borrow_user_attributes_const(). |
| 260 | </dd> |
| 261 | </dl> |
| 262 | |
| 263 | <h1>\anchor api-tir-fc-bool Boolean field class</h1> |
| 264 | |
| 265 | @image html fc-bool.png |
| 266 | |
| 267 | A <strong><em>boolean field class</em></strong> is the class |
| 268 | of \bt_p_bool_field. |
| 269 | |
| 270 | A boolean field contains a boolean value (#BT_TRUE or #BT_FALSE). |
| 271 | |
| 272 | Create a boolean field class with bt_field_class_bool_create(). |
| 273 | |
| 274 | A boolean field class has no specific properties. |
| 275 | |
| 276 | <h1>\anchor api-tir-fc-ba Bit array field class</h1> |
| 277 | |
| 278 | @image html fc-ba.png |
| 279 | |
| 280 | A <strong><em>bit array field class</em></strong> is the class |
| 281 | of \bt_p_ba_field. |
| 282 | |
| 283 | A bit array field contains a fixed-length array of bits. |
| 284 | |
| 285 | Create a bit array field class with bt_field_class_bit_array_create(). |
| 286 | |
| 287 | A bit array field class has the following property: |
| 288 | |
| 289 | <dl> |
| 290 | <dt> |
| 291 | \anchor api-tir-fc-ba-prop-len |
| 292 | Length |
| 293 | </dt> |
| 294 | <dd> |
| 295 | Number of bits contained in the instances (bit array fields) of |
| 296 | the bit array field class. |
| 297 | |
| 298 | As of \bt_name_version_min_maj, the maximum length of a bit array |
| 299 | field is 64. |
| 300 | |
| 301 | You cannot change the length once the bit array field class is |
| 302 | created. |
| 303 | |
| 304 | Get a bit array field class's length with |
| 305 | bt_field_class_bit_array_get_length(). |
| 306 | </dd> |
| 307 | </dl> |
| 308 | |
| 309 | <h1>\anchor api-tir-fc-int Integer field classes</h1> |
| 310 | |
| 311 | @image html fc-int.png |
| 312 | |
| 313 | <strong><em>Integer field classes</em></strong> are classes |
| 314 | of \bt_p_int_field. |
| 315 | |
| 316 | Integer fields contain integral values. |
| 317 | |
| 318 | An integer field class is an \em abstract field class: you cannot create |
| 319 | one. The concrete integer field classes are: |
| 320 | |
| 321 | <dl> |
| 322 | <dt>Unsigned integer field class</dt> |
| 323 | <dd> |
| 324 | Its instances (unsigned integer fields) contain an unsigned integral |
| 325 | value (\c uint64_t). |
| 326 | |
| 327 | Create with bt_field_class_integer_unsigned_create(). |
| 328 | </dd> |
| 329 | |
| 330 | <dt>Signed integer field class</dt> |
| 331 | <dd> |
| 332 | Its instances (signed integer fields) contain a signed integral |
| 333 | value (\c int64_t). |
| 334 | |
| 335 | Create with bt_field_class_integer_signed_create(). |
| 336 | </dd> |
| 337 | </dl> |
| 338 | |
| 339 | Integer field classes have the following common properties: |
| 340 | |
| 341 | <dl> |
| 342 | <dt> |
| 343 | \anchor api-tir-fc-int-prop-size |
| 344 | Field value range |
| 345 | </dt> |
| 346 | <dd> |
| 347 | Expected range of values that the instances (integer fields) |
| 348 | of the integer field class can contain. |
| 349 | |
| 350 | For example, if the field value range of an unsigned integer |
| 351 | field class is [0, 16383], then its unsigned integer fields |
| 352 | can only contain the values from 0 to 16383. |
| 353 | |
| 354 | \bt_cp_sink_comp can benefit from this property to make some space |
| 355 | optimizations when writing trace data. |
| 356 | |
| 357 | Use bt_field_class_integer_set_field_value_range() and |
| 358 | bt_field_class_integer_get_field_value_range(). |
| 359 | </dd> |
| 360 | |
| 361 | <dt> |
| 362 | \anchor api-tir-fc-int-prop-base |
| 363 | Preferred display base |
| 364 | </dt> |
| 365 | <dd> |
| 366 | Preferred base (2, 8, 10, or 16) to use when displaying the |
| 367 | instances (integer fields) of the integer field class. |
| 368 | |
| 369 | Use bt_field_class_integer_set_preferred_display_base() and |
| 370 | bt_field_class_integer_get_preferred_display_base(). |
| 371 | </dd> |
| 372 | </dl> |
| 373 | |
| 374 | <h2>\anchor api-tir-fc-enum Enumeration field classes</h2> |
| 375 | |
| 376 | @image html fc-enum.png |
| 377 | |
| 378 | <strong><em>Enumeration field classes</em></strong> are classes |
| 379 | of \bt_p_enum_field. |
| 380 | |
| 381 | Enumeration field classes \em are \bt_p_int_fc: they have the integer |
| 382 | field classes properties. |
| 383 | |
| 384 | Enumeration fields \em are integer fields: they contain integral values. |
| 385 | |
| 386 | Enumeration field classes associate labels (strings) to specific |
| 387 | ranges of integral values. This association is called an enumeration |
| 388 | field class <em>mapping</em>. |
| 389 | |
| 390 | For example, if an enumeration field class maps the label \c SUGAR to |
| 391 | the integer ranges [1, 19] and [25, 31], then an instance |
| 392 | (enumeration field) of this field class with the value 15 or 28 has the |
| 393 | label <code>SUGAR</code>. |
| 394 | |
| 395 | An enumeration field class is an \em abstract field class: you cannot |
| 396 | create one. The concrete enumeration field classes are: |
| 397 | |
| 398 | <dl> |
| 399 | <dt>Unsigned enumeration field class</dt> |
| 400 | <dd> |
| 401 | Its instances (unsigned enumeration fields) contain an unsigned |
| 402 | value (\c uint64_t). |
| 403 | |
| 404 | Create with bt_field_class_enumeration_unsigned_create(). |
| 405 | </dd> |
| 406 | |
| 407 | <dt>Signed enumeration field class</dt> |
| 408 | <dd> |
| 409 | Its instances (signed enumeration fields) contain a signed value |
| 410 | (\c int64_t). |
| 411 | |
| 412 | Create with bt_field_class_enumeration_signed_create(). |
| 413 | </dd> |
| 414 | </dl> |
| 415 | |
| 416 | Enumeration field classes have the following common property: |
| 417 | |
| 418 | <dl> |
| 419 | <dt> |
| 420 | \anchor api-tir-fc-enum-prop-mappings |
| 421 | Mappings |
| 422 | </dt> |
| 423 | <dd> |
| 424 | Set of mappings of the enumeration field class. |
| 425 | |
| 426 | An enumeration field class mapping is a label (string) and an |
| 427 | \bt_int_rs. |
| 428 | |
| 429 | The integer ranges of a given mapping or of multiple mappings of |
| 430 | the same enumeration field class can overlap. For example, |
| 431 | an enumeration field class can have those two mappings: |
| 432 | |
| 433 | - <code>CALORIES</code>: [1, 11], [15, 37] |
| 434 | - <code>SODIUM</code>: [7, 13] |
| 435 | |
| 436 | In that case, the values 2 and 30 correpond to the label |
| 437 | <code>CALORIES</code>, the value 12 to the label |
| 438 | <code>SODIUM</code>, and the value 10 to the labels |
| 439 | \c CALORIES \em and <code>SODIUM</code>. |
| 440 | |
| 441 | Two mappings of the same enumeration field class cannot have the |
| 442 | same label. |
| 443 | |
| 444 | Add a mapping to an enumeration field class with |
| 445 | bt_field_class_enumeration_unsigned_add_mapping() or |
| 446 | bt_field_class_enumeration_signed_add_mapping(). |
| 447 | |
| 448 | Get the number of mappings in an enumeration field class with |
| 449 | bt_field_class_enumeration_get_mapping_count(). |
| 450 | |
| 451 | Borrow a mapping from an enumeration field class with |
| 452 | bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const(), |
| 453 | bt_field_class_enumeration_signed_borrow_mapping_by_index_const(), |
| 454 | bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const(), |
| 455 | and |
| 456 | bt_field_class_enumeration_signed_borrow_mapping_by_label_const(). |
| 457 | |
| 458 | An enumeration field class mapping is a |
| 459 | \ref api-fund-unique-object "unique object": it |
| 460 | belongs to the enumeration field class which contains it. |
| 461 | |
| 462 | There are two enumeration field class mapping types, depending on |
| 463 | the field class's type: |
| 464 | #bt_field_class_enumeration_unsigned_mapping and |
| 465 | #bt_field_class_enumeration_signed_mapping. |
| 466 | |
| 467 | There is also the #bt_field_class_enumeration_mapping type for |
| 468 | common properties and operations (for example, |
| 469 | bt_field_class_enumeration_mapping_get_label()). |
| 470 | \ref api-fund-c-typing "Upcast" a specific enumeration field class |
| 471 | mapping to the #bt_field_class_enumeration_mapping type with |
| 472 | bt_field_class_enumeration_unsigned_mapping_as_mapping_const() or |
| 473 | bt_field_class_enumeration_signed_mapping_as_mapping_const(). |
| 474 | |
| 475 | Get all the enumeration field class labels mapped to a given integer |
| 476 | value with |
| 477 | bt_field_class_enumeration_unsigned_get_mapping_labels_for_value() |
| 478 | and |
| 479 | bt_field_class_enumeration_signed_get_mapping_labels_for_value(). |
| 480 | </dd> |
| 481 | </dl> |
| 482 | |
| 483 | <h1>\anchor api-tir-fc-real Real field classes</h1> |
| 484 | |
| 485 | @image html fc-real.png |
| 486 | |
| 487 | <strong><em>Real field classes</em></strong> are classes |
| 488 | of \bt_p_real_field. |
| 489 | |
| 490 | Real fields contain |
| 491 | <a href="https://en.wikipedia.org/wiki/Real_number">real</a> |
| 492 | values (\c float or \c double types). |
| 493 | |
| 494 | A real field class is an \em abstract field class: you cannot create |
| 495 | one. The concrete real field classes are: |
| 496 | |
| 497 | <dl> |
| 498 | <dt>Single-precision real field class</dt> |
| 499 | <dd> |
| 500 | Its instances (single-precision real fields) contain a \c float |
| 501 | value. |
| 502 | |
| 503 | Create with bt_field_class_real_single_precision_create(). |
| 504 | </dd> |
| 505 | |
| 506 | <dt>Double-precision real field class</dt> |
| 507 | <dd> |
| 508 | Its instances (double-precision real fields) contain a \c double |
| 509 | value. |
| 510 | |
| 511 | Create with bt_field_class_real_double_precision_create(). |
| 512 | </dd> |
| 513 | </dl> |
| 514 | |
| 515 | Real field classes have no specific properties. |
| 516 | |
| 517 | <h1>\anchor api-tir-fc-string String field class</h1> |
| 518 | |
| 519 | @image html fc-string.png |
| 520 | |
| 521 | A <strong><em>string field class</em></strong> is the class |
| 522 | of \bt_p_string_field. |
| 523 | |
| 524 | A string field contains an UTF-8 string value. |
| 525 | |
| 526 | Create a string field class with bt_field_class_string_create(). |
| 527 | |
| 528 | A string field class has no specific properties. |
| 529 | |
| 530 | <h1>\anchor api-tir-fc-array Array field classes</h1> |
| 531 | |
| 532 | @image html fc-array.png |
| 533 | |
| 534 | <strong><em>Array field classes</em></strong> are classes |
| 535 | of \bt_p_array_field. |
| 536 | |
| 537 | Array fields contain zero or more fields which have the same class. |
| 538 | |
| 539 | An array field class is an \em abstract field class: you cannot create |
| 540 | one. The concrete array field classes are: |
| 541 | |
| 542 | <dl> |
| 543 | <dt>Static array field class</dt> |
| 544 | <dd> |
| 545 | Its instances (static array fields) contain a fixed number of |
| 546 | fields. |
| 547 | |
| 548 | Create with bt_field_class_array_static_create(). |
| 549 | |
| 550 | A static array field class has the following specific property: |
| 551 | |
| 552 | <dl> |
| 553 | <dt> |
| 554 | \anchor api-tir-fc-sarray-prop-len |
| 555 | Length |
| 556 | </dt> |
| 557 | <dd> |
| 558 | Number of fields contained in the instances (static array |
| 559 | fields) of the static array field class. |
| 560 | |
| 561 | You cannot change the length once the static array field class |
| 562 | is created. |
| 563 | |
| 564 | Get a static array field class's length with |
| 565 | bt_field_class_array_static_get_length(). |
| 566 | </dd> |
| 567 | </dl> |
| 568 | </dd> |
| 569 | |
| 570 | <dt>Dynamic array field class</dt> |
| 571 | <dd> |
| 572 | Its instances (dynamic array fields) contain a variable number array |
| 573 | of fields. |
| 574 | |
| 575 | There are two types of dynamic array field classes: without or |
| 576 | with a length field. See |
| 577 | \ref api-tir-fc-link "Field classes with links to other field classes" |
| 578 | to learn more. |
| 579 | |
| 580 | @image html darray-link.png "Dynamic array field class with a length field." |
| 581 | |
| 582 | Create with bt_field_class_array_dynamic_create(). |
| 583 | |
| 584 | A dynamic array field class with a length field has the |
| 585 | specific property: |
| 586 | |
| 587 | <dl> |
| 588 | <dt> |
| 589 | \anchor api-tir-fc-darray-prop-len-fp |
| 590 | Length field path |
| 591 | </dt> |
| 592 | <dd> |
| 593 | Field path of the linked length field class. |
| 594 | |
| 595 | Get a dynamic array field class's length field path with |
| 596 | bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const(). |
| 597 | </dd> |
| 598 | </dl> |
| 599 | </dd> |
| 600 | </dl> |
| 601 | |
| 602 | Array field classes have the following common property: |
| 603 | |
| 604 | <dl> |
| 605 | <dt> |
| 606 | \anchor api-tir-fc-array-prop-elem-fc |
| 607 | Element field class |
| 608 | </dt> |
| 609 | <dd> |
| 610 | Class of the fields contained in the instances (array fields) of the |
| 611 | array field class. |
| 612 | |
| 613 | You cannot change the element field class once the array field class |
| 614 | is created. |
| 615 | |
| 616 | Borrow an array field class's element field class with |
| 617 | Use bt_field_class_array_borrow_element_field_class() and |
| 618 | bt_field_class_array_borrow_element_field_class_const(). |
| 619 | </dd> |
| 620 | </dl> |
| 621 | |
| 622 | <h1>\anchor api-tir-fc-struct Structure field class</h1> |
| 623 | |
| 624 | @image html fc-struct.png |
| 625 | |
| 626 | A <strong><em>structure field class</em></strong> is the class |
| 627 | of a \bt_struct_field. |
| 628 | |
| 629 | A structure field contains an ordered list of zero or more members. Each |
| 630 | structure field member is the instance of a structure field class |
| 631 | member. A structure field class member has a name, a field class, |
| 632 | and user attributes. |
| 633 | |
| 634 | Create a structure field class with bt_field_class_structure_create(). |
| 635 | |
| 636 | A structure field class has the following specific property: |
| 637 | |
| 638 | <dl> |
| 639 | <dt> |
| 640 | \anchor api-tir-fc-struct-prop-members |
| 641 | Members |
| 642 | </dt> |
| 643 | <dd> |
| 644 | Ordered list of members (zero or more) of the structure field class. |
| 645 | |
| 646 | Each member has: |
| 647 | |
| 648 | - A name, unique amongst all the member names of the same |
| 649 | structure field class. |
| 650 | - A field class. |
| 651 | - User attributes. |
| 652 | |
| 653 | The instances (structure fields) of a structure field class have |
| 654 | members which are instances of the corresponding structure field |
| 655 | class members. |
| 656 | |
| 657 | Append a member to a structure field class with |
| 658 | bt_field_class_structure_append_member(). |
| 659 | |
| 660 | Borrow a member from a structure field class with |
| 661 | bt_field_class_structure_borrow_member_by_index(), |
| 662 | bt_field_class_structure_borrow_member_by_name(), |
| 663 | bt_field_class_structure_borrow_member_by_index_const(), and |
| 664 | bt_field_class_structure_borrow_member_by_name_const(). |
| 665 | |
| 666 | A structure field class member is a |
| 667 | \ref api-fund-unique-object "unique object": it |
| 668 | belongs to the structure field class which contains it. |
| 669 | |
| 670 | The type of a structure field class member is |
| 671 | #bt_field_class_structure_member. |
| 672 | |
| 673 | Get a structure field class member's name with |
| 674 | bt_field_class_structure_member_get_name(). |
| 675 | |
| 676 | Borrow a structure field class member's field class with |
| 677 | bt_field_class_structure_member_borrow_field_class() and |
| 678 | bt_field_class_structure_member_borrow_field_class_const(). |
| 679 | |
| 680 | Set a structure field class member's user attributes with |
| 681 | bt_field_class_structure_member_set_user_attributes(). |
| 682 | |
| 683 | Borrow a structure field class member's user attributes with |
| 684 | bt_field_class_structure_member_borrow_user_attributes() and |
| 685 | bt_field_class_structure_member_borrow_user_attributes_const(). |
| 686 | </dd> |
| 687 | </dl> |
| 688 | |
| 689 | <h1>\anchor api-tir-fc-opt Option field classes</h1> |
| 690 | |
| 691 | @image html fc-opt.png |
| 692 | |
| 693 | <strong><em>Option field classes</em></strong> are classes |
| 694 | of \bt_p_opt_field. |
| 695 | |
| 696 | An option field either does or doesn't contain a field, called its |
| 697 | optional field. |
| 698 | |
| 699 | An option field class is an \em abstract field class: you cannot create |
| 700 | one. An option field class either has a selector field (it's linked to a |
| 701 | selector field class; see |
| 702 | \ref api-tir-fc-link "Field classes with links to other field classes") |
| 703 | or none. Therefore, the concrete option field classes are: |
| 704 | |
| 705 | <dl> |
| 706 | <dt>Option field class without a selector field</dt> |
| 707 | <dd> |
| 708 | Create with bt_field_class_option_without_selector_create(). |
| 709 | |
| 710 | An option field class without a selector field has no specific |
| 711 | properties. |
| 712 | </dd> |
| 713 | |
| 714 | <dt>Option field class with a boolean selector field</dt> |
| 715 | <dd> |
| 716 | The linked selector field of an option field class's instance |
| 717 | (an option field) is a \bt_bool_field. |
| 718 | |
| 719 | Consequently, the option field class's selector field class is |
| 720 | a \bt_bool_fc. |
| 721 | |
| 722 | @image html opt-link.png "Option field class with a boolean selector field." |
| 723 | |
| 724 | Create with bt_field_class_option_with_selector_field_bool_create(). |
| 725 | |
| 726 | An option field class with a boolean selector field has the |
| 727 | following specific property: |
| 728 | |
| 729 | <dl> |
| 730 | <dt> |
| 731 | \anchor api-tir-fc-opt-prop-sel-rev |
| 732 | Selector is reversed? |
| 733 | </dt> |
| 734 | <dd> |
| 735 | Whether or not the linked boolean selector field makes the |
| 736 | option field class's instance (an option field) contain a field |
| 737 | when it's #BT_TRUE or when it's #BT_FALSE. |
| 738 | |
| 739 | If this property is #BT_TRUE, then if the linked selector field |
| 740 | has the value #BT_FALSE, the option field contains a field. |
| 741 | |
| 742 | Use |
| 743 | bt_field_class_option_with_selector_field_bool_set_selector_is_reversed() |
| 744 | and |
| 745 | bt_field_class_option_with_selector_field_bool_selector_is_reversed(). |
| 746 | </dd> |
| 747 | </dl> |
| 748 | </dd> |
| 749 | |
| 750 | <dt>Option field class with an unsigned selector field</dt> |
| 751 | <dd> |
| 752 | The linked selector field of an option field class's instance |
| 753 | (an option field) is an \bt_uint_field. |
| 754 | |
| 755 | Consequently, the option field class's selector field class is |
| 756 | an \bt_uint_fc. |
| 757 | |
| 758 | Create with |
| 759 | bt_field_class_option_with_selector_field_integer_unsigned_create(). |
| 760 | |
| 761 | Pass an \bt_uint_rs on creation to set which values of the selector |
| 762 | field can make the option field contain a field. |
| 763 | |
| 764 | An option field class with an unsigned integer selector field has |
| 765 | the following specific property: |
| 766 | |
| 767 | <dl> |
| 768 | <dt> |
| 769 | \anchor api-tir-fc-opt-prop-uint-rs |
| 770 | Selector's unsigned integer ranges |
| 771 | </dt> |
| 772 | <dd> |
| 773 | If the linked unsigned integer selector field of an option |
| 774 | field class's instance (an option field) has a value which |
| 775 | intersects with the selector's unsigned integer ranges, then |
| 776 | the option field contains a field. |
| 777 | |
| 778 | You cannot change the selector's unsigned integer ranges once |
| 779 | the option field class is created. |
| 780 | |
| 781 | Borrow the selector's unsigned integer ranges from an |
| 782 | option field class with an unsigned integer selector field with |
| 783 | bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const(). |
| 784 | </dd> |
| 785 | </dl> |
| 786 | </dd> |
| 787 | |
| 788 | <dt>Option field class with a signed selector field</dt> |
| 789 | <dd> |
| 790 | The linked selector field of an option field class's instance |
| 791 | (an option field) is a \bt_sint_field. |
| 792 | |
| 793 | Consequently, the option field class's selector field class is |
| 794 | a \bt_sint_fc. |
| 795 | |
| 796 | Create with |
| 797 | bt_field_class_option_with_selector_field_integer_signed_create(). |
| 798 | |
| 799 | Pass a \bt_sint_rs on creation to set which values of the selector |
| 800 | field can make the option field contain a field. |
| 801 | |
| 802 | An option field class with a signed integer selector field has |
| 803 | the following specific property: |
| 804 | |
| 805 | <dl> |
| 806 | <dt> |
| 807 | \anchor api-tir-fc-opt-prop-sint-rs |
| 808 | Selector's signed integer ranges |
| 809 | </dt> |
| 810 | <dd> |
| 811 | If the linked signed integer selector field of an option |
| 812 | field class's instance (an option field) has a value which |
| 813 | intersects with the selector's signed integer ranges, then |
| 814 | the option field contains a field. |
| 815 | |
| 816 | You cannot change the selector's signed integer ranges once |
| 817 | the option field class is created. |
| 818 | |
| 819 | Borrow the selector's signed integer ranges from an |
| 820 | option field class with a signed integer selector field with |
| 821 | bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const(). |
| 822 | </dd> |
| 823 | </dl> |
| 824 | </dd> |
| 825 | </dl> |
| 826 | |
| 827 | Option field classes with a selector have the following common |
| 828 | property: |
| 829 | |
| 830 | <dl> |
| 831 | <dt> |
| 832 | \anchor api-tir-fc-opt-prop-sel-fp |
| 833 | Selector field path |
| 834 | </dt> |
| 835 | <dd> |
| 836 | Field path of the linked selector field class. |
| 837 | |
| 838 | Borrow such an option field class's selector field path with |
| 839 | bt_field_class_option_with_selector_field_borrow_selector_field_path_const(). |
| 840 | </dd> |
| 841 | </dl> |
| 842 | |
| 843 | Option field classes have the following common property: |
| 844 | |
| 845 | <dl> |
| 846 | <dt> |
| 847 | \anchor api-tir-fc-opt-prop-fc |
| 848 | Optional field class |
| 849 | </dt> |
| 850 | <dd> |
| 851 | Class of the optional field of an instance (option field) of the |
| 852 | option field class. |
| 853 | |
| 854 | You cannot change the optional field class once the option field |
| 855 | class is created. |
| 856 | |
| 857 | Borrow an option field class's optional field class with |
| 858 | Use bt_field_class_option_borrow_field_class() and |
| 859 | bt_field_class_option_borrow_field_class_const(). |
| 860 | </dd> |
| 861 | </dl> |
| 862 | |
| 863 | <h1>\anchor api-tir-fc-var Variant field classes</h1> |
| 864 | |
| 865 | @image html fc-var.png |
| 866 | |
| 867 | <strong><em>Variant field classes</em></strong> are classes |
| 868 | of \bt_p_var_field. |
| 869 | |
| 870 | A variant field contains a field amongst one or more possible fields. |
| 871 | |
| 872 | Variant field classes contain one or more options. Each variant field |
| 873 | class option has a name, a field class, user attributes, and integer |
| 874 | ranges, depending on the exact type. |
| 875 | |
| 876 | A variant field class is an \em abstract field class: you cannot create |
| 877 | one. A variant field class either has a selector field (it's linked to a |
| 878 | selector field class; see |
| 879 | \ref api-tir-fc-link "Field classes with links to other field classes") |
| 880 | or none. Therefore, the concrete variant field classes are: |
| 881 | |
| 882 | <dl> |
| 883 | <dt>Variant field class without a selector field</dt> |
| 884 | <dd> |
| 885 | Create with bt_field_class_variant_create(), passing \c NULL as |
| 886 | the selector field class. |
| 887 | |
| 888 | Append an option to such a variant field class with |
| 889 | bt_field_class_variant_without_selector_append_option(). |
| 890 | |
| 891 | A variant field class without a selector field has no specific |
| 892 | properties. |
| 893 | </dd> |
| 894 | |
| 895 | <dt>Variant field class with an unsigned selector field</dt> |
| 896 | <dd> |
| 897 | The linked selector field of a variant field class's instance |
| 898 | (a variant field) is an \bt_uint_field. |
| 899 | |
| 900 | Consequently, the variant field class's selector field class is |
| 901 | an \bt_uint_fc. |
| 902 | |
| 903 | @image html var-link.png "Variant field class with an unsigned integer selector field." |
| 904 | |
| 905 | Create with bt_field_class_variant_create(), passing an |
| 906 | unsigned integer field class as the selector field class. |
| 907 | |
| 908 | Append an option to such a variant field class with |
| 909 | bt_field_class_variant_with_selector_field_integer_unsigned_append_option(). |
| 910 | |
| 911 | Pass an \bt_uint_rs when you append an option to set which values of |
| 912 | the selector field can make the variant field have a given |
| 913 | current option. |
| 914 | |
| 915 | Borrow such a variant field class's option with |
| 916 | bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const() |
| 917 | and |
| 918 | bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const(). |
| 919 | </dd> |
| 920 | |
| 921 | <dt>Variant field class with a signed selector field</dt> |
| 922 | <dd> |
| 923 | The linked selector field of a variant field class's instance |
| 924 | (a variant field) is a \bt_sint_field. |
| 925 | |
| 926 | Consequently, the variant field class's selector field class is |
| 927 | a \bt_sint_fc. |
| 928 | |
| 929 | Create with bt_field_class_variant_create(), passing a |
| 930 | signed integer field class as the selector field class. |
| 931 | |
| 932 | Append an option to such a variant field class with |
| 933 | bt_field_class_variant_with_selector_field_integer_signed_append_option(). |
| 934 | |
| 935 | Pass a \bt_sint_rs when you append an option to set which values of |
| 936 | the selector field can make the variant field have a given |
| 937 | current option. |
| 938 | |
| 939 | Borrow such a variant field class's option with |
| 940 | bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const() |
| 941 | and |
| 942 | bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const(). |
| 943 | </dd> |
| 944 | </dl> |
| 945 | |
| 946 | Variant field classes with a selector have the following common |
| 947 | property: |
| 948 | |
| 949 | <dl> |
| 950 | <dt> |
| 951 | \anchor api-tir-fc-var-prop-sel-fp |
| 952 | Selector field path |
| 953 | </dt> |
| 954 | <dd> |
| 955 | Field path of the linked selector field class. |
| 956 | |
| 957 | Borrow such a variant field class's selector field path with |
| 958 | bt_field_class_variant_with_selector_field_borrow_selector_field_path_const(). |
| 959 | </dd> |
| 960 | </dl> |
| 961 | |
| 962 | Variant field classes have the following common property: |
| 963 | |
| 964 | <dl> |
| 965 | <dt> |
| 966 | \anchor api-tir-fc-var-prop-opts |
| 967 | Options |
| 968 | </dt> |
| 969 | <dd> |
| 970 | Options of the variant field class. |
| 971 | |
| 972 | Each option has: |
| 973 | |
| 974 | - A name, unique amongst all the option names of the same |
| 975 | variant field class. |
| 976 | - A field class. |
| 977 | - User attributes. |
| 978 | |
| 979 | If the variant field class is linked to a selector field class, then |
| 980 | each option also has an \bt_int_rs. In that case, the ranges of a |
| 981 | given option cannot overlap any range of any other option. |
| 982 | |
| 983 | A variant field class must contain at least one option. |
| 984 | |
| 985 | Depending on whether or not the variant field class has a selector |
| 986 | field class, append an option to a variant field class |
| 987 | with bt_field_class_variant_without_selector_append_option(), |
| 988 | bt_field_class_variant_with_selector_field_integer_unsigned_append_option(), |
| 989 | or |
| 990 | bt_field_class_variant_with_selector_field_integer_signed_append_option(). |
| 991 | |
| 992 | Get the number of options contained in a variant field class |
| 993 | with bt_field_class_variant_get_option_count(). |
| 994 | |
| 995 | A variant field class option is a |
| 996 | \ref api-fund-unique-object "unique object": it |
| 997 | belongs to the variant field class which contains it. |
| 998 | |
| 999 | Borrow any variant field class's option with |
| 1000 | bt_field_class_variant_borrow_option_by_index(), |
| 1001 | bt_field_class_variant_borrow_option_by_name(), |
| 1002 | bt_field_class_variant_borrow_option_by_index_const(), and |
| 1003 | bt_field_class_variant_borrow_option_by_name_const(). |
| 1004 | |
| 1005 | Those functions return the common #bt_field_class_variant_option |
| 1006 | type. Get the name of a variant field class option with |
| 1007 | bt_field_class_variant_option_get_name(). Borrow a variant field |
| 1008 | class option's field class with |
| 1009 | bt_field_class_variant_option_borrow_field_class() and |
| 1010 | bt_field_class_variant_option_borrow_field_class_const(). |
| 1011 | |
| 1012 | Borrow the option of a variant field classes with a selector field |
| 1013 | class with |
| 1014 | bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const(), |
| 1015 | bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const(), |
| 1016 | bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const(), or |
| 1017 | bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const(), |
| 1018 | depending on the selector field class's type. |
| 1019 | |
| 1020 | Those functions return the |
| 1021 | #bt_field_class_variant_with_selector_field_integer_unsigned_option or |
| 1022 | #bt_field_class_variant_with_selector_field_integer_signed_option type. |
| 1023 | \ref api-fund-c-typing "Upcast" those types to the |
| 1024 | #bt_field_class_variant_option type with |
| 1025 | bt_field_class_variant_with_selector_field_integer_unsigned_option_as_option_const() |
| 1026 | or |
| 1027 | bt_field_class_variant_with_selector_field_integer_signed_option_as_option_const(). |
| 1028 | |
| 1029 | Borrow the option's ranges from a variant field class with a |
| 1030 | selector field class with |
| 1031 | bt_field_class_variant_with_selector_field_integer_unsigned_option_borrow_ranges_const() |
| 1032 | or |
| 1033 | bt_field_class_variant_with_selector_field_integer_signed_option_borrow_ranges_const(). |
| 1034 | |
| 1035 | Set a variant field class option's user attributes with |
| 1036 | bt_field_class_variant_option_set_user_attributes(). |
| 1037 | |
| 1038 | Borrow a variant field class option's user attributes with |
| 1039 | bt_field_class_variant_option_borrow_user_attributes() and |
| 1040 | bt_field_class_variant_option_borrow_user_attributes_const(). |
| 1041 | </dd> |
| 1042 | </dl> |
| 1043 | |
| 1044 | <h1>\anchor api-tir-fc-link Field classes with links to other field classes</h1> |
| 1045 | |
| 1046 | \bt_cp_darray_fc, \bt_p_opt_fc, and \bt_p_var_fc \em can have links to |
| 1047 | other, preceding field classes. |
| 1048 | |
| 1049 | When a field class A has a link to another field class B, then |
| 1050 | an instance (\bt_field) of A has a link to an instance of B. |
| 1051 | |
| 1052 | This feature exists so that the linked field can contain the value of a |
| 1053 | dynamic property of the field. Those properties are: |
| 1054 | |
| 1055 | <dl> |
| 1056 | <dt>\bt_c_darray_field</dt> |
| 1057 | <dd> |
| 1058 | The linked field, a \bt_uint_field, contains the \b length of the |
| 1059 | dynamic array field. |
| 1060 | </dd> |
| 1061 | |
| 1062 | <dt>\bt_c_opt_field</dt> |
| 1063 | <dd> |
| 1064 | The linked field, either a \bt_bool_field or an \bt_int_field, |
| 1065 | indicates whether or not the option field has a field. |
| 1066 | </dd> |
| 1067 | |
| 1068 | <dt>\bt_c_var_field</dt> |
| 1069 | <dd> |
| 1070 | The linked field, an \bt_int_field, indicates the variant field's |
| 1071 | current selected field. |
| 1072 | </dd> |
| 1073 | </dl> |
| 1074 | |
| 1075 | Having a linked field class is <em>optional</em>: you always set the |
| 1076 | field properties with a dedicated function anyway. For example, even if |
| 1077 | a dynamic array field is linked to a preceding length field, you must |
| 1078 | still set its length with bt_field_array_dynamic_set_length(). In that |
| 1079 | case, the value of the length field must match what you pass to |
| 1080 | bt_field_array_dynamic_set_length(). |
| 1081 | |
| 1082 | The purpose of this feature is to eventually save space when a |
| 1083 | \bt_sink_comp writes trace files: if the trace format can convey that |
| 1084 | a preceding, existing field represents the length of a dynamic array |
| 1085 | field, then the sink component doesn't need to write the dynamic array |
| 1086 | field's length twice. This is the case of the |
| 1087 | <a href="https://diamon.org/ctf/">Common Trace Format</a>, for |
| 1088 | example. |
| 1089 | |
| 1090 | @image html darray-link.png "A dynamic array field class linked to an unsigned integer field class." |
| 1091 | |
| 1092 | To link a field class A to a preceding field class B, pass |
| 1093 | field class B when you create field class A. For example, pass |
| 1094 | the \bt_uint_fc to bt_field_class_array_dynamic_create() to create a |
| 1095 | \bt_darray_fc with a length field. |
| 1096 | |
| 1097 | When you call bt_stream_class_set_packet_context_field_class(), |
| 1098 | bt_stream_class_set_event_common_context_field_class(), |
| 1099 | bt_event_class_set_specific_context_field_class(), or |
| 1100 | bt_event_class_set_payload_field_class() with a field class containing |
| 1101 | a field class A with a linked field class B, the path to |
| 1102 | B becomes available in A. The functions to borrow this field path are: |
| 1103 | |
| 1104 | - bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const() |
| 1105 | - bt_field_class_option_with_selector_field_borrow_selector_field_path_const() |
| 1106 | - bt_field_class_variant_with_selector_field_borrow_selector_field_path_const() |
| 1107 | |
| 1108 | A field path indicates how to reach a linked field from a given |
| 1109 | root <em>scope</em>. The available scopes are: |
| 1110 | |
| 1111 | <dl> |
| 1112 | <dt>#BT_FIELD_PATH_SCOPE_PACKET_CONTEXT</dt> |
| 1113 | <dd> |
| 1114 | Packet context field. |
| 1115 | |
| 1116 | See bt_packet_borrow_context_field_const(). |
| 1117 | </dd> |
| 1118 | |
| 1119 | <dt>#BT_FIELD_PATH_SCOPE_EVENT_COMMON_CONTEXT</dt> |
| 1120 | <dd> |
| 1121 | Event common context field. |
| 1122 | |
| 1123 | See bt_event_borrow_common_context_field_const(). |
| 1124 | </dd> |
| 1125 | |
| 1126 | <dt>#BT_FIELD_PATH_SCOPE_EVENT_SPECIFIC_CONTEXT</dt> |
| 1127 | <dd> |
| 1128 | Event specific context field. |
| 1129 | |
| 1130 | See bt_event_borrow_specific_context_field_const(). |
| 1131 | </dd> |
| 1132 | |
| 1133 | <dt>#BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD</dt> |
| 1134 | <dd> |
| 1135 | Event payload field. |
| 1136 | |
| 1137 | See bt_event_borrow_payload_field_const(). |
| 1138 | </dd> |
| 1139 | </dl> |
| 1140 | |
| 1141 | The rules regarding field class A vs. field class B (linked |
| 1142 | field class) are: |
| 1143 | |
| 1144 | - If A is within a packet context field class, B must also be in the |
| 1145 | same packet context field class. |
| 1146 | |
| 1147 | See bt_stream_class_set_packet_context_field_class(). |
| 1148 | |
| 1149 | - If A is within a event common context field class, B must be in one |
| 1150 | of: |
| 1151 | |
| 1152 | - The same event common context field class. |
| 1153 | - The packet context field class of the same \bt_stream_cls. |
| 1154 | |
| 1155 | See bt_stream_class_set_event_common_context_field_class(). |
| 1156 | |
| 1157 | - If A is within an event specific context field class, B must be in |
| 1158 | one of: |
| 1159 | |
| 1160 | - The same event specific context field class. |
| 1161 | - The event common context field class of the same stream class. |
| 1162 | - The packet context field class of the same stream class. |
| 1163 | |
| 1164 | See bt_event_class_set_specific_context_field_class(). |
| 1165 | |
| 1166 | - If A is within an event payload field class, B must be in one of: |
| 1167 | |
| 1168 | - The same event payload field class. |
| 1169 | - The event specific context field class of the same \bt_ev_cls. |
| 1170 | - The event common context field class of the same stream class. |
| 1171 | - The packet context field class of the same stream class. |
| 1172 | |
| 1173 | See bt_event_class_set_payload_field_class(). |
| 1174 | |
| 1175 | - If both A and B are in the same scope, then: |
| 1176 | |
| 1177 | - The lowest common ancestor field class of A and B must be a |
| 1178 | \bt_struct_fc. |
| 1179 | |
| 1180 | - B must precede A. |
| 1181 | |
| 1182 | Considering that the members of a structure field class are ordered, |
| 1183 | then B must be part of a member that's before the member which |
| 1184 | contains A in their lowest common ancestor structure field class. |
| 1185 | |
| 1186 | - The path from the lowest common ancestor structure field class of A |
| 1187 | and B to A and to B must only contain structure field classes. |
| 1188 | |
| 1189 | - If A is in a different scope than B, the path from the root scope of B |
| 1190 | to B must only contain structure field classes. |
| 1191 | */ |
| 1192 | |
| 1193 | /*! @{ */ |
| 1194 | |
| 1195 | /*! |
| 1196 | @name Type |
| 1197 | @{ |
| 1198 | |
| 1199 | @typedef struct bt_field_class bt_field_class; |
| 1200 | |
| 1201 | @brief |
| 1202 | Field class. |
| 1203 | |
| 1204 | @} |
| 1205 | */ |
| 1206 | |
| 1207 | /*! |
| 1208 | @name Type query |
| 1209 | @{ |
| 1210 | */ |
| 1211 | |
| 1212 | /*! |
| 1213 | @brief |
| 1214 | Field class type enumerators. |
| 1215 | */ |
| 1216 | typedef enum bt_field_class_type { |
| 1217 | /*! |
| 1218 | @brief |
| 1219 | \bt_c_bool_fc. |
| 1220 | */ |
| 1221 | BT_FIELD_CLASS_TYPE_BOOL = 1ULL << 0, |
| 1222 | |
| 1223 | /*! |
| 1224 | @brief |
| 1225 | \bt_c_ba_fc. |
| 1226 | */ |
| 1227 | BT_FIELD_CLASS_TYPE_BIT_ARRAY = 1ULL << 1, |
| 1228 | |
| 1229 | /*! |
| 1230 | @brief |
| 1231 | \bt_c_int_fc. |
| 1232 | |
| 1233 | No field class has this type: use it with |
| 1234 | bt_field_class_type_is(). |
| 1235 | */ |
| 1236 | BT_FIELD_CLASS_TYPE_INTEGER = 1ULL << 2, |
| 1237 | |
| 1238 | /*! |
| 1239 | @brief |
| 1240 | \bt_c_uint_fc. |
| 1241 | |
| 1242 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_INTEGER. |
| 1243 | */ |
| 1244 | BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER = (1ULL << 3) | BT_FIELD_CLASS_TYPE_INTEGER, |
| 1245 | |
| 1246 | /*! |
| 1247 | @brief |
| 1248 | \bt_c_sint_fc. |
| 1249 | |
| 1250 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_INTEGER. |
| 1251 | */ |
| 1252 | BT_FIELD_CLASS_TYPE_SIGNED_INTEGER = (1ULL << 4) | BT_FIELD_CLASS_TYPE_INTEGER, |
| 1253 | |
| 1254 | /*! |
| 1255 | @brief |
| 1256 | \bt_c_enum_fc. |
| 1257 | |
| 1258 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_INTEGER. |
| 1259 | |
| 1260 | No field class has this type: use it with |
| 1261 | bt_field_class_type_is(). |
| 1262 | */ |
| 1263 | BT_FIELD_CLASS_TYPE_ENUMERATION = 1ULL << 5, |
| 1264 | |
| 1265 | /*! |
| 1266 | @brief |
| 1267 | \bt_c_uenum_fc. |
| 1268 | |
| 1269 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_ENUMERATION |
| 1270 | and #BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER. |
| 1271 | */ |
| 1272 | BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION = BT_FIELD_CLASS_TYPE_ENUMERATION | BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, |
| 1273 | |
| 1274 | /*! |
| 1275 | @brief |
| 1276 | \bt_c_senum_fc. |
| 1277 | |
| 1278 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_ENUMERATION |
| 1279 | and #BT_FIELD_CLASS_TYPE_SIGNED_INTEGER. |
| 1280 | */ |
| 1281 | BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION = BT_FIELD_CLASS_TYPE_ENUMERATION | BT_FIELD_CLASS_TYPE_SIGNED_INTEGER, |
| 1282 | |
| 1283 | /*! |
| 1284 | @brief |
| 1285 | \bt_c_real_fc. |
| 1286 | |
| 1287 | No field class has this type: use it with |
| 1288 | bt_field_class_type_is(). |
| 1289 | */ |
| 1290 | BT_FIELD_CLASS_TYPE_REAL = 1ULL << 6, |
| 1291 | |
| 1292 | /*! |
| 1293 | @brief |
| 1294 | Single-precision \bt_real_fc. |
| 1295 | |
| 1296 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_REAL. |
| 1297 | */ |
| 1298 | BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL = (1ULL << 7) | BT_FIELD_CLASS_TYPE_REAL, |
| 1299 | |
| 1300 | /*! |
| 1301 | @brief |
| 1302 | Double-precision \bt_real_fc. |
| 1303 | |
| 1304 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_REAL. |
| 1305 | */ |
| 1306 | BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL = (1ULL << 8) | BT_FIELD_CLASS_TYPE_REAL, |
| 1307 | |
| 1308 | /*! |
| 1309 | @brief |
| 1310 | \bt_c_string_fc.. |
| 1311 | */ |
| 1312 | BT_FIELD_CLASS_TYPE_STRING = 1ULL << 9, |
| 1313 | |
| 1314 | /*! |
| 1315 | @brief |
| 1316 | \bt_c_struct_fc. |
| 1317 | */ |
| 1318 | BT_FIELD_CLASS_TYPE_STRUCTURE = 1ULL << 10, |
| 1319 | |
| 1320 | /*! |
| 1321 | @brief |
| 1322 | \bt_c_array_fc. |
| 1323 | |
| 1324 | No field class has this type: use it with |
| 1325 | bt_field_class_type_is(). |
| 1326 | */ |
| 1327 | BT_FIELD_CLASS_TYPE_ARRAY = 1ULL << 11, |
| 1328 | |
| 1329 | /*! |
| 1330 | @brief |
| 1331 | \bt_c_sarray_fc. |
| 1332 | |
| 1333 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_ARRAY. |
| 1334 | */ |
| 1335 | BT_FIELD_CLASS_TYPE_STATIC_ARRAY = (1ULL << 12) | BT_FIELD_CLASS_TYPE_ARRAY, |
| 1336 | |
| 1337 | /*! |
| 1338 | @brief |
| 1339 | \bt_c_darray_fc. |
| 1340 | |
| 1341 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_ARRAY. |
| 1342 | |
| 1343 | No field class has this type: use it with |
| 1344 | bt_field_class_type_is(). |
| 1345 | */ |
| 1346 | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY = (1ULL << 13) | BT_FIELD_CLASS_TYPE_ARRAY, |
| 1347 | |
| 1348 | /*! |
| 1349 | @brief |
| 1350 | \bt_c_darray_fc (without a length field). |
| 1351 | |
| 1352 | This type conceptually inherits |
| 1353 | #BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY. |
| 1354 | */ |
| 1355 | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD = (1ULL << 14) | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, |
| 1356 | |
| 1357 | /*! |
| 1358 | @brief |
| 1359 | \bt_c_darray_fc (with a length field). |
| 1360 | |
| 1361 | This type conceptually inherits |
| 1362 | #BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY. |
| 1363 | */ |
| 1364 | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD = (1ULL << 15) | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, |
| 1365 | |
| 1366 | /*! |
| 1367 | @brief |
| 1368 | \bt_c_opt_fc. |
| 1369 | |
| 1370 | No field class has this type: use it with |
| 1371 | bt_field_class_type_is(). |
| 1372 | */ |
| 1373 | BT_FIELD_CLASS_TYPE_OPTION = 1ULL << 16, |
| 1374 | |
| 1375 | /*! |
| 1376 | @brief |
| 1377 | \bt_c_opt_fc (without a selector field). |
| 1378 | */ |
| 1379 | BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD = (1ULL << 17) | BT_FIELD_CLASS_TYPE_OPTION, |
| 1380 | |
| 1381 | /*! |
| 1382 | @brief |
| 1383 | \bt_c_opt_fc (with a selector field). |
| 1384 | |
| 1385 | This type conceptually inherits #BT_FIELD_CLASS_TYPE_OPTION. |
| 1386 | |
| 1387 | No field class has this type: use it with |
| 1388 | bt_field_class_type_is(). |
| 1389 | */ |
| 1390 | BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD = (1ULL << 18) | BT_FIELD_CLASS_TYPE_OPTION, |
| 1391 | |
| 1392 | /*! |
| 1393 | @brief |
| 1394 | \bt_c_opt_fc (with a boolean selector field). |
| 1395 | |
| 1396 | This type conceptually inherits |
| 1397 | #BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD. |
| 1398 | */ |
| 1399 | BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD = (1ULL << 19) | BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD, |
| 1400 | |
| 1401 | /*! |
| 1402 | @brief |
| 1403 | \bt_c_opt_fc (with an integer selector field). |
| 1404 | |
| 1405 | This type conceptually inherits |
| 1406 | #BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD. |
| 1407 | |
| 1408 | No field class has this type: use it with |
| 1409 | bt_field_class_type_is(). |
| 1410 | */ |
| 1411 | BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD = (1ULL << 20) | BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD, |
| 1412 | |
| 1413 | /*! |
| 1414 | @brief |
| 1415 | \bt_c_opt_fc (with an unsigned integer selector field). |
| 1416 | |
| 1417 | This type conceptually inherits |
| 1418 | #BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD. |
| 1419 | */ |
| 1420 | BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 21) | BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD, |
| 1421 | |
| 1422 | /*! |
| 1423 | @brief |
| 1424 | \bt_c_opt_fc (with a signed integer selector field). |
| 1425 | |
| 1426 | This type conceptually inherits |
| 1427 | #BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD. |
| 1428 | */ |
| 1429 | BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 22) | BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD, |
| 1430 | |
| 1431 | /*! |
| 1432 | @brief |
| 1433 | \bt_c_var_fc. |
| 1434 | |
| 1435 | No field class has this type: use it with |
| 1436 | bt_field_class_type_is(). |
| 1437 | */ |
| 1438 | BT_FIELD_CLASS_TYPE_VARIANT = 1ULL << 23, |
| 1439 | |
| 1440 | /*! |
| 1441 | @brief |
| 1442 | \bt_c_var_fc (without a selector field). |
| 1443 | */ |
| 1444 | BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD = (1ULL << 24) | BT_FIELD_CLASS_TYPE_VARIANT, |
| 1445 | |
| 1446 | /*! |
| 1447 | @brief |
| 1448 | \bt_c_var_fc (with a selector field). |
| 1449 | |
| 1450 | This type conceptually inherits |
| 1451 | #BT_FIELD_CLASS_TYPE_VARIANT. |
| 1452 | |
| 1453 | No field class has this type: use it with |
| 1454 | bt_field_class_type_is(). |
| 1455 | */ |
| 1456 | BT_FIELD_CLASS_TYPE_VARIANT_WITH_SELECTOR_FIELD = (1ULL << 25) | BT_FIELD_CLASS_TYPE_VARIANT, |
| 1457 | |
| 1458 | /*! |
| 1459 | @brief |
| 1460 | \bt_c_var_fc (with an integer selector field). |
| 1461 | |
| 1462 | This type conceptually inherits |
| 1463 | #BT_FIELD_CLASS_TYPE_VARIANT_WITH_SELECTOR_FIELD. |
| 1464 | |
| 1465 | No field class has this type: use it with |
| 1466 | bt_field_class_type_is(). |
| 1467 | */ |
| 1468 | BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD = (1ULL << 26) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_SELECTOR_FIELD, |
| 1469 | |
| 1470 | /*! |
| 1471 | @brief |
| 1472 | \bt_c_opt_fc (with an unsigned integer selector field). |
| 1473 | |
| 1474 | This type conceptually inherits |
| 1475 | #BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD. |
| 1476 | */ |
| 1477 | BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 27) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD, |
| 1478 | |
| 1479 | /*! |
| 1480 | @brief |
| 1481 | \bt_c_opt_fc (with a signed integer selector field). |
| 1482 | |
| 1483 | This type conceptually inherits |
| 1484 | #BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD. |
| 1485 | */ |
| 1486 | BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 28) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD, |
| 1487 | |
| 1488 | /* |
| 1489 | * Make sure the enumeration type is a 64-bit integer in case |
| 1490 | * the project needs field class types in the future. |
| 1491 | * |
| 1492 | * This is not part of the API. |
| 1493 | */ |
| 1494 | __BT_FIELD_CLASS_TYPE_BIG_VALUE = 1ULL << 62, |
| 1495 | } bt_field_class_type; |
| 1496 | |
| 1497 | /*! |
| 1498 | @brief |
| 1499 | Returns the type enumerator of the field class \bt_p{field_class}. |
| 1500 | |
| 1501 | @param[in] field_class |
| 1502 | Field class of which to get the type enumerator |
| 1503 | |
| 1504 | @returns |
| 1505 | Type enumerator of \bt_p{field_class}. |
| 1506 | |
| 1507 | @bt_pre_not_null{field_class} |
| 1508 | |
| 1509 | @sa bt_field_class_type_is() — |
| 1510 | Returns whether or not the type of a field class conceptually is a |
| 1511 | given type. |
| 1512 | */ |
| 1513 | extern bt_field_class_type bt_field_class_get_type( |
| 1514 | const bt_field_class *field_class); |
| 1515 | |
| 1516 | /*! |
| 1517 | @brief |
| 1518 | Returns whether or not the field class type \bt_p{type} conceptually |
| 1519 | \em is the field class type \bt_p{other_type}. |
| 1520 | |
| 1521 | For example, an \bt_uint_fc conceptually \em is an integer field class, |
| 1522 | so |
| 1523 | |
| 1524 | @code |
| 1525 | bt_field_class_type_is(BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, BT_FIELD_CLASS_TYPE_INTEGER) |
| 1526 | @endcode |
| 1527 | |
| 1528 | returns #BT_TRUE. |
| 1529 | |
| 1530 | @param[in] type |
| 1531 | Field class type to check against \bt_p{other_type}. |
| 1532 | @param[in] other_type |
| 1533 | Field class type against which to check \bt_p{type}. |
| 1534 | |
| 1535 | @returns |
| 1536 | #BT_TRUE if \bt_p{type} conceptually \em is \bt_p{other_type}. |
| 1537 | |
| 1538 | @sa bt_field_class_get_type() — |
| 1539 | Returns the type enumerator of a field class. |
| 1540 | */ |
| 1541 | static inline |
| 1542 | bt_bool bt_field_class_type_is(const bt_field_class_type type, |
| 1543 | const bt_field_class_type other_type) |
| 1544 | { |
| 1545 | return (type & other_type) == other_type; |
| 1546 | } |
| 1547 | |
| 1548 | /*! @} */ |
| 1549 | |
| 1550 | /*! |
| 1551 | @name Common property |
| 1552 | @{ |
| 1553 | */ |
| 1554 | |
| 1555 | /*! |
| 1556 | @brief |
| 1557 | Sets the user attributes of the field class \bt_p{field_class} to |
| 1558 | \bt_p{user_attributes}. |
| 1559 | |
| 1560 | See the \ref api-tir-fc-prop-user-attrs "user attributes" property. |
| 1561 | |
| 1562 | @note |
| 1563 | When you create a field class with one of the |
| 1564 | <code>bt_field_class_*_create()</code> functions, the field class's |
| 1565 | initial user attributes is an empty \bt_map_val. Therefore you can |
| 1566 | borrow it with bt_field_class_borrow_user_attributes() and fill it |
| 1567 | directly instead of setting a new one with this function. |
| 1568 | |
| 1569 | @param[in] field_class |
| 1570 | Field class of which to set the user attributes to |
| 1571 | \bt_p{user_attributes}. |
| 1572 | @param[in] user_attributes |
| 1573 | New user attributes of \bt_p{field_class}. |
| 1574 | |
| 1575 | @bt_pre_not_null{field_class} |
| 1576 | @bt_pre_hot{field_class} |
| 1577 | @bt_pre_not_null{user_attributes} |
| 1578 | @bt_pre_is_map_val{user_attributes} |
| 1579 | |
| 1580 | @sa bt_field_class_borrow_user_attributes() — |
| 1581 | Borrows the user attributes of a field class. |
| 1582 | */ |
| 1583 | extern void bt_field_class_set_user_attributes( |
| 1584 | bt_field_class *field_class, const bt_value *user_attributes); |
| 1585 | |
| 1586 | /*! |
| 1587 | @brief |
| 1588 | Borrows the user attributes of the field class \bt_p{field_class}. |
| 1589 | |
| 1590 | See the \ref api-tir-fc-prop-user-attrs "user attributes" property. |
| 1591 | |
| 1592 | @note |
| 1593 | When you create a field class with one of the |
| 1594 | <code>bt_field_class_*_create()</code> functions, the field class's |
| 1595 | initial user attributes is an empty \bt_map_val. |
| 1596 | |
| 1597 | @param[in] field_class |
| 1598 | Field class from which to borrow the user attributes. |
| 1599 | |
| 1600 | @returns |
| 1601 | User attributes of \bt_p{field_class} (a \bt_map_val). |
| 1602 | |
| 1603 | @bt_pre_not_null{field_class} |
| 1604 | |
| 1605 | @sa bt_field_class_set_user_attributes() — |
| 1606 | Sets the user attributes of a field class. |
| 1607 | @sa bt_field_class_borrow_user_attributes_const() — |
| 1608 | \c const version of this function. |
| 1609 | */ |
| 1610 | extern bt_value *bt_field_class_borrow_user_attributes( |
| 1611 | bt_field_class *field_class); |
| 1612 | |
| 1613 | /*! |
| 1614 | @brief |
| 1615 | Borrows the user attributes of the field class \bt_p{field_class} |
| 1616 | (\c const version). |
| 1617 | |
| 1618 | See bt_field_class_borrow_user_attributes(). |
| 1619 | */ |
| 1620 | extern const bt_value *bt_field_class_borrow_user_attributes_const( |
| 1621 | const bt_field_class *field_class); |
| 1622 | |
| 1623 | /*! @} */ |
| 1624 | |
| 1625 | /*! |
| 1626 | @name Boolean field class |
| 1627 | @{ |
| 1628 | */ |
| 1629 | |
| 1630 | /*! |
| 1631 | @brief |
| 1632 | Creates a \bt_bool_fc from the trace class \bt_p{trace_class}. |
| 1633 | |
| 1634 | On success, the returned boolean field class has the following |
| 1635 | property value: |
| 1636 | |
| 1637 | <table> |
| 1638 | <tr> |
| 1639 | <th>Property |
| 1640 | <th>Value |
| 1641 | <tr> |
| 1642 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 1643 | <td>Empty \bt_map_val |
| 1644 | </table> |
| 1645 | |
| 1646 | @param[in] trace_class |
| 1647 | Trace class from which to create a boolean field class. |
| 1648 | |
| 1649 | @returns |
| 1650 | New boolean field class reference, or \c NULL on memory error. |
| 1651 | |
| 1652 | @bt_pre_not_null{trace_class} |
| 1653 | */ |
| 1654 | extern bt_field_class *bt_field_class_bool_create( |
| 1655 | bt_trace_class *trace_class); |
| 1656 | |
| 1657 | /*! |
| 1658 | @} |
| 1659 | */ |
| 1660 | |
| 1661 | /*! |
| 1662 | @name Bit array field class |
| 1663 | @{ |
| 1664 | */ |
| 1665 | |
| 1666 | /*! |
| 1667 | @brief |
| 1668 | Creates a \bt_ba_fc with the length \bt_p{length} from the trace |
| 1669 | class \bt_p{trace_class}. |
| 1670 | |
| 1671 | On success, the returned bit array field class has the following |
| 1672 | property values: |
| 1673 | |
| 1674 | <table> |
| 1675 | <tr> |
| 1676 | <th>Property |
| 1677 | <th>Value |
| 1678 | <tr> |
| 1679 | <td>\ref api-tir-fc-ba-prop-len "Length" |
| 1680 | <td>\bt_p{length} |
| 1681 | <tr> |
| 1682 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 1683 | <td>Empty \bt_map_val |
| 1684 | </table> |
| 1685 | |
| 1686 | @param[in] trace_class |
| 1687 | Trace class from which to create a bit array field class. |
| 1688 | @param[in] length |
| 1689 | Length (number of bits) of the instances of the bit array field |
| 1690 | class to create. |
| 1691 | |
| 1692 | @returns |
| 1693 | New bit array field class reference, or \c NULL on memory error. |
| 1694 | |
| 1695 | @bt_pre_not_null{trace_class} |
| 1696 | @pre |
| 1697 | 0 < \bt_p{length} ≤ 64. |
| 1698 | */ |
| 1699 | extern bt_field_class *bt_field_class_bit_array_create( |
| 1700 | bt_trace_class *trace_class, uint64_t length); |
| 1701 | |
| 1702 | /*! |
| 1703 | @brief |
| 1704 | Returns the length of the \bt_ba_fc \bt_p{field_class}. |
| 1705 | |
| 1706 | See the \ref api-tir-fc-ba-prop-len "length" property. |
| 1707 | |
| 1708 | @param[in] field_class |
| 1709 | Bit array field class of which to get the length. |
| 1710 | |
| 1711 | @returns |
| 1712 | Length of \bt_p{field_class}. |
| 1713 | |
| 1714 | @bt_pre_not_null{field_class} |
| 1715 | @bt_pre_is_ba_fc{field_class} |
| 1716 | */ |
| 1717 | extern uint64_t bt_field_class_bit_array_get_length( |
| 1718 | const bt_field_class *field_class); |
| 1719 | |
| 1720 | /*! |
| 1721 | @} |
| 1722 | */ |
| 1723 | |
| 1724 | /*! |
| 1725 | @name Integer field class |
| 1726 | @{ |
| 1727 | */ |
| 1728 | |
| 1729 | /*! |
| 1730 | @brief |
| 1731 | Sets the field value range of the \bt_int_fc \bt_p{field_class} |
| 1732 | to \bt_p{n}. |
| 1733 | |
| 1734 | See the \ref api-tir-fc-int-prop-size "field value range" property. |
| 1735 | |
| 1736 | @param[in] field_class |
| 1737 | Integer field class of which to set the field value range to |
| 1738 | \bt_p{n}. |
| 1739 | @param[in] n |
| 1740 | @parblock |
| 1741 | \em N in: |
| 1742 | |
| 1743 | <dl> |
| 1744 | <dt>Unsigned integer field class</dt> |
| 1745 | <dd>[0, 2<sup><em>N</em></sup> - 1]</dd> |
| 1746 | |
| 1747 | <dt>Signed integer field class</dt> |
| 1748 | <dd>[-2<sup><em>N</em></sup>, 2<sup><em>N</em></sup> - 1]</dd> |
| 1749 | </dl> |
| 1750 | @endparblock |
| 1751 | |
| 1752 | @bt_pre_not_null{field_class} |
| 1753 | @bt_pre_hot{field_class} |
| 1754 | @bt_pre_is_int_fc{field_class} |
| 1755 | @pre |
| 1756 | \bt_p{n} â©˝ 64. |
| 1757 | |
| 1758 | @sa bt_field_class_integer_get_field_value_range() — |
| 1759 | Returns the field value range of an integer field class. |
| 1760 | */ |
| 1761 | extern void bt_field_class_integer_set_field_value_range( |
| 1762 | bt_field_class *field_class, uint64_t n); |
| 1763 | |
| 1764 | /*! |
| 1765 | @brief |
| 1766 | Returns the field value range of the \bt_int_fc \bt_p{field_class}. |
| 1767 | |
| 1768 | See the \ref api-tir-fc-int-prop-size "field value range" property. |
| 1769 | |
| 1770 | @param[in] field_class |
| 1771 | Integer field class of which to get the field value range. |
| 1772 | |
| 1773 | @returns |
| 1774 | @parblock |
| 1775 | Field value range of \bt_p{field_class}, that is, \em N in: |
| 1776 | |
| 1777 | <dl> |
| 1778 | <dt>Unsigned integer field class</dt> |
| 1779 | <dd>[0, 2<sup><em>N</em></sup> - 1]</dd> |
| 1780 | |
| 1781 | <dt>Signed integer field class</dt> |
| 1782 | <dd>[-2<sup><em>N</em></sup>, 2<sup><em>N</em></sup> - 1]</dd> |
| 1783 | </dl> |
| 1784 | @endparblock |
| 1785 | |
| 1786 | @bt_pre_not_null{field_class} |
| 1787 | @bt_pre_is_int_fc{field_class} |
| 1788 | |
| 1789 | @sa bt_field_class_integer_set_field_value_range() — |
| 1790 | Sets the field value range of an integer field class. |
| 1791 | */ |
| 1792 | extern uint64_t bt_field_class_integer_get_field_value_range( |
| 1793 | const bt_field_class *field_class); |
| 1794 | |
| 1795 | /*! |
| 1796 | @brief |
| 1797 | Integer field class preferred display bases. |
| 1798 | */ |
| 1799 | typedef enum bt_field_class_integer_preferred_display_base { |
| 1800 | /*! |
| 1801 | @brief |
| 1802 | Binary (2). |
| 1803 | */ |
| 1804 | BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY = 2, |
| 1805 | |
| 1806 | /*! |
| 1807 | @brief |
| 1808 | Octal (8). |
| 1809 | */ |
| 1810 | BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL = 8, |
| 1811 | |
| 1812 | /*! |
| 1813 | @brief |
| 1814 | Decimal (10). |
| 1815 | */ |
| 1816 | BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL = 10, |
| 1817 | |
| 1818 | /*! |
| 1819 | @brief |
| 1820 | Hexadecimal (16). |
| 1821 | */ |
| 1822 | BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL = 16, |
| 1823 | } bt_field_class_integer_preferred_display_base; |
| 1824 | |
| 1825 | /*! |
| 1826 | @brief |
| 1827 | Sets the preferred display base of the \bt_int_fc \bt_p{field_class} |
| 1828 | to \bt_p{preferred_display_base}. |
| 1829 | |
| 1830 | See the \ref api-tir-fc-int-prop-base "preferred display base" property. |
| 1831 | |
| 1832 | @param[in] field_class |
| 1833 | Integer field class of which to set the preferred display base to |
| 1834 | \bt_p{preferred_display_base}. |
| 1835 | @param[in] preferred_display_base |
| 1836 | New preferred display base of \bt_p{field_class}. |
| 1837 | |
| 1838 | @bt_pre_not_null{field_class} |
| 1839 | @bt_pre_hot{field_class} |
| 1840 | @bt_pre_is_int_fc{field_class} |
| 1841 | |
| 1842 | @sa bt_field_class_integer_get_preferred_display_base() — |
| 1843 | Returns the preferred display base of an integer field class. |
| 1844 | */ |
| 1845 | extern void bt_field_class_integer_set_preferred_display_base( |
| 1846 | bt_field_class *field_class, |
| 1847 | bt_field_class_integer_preferred_display_base preferred_display_base); |
| 1848 | |
| 1849 | /*! |
| 1850 | @brief |
| 1851 | Returns the preferred display base of the \bt_int_fc |
| 1852 | \bt_p{field_class}. |
| 1853 | |
| 1854 | See the \ref api-tir-fc-int-prop-base "preferred display base" property. |
| 1855 | |
| 1856 | @param[in] field_class |
| 1857 | Integer field class of which to get the preferred display base. |
| 1858 | |
| 1859 | @retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY |
| 1860 | 2 (binary) |
| 1861 | @retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL |
| 1862 | 8 (octal) |
| 1863 | @retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL |
| 1864 | 10 (decimal) |
| 1865 | @retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL |
| 1866 | 16 (hexadecimal) |
| 1867 | |
| 1868 | @bt_pre_not_null{field_class} |
| 1869 | @bt_pre_is_int_fc{field_class} |
| 1870 | |
| 1871 | @sa bt_field_class_integer_set_preferred_display_base() — |
| 1872 | Sets the preferred display base of an integer field class. |
| 1873 | */ |
| 1874 | extern bt_field_class_integer_preferred_display_base |
| 1875 | bt_field_class_integer_get_preferred_display_base( |
| 1876 | const bt_field_class *field_class); |
| 1877 | |
| 1878 | /*! @} */ |
| 1879 | |
| 1880 | /*! |
| 1881 | @name Unsigned integer field class |
| 1882 | @{ |
| 1883 | */ |
| 1884 | |
| 1885 | /*! |
| 1886 | @brief |
| 1887 | Creates an \bt_uint_fc from the trace class \bt_p{trace_class}. |
| 1888 | |
| 1889 | On success, the returned unsigned integer field class has the following |
| 1890 | property values: |
| 1891 | |
| 1892 | <table> |
| 1893 | <tr> |
| 1894 | <th>Property |
| 1895 | <th>Value |
| 1896 | <tr> |
| 1897 | <td>\ref api-tir-fc-int-prop-size "Field value range" |
| 1898 | <td>[0, 2<sup>64</sup> - 1] |
| 1899 | <tr> |
| 1900 | <td>\ref api-tir-fc-int-prop-base "Preferred display base" |
| 1901 | <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL |
| 1902 | <tr> |
| 1903 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 1904 | <td>Empty \bt_map_val |
| 1905 | </table> |
| 1906 | |
| 1907 | @param[in] trace_class |
| 1908 | Trace class from which to create an unsigned integer field class. |
| 1909 | |
| 1910 | @returns |
| 1911 | New unsigned integer field class reference, or \c NULL on memory error. |
| 1912 | |
| 1913 | @bt_pre_not_null{trace_class} |
| 1914 | */ |
| 1915 | extern bt_field_class *bt_field_class_integer_unsigned_create( |
| 1916 | bt_trace_class *trace_class); |
| 1917 | |
| 1918 | /*! @} */ |
| 1919 | |
| 1920 | /*! |
| 1921 | @name Signed integer field class |
| 1922 | @{ |
| 1923 | */ |
| 1924 | |
| 1925 | /*! |
| 1926 | @brief |
| 1927 | Creates an \bt_sint_fc from the trace class \bt_p{trace_class}. |
| 1928 | |
| 1929 | On success, the returned signed integer field class has the following |
| 1930 | property values: |
| 1931 | |
| 1932 | <table> |
| 1933 | <tr> |
| 1934 | <th>Property |
| 1935 | <th>Value |
| 1936 | <tr> |
| 1937 | <td>\ref api-tir-fc-int-prop-size "Field value range" |
| 1938 | <td>[-2<sup>63</sup>, 2<sup>63</sup> - 1] |
| 1939 | <tr> |
| 1940 | <td>\ref api-tir-fc-int-prop-base "Preferred display base" |
| 1941 | <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL |
| 1942 | <tr> |
| 1943 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 1944 | <td>Empty \bt_map_val |
| 1945 | </table> |
| 1946 | |
| 1947 | @param[in] trace_class |
| 1948 | Trace class from which to create a signed integer field class. |
| 1949 | |
| 1950 | @returns |
| 1951 | New signed integer field class reference, or \c NULL on memory error. |
| 1952 | |
| 1953 | @bt_pre_not_null{trace_class} |
| 1954 | */ |
| 1955 | extern bt_field_class *bt_field_class_integer_signed_create( |
| 1956 | bt_trace_class *trace_class); |
| 1957 | |
| 1958 | /*! @} */ |
| 1959 | |
| 1960 | /*! |
| 1961 | @name Single-precision real field class |
| 1962 | @{ |
| 1963 | */ |
| 1964 | |
| 1965 | /*! |
| 1966 | @brief |
| 1967 | Creates a single-precision \bt_real_fc from the trace class |
| 1968 | \bt_p{trace_class}. |
| 1969 | |
| 1970 | On success, the returned single-precision real field class has the |
| 1971 | following property value: |
| 1972 | |
| 1973 | <table> |
| 1974 | <tr> |
| 1975 | <th>Property |
| 1976 | <th>Value |
| 1977 | <tr> |
| 1978 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 1979 | <td>Empty \bt_map_val |
| 1980 | </table> |
| 1981 | |
| 1982 | @param[in] trace_class |
| 1983 | Trace class from which to create a single-preicision real |
| 1984 | field class. |
| 1985 | |
| 1986 | @returns |
| 1987 | New single-precision real field class reference, or \c NULL on |
| 1988 | memory error. |
| 1989 | |
| 1990 | @bt_pre_not_null{trace_class} |
| 1991 | */ |
| 1992 | extern bt_field_class *bt_field_class_real_single_precision_create( |
| 1993 | bt_trace_class *trace_class); |
| 1994 | |
| 1995 | /*! @} */ |
| 1996 | |
| 1997 | /*! |
| 1998 | @name Double-precision real field class |
| 1999 | @{ |
| 2000 | */ |
| 2001 | |
| 2002 | /*! |
| 2003 | @brief |
| 2004 | Creates a double-precision \bt_real_fc from the trace class |
| 2005 | \bt_p{trace_class}. |
| 2006 | |
| 2007 | On success, the returned double-precision real field class has the |
| 2008 | following property value: |
| 2009 | |
| 2010 | <table> |
| 2011 | <tr> |
| 2012 | <th>Property |
| 2013 | <th>Value |
| 2014 | <tr> |
| 2015 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 2016 | <td>Empty \bt_map_val |
| 2017 | </table> |
| 2018 | |
| 2019 | @param[in] trace_class |
| 2020 | Trace class from which to create a double-preicision real |
| 2021 | field class. |
| 2022 | |
| 2023 | @returns |
| 2024 | New double-precision real field class reference, or \c NULL on |
| 2025 | memory error. |
| 2026 | |
| 2027 | @bt_pre_not_null{trace_class} |
| 2028 | */ |
| 2029 | extern bt_field_class *bt_field_class_real_double_precision_create( |
| 2030 | bt_trace_class *trace_class); |
| 2031 | |
| 2032 | /*! @} */ |
| 2033 | |
| 2034 | /*! |
| 2035 | @name Enumeration field class |
| 2036 | @{ |
| 2037 | */ |
| 2038 | |
| 2039 | /*! |
| 2040 | @brief |
| 2041 | Array of \c const \bt_enum_fc labels. |
| 2042 | |
| 2043 | Returned by bt_field_class_enumeration_unsigned_get_mapping_labels_for_value() |
| 2044 | and bt_field_class_enumeration_signed_get_mapping_labels_for_value(). |
| 2045 | */ |
| 2046 | typedef char const * const *bt_field_class_enumeration_mapping_label_array; |
| 2047 | |
| 2048 | /*! |
| 2049 | @brief |
| 2050 | Status codes for |
| 2051 | bt_field_class_enumeration_unsigned_get_mapping_labels_for_value() |
| 2052 | and |
| 2053 | bt_field_class_enumeration_signed_get_mapping_labels_for_value(). |
| 2054 | */ |
| 2055 | typedef enum bt_field_class_enumeration_get_mapping_labels_for_value_status { |
| 2056 | /*! |
| 2057 | @brief |
| 2058 | Success. |
| 2059 | */ |
| 2060 | BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 2061 | |
| 2062 | /*! |
| 2063 | @brief |
| 2064 | Out of memory. |
| 2065 | */ |
| 2066 | BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 2067 | } bt_field_class_enumeration_get_mapping_labels_for_value_status; |
| 2068 | |
| 2069 | /*! |
| 2070 | @brief |
| 2071 | Status codes for bt_field_class_enumeration_unsigned_add_mapping() |
| 2072 | and bt_field_class_enumeration_signed_add_mapping(). |
| 2073 | */ |
| 2074 | typedef enum bt_field_class_enumeration_add_mapping_status { |
| 2075 | /*! |
| 2076 | @brief |
| 2077 | Success. |
| 2078 | */ |
| 2079 | BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 2080 | |
| 2081 | /*! |
| 2082 | @brief |
| 2083 | Out of memory. |
| 2084 | */ |
| 2085 | BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 2086 | } bt_field_class_enumeration_add_mapping_status; |
| 2087 | |
| 2088 | /*! @} */ |
| 2089 | |
| 2090 | /*! |
| 2091 | @name Enumeration field class mapping |
| 2092 | @{ |
| 2093 | */ |
| 2094 | |
| 2095 | /*! |
| 2096 | @typedef struct bt_field_class_enumeration_mapping bt_field_class_enumeration_mapping; |
| 2097 | |
| 2098 | @brief |
| 2099 | Enumeration field class mapping. |
| 2100 | */ |
| 2101 | |
| 2102 | /*! |
| 2103 | @brief |
| 2104 | Returns the number of mappings contained in the \bt_enum_fc |
| 2105 | \bt_p{field_class}. |
| 2106 | |
| 2107 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2108 | |
| 2109 | @param[in] field_class |
| 2110 | Enumeration field class of which to get the number of contained |
| 2111 | mappings. |
| 2112 | |
| 2113 | @returns |
| 2114 | Number of contained mappings in \bt_p{field_class}. |
| 2115 | |
| 2116 | @bt_pre_not_null{field_class} |
| 2117 | @bt_pre_is_enum_fc{field_class} |
| 2118 | */ |
| 2119 | extern uint64_t bt_field_class_enumeration_get_mapping_count( |
| 2120 | const bt_field_class *field_class); |
| 2121 | |
| 2122 | /*! |
| 2123 | @brief |
| 2124 | Returns the label of the \bt_enum_fc mapping \bt_p{mapping}. |
| 2125 | |
| 2126 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2127 | |
| 2128 | @param[in] mapping |
| 2129 | Enumeration field class mapping of which to get the label. |
| 2130 | |
| 2131 | @returns |
| 2132 | @parblock |
| 2133 | Label of \bt_p{mapping}. |
| 2134 | |
| 2135 | The returned pointer remains valid as long as \bt_p{mapping} exists. |
| 2136 | @endparblock |
| 2137 | |
| 2138 | @bt_pre_not_null{mapping} |
| 2139 | */ |
| 2140 | extern const char *bt_field_class_enumeration_mapping_get_label( |
| 2141 | const bt_field_class_enumeration_mapping *mapping); |
| 2142 | |
| 2143 | /*! @} */ |
| 2144 | |
| 2145 | /*! |
| 2146 | @name Unsigned enumeration field class |
| 2147 | @{ |
| 2148 | */ |
| 2149 | |
| 2150 | /*! |
| 2151 | @brief |
| 2152 | Creates an \bt_uenum_fc from the trace class \bt_p{trace_class}. |
| 2153 | |
| 2154 | On success, the returned unsigned enumeration field class has the |
| 2155 | following property values: |
| 2156 | |
| 2157 | <table> |
| 2158 | <tr> |
| 2159 | <th>Property |
| 2160 | <th>Value |
| 2161 | <tr> |
| 2162 | <td>\ref api-tir-fc-int-prop-size "Field value range" |
| 2163 | <td>[0, 2<sup>64</sup> - 1] |
| 2164 | <tr> |
| 2165 | <td>\ref api-tir-fc-int-prop-base "Preferred display base" |
| 2166 | <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL |
| 2167 | <tr> |
| 2168 | <td>\ref api-tir-fc-enum-prop-mappings "Mappings" |
| 2169 | <td>\em None |
| 2170 | <tr> |
| 2171 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 2172 | <td>Empty \bt_map_val |
| 2173 | </table> |
| 2174 | |
| 2175 | @param[in] trace_class |
| 2176 | Trace class from which to create an unsigned enumeration field |
| 2177 | class. |
| 2178 | |
| 2179 | @returns |
| 2180 | New unsigned enumeration field class reference, or \c NULL on memory |
| 2181 | error. |
| 2182 | |
| 2183 | @bt_pre_not_null{trace_class} |
| 2184 | */ |
| 2185 | extern bt_field_class *bt_field_class_enumeration_unsigned_create( |
| 2186 | bt_trace_class *trace_class); |
| 2187 | |
| 2188 | /*! |
| 2189 | @brief |
| 2190 | Adds a mapping to the \bt_uenum_fc \bt_p{field_class} having the |
| 2191 | label \bt_p{label} and the unsigned integer ranges \bt_p{ranges}. |
| 2192 | |
| 2193 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2194 | |
| 2195 | @param[in] field_class |
| 2196 | Unsigned enumeration field class to which to add a mapping having |
| 2197 | the label \bt_p{label} and the integer ranges \bt_p{ranges}. |
| 2198 | @param[in] label |
| 2199 | Label of the mapping to add to \bt_p{field_class} (copied). |
| 2200 | @param[in] ranges |
| 2201 | Unsigned integer ranges of the mapping to add to |
| 2202 | \bt_p{field_class}. |
| 2203 | |
| 2204 | @retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK |
| 2205 | Success. |
| 2206 | @retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR |
| 2207 | Out of memory. |
| 2208 | |
| 2209 | @bt_pre_not_null{field_class} |
| 2210 | @bt_pre_hot{field_class} |
| 2211 | @bt_pre_is_uenum_fc{field_class} |
| 2212 | @bt_pre_not_null{label} |
| 2213 | @pre |
| 2214 | \bt_p{field_class} has no mapping with the label \bt_p{label}. |
| 2215 | @bt_pre_not_null{ranges} |
| 2216 | @pre |
| 2217 | \bt_p{ranges} contains one or more unsigned integer ranges. |
| 2218 | */ |
| 2219 | extern bt_field_class_enumeration_add_mapping_status |
| 2220 | bt_field_class_enumeration_unsigned_add_mapping( |
| 2221 | bt_field_class *field_class, const char *label, |
| 2222 | const bt_integer_range_set_unsigned *ranges); |
| 2223 | |
| 2224 | /*! |
| 2225 | @brief |
| 2226 | Borrows the mapping at index \bt_p{index} from the |
| 2227 | \bt_uenum_fc \bt_p{field_class}. |
| 2228 | |
| 2229 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2230 | |
| 2231 | @param[in] field_class |
| 2232 | Unsigned enumeration field class from which to borrow the mapping at |
| 2233 | index \bt_p{index}. |
| 2234 | @param[in] index |
| 2235 | Index of the mapping to borrow from \bt_p{field_class}. |
| 2236 | |
| 2237 | @returns |
| 2238 | @parblock |
| 2239 | \em Borrowed reference of the mapping of |
| 2240 | \bt_p{field_class} at index \bt_p{index}. |
| 2241 | |
| 2242 | The returned pointer remains valid as long as \bt_p{field_class} |
| 2243 | is not modified. |
| 2244 | @endparblock |
| 2245 | |
| 2246 | @bt_pre_not_null{field_class} |
| 2247 | @bt_pre_is_uenum_fc{field_class} |
| 2248 | @pre |
| 2249 | \bt_p{index} is less than the number of mappings in |
| 2250 | \bt_p{field_class} (as returned by |
| 2251 | bt_field_class_enumeration_get_mapping_count()). |
| 2252 | |
| 2253 | @sa bt_field_class_enumeration_get_mapping_count() — |
| 2254 | Returns the number of mappings contained in an |
| 2255 | enumeration field class. |
| 2256 | */ |
| 2257 | extern const bt_field_class_enumeration_unsigned_mapping * |
| 2258 | bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const( |
| 2259 | const bt_field_class *field_class, uint64_t index); |
| 2260 | |
| 2261 | /*! |
| 2262 | @brief |
| 2263 | Borrows the mapping having the label \bt_p{label} from the |
| 2264 | \bt_uenum_fc \bt_p{field_class}. |
| 2265 | |
| 2266 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2267 | |
| 2268 | If there's no mapping having the label \bt_p{label} in |
| 2269 | \bt_p{field_class}, this function returns \c NULL. |
| 2270 | |
| 2271 | @param[in] field_class |
| 2272 | Unsigned enumeration field class from which to borrow the mapping |
| 2273 | having the label \bt_p{label}. |
| 2274 | @param[in] label |
| 2275 | Label of the mapping to borrow from \bt_p{field_class}. |
| 2276 | |
| 2277 | @returns |
| 2278 | @parblock |
| 2279 | \em Borrowed reference of the mapping of |
| 2280 | \bt_p{field_class} having the label \bt_p{label}, or \c NULL |
| 2281 | if none. |
| 2282 | |
| 2283 | The returned pointer remains valid as long as \bt_p{field_class} |
| 2284 | is not modified. |
| 2285 | @endparblock |
| 2286 | |
| 2287 | @bt_pre_not_null{field_class} |
| 2288 | @bt_pre_is_uenum_fc{field_class} |
| 2289 | @bt_pre_not_null{label} |
| 2290 | */ |
| 2291 | extern const bt_field_class_enumeration_unsigned_mapping * |
| 2292 | bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const( |
| 2293 | const bt_field_class *field_class, const char *label); |
| 2294 | |
| 2295 | /*! |
| 2296 | @brief |
| 2297 | Returns an array of all the labels of the mappings of the |
| 2298 | \bt_uenum_fc \bt_p{field_class} of which the \bt_p_uint_rg contain |
| 2299 | the integral value \bt_p{value}. |
| 2300 | |
| 2301 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2302 | |
| 2303 | This function sets \bt_p{*labels} to the resulting array and |
| 2304 | \bt_p{*count} to the number of labels in \bt_p{*labels}. |
| 2305 | |
| 2306 | On success, if there's no mapping ranges containing the value |
| 2307 | \bt_p{value}, \bt_p{*count} is 0. |
| 2308 | |
| 2309 | @param[in] field_class |
| 2310 | Unsigned enumeration field class from which to get the labels of the |
| 2311 | mappings of which the ranges contain \bt_p{value}. |
| 2312 | @param[in] value |
| 2313 | Value for which to get the mapped labels in \bt_p{field_class}. |
| 2314 | @param[out] labels |
| 2315 | @parblock |
| 2316 | <strong>On success</strong>, \bt_p{*labels} |
| 2317 | is an array of labels of the mappings of \bt_p{field_class} |
| 2318 | containing \bt_p{value}. |
| 2319 | |
| 2320 | The number of labels in \bt_p{*labels} is \bt_p{*count}. |
| 2321 | |
| 2322 | The array is owned by \bt_p{field_class} and remains valid as long |
| 2323 | as \bt_p{field_class} is not modified. |
| 2324 | @endparblock |
| 2325 | @param[out] count |
| 2326 | <strong>On success</strong>, \bt_p{*count} is the number of labels |
| 2327 | in \bt_p{*labels} (can be 0). |
| 2328 | |
| 2329 | @retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK |
| 2330 | Success. |
| 2331 | @retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR |
| 2332 | Out of memory. |
| 2333 | |
| 2334 | @bt_pre_not_null{field_class} |
| 2335 | @bt_pre_is_uenum_fc{field_class} |
| 2336 | @bt_pre_not_null{labels} |
| 2337 | @bt_pre_not_null{count} |
| 2338 | */ |
| 2339 | extern bt_field_class_enumeration_get_mapping_labels_for_value_status |
| 2340 | bt_field_class_enumeration_unsigned_get_mapping_labels_for_value( |
| 2341 | const bt_field_class *field_class, uint64_t value, |
| 2342 | bt_field_class_enumeration_mapping_label_array *labels, |
| 2343 | uint64_t *count); |
| 2344 | |
| 2345 | /*! @} */ |
| 2346 | |
| 2347 | /*! |
| 2348 | @name Unsigned enumeration field class mapping |
| 2349 | @{ |
| 2350 | */ |
| 2351 | |
| 2352 | /*! |
| 2353 | @typedef struct bt_field_class_enumeration_unsigned_mapping bt_field_class_enumeration_unsigned_mapping; |
| 2354 | |
| 2355 | @brief |
| 2356 | Unsigned enumeration field class mapping. |
| 2357 | */ |
| 2358 | |
| 2359 | /*! |
| 2360 | @brief |
| 2361 | Borrows the \bt_p_uint_rg from the \bt_uenum_fc mapping |
| 2362 | \bt_p{mapping}. |
| 2363 | |
| 2364 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2365 | |
| 2366 | @param[in] mapping |
| 2367 | Unsigned enumeration field class mapping from which to borrow the |
| 2368 | unsigned integer ranges. |
| 2369 | |
| 2370 | @returns |
| 2371 | Unsigned integer ranges of \bt_p{mapping}. |
| 2372 | |
| 2373 | @bt_pre_not_null{mapping} |
| 2374 | */ |
| 2375 | extern const bt_integer_range_set_unsigned * |
| 2376 | bt_field_class_enumeration_unsigned_mapping_borrow_ranges_const( |
| 2377 | const bt_field_class_enumeration_unsigned_mapping *mapping); |
| 2378 | |
| 2379 | /*! |
| 2380 | @brief |
| 2381 | \ref api-fund-c-typing "Upcasts" the \bt_uenum_fc mapping |
| 2382 | \bt_p{mapping} to the common #bt_field_class_enumeration_mapping |
| 2383 | type. |
| 2384 | |
| 2385 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2386 | |
| 2387 | @param[in] mapping |
| 2388 | @parblock |
| 2389 | Unsigned enumeration field class mapping to upcast. |
| 2390 | |
| 2391 | Can be \c NULL. |
| 2392 | @endparblock |
| 2393 | |
| 2394 | @returns |
| 2395 | \bt_p{mapping} as a common enumeration field class mapping. |
| 2396 | */ |
| 2397 | static inline |
| 2398 | const bt_field_class_enumeration_mapping * |
| 2399 | bt_field_class_enumeration_unsigned_mapping_as_mapping_const( |
| 2400 | const bt_field_class_enumeration_unsigned_mapping *mapping) |
| 2401 | { |
| 2402 | return __BT_UPCAST_CONST(bt_field_class_enumeration_mapping, mapping); |
| 2403 | } |
| 2404 | |
| 2405 | /*! @} */ |
| 2406 | |
| 2407 | /*! |
| 2408 | @name Signed enumeration field class |
| 2409 | @{ |
| 2410 | */ |
| 2411 | |
| 2412 | /*! |
| 2413 | @brief |
| 2414 | Creates a \bt_senum_fc from the trace class \bt_p{trace_class}. |
| 2415 | |
| 2416 | On success, the returned signed enumeration field class has the |
| 2417 | following property values: |
| 2418 | |
| 2419 | <table> |
| 2420 | <tr> |
| 2421 | <th>Property |
| 2422 | <th>Value |
| 2423 | <tr> |
| 2424 | <td>\ref api-tir-fc-int-prop-size "Field value range" |
| 2425 | <td>[-2<sup>63</sup>, 2<sup>63</sup> - 1] |
| 2426 | <tr> |
| 2427 | <td>\ref api-tir-fc-int-prop-base "Preferred display base" |
| 2428 | <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL |
| 2429 | <tr> |
| 2430 | <td>\ref api-tir-fc-enum-prop-mappings "Mappings" |
| 2431 | <td>\em None |
| 2432 | <tr> |
| 2433 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 2434 | <td>Empty \bt_map_val |
| 2435 | </table> |
| 2436 | |
| 2437 | @param[in] trace_class |
| 2438 | Trace class from which to create a signed enumeration field |
| 2439 | class. |
| 2440 | |
| 2441 | @returns |
| 2442 | New signed enumeration field class reference, or \c NULL on memory |
| 2443 | error. |
| 2444 | |
| 2445 | @bt_pre_not_null{trace_class} |
| 2446 | */ |
| 2447 | extern bt_field_class *bt_field_class_enumeration_signed_create( |
| 2448 | bt_trace_class *trace_class); |
| 2449 | |
| 2450 | /*! |
| 2451 | @brief |
| 2452 | Adds a mapping to the \bt_senum_fc \bt_p{field_class} having the |
| 2453 | label \bt_p{label} and the \bt_p_sint_rg \bt_p{ranges}. |
| 2454 | |
| 2455 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2456 | |
| 2457 | @param[in] field_class |
| 2458 | Signed enumeration field class to which to add a mapping having |
| 2459 | the label \bt_p{label} and the integer ranges \bt_p{ranges}. |
| 2460 | @param[in] label |
| 2461 | Label of the mapping to add to \bt_p{field_class} (copied). |
| 2462 | @param[in] ranges |
| 2463 | Signed integer ranges of the mapping to add to |
| 2464 | \bt_p{field_class}. |
| 2465 | |
| 2466 | @retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK |
| 2467 | Success. |
| 2468 | @retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR |
| 2469 | Out of memory. |
| 2470 | |
| 2471 | @bt_pre_not_null{field_class} |
| 2472 | @bt_pre_hot{field_class} |
| 2473 | @bt_pre_is_senum_fc{field_class} |
| 2474 | @bt_pre_not_null{label} |
| 2475 | @pre |
| 2476 | \bt_p{field_class} has no mapping with the label \bt_p{label}. |
| 2477 | @bt_pre_not_null{ranges} |
| 2478 | @pre |
| 2479 | \bt_p{ranges} contains one or more signed integer ranges. |
| 2480 | */ |
| 2481 | extern bt_field_class_enumeration_add_mapping_status |
| 2482 | bt_field_class_enumeration_signed_add_mapping( |
| 2483 | bt_field_class *field_class, const char *label, |
| 2484 | const bt_integer_range_set_signed *ranges); |
| 2485 | |
| 2486 | /*! |
| 2487 | @brief |
| 2488 | Borrows the mapping at index \bt_p{index} from the |
| 2489 | \bt_senum_fc \bt_p{field_class}. |
| 2490 | |
| 2491 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2492 | |
| 2493 | @param[in] field_class |
| 2494 | Signed enumeration field class from which to borrow the mapping at |
| 2495 | index \bt_p{index}. |
| 2496 | @param[in] index |
| 2497 | Index of the mapping to borrow from \bt_p{field_class}. |
| 2498 | |
| 2499 | @returns |
| 2500 | @parblock |
| 2501 | \em Borrowed reference of the mapping of |
| 2502 | \bt_p{field_class} at index \bt_p{index}. |
| 2503 | |
| 2504 | The returned pointer remains valid as long as \bt_p{field_class} |
| 2505 | is not modified. |
| 2506 | @endparblock |
| 2507 | |
| 2508 | @bt_pre_not_null{field_class} |
| 2509 | @bt_pre_is_senum_fc{field_class} |
| 2510 | @pre |
| 2511 | \bt_p{index} is less than the number of mappings in |
| 2512 | \bt_p{field_class} (as returned by |
| 2513 | bt_field_class_enumeration_get_mapping_count()). |
| 2514 | |
| 2515 | @sa bt_field_class_enumeration_get_mapping_count() — |
| 2516 | Returns the number of mappings contained in an |
| 2517 | enumeration field class. |
| 2518 | */ |
| 2519 | extern const bt_field_class_enumeration_signed_mapping * |
| 2520 | bt_field_class_enumeration_signed_borrow_mapping_by_index_const( |
| 2521 | const bt_field_class *field_class, uint64_t index); |
| 2522 | |
| 2523 | /*! |
| 2524 | @brief |
| 2525 | Borrows the mapping having the label \bt_p{label} from the |
| 2526 | \bt_senum_fc \bt_p{field_class}. |
| 2527 | |
| 2528 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2529 | |
| 2530 | If there's no mapping having the label \bt_p{label} in |
| 2531 | \bt_p{field_class}, this function returns \c NULL. |
| 2532 | |
| 2533 | @param[in] field_class |
| 2534 | Signed enumeration field class from which to borrow the mapping |
| 2535 | having the label \bt_p{label}. |
| 2536 | @param[in] label |
| 2537 | Label of the mapping to borrow from \bt_p{field_class}. |
| 2538 | |
| 2539 | @returns |
| 2540 | @parblock |
| 2541 | \em Borrowed reference of the mapping of |
| 2542 | \bt_p{field_class} having the label \bt_p{label}, or \c NULL |
| 2543 | if none. |
| 2544 | |
| 2545 | The returned pointer remains valid as long as \bt_p{field_class} |
| 2546 | is not modified. |
| 2547 | @endparblock |
| 2548 | |
| 2549 | @bt_pre_not_null{field_class} |
| 2550 | @bt_pre_is_senum_fc{field_class} |
| 2551 | @bt_pre_not_null{label} |
| 2552 | */ |
| 2553 | extern const bt_field_class_enumeration_signed_mapping * |
| 2554 | bt_field_class_enumeration_signed_borrow_mapping_by_label_const( |
| 2555 | const bt_field_class *field_class, const char *label); |
| 2556 | |
| 2557 | /*! |
| 2558 | @brief |
| 2559 | Returns an array of all the labels of the mappings of the |
| 2560 | \bt_senum_fc \bt_p{field_class} of which the \bt_p_sint_rg contain |
| 2561 | the integral value \bt_p{value}. |
| 2562 | |
| 2563 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2564 | |
| 2565 | This function sets \bt_p{*labels} to the resulting array and |
| 2566 | \bt_p{*count} to the number of labels in \bt_p{*labels}. |
| 2567 | |
| 2568 | On success, if there's no mapping ranges containing the value |
| 2569 | \bt_p{value}, \bt_p{*count} is 0. |
| 2570 | |
| 2571 | @param[in] field_class |
| 2572 | Signed enumeration field class from which to get the labels of the |
| 2573 | mappings of which the ranges contain \bt_p{value}. |
| 2574 | @param[in] value |
| 2575 | Value for which to get the mapped labels in \bt_p{field_class}. |
| 2576 | @param[out] labels |
| 2577 | @parblock |
| 2578 | <strong>On success</strong>, \bt_p{*labels} |
| 2579 | is an array of labels of the mappings of \bt_p{field_class} |
| 2580 | containing \bt_p{value}. |
| 2581 | |
| 2582 | The number of labels in \bt_p{*labels} is \bt_p{*count}. |
| 2583 | |
| 2584 | The array is owned by \bt_p{field_class} and remains valid as long |
| 2585 | as \bt_p{field_class} is not modified. |
| 2586 | @endparblock |
| 2587 | @param[out] count |
| 2588 | <strong>On success</strong>, \bt_p{*count} is the number of labels |
| 2589 | in \bt_p{*labels} (can be 0). |
| 2590 | |
| 2591 | @retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK |
| 2592 | Success. |
| 2593 | @retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR |
| 2594 | Out of memory. |
| 2595 | |
| 2596 | @bt_pre_not_null{field_class} |
| 2597 | @bt_pre_is_senum_fc{field_class} |
| 2598 | @bt_pre_not_null{labels} |
| 2599 | @bt_pre_not_null{count} |
| 2600 | */ |
| 2601 | extern bt_field_class_enumeration_get_mapping_labels_for_value_status |
| 2602 | bt_field_class_enumeration_signed_get_mapping_labels_for_value( |
| 2603 | const bt_field_class *field_class, int64_t value, |
| 2604 | bt_field_class_enumeration_mapping_label_array *labels, |
| 2605 | uint64_t *count); |
| 2606 | |
| 2607 | /*! @} */ |
| 2608 | |
| 2609 | /*! |
| 2610 | @name Signed enumeration field class mapping |
| 2611 | @{ |
| 2612 | */ |
| 2613 | |
| 2614 | /*! |
| 2615 | @typedef struct bt_field_class_enumeration_signed_mapping bt_field_class_enumeration_signed_mapping; |
| 2616 | |
| 2617 | @brief |
| 2618 | Signed enumeration field class mapping. |
| 2619 | */ |
| 2620 | |
| 2621 | /*! |
| 2622 | @brief |
| 2623 | Borrows the \bt_p_sint_rg from the \bt_senum_fc mapping |
| 2624 | \bt_p{mapping}. |
| 2625 | |
| 2626 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2627 | |
| 2628 | @param[in] mapping |
| 2629 | Signed enumeration field class mapping from which to borrow the |
| 2630 | signed integer ranges. |
| 2631 | |
| 2632 | @returns |
| 2633 | Signed integer ranges of \bt_p{mapping}. |
| 2634 | |
| 2635 | @bt_pre_not_null{mapping} |
| 2636 | */ |
| 2637 | extern const bt_integer_range_set_signed * |
| 2638 | bt_field_class_enumeration_signed_mapping_borrow_ranges_const( |
| 2639 | const bt_field_class_enumeration_signed_mapping *mapping); |
| 2640 | |
| 2641 | /*! |
| 2642 | @brief |
| 2643 | \ref api-fund-c-typing "Upcasts" the \bt_senum_fc mapping |
| 2644 | \bt_p{mapping} to the common #bt_field_class_enumeration_mapping |
| 2645 | type. |
| 2646 | |
| 2647 | See the \ref api-tir-fc-enum-prop-mappings "mappings" property. |
| 2648 | |
| 2649 | @param[in] mapping |
| 2650 | @parblock |
| 2651 | Signed enumeration field class mapping to upcast. |
| 2652 | |
| 2653 | Can be \c NULL. |
| 2654 | @endparblock |
| 2655 | |
| 2656 | @returns |
| 2657 | \bt_p{mapping} as a common enumeration field class mapping. |
| 2658 | */ |
| 2659 | static inline |
| 2660 | const bt_field_class_enumeration_mapping * |
| 2661 | bt_field_class_enumeration_signed_mapping_as_mapping_const( |
| 2662 | const bt_field_class_enumeration_signed_mapping *mapping) |
| 2663 | { |
| 2664 | return __BT_UPCAST_CONST(bt_field_class_enumeration_mapping, mapping); |
| 2665 | } |
| 2666 | |
| 2667 | /*! @} */ |
| 2668 | |
| 2669 | /*! |
| 2670 | @name String field class |
| 2671 | @{ |
| 2672 | */ |
| 2673 | |
| 2674 | /*! |
| 2675 | @brief |
| 2676 | Creates a \bt_string_fc from the trace class \bt_p{trace_class}. |
| 2677 | |
| 2678 | On success, the returned string field class has the following property |
| 2679 | value: |
| 2680 | |
| 2681 | <table> |
| 2682 | <tr> |
| 2683 | <th>Property |
| 2684 | <th>Value |
| 2685 | <tr> |
| 2686 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 2687 | <td>Empty \bt_map_val |
| 2688 | </table> |
| 2689 | |
| 2690 | @param[in] trace_class |
| 2691 | Trace class from which to create a string field class. |
| 2692 | |
| 2693 | @returns |
| 2694 | New string field class reference, or \c NULL on memory error. |
| 2695 | |
| 2696 | @bt_pre_not_null{trace_class} |
| 2697 | */ |
| 2698 | extern bt_field_class *bt_field_class_string_create( |
| 2699 | bt_trace_class *trace_class); |
| 2700 | |
| 2701 | /*! @} */ |
| 2702 | |
| 2703 | /*! |
| 2704 | @name Array field class |
| 2705 | @{ |
| 2706 | */ |
| 2707 | |
| 2708 | /*! |
| 2709 | @brief |
| 2710 | Borrows the element field class from the \bt_array_fc |
| 2711 | \bt_p{field_class}. |
| 2712 | |
| 2713 | See the \ref api-tir-fc-array-prop-elem-fc "element field class" |
| 2714 | property. |
| 2715 | |
| 2716 | @param[in] field_class |
| 2717 | Array field class from which to borrow the element field class. |
| 2718 | |
| 2719 | @returns |
| 2720 | Element field class of \bt_p{field_class}. |
| 2721 | |
| 2722 | @bt_pre_not_null{field_class} |
| 2723 | @bt_pre_is_array_fc{field_class} |
| 2724 | |
| 2725 | @sa bt_field_class_array_borrow_element_field_class_const() — |
| 2726 | \c const version of this function. |
| 2727 | */ |
| 2728 | extern bt_field_class *bt_field_class_array_borrow_element_field_class( |
| 2729 | bt_field_class *field_class); |
| 2730 | |
| 2731 | /*! |
| 2732 | @brief |
| 2733 | Borrows the element field class from the \bt_array_fc |
| 2734 | \bt_p{field_class} (\c const version). |
| 2735 | |
| 2736 | See bt_field_class_array_borrow_element_field_class(). |
| 2737 | */ |
| 2738 | extern const bt_field_class * |
| 2739 | bt_field_class_array_borrow_element_field_class_const( |
| 2740 | const bt_field_class *field_class); |
| 2741 | |
| 2742 | /*! @} */ |
| 2743 | |
| 2744 | /*! |
| 2745 | @name Static array field class |
| 2746 | @{ |
| 2747 | */ |
| 2748 | |
| 2749 | /*! |
| 2750 | @brief |
| 2751 | Creates a \bt_sarray_fc having the element field class |
| 2752 | \bt_p{element_field_class} and the length \bt_p{length} from the |
| 2753 | trace class \bt_p{trace_class}. |
| 2754 | |
| 2755 | On success, the returned static array field class has the following |
| 2756 | property values: |
| 2757 | |
| 2758 | <table> |
| 2759 | <tr> |
| 2760 | <th>Property |
| 2761 | <th>Value |
| 2762 | <tr> |
| 2763 | <td>\ref api-tir-fc-array-prop-elem-fc "Element field class" |
| 2764 | <td>\bt_p{element_field_class} |
| 2765 | <tr> |
| 2766 | <td>\ref api-tir-fc-sarray-prop-len "Length" |
| 2767 | <td>\bt_p{length} |
| 2768 | <tr> |
| 2769 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 2770 | <td>Empty \bt_map_val |
| 2771 | </table> |
| 2772 | |
| 2773 | @param[in] trace_class |
| 2774 | Trace class from which to create a static array field class. |
| 2775 | @param[in] element_field_class |
| 2776 | Class of the element fields of the instances of the static array |
| 2777 | field class to create. |
| 2778 | @param[in] length |
| 2779 | Length of the instances of the static array field class to create. |
| 2780 | |
| 2781 | @returns |
| 2782 | New static array field class reference, or \c NULL on memory error. |
| 2783 | |
| 2784 | @bt_pre_not_null{trace_class} |
| 2785 | @bt_pre_not_null{element_field_class} |
| 2786 | bt_pre_fc_not_in_tc{element_field_class} |
| 2787 | |
| 2788 | @bt_post_success_frozen{element_field_class} |
| 2789 | */ |
| 2790 | extern bt_field_class *bt_field_class_array_static_create( |
| 2791 | bt_trace_class *trace_class, |
| 2792 | bt_field_class *element_field_class, uint64_t length); |
| 2793 | |
| 2794 | /*! |
| 2795 | @brief |
| 2796 | Returns the length of the \bt_sarray_fc \bt_p{field_class}. |
| 2797 | |
| 2798 | See the \ref api-tir-fc-sarray-prop-len "length" property. |
| 2799 | |
| 2800 | @param[in] field_class |
| 2801 | Static array field class of which to get the length. |
| 2802 | |
| 2803 | @returns |
| 2804 | Length of \bt_p{field_class}. |
| 2805 | |
| 2806 | @bt_pre_not_null{field_class} |
| 2807 | @bt_pre_is_sarray_fc{field_class} |
| 2808 | */ |
| 2809 | extern uint64_t bt_field_class_array_static_get_length( |
| 2810 | const bt_field_class *field_class); |
| 2811 | |
| 2812 | /*! @} */ |
| 2813 | |
| 2814 | /*! |
| 2815 | @name Dynamic array field class |
| 2816 | @{ |
| 2817 | */ |
| 2818 | |
| 2819 | /*! |
| 2820 | @brief |
| 2821 | Creates a \bt_darray_fc having the element field class |
| 2822 | \bt_p{element_field_class} from the trace class \bt_p{trace_class}. |
| 2823 | |
| 2824 | If \bt_p{length_field_class} is not \c NULL, then the created dynamic |
| 2825 | array field class has a linked length field class. |
| 2826 | See |
| 2827 | \ref api-tir-fc-link "Field classes with links to other field classes" |
| 2828 | to learn more. |
| 2829 | |
| 2830 | On success, the returned dynamic array field class has the following |
| 2831 | property values: |
| 2832 | |
| 2833 | <table> |
| 2834 | <tr> |
| 2835 | <th>Property |
| 2836 | <th>Value |
| 2837 | <tr> |
| 2838 | <td>\ref api-tir-fc-array-prop-elem-fc "Element field class" |
| 2839 | <td>\bt_p{element_field_class} |
| 2840 | <tr> |
| 2841 | <td>\ref api-tir-fc-darray-prop-len-fp "Length field path" |
| 2842 | <td> |
| 2843 | \em None (if \bt_p{length_field_class} is not \c NULL, this |
| 2844 | property becomes available when the returned field class becomes |
| 2845 | part of an \bt_ev_cls or of a \bt_stream_cls) |
| 2846 | <tr> |
| 2847 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 2848 | <td>Empty \bt_map_val |
| 2849 | </table> |
| 2850 | |
| 2851 | @param[in] trace_class |
| 2852 | Trace class from which to create a dynamic array field class. |
| 2853 | @param[in] element_field_class |
| 2854 | Class of the element fields of the instances of the dynamic array |
| 2855 | field class to create. |
| 2856 | @param[in] length_field_class |
| 2857 | @parblock |
| 2858 | Linked length field class of the dynamic array field class to |
| 2859 | create. |
| 2860 | |
| 2861 | Can be \c NULL. |
| 2862 | @endparblock |
| 2863 | |
| 2864 | @returns |
| 2865 | New dynamic array field class reference, or \c NULL on memory error. |
| 2866 | |
| 2867 | @bt_pre_not_null{trace_class} |
| 2868 | @bt_pre_not_null{element_field_class} |
| 2869 | @bt_pre_fc_not_in_tc{element_field_class} |
| 2870 | @pre |
| 2871 | <strong>If \bt_p{length_field_class} is not \c NULL</strong>, |
| 2872 | \bt_p{length_field_class} is an \bt_uint_fc. |
| 2873 | |
| 2874 | @bt_post_success_frozen{element_field_class} |
| 2875 | @bt_post_success_frozen{length_field_class} |
| 2876 | */ |
| 2877 | extern bt_field_class *bt_field_class_array_dynamic_create( |
| 2878 | bt_trace_class *trace_class, |
| 2879 | bt_field_class *element_field_class, |
| 2880 | bt_field_class *length_field_class); |
| 2881 | |
| 2882 | /*! @} */ |
| 2883 | |
| 2884 | /*! |
| 2885 | @name Dynamic array field class with length field |
| 2886 | @{ |
| 2887 | */ |
| 2888 | |
| 2889 | /*! |
| 2890 | @brief |
| 2891 | Borrows the length field path from the \bt_darray_fc (with a length |
| 2892 | field) \bt_p{field_class}. |
| 2893 | |
| 2894 | See the \ref api-tir-fc-darray-prop-len-fp "length field path" property. |
| 2895 | |
| 2896 | This property is only available when a \bt_struct_fc containing |
| 2897 | (recursively) \bt_p{field_class} is passed to one of: |
| 2898 | |
| 2899 | - bt_stream_class_set_packet_context_field_class() |
| 2900 | - bt_stream_class_set_event_common_context_field_class() |
| 2901 | - bt_event_class_set_specific_context_field_class() |
| 2902 | - bt_event_class_set_payload_field_class() |
| 2903 | |
| 2904 | In the meantime, this function returns \c NULL. |
| 2905 | |
| 2906 | @param[in] field_class |
| 2907 | Dynamic array field class from which to borrow the length |
| 2908 | field path. |
| 2909 | |
| 2910 | @returns |
| 2911 | Length field path of \bt_p{field_class}. |
| 2912 | |
| 2913 | @bt_pre_not_null{field_class} |
| 2914 | @bt_pre_is_darray_wl_fc{field_class} |
| 2915 | */ |
| 2916 | extern const bt_field_path * |
| 2917 | bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const( |
| 2918 | const bt_field_class *field_class); |
| 2919 | |
| 2920 | /*! @} */ |
| 2921 | |
| 2922 | /*! |
| 2923 | @name Structure field class |
| 2924 | @{ |
| 2925 | */ |
| 2926 | |
| 2927 | /*! |
| 2928 | @brief |
| 2929 | Creates a \bt_struct_fc from the trace class \bt_p{trace_class}. |
| 2930 | |
| 2931 | On success, the returned structure field class has the following |
| 2932 | property values: |
| 2933 | |
| 2934 | <table> |
| 2935 | <tr> |
| 2936 | <th>Property |
| 2937 | <th>Value |
| 2938 | <tr> |
| 2939 | <td>\ref api-tir-fc-struct-prop-members "Members" |
| 2940 | <td>\em None |
| 2941 | <tr> |
| 2942 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 2943 | <td>Empty \bt_map_val |
| 2944 | </table> |
| 2945 | |
| 2946 | @param[in] trace_class |
| 2947 | Trace class from which to create a structure field class. |
| 2948 | |
| 2949 | @returns |
| 2950 | New structure field class reference, or \c NULL on memory error. |
| 2951 | |
| 2952 | @bt_pre_not_null{trace_class} |
| 2953 | */ |
| 2954 | extern bt_field_class *bt_field_class_structure_create( |
| 2955 | bt_trace_class *trace_class); |
| 2956 | |
| 2957 | /*! |
| 2958 | @brief |
| 2959 | Status codes for bt_field_class_structure_append_member(). |
| 2960 | */ |
| 2961 | typedef enum bt_field_class_structure_append_member_status { |
| 2962 | /*! |
| 2963 | @brief |
| 2964 | Success. |
| 2965 | */ |
| 2966 | BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 2967 | |
| 2968 | /*! |
| 2969 | @brief |
| 2970 | Out of memory. |
| 2971 | */ |
| 2972 | BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 2973 | } bt_field_class_structure_append_member_status; |
| 2974 | |
| 2975 | /*! |
| 2976 | @brief |
| 2977 | Appends a member to the \bt_struct_fc \bt_p{field_class} having the |
| 2978 | name \bt_p{name} and the field class \bt_p{member_field_class}. |
| 2979 | |
| 2980 | See the \ref api-tir-fc-struct-prop-members "members" property. |
| 2981 | |
| 2982 | @param[in] field_class |
| 2983 | Structure field class to which to append a member having |
| 2984 | the name \bt_p{name} and the field class \bt_p{member_field_class}. |
| 2985 | @param[in] name |
| 2986 | Name of the member to append to \bt_p{field_class} (copied). |
| 2987 | @param[in] member_field_class |
| 2988 | Field class of the member to append to \bt_p{field_class}. |
| 2989 | |
| 2990 | @retval #BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK |
| 2991 | Success. |
| 2992 | @retval #BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR |
| 2993 | Out of memory. |
| 2994 | |
| 2995 | @bt_pre_not_null{field_class} |
| 2996 | @bt_pre_hot{field_class} |
| 2997 | @bt_pre_is_struct_fc{field_class} |
| 2998 | @pre |
| 2999 | \bt_p{field_class} has no member with the name \bt_p{name}. |
| 3000 | @bt_pre_not_null{name} |
| 3001 | @bt_pre_not_null{member_field_class} |
| 3002 | @bt_pre_fc_not_in_tc{member_field_class} |
| 3003 | |
| 3004 | @bt_post_success_frozen{member_field_class} |
| 3005 | */ |
| 3006 | extern bt_field_class_structure_append_member_status |
| 3007 | bt_field_class_structure_append_member( |
| 3008 | bt_field_class *field_class, |
| 3009 | const char *name, bt_field_class *member_field_class); |
| 3010 | |
| 3011 | /*! |
| 3012 | @brief |
| 3013 | Returns the number of members contained in the \bt_struct_fc |
| 3014 | \bt_p{field_class}. |
| 3015 | |
| 3016 | See the \ref api-tir-fc-struct-prop-members "members" property. |
| 3017 | |
| 3018 | @param[in] field_class |
| 3019 | Structure field class of which to get the number of contained |
| 3020 | members. |
| 3021 | |
| 3022 | @returns |
| 3023 | Number of contained members in \bt_p{field_class}. |
| 3024 | |
| 3025 | @bt_pre_not_null{field_class} |
| 3026 | @bt_pre_is_struct_fc{field_class} |
| 3027 | */ |
| 3028 | extern uint64_t bt_field_class_structure_get_member_count( |
| 3029 | const bt_field_class *field_class); |
| 3030 | |
| 3031 | /*! |
| 3032 | @brief |
| 3033 | Borrows the member at index \bt_p{index} from the |
| 3034 | \bt_struct_fc \bt_p{field_class}. |
| 3035 | |
| 3036 | See the \ref api-tir-fc-struct-prop-members "members" property. |
| 3037 | |
| 3038 | @param[in] field_class |
| 3039 | Structure field class from which to borrow the member at |
| 3040 | index \bt_p{index}. |
| 3041 | @param[in] index |
| 3042 | Index of the member to borrow from \bt_p{field_class}. |
| 3043 | |
| 3044 | @returns |
| 3045 | @parblock |
| 3046 | \em Borrowed reference of the member of |
| 3047 | \bt_p{field_class} at index \bt_p{index}. |
| 3048 | |
| 3049 | The returned pointer remains valid as long as \bt_p{field_class} |
| 3050 | is not modified. |
| 3051 | @endparblock |
| 3052 | |
| 3053 | @bt_pre_not_null{field_class} |
| 3054 | @bt_pre_is_struct_fc{field_class} |
| 3055 | @pre |
| 3056 | \bt_p{index} is less than the number of members in |
| 3057 | \bt_p{field_class} (as returned by |
| 3058 | bt_field_class_structure_get_member_count()). |
| 3059 | |
| 3060 | @sa bt_field_class_structure_get_member_count() — |
| 3061 | Returns the number of members contained in a structure field class. |
| 3062 | @sa bt_field_class_structure_borrow_member_by_index_const() — |
| 3063 | \c const version of this function. |
| 3064 | */ |
| 3065 | extern bt_field_class_structure_member * |
| 3066 | bt_field_class_structure_borrow_member_by_index( |
| 3067 | bt_field_class *field_class, uint64_t index); |
| 3068 | |
| 3069 | /*! |
| 3070 | @brief |
| 3071 | Borrows the member at index \bt_p{index} from the |
| 3072 | \bt_struct_fc \bt_p{field_class} (\c const version). |
| 3073 | |
| 3074 | See bt_field_class_structure_borrow_member_by_index(). |
| 3075 | */ |
| 3076 | extern const bt_field_class_structure_member * |
| 3077 | bt_field_class_structure_borrow_member_by_index_const( |
| 3078 | const bt_field_class *field_class, uint64_t index); |
| 3079 | |
| 3080 | /*! |
| 3081 | @brief |
| 3082 | Borrows the member having the name \bt_p{name} from the |
| 3083 | \bt_struct_fc \bt_p{field_class}. |
| 3084 | |
| 3085 | See the \ref api-tir-fc-struct-prop-members "members" property. |
| 3086 | |
| 3087 | If there's no member having the name \bt_p{name} in |
| 3088 | \bt_p{field_class}, this function returns \c NULL. |
| 3089 | |
| 3090 | @param[in] field_class |
| 3091 | Structure field class from which to borrow the member having the |
| 3092 | name \bt_p{name}. |
| 3093 | @param[in] name |
| 3094 | Name of the member to borrow from \bt_p{field_class}. |
| 3095 | |
| 3096 | @returns |
| 3097 | @parblock |
| 3098 | \em Borrowed reference of the member of |
| 3099 | \bt_p{field_class} having the name \bt_p{name}, or \c NULL |
| 3100 | if none. |
| 3101 | |
| 3102 | The returned pointer remains valid as long as \bt_p{field_class} |
| 3103 | is not modified. |
| 3104 | @endparblock |
| 3105 | |
| 3106 | @bt_pre_not_null{field_class} |
| 3107 | @bt_pre_is_struct_fc{field_class} |
| 3108 | @bt_pre_not_null{name} |
| 3109 | |
| 3110 | @sa bt_field_class_structure_borrow_member_by_name_const() — |
| 3111 | \c const version of this function. |
| 3112 | */ |
| 3113 | extern bt_field_class_structure_member * |
| 3114 | bt_field_class_structure_borrow_member_by_name( |
| 3115 | bt_field_class *field_class, const char *name); |
| 3116 | |
| 3117 | /*! |
| 3118 | @brief |
| 3119 | Borrows the member having the name \bt_p{name} from the |
| 3120 | \bt_struct_fc \bt_p{field_class} (\c const version). |
| 3121 | |
| 3122 | See bt_field_class_structure_borrow_member_by_name(). |
| 3123 | */ |
| 3124 | extern const bt_field_class_structure_member * |
| 3125 | bt_field_class_structure_borrow_member_by_name_const( |
| 3126 | const bt_field_class *field_class, const char *name); |
| 3127 | |
| 3128 | /*! @} */ |
| 3129 | |
| 3130 | /*! |
| 3131 | @name Structure field class member |
| 3132 | @{ |
| 3133 | */ |
| 3134 | |
| 3135 | /*! |
| 3136 | @typedef struct bt_field_class_structure_member bt_field_class_structure_member; |
| 3137 | |
| 3138 | @brief |
| 3139 | Structure field class member. |
| 3140 | */ |
| 3141 | |
| 3142 | /*! |
| 3143 | @brief |
| 3144 | Returns the name of the \bt_struct_fc member \bt_p{member}. |
| 3145 | |
| 3146 | See the \ref api-tir-fc-struct-prop-members "members" property. |
| 3147 | |
| 3148 | @param[in] member |
| 3149 | Structure field class member of which to get the name. |
| 3150 | |
| 3151 | @returns |
| 3152 | @parblock |
| 3153 | Name of \bt_p{member}. |
| 3154 | |
| 3155 | The returned pointer remains valid as long as \bt_p{member} exists. |
| 3156 | @endparblock |
| 3157 | |
| 3158 | @bt_pre_not_null{member} |
| 3159 | */ |
| 3160 | extern const char *bt_field_class_structure_member_get_name( |
| 3161 | const bt_field_class_structure_member *member); |
| 3162 | |
| 3163 | /*! |
| 3164 | @brief |
| 3165 | Borrows the field class from the \bt_struct_fc member |
| 3166 | \bt_p{member}. |
| 3167 | |
| 3168 | See the \ref api-tir-fc-struct-prop-members "members" property. |
| 3169 | |
| 3170 | @param[in] member |
| 3171 | Structure field class member from which to borrow the field class. |
| 3172 | |
| 3173 | @returns |
| 3174 | Field class of \bt_p{member}. |
| 3175 | |
| 3176 | @bt_pre_not_null{member} |
| 3177 | |
| 3178 | @sa bt_field_class_structure_member_borrow_field_class_const() — |
| 3179 | \c const version of this function. |
| 3180 | */ |
| 3181 | extern bt_field_class * |
| 3182 | bt_field_class_structure_member_borrow_field_class( |
| 3183 | bt_field_class_structure_member *member); |
| 3184 | |
| 3185 | /*! |
| 3186 | @brief |
| 3187 | Borrows the field class from the \bt_struct_fc member |
| 3188 | \bt_p{member} (\c const version). |
| 3189 | |
| 3190 | See bt_field_class_structure_member_borrow_field_class(). |
| 3191 | */ |
| 3192 | extern const bt_field_class * |
| 3193 | bt_field_class_structure_member_borrow_field_class_const( |
| 3194 | const bt_field_class_structure_member *member); |
| 3195 | |
| 3196 | /*! |
| 3197 | @brief |
| 3198 | Sets the user attributes of the \bt_struct_fc member \bt_p{member} |
| 3199 | to \bt_p{user_attributes}. |
| 3200 | |
| 3201 | See the \ref api-tir-fc-struct-prop-members "members" property. |
| 3202 | |
| 3203 | @note |
| 3204 | When you append a member to a structure field class with |
| 3205 | bt_field_class_structure_append_member(), the member's |
| 3206 | initial user attributes is an empty \bt_map_val. Therefore you can |
| 3207 | borrow it with |
| 3208 | bt_field_class_structure_member_borrow_user_attributes() and fill it |
| 3209 | directly instead of setting a new one with this function. |
| 3210 | |
| 3211 | @param[in] member |
| 3212 | Structure field class member of which to set the user attributes to |
| 3213 | \bt_p{user_attributes}. |
| 3214 | @param[in] user_attributes |
| 3215 | New user attributes of \bt_p{member}. |
| 3216 | |
| 3217 | @bt_pre_not_null{member} |
| 3218 | @bt_pre_hot{member} |
| 3219 | @bt_pre_not_null{user_attributes} |
| 3220 | @bt_pre_is_map_val{user_attributes} |
| 3221 | |
| 3222 | @sa bt_field_class_structure_member_borrow_user_attributes() — |
| 3223 | Borrows the user attributes of a structure field class member. |
| 3224 | */ |
| 3225 | extern void bt_field_class_structure_member_set_user_attributes( |
| 3226 | bt_field_class_structure_member *member, |
| 3227 | const bt_value *user_attributes); |
| 3228 | |
| 3229 | /*! |
| 3230 | @brief |
| 3231 | Borrows the user attributes of the \bt_struct_fc member |
| 3232 | \bt_p{member}. |
| 3233 | |
| 3234 | See the \ref api-tir-fc-struct-prop-members "members" property. |
| 3235 | |
| 3236 | @note |
| 3237 | When you append a member to a structure field class with |
| 3238 | bt_field_class_structure_append_member(), the member's |
| 3239 | initial user attributes is an empty \bt_map_val. |
| 3240 | |
| 3241 | @param[in] member |
| 3242 | Structure field class member from which to borrow the user |
| 3243 | attributes. |
| 3244 | |
| 3245 | @returns |
| 3246 | User attributes of \bt_p{member} (a \bt_map_val). |
| 3247 | |
| 3248 | @bt_pre_not_null{member} |
| 3249 | |
| 3250 | @sa bt_field_class_structure_member_set_user_attributes() — |
| 3251 | Sets the user attributes of a structure field class member. |
| 3252 | @sa bt_field_class_structure_member_borrow_user_attributes_const() — |
| 3253 | \c const version of this function. |
| 3254 | */ |
| 3255 | extern bt_value * |
| 3256 | bt_field_class_structure_member_borrow_user_attributes( |
| 3257 | bt_field_class_structure_member *member); |
| 3258 | |
| 3259 | /*! |
| 3260 | @brief |
| 3261 | Borrows the user attributes of the \bt_struct_fc member |
| 3262 | \bt_p{member} (\c const version). |
| 3263 | |
| 3264 | See bt_field_class_structure_member_borrow_user_attributes(). |
| 3265 | */ |
| 3266 | extern const bt_value * |
| 3267 | bt_field_class_structure_member_borrow_user_attributes_const( |
| 3268 | const bt_field_class_structure_member *member); |
| 3269 | |
| 3270 | /*! @} */ |
| 3271 | |
| 3272 | /*! |
| 3273 | @name Option field class |
| 3274 | @{ |
| 3275 | */ |
| 3276 | |
| 3277 | /*! |
| 3278 | @brief |
| 3279 | Borrows the optional field class from the \bt_opt_fc |
| 3280 | \bt_p{field_class}. |
| 3281 | |
| 3282 | See the \ref api-tir-fc-opt-prop-fc "optional field class" property. |
| 3283 | |
| 3284 | @param[in] field_class |
| 3285 | Option field class from which to borrow the optional field class. |
| 3286 | |
| 3287 | @returns |
| 3288 | Optional field class of \bt_p{field_class}. |
| 3289 | |
| 3290 | @bt_pre_not_null{field_class} |
| 3291 | @bt_pre_is_opt_fc{field_class} |
| 3292 | |
| 3293 | @sa bt_field_class_option_borrow_field_class_const() — |
| 3294 | \c const version of this function. |
| 3295 | */ |
| 3296 | extern bt_field_class *bt_field_class_option_borrow_field_class( |
| 3297 | bt_field_class *field_class); |
| 3298 | |
| 3299 | /*! |
| 3300 | @brief |
| 3301 | Borrows the optional field class from the \bt_opt_fc |
| 3302 | \bt_p{field_class} (\c const version). |
| 3303 | |
| 3304 | See bt_field_class_option_borrow_field_class(). |
| 3305 | */ |
| 3306 | extern const bt_field_class * |
| 3307 | bt_field_class_option_borrow_field_class_const( |
| 3308 | const bt_field_class *field_class); |
| 3309 | |
| 3310 | /*! @} */ |
| 3311 | |
| 3312 | /*! |
| 3313 | @name Option field class without a selector field |
| 3314 | @{ |
| 3315 | */ |
| 3316 | |
| 3317 | /*! |
| 3318 | @brief |
| 3319 | Creates an \bt_opt_fc (without a selector field) having the optional |
| 3320 | field class \bt_p{optional_field_class} from the trace class |
| 3321 | \bt_p{trace_class}. |
| 3322 | |
| 3323 | On success, the returned option field class has the following property |
| 3324 | values: |
| 3325 | |
| 3326 | <table> |
| 3327 | <tr> |
| 3328 | <th>Property |
| 3329 | <th>Value |
| 3330 | <tr> |
| 3331 | <td>\ref api-tir-fc-opt-prop-fc "Optional field class" |
| 3332 | <td>\bt_p{optional_field_class} |
| 3333 | <tr> |
| 3334 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 3335 | <td>Empty \bt_map_val |
| 3336 | </table> |
| 3337 | |
| 3338 | @param[in] trace_class |
| 3339 | Trace class from which to create an option field class. |
| 3340 | @param[in] optional_field_class |
| 3341 | Class of the optional fields of the instances of the option field |
| 3342 | class to create. |
| 3343 | |
| 3344 | @returns |
| 3345 | New option field class reference, or \c NULL on memory error. |
| 3346 | |
| 3347 | @bt_pre_not_null{trace_class} |
| 3348 | @bt_pre_not_null{optional_field_class} |
| 3349 | @bt_pre_fc_not_in_tc{optional_field_class} |
| 3350 | |
| 3351 | @bt_post_success_frozen{optional_field_class} |
| 3352 | */ |
| 3353 | extern bt_field_class *bt_field_class_option_without_selector_create( |
| 3354 | bt_trace_class *trace_class, |
| 3355 | bt_field_class *optional_field_class); |
| 3356 | |
| 3357 | /*! @} */ |
| 3358 | |
| 3359 | /*! |
| 3360 | @name Option field class with a selector field |
| 3361 | @{ |
| 3362 | */ |
| 3363 | |
| 3364 | /*! |
| 3365 | @brief |
| 3366 | Borrows the selector field path from the \bt_opt_fc (with a selector |
| 3367 | field) \bt_p{field_class}. |
| 3368 | |
| 3369 | See the \ref api-tir-fc-opt-prop-sel-fp "selector field path" property. |
| 3370 | |
| 3371 | This property is only available when a \bt_struct_fc containing |
| 3372 | (recursively) \bt_p{field_class} is passed to one of: |
| 3373 | |
| 3374 | - bt_stream_class_set_packet_context_field_class() |
| 3375 | - bt_stream_class_set_event_common_context_field_class() |
| 3376 | - bt_event_class_set_specific_context_field_class() |
| 3377 | - bt_event_class_set_payload_field_class() |
| 3378 | |
| 3379 | In the meantime, this function returns \c NULL. |
| 3380 | |
| 3381 | @param[in] field_class |
| 3382 | Option field class from which to borrow the selector field path. |
| 3383 | |
| 3384 | @returns |
| 3385 | Selector field path of \bt_p{field_class}. |
| 3386 | |
| 3387 | @bt_pre_not_null{field_class} |
| 3388 | @bt_pre_is_opt_ws_fc{field_class} |
| 3389 | */ |
| 3390 | extern const bt_field_path * |
| 3391 | bt_field_class_option_with_selector_field_borrow_selector_field_path_const( |
| 3392 | const bt_field_class *field_class); |
| 3393 | |
| 3394 | /*! @} */ |
| 3395 | |
| 3396 | /*! |
| 3397 | @name Option field class with a boolean selector field |
| 3398 | @{ |
| 3399 | */ |
| 3400 | |
| 3401 | /*! |
| 3402 | @brief |
| 3403 | Creates an \bt_opt_fc (with a boolean selector field) having the |
| 3404 | optional field class \bt_p{optional_field_class} from the trace |
| 3405 | class \bt_p{trace_class}. |
| 3406 | |
| 3407 | On success, the returned option field class has the following property |
| 3408 | values: |
| 3409 | |
| 3410 | <table> |
| 3411 | <tr> |
| 3412 | <th>Property |
| 3413 | <th>Value |
| 3414 | <tr> |
| 3415 | <td>\ref api-tir-fc-opt-prop-fc "Optional field class" |
| 3416 | <td>\bt_p{optional_field_class} |
| 3417 | <tr> |
| 3418 | <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path" |
| 3419 | <td> |
| 3420 | \em None (this property becomes available when the returned field |
| 3421 | class becomes part of an \bt_ev_cls or of a \bt_stream_cls) |
| 3422 | <tr> |
| 3423 | <td>\ref api-tir-fc-opt-prop-sel-rev "Selector is reversed?" |
| 3424 | <td>#BT_FALSE |
| 3425 | <tr> |
| 3426 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 3427 | <td>Empty \bt_map_val |
| 3428 | </table> |
| 3429 | |
| 3430 | @param[in] trace_class |
| 3431 | Trace class from which to create an option field class. |
| 3432 | @param[in] optional_field_class |
| 3433 | Class of the optional fields of the instances of the option field |
| 3434 | class to create. |
| 3435 | @param[in] selector_field_class |
| 3436 | Linked selector field class of the option field class to create. |
| 3437 | |
| 3438 | @returns |
| 3439 | New option field class reference, or \c NULL on memory error. |
| 3440 | |
| 3441 | @bt_pre_not_null{trace_class} |
| 3442 | @bt_pre_not_null{optional_field_class} |
| 3443 | @bt_pre_fc_not_in_tc{optional_field_class} |
| 3444 | @bt_pre_not_null{selector_field_class} |
| 3445 | @pre |
| 3446 | \bt_p{selector_field_class} is a \bt_bool_fc. |
| 3447 | |
| 3448 | @bt_post_success_frozen{optional_field_class} |
| 3449 | @bt_post_success_frozen{selector_field_class} |
| 3450 | */ |
| 3451 | extern bt_field_class *bt_field_class_option_with_selector_field_bool_create( |
| 3452 | bt_trace_class *trace_class, |
| 3453 | bt_field_class *optional_field_class, |
| 3454 | bt_field_class *selector_field_class); |
| 3455 | |
| 3456 | /*! |
| 3457 | @brief |
| 3458 | Sets whether or not the selector of the \bt_opt_fc (with a boolean |
| 3459 | selector field) \bt_p{field_class} is reversed. |
| 3460 | |
| 3461 | See the \ref api-tir-fc-opt-prop-sel-rev "selector is reversed?" |
| 3462 | property. |
| 3463 | |
| 3464 | @param[in] field_class |
| 3465 | Option field class of which to set whether or not its selector |
| 3466 | is reversed. |
| 3467 | @param[in] selector_is_reversed |
| 3468 | #BT_TRUE to make \bt_p{field_class} have a reversed selector. |
| 3469 | |
| 3470 | @bt_pre_not_null{field_class} |
| 3471 | @bt_pre_hot{field_class} |
| 3472 | @bt_pre_is_opt_wbs_fc{field_class} |
| 3473 | |
| 3474 | @sa bt_field_class_option_with_selector_field_bool_selector_is_reversed() — |
| 3475 | Returns whether or not the selector of an option field class (with |
| 3476 | a boolean selector field) is reversed. |
| 3477 | */ |
| 3478 | extern void |
| 3479 | bt_field_class_option_with_selector_field_bool_set_selector_is_reversed( |
| 3480 | bt_field_class *field_class, bt_bool selector_is_reversed); |
| 3481 | |
| 3482 | /*! |
| 3483 | @brief |
| 3484 | Returns whether or not the selector of the |
| 3485 | \bt_opt_fc (with a boolean selector field) is reversed. |
| 3486 | |
| 3487 | See the \ref api-tir-fc-opt-prop-sel-rev "selector is reversed?" |
| 3488 | property. |
| 3489 | |
| 3490 | @param[in] field_class |
| 3491 | Option field class of which to get whether or not its selector is |
| 3492 | reversed. |
| 3493 | |
| 3494 | @returns |
| 3495 | #BT_TRUE if the selector of \bt_p{field_class} is reversed. |
| 3496 | |
| 3497 | @bt_pre_not_null{field_class} |
| 3498 | @bt_pre_is_opt_wbs_fc{field_class} |
| 3499 | |
| 3500 | @sa bt_field_class_option_with_selector_field_bool_set_selector_is_reversed() — |
| 3501 | Sets whether or not the selector of an option field class (with |
| 3502 | a boolean selector field) is reversed. |
| 3503 | */ |
| 3504 | extern bt_bool |
| 3505 | bt_field_class_option_with_selector_field_bool_selector_is_reversed( |
| 3506 | const bt_field_class *field_class); |
| 3507 | |
| 3508 | /*! @} */ |
| 3509 | |
| 3510 | /*! |
| 3511 | @name Option field class with an unsigned integer selector field |
| 3512 | @{ |
| 3513 | */ |
| 3514 | |
| 3515 | /*! |
| 3516 | @brief |
| 3517 | Creates an \bt_opt_fc (with an unsigned integer selector field) |
| 3518 | having the optional field class \bt_p{optional_field_class} from the |
| 3519 | trace class \bt_p{trace_class}. |
| 3520 | |
| 3521 | On success, the returned option field class has the following property |
| 3522 | values: |
| 3523 | |
| 3524 | <table> |
| 3525 | <tr> |
| 3526 | <th>Property |
| 3527 | <th>Value |
| 3528 | <tr> |
| 3529 | <td>\ref api-tir-fc-opt-prop-fc "Optional field class" |
| 3530 | <td>\bt_p{optional_field_class} |
| 3531 | <tr> |
| 3532 | <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path" |
| 3533 | <td> |
| 3534 | \em None (this property becomes available when the returned field |
| 3535 | class becomes part of an \bt_ev_cls or of a \bt_stream_cls) |
| 3536 | <tr> |
| 3537 | <td>\ref api-tir-fc-opt-prop-uint-rs "Selector's unsigned integer ranges" |
| 3538 | <td>\bt_p{ranges} |
| 3539 | <tr> |
| 3540 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 3541 | <td>Empty \bt_map_val |
| 3542 | </table> |
| 3543 | |
| 3544 | @param[in] trace_class |
| 3545 | Trace class from which to create an option field class. |
| 3546 | @param[in] optional_field_class |
| 3547 | Class of the optional fields of the instances of the option field |
| 3548 | class to create. |
| 3549 | @param[in] selector_field_class |
| 3550 | Linked selector field class of the option field class to create. |
| 3551 | @param[in] ranges |
| 3552 | Selector's unsigned integer ranges of the option field class to |
| 3553 | create. |
| 3554 | |
| 3555 | @returns |
| 3556 | New option field class reference, or \c NULL on memory error. |
| 3557 | |
| 3558 | @bt_pre_not_null{trace_class} |
| 3559 | @bt_pre_not_null{optional_field_class} |
| 3560 | @bt_pre_fc_not_in_tc{optional_field_class} |
| 3561 | @bt_pre_not_null{selector_field_class} |
| 3562 | @pre |
| 3563 | \bt_p{selector_field_class} is a \bt_uint_fc. |
| 3564 | @bt_pre_not_null{ranges} |
| 3565 | @pre |
| 3566 | \bt_p{ranges} contains one or more \bt_p_uint_rg. |
| 3567 | |
| 3568 | @bt_post_success_frozen{optional_field_class} |
| 3569 | @bt_post_success_frozen{selector_field_class} |
| 3570 | @bt_post_success_frozen{ranges} |
| 3571 | */ |
| 3572 | extern bt_field_class * |
| 3573 | bt_field_class_option_with_selector_field_integer_unsigned_create( |
| 3574 | bt_trace_class *trace_class, |
| 3575 | bt_field_class *optional_field_class, |
| 3576 | bt_field_class *selector_field_class, |
| 3577 | const bt_integer_range_set_unsigned *ranges); |
| 3578 | |
| 3579 | /*! |
| 3580 | @brief |
| 3581 | Borrows the \bt_p_uint_rg from the \bt_opt_fc (with an unsigned |
| 3582 | integer selector field) \bt_p{field_class}. |
| 3583 | |
| 3584 | See the |
| 3585 | \ref api-tir-fc-opt-prop-uint-rs "selector's unsigned integer ranges" |
| 3586 | property. |
| 3587 | |
| 3588 | @param[in] field_class |
| 3589 | Option field class from which to borrow the unsigned integer ranges. |
| 3590 | |
| 3591 | @returns |
| 3592 | Unsigned integer ranges of \bt_p{field_class}. |
| 3593 | |
| 3594 | @bt_pre_not_null{field_class} |
| 3595 | @bt_pre_is_opt_wuis_fc{field_class} |
| 3596 | */ |
| 3597 | extern const bt_integer_range_set_unsigned * |
| 3598 | bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const( |
| 3599 | const bt_field_class *field_class); |
| 3600 | |
| 3601 | /*! @} */ |
| 3602 | |
| 3603 | /*! |
| 3604 | @name Option field class with a signed integer selector field |
| 3605 | @{ |
| 3606 | */ |
| 3607 | |
| 3608 | /*! |
| 3609 | @brief |
| 3610 | Creates an \bt_opt_fc (with a signed integer selector field) |
| 3611 | having the optional field class \bt_p{optional_field_class} from the |
| 3612 | trace class \bt_p{trace_class}. |
| 3613 | |
| 3614 | On success, the returned option field class has the following property |
| 3615 | values: |
| 3616 | |
| 3617 | <table> |
| 3618 | <tr> |
| 3619 | <th>Property |
| 3620 | <th>Value |
| 3621 | <tr> |
| 3622 | <td>\ref api-tir-fc-opt-prop-fc "Optional field class" |
| 3623 | <td>\bt_p{optional_field_class} |
| 3624 | <tr> |
| 3625 | <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path" |
| 3626 | <td> |
| 3627 | \em None (this property becomes available when the returned field |
| 3628 | class becomes part of an \bt_ev_cls or of a \bt_stream_cls) |
| 3629 | <tr> |
| 3630 | <td>\ref api-tir-fc-opt-prop-sint-rs "Selector's signed integer ranges" |
| 3631 | <td>\bt_p{ranges} |
| 3632 | <tr> |
| 3633 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 3634 | <td>Empty \bt_map_val |
| 3635 | </table> |
| 3636 | |
| 3637 | @param[in] trace_class |
| 3638 | Trace class from which to create an option field class. |
| 3639 | @param[in] optional_field_class |
| 3640 | Class of the optional fields of the instances of the option field |
| 3641 | class to create. |
| 3642 | @param[in] selector_field_class |
| 3643 | Linked selector field class of the option field class to create. |
| 3644 | @param[in] ranges |
| 3645 | Selector's signed integer ranges of the option field class to |
| 3646 | create. |
| 3647 | |
| 3648 | @returns |
| 3649 | New option field class reference, or \c NULL on memory error. |
| 3650 | |
| 3651 | @bt_pre_not_null{trace_class} |
| 3652 | @bt_pre_not_null{optional_field_class} |
| 3653 | @bt_pre_fc_not_in_tc{optional_field_class} |
| 3654 | @bt_pre_not_null{selector_field_class} |
| 3655 | @pre |
| 3656 | \bt_p{selector_field_class} is a \bt_uint_fc. |
| 3657 | @bt_pre_not_null{ranges} |
| 3658 | @pre |
| 3659 | \bt_p{ranges} contains one or more \bt_p_uint_rg. |
| 3660 | |
| 3661 | @bt_post_success_frozen{optional_field_class} |
| 3662 | @bt_post_success_frozen{selector_field_class} |
| 3663 | @bt_post_success_frozen{ranges} |
| 3664 | */ |
| 3665 | extern bt_field_class * |
| 3666 | bt_field_class_option_with_selector_field_integer_signed_create( |
| 3667 | bt_trace_class *trace_class, |
| 3668 | bt_field_class *optional_field_class, |
| 3669 | bt_field_class *selector_field_class, |
| 3670 | const bt_integer_range_set_signed *ranges); |
| 3671 | |
| 3672 | /*! |
| 3673 | @brief |
| 3674 | Borrows the \bt_p_sint_rg from the \bt_opt_fc (with a signed |
| 3675 | integer selector field) \bt_p{field_class}. |
| 3676 | |
| 3677 | See the |
| 3678 | \ref api-tir-fc-opt-prop-sint-rs "selector's signed integer ranges" |
| 3679 | property. |
| 3680 | |
| 3681 | @param[in] field_class |
| 3682 | Option field class from which to borrow the signed integer ranges. |
| 3683 | |
| 3684 | @returns |
| 3685 | Signed integer ranges of \bt_p{field_class}. |
| 3686 | |
| 3687 | @bt_pre_not_null{field_class} |
| 3688 | @bt_pre_is_opt_wsis_fc{field_class} |
| 3689 | */ |
| 3690 | extern const bt_integer_range_set_signed * |
| 3691 | bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const( |
| 3692 | const bt_field_class *field_class); |
| 3693 | |
| 3694 | /*! @} */ |
| 3695 | |
| 3696 | /*! |
| 3697 | @name Variant field class |
| 3698 | @{ |
| 3699 | */ |
| 3700 | |
| 3701 | /*! |
| 3702 | @brief |
| 3703 | Creates a \bt_var_fc from the trace class \bt_p{trace_class}. |
| 3704 | |
| 3705 | If \bt_p{selector_field_class} is not \c NULL, then the created variant |
| 3706 | field class has a linked selector field class. |
| 3707 | See |
| 3708 | \ref api-tir-fc-link "Field classes with links to other field classes" |
| 3709 | to learn more. |
| 3710 | |
| 3711 | On success, the returned variant field class has the following |
| 3712 | property values: |
| 3713 | |
| 3714 | <table> |
| 3715 | <tr> |
| 3716 | <th>Property |
| 3717 | <th>Value |
| 3718 | <tr> |
| 3719 | <td>\ref api-tir-fc-var-prop-sel-fp "Selector field path" |
| 3720 | <td> |
| 3721 | \em None (if \bt_p{selector_field_class} is not \c NULL, this |
| 3722 | property becomes available when the returned field class becomes |
| 3723 | part of an \bt_ev_cls or of a \bt_stream_cls) |
| 3724 | <tr> |
| 3725 | <td>\ref api-tir-fc-var-prop-opts "Options" |
| 3726 | <td>\em None |
| 3727 | <tr> |
| 3728 | <td>\ref api-tir-fc-prop-user-attrs "User attributes" |
| 3729 | <td>Empty \bt_map_val |
| 3730 | </table> |
| 3731 | |
| 3732 | @param[in] trace_class |
| 3733 | Trace class from which to create a variant field class. |
| 3734 | @param[in] selector_field_class |
| 3735 | @parblock |
| 3736 | Linked selector field class of the variant field class to create. |
| 3737 | |
| 3738 | Can be \c NULL. |
| 3739 | @endparblock |
| 3740 | |
| 3741 | @returns |
| 3742 | New variant field class reference, or \c NULL on memory error. |
| 3743 | |
| 3744 | @bt_pre_not_null{trace_class} |
| 3745 | @pre |
| 3746 | <strong>If \bt_p{selector_field_class} is not \c NULL</strong>, |
| 3747 | \bt_p{selector_field_class} is an \bt_int_fc. |
| 3748 | |
| 3749 | @bt_post_success_frozen{element_field_class} |
| 3750 | @bt_post_success_frozen{selector_field_class} |
| 3751 | */ |
| 3752 | extern bt_field_class *bt_field_class_variant_create( |
| 3753 | bt_trace_class *trace_class, |
| 3754 | bt_field_class *selector_field_class); |
| 3755 | |
| 3756 | /*! |
| 3757 | @brief |
| 3758 | Returns the number of options contained in the \bt_var_fc |
| 3759 | \bt_p{field_class}. |
| 3760 | |
| 3761 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 3762 | |
| 3763 | @param[in] field_class |
| 3764 | Variant field class of which to get the number of contained |
| 3765 | options. |
| 3766 | |
| 3767 | @returns |
| 3768 | Number of contained options in \bt_p{field_class}. |
| 3769 | |
| 3770 | @bt_pre_not_null{field_class} |
| 3771 | @bt_pre_is_var_fc{field_class} |
| 3772 | */ |
| 3773 | extern uint64_t bt_field_class_variant_get_option_count( |
| 3774 | const bt_field_class *field_class); |
| 3775 | |
| 3776 | /*! |
| 3777 | @brief |
| 3778 | Borrows the option at index \bt_p{index} from the |
| 3779 | \bt_var_fc \bt_p{field_class}. |
| 3780 | |
| 3781 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 3782 | |
| 3783 | @param[in] field_class |
| 3784 | Variant field class from which to borrow the option at |
| 3785 | index \bt_p{index}. |
| 3786 | @param[in] index |
| 3787 | Index of the option to borrow from \bt_p{field_class}. |
| 3788 | |
| 3789 | @returns |
| 3790 | @parblock |
| 3791 | \em Borrowed reference of the option of |
| 3792 | \bt_p{field_class} at index \bt_p{index}. |
| 3793 | |
| 3794 | The returned pointer remains valid as long as \bt_p{field_class} |
| 3795 | is not modified. |
| 3796 | @endparblock |
| 3797 | |
| 3798 | @bt_pre_not_null{field_class} |
| 3799 | @bt_pre_is_var_fc{field_class} |
| 3800 | @pre |
| 3801 | \bt_p{index} is less than the number of options in |
| 3802 | \bt_p{field_class} (as returned by |
| 3803 | bt_field_class_variant_get_option_count()). |
| 3804 | |
| 3805 | @sa bt_field_class_variant_get_option_count() — |
| 3806 | Returns the number of options contained in a variant field class. |
| 3807 | @sa bt_field_class_variant_borrow_option_by_index_const() — |
| 3808 | \c const version of this function. |
| 3809 | */ |
| 3810 | extern bt_field_class_variant_option * |
| 3811 | bt_field_class_variant_borrow_option_by_index( |
| 3812 | bt_field_class *field_class, uint64_t index); |
| 3813 | |
| 3814 | /*! |
| 3815 | @brief |
| 3816 | Borrows the option at index \bt_p{index} from the |
| 3817 | \bt_var_fc \bt_p{field_class} (\c const version). |
| 3818 | |
| 3819 | See bt_field_class_variant_borrow_option_by_index(). |
| 3820 | */ |
| 3821 | extern const bt_field_class_variant_option * |
| 3822 | bt_field_class_variant_borrow_option_by_index_const( |
| 3823 | const bt_field_class *field_class, uint64_t index); |
| 3824 | |
| 3825 | /*! |
| 3826 | @brief |
| 3827 | Borrows the option having the name \bt_p{name} from the |
| 3828 | \bt_var_fc \bt_p{field_class}. |
| 3829 | |
| 3830 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 3831 | |
| 3832 | If there's no option having the name \bt_p{name} in |
| 3833 | \bt_p{field_class}, this function returns \c NULL. |
| 3834 | |
| 3835 | @param[in] field_class |
| 3836 | Variant field class from which to borrow the option having the |
| 3837 | name \bt_p{name}. |
| 3838 | @param[in] name |
| 3839 | Name of the option to borrow from \bt_p{field_class}. |
| 3840 | |
| 3841 | @returns |
| 3842 | @parblock |
| 3843 | \em Borrowed reference of the option of |
| 3844 | \bt_p{field_class} having the name \bt_p{name}, or \c NULL |
| 3845 | if none. |
| 3846 | |
| 3847 | The returned pointer remains valid as long as \bt_p{field_class} |
| 3848 | is not modified. |
| 3849 | @endparblock |
| 3850 | |
| 3851 | @bt_pre_not_null{field_class} |
| 3852 | @bt_pre_is_var_fc{field_class} |
| 3853 | @bt_pre_not_null{name} |
| 3854 | |
| 3855 | @sa bt_field_class_variant_borrow_option_by_name_const() — |
| 3856 | \c const version of this function. |
| 3857 | */ |
| 3858 | extern bt_field_class_variant_option * |
| 3859 | bt_field_class_variant_borrow_option_by_name( |
| 3860 | bt_field_class *field_class, const char *name); |
| 3861 | |
| 3862 | /*! |
| 3863 | @brief |
| 3864 | Borrows the option having the name \bt_p{name} from the |
| 3865 | \bt_var_fc \bt_p{field_class} (\c const version). |
| 3866 | |
| 3867 | See bt_field_class_variant_borrow_option_by_name(). |
| 3868 | */ |
| 3869 | extern const bt_field_class_variant_option * |
| 3870 | bt_field_class_variant_borrow_option_by_name_const( |
| 3871 | const bt_field_class *field_class, const char *name); |
| 3872 | |
| 3873 | /*! @} */ |
| 3874 | |
| 3875 | /*! |
| 3876 | @name Variant field class option |
| 3877 | @{ |
| 3878 | */ |
| 3879 | |
| 3880 | /*! |
| 3881 | @typedef struct bt_field_class_variant_option bt_field_class_variant_option; |
| 3882 | |
| 3883 | @brief |
| 3884 | Variant field class option. |
| 3885 | */ |
| 3886 | |
| 3887 | /*! |
| 3888 | @brief |
| 3889 | Returns the name of the \bt_var_fc option \bt_p{option}. |
| 3890 | |
| 3891 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 3892 | |
| 3893 | @param[in] option |
| 3894 | Variant field class option of which to get the name. |
| 3895 | |
| 3896 | @returns |
| 3897 | @parblock |
| 3898 | Name of \bt_p{option}. |
| 3899 | |
| 3900 | The returned pointer remains valid as long as \bt_p{option} exists. |
| 3901 | @endparblock |
| 3902 | |
| 3903 | @bt_pre_not_null{option} |
| 3904 | */ |
| 3905 | extern const char *bt_field_class_variant_option_get_name( |
| 3906 | const bt_field_class_variant_option *option); |
| 3907 | |
| 3908 | /*! |
| 3909 | @brief |
| 3910 | Borrows the field class from the \bt_var_fc option |
| 3911 | \bt_p{option}. |
| 3912 | |
| 3913 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 3914 | |
| 3915 | @param[in] option |
| 3916 | Variant field class option from which to borrow the field class. |
| 3917 | |
| 3918 | @returns |
| 3919 | Field class of \bt_p{option}. |
| 3920 | |
| 3921 | @bt_pre_not_null{option} |
| 3922 | |
| 3923 | @sa bt_field_class_variant_option_borrow_field_class_const() — |
| 3924 | \c const version of this function. |
| 3925 | */ |
| 3926 | extern bt_field_class *bt_field_class_variant_option_borrow_field_class( |
| 3927 | bt_field_class_variant_option *option); |
| 3928 | |
| 3929 | /*! |
| 3930 | @brief |
| 3931 | Borrows the field class from the \bt_var_fc option |
| 3932 | \bt_p{option} (\c const version). |
| 3933 | |
| 3934 | See bt_field_class_variant_option_borrow_field_class(). |
| 3935 | */ |
| 3936 | extern const bt_field_class * |
| 3937 | bt_field_class_variant_option_borrow_field_class_const( |
| 3938 | const bt_field_class_variant_option *option); |
| 3939 | |
| 3940 | /*! |
| 3941 | @brief |
| 3942 | Sets the user attributes of the \bt_var_fc option \bt_p{option} |
| 3943 | to \bt_p{user_attributes}. |
| 3944 | |
| 3945 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 3946 | |
| 3947 | @note |
| 3948 | When you append an option to a variant field class with |
| 3949 | bt_field_class_variant_without_selector_append_option(), |
| 3950 | bt_field_class_variant_with_selector_field_integer_unsigned_append_option(), |
| 3951 | or |
| 3952 | bt_field_class_variant_with_selector_field_integer_signed_append_option(), |
| 3953 | the option's initial user attributes is an empty \bt_map_val. |
| 3954 | Therefore you can borrow it with |
| 3955 | bt_field_class_variant_option_borrow_user_attributes() and fill it |
| 3956 | directly instead of setting a new one with this function. |
| 3957 | |
| 3958 | @param[in] option |
| 3959 | Variant field class option of which to set the user attributes to |
| 3960 | \bt_p{user_attributes}. |
| 3961 | @param[in] user_attributes |
| 3962 | New user attributes of \bt_p{option}. |
| 3963 | |
| 3964 | @bt_pre_not_null{option} |
| 3965 | @bt_pre_hot{option} |
| 3966 | @bt_pre_not_null{user_attributes} |
| 3967 | @bt_pre_is_map_val{user_attributes} |
| 3968 | |
| 3969 | @sa bt_field_class_variant_option_borrow_user_attributes() — |
| 3970 | Borrows the user attributes of a variant field class option. |
| 3971 | */ |
| 3972 | extern void bt_field_class_variant_option_set_user_attributes( |
| 3973 | bt_field_class_variant_option *option, |
| 3974 | const bt_value *user_attributes); |
| 3975 | |
| 3976 | /*! |
| 3977 | @brief |
| 3978 | Borrows the user attributes of the \bt_var_fc option \bt_p{option}. |
| 3979 | |
| 3980 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 3981 | |
| 3982 | @note |
| 3983 | When you append an option to a variant field class with |
| 3984 | bt_field_class_variant_without_selector_append_option(), |
| 3985 | bt_field_class_variant_with_selector_field_integer_unsigned_append_option(), |
| 3986 | or |
| 3987 | bt_field_class_variant_with_selector_field_integer_signed_append_option(), |
| 3988 | the option's initial user attributes is an empty \bt_map_val. |
| 3989 | |
| 3990 | @param[in] option |
| 3991 | Variant field class option from which to borrow the user |
| 3992 | attributes. |
| 3993 | |
| 3994 | @returns |
| 3995 | User attributes of \bt_p{option} (a \bt_map_val). |
| 3996 | |
| 3997 | @bt_pre_not_null{option} |
| 3998 | |
| 3999 | @sa bt_field_class_variant_option_set_user_attributes() — |
| 4000 | Sets the user attributes of a variant field class option. |
| 4001 | @sa bt_field_class_variant_option_borrow_user_attributes_const() — |
| 4002 | \c const version of this function. |
| 4003 | */ |
| 4004 | extern bt_value *bt_field_class_variant_option_borrow_user_attributes( |
| 4005 | bt_field_class_variant_option *option); |
| 4006 | |
| 4007 | /*! |
| 4008 | @brief |
| 4009 | Borrows the user attributes of the \bt_var_fc option \bt_p{option} |
| 4010 | (\c const version). |
| 4011 | |
| 4012 | See bt_field_class_variant_option_borrow_user_attributes(). |
| 4013 | */ |
| 4014 | extern const bt_value *bt_field_class_variant_option_borrow_user_attributes_const( |
| 4015 | const bt_field_class_variant_option *option); |
| 4016 | |
| 4017 | /*! @} */ |
| 4018 | |
| 4019 | /*! |
| 4020 | @name Variant field class without a selector field |
| 4021 | @{ |
| 4022 | */ |
| 4023 | |
| 4024 | /*! |
| 4025 | @brief |
| 4026 | Status codes for |
| 4027 | bt_field_class_variant_without_selector_append_option(). |
| 4028 | */ |
| 4029 | typedef enum bt_field_class_variant_without_selector_append_option_status { |
| 4030 | /*! |
| 4031 | @brief |
| 4032 | Success. |
| 4033 | */ |
| 4034 | BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 4035 | |
| 4036 | /*! |
| 4037 | @brief |
| 4038 | Out of memory. |
| 4039 | */ |
| 4040 | BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 4041 | } bt_field_class_variant_without_selector_append_option_status; |
| 4042 | |
| 4043 | /*! |
| 4044 | @brief |
| 4045 | Appends an option to the \bt_var_fc (without a selector field) |
| 4046 | \bt_p{field_class} having the name \bt_p{name} and the |
| 4047 | field class \bt_p{option_field_class}. |
| 4048 | |
| 4049 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4050 | |
| 4051 | @param[in] field_class |
| 4052 | Variant field class to which to append an option having |
| 4053 | the name \bt_p{name} and the field class \bt_p{option_field_class}. |
| 4054 | @param[in] name |
| 4055 | Name of the option to append to \bt_p{field_class} (copied). |
| 4056 | @param[in] option_field_class |
| 4057 | Field class of the option to append to \bt_p{field_class}. |
| 4058 | |
| 4059 | @retval #BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK |
| 4060 | Success. |
| 4061 | @retval #BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR |
| 4062 | Out of memory. |
| 4063 | |
| 4064 | @bt_pre_not_null{field_class} |
| 4065 | @bt_pre_hot{field_class} |
| 4066 | @bt_pre_is_var_wos_fc{field_class} |
| 4067 | @pre |
| 4068 | \bt_p{field_class} has no option with the name \bt_p{name}. |
| 4069 | @bt_pre_not_null{name} |
| 4070 | @bt_pre_not_null{option_field_class} |
| 4071 | @bt_pre_fc_not_in_tc{option_field_class} |
| 4072 | |
| 4073 | @bt_post_success_frozen{option_field_class} |
| 4074 | */ |
| 4075 | extern bt_field_class_variant_without_selector_append_option_status |
| 4076 | bt_field_class_variant_without_selector_append_option( |
| 4077 | bt_field_class *field_class, const char *name, |
| 4078 | bt_field_class *option_field_class); |
| 4079 | |
| 4080 | /*! @} */ |
| 4081 | |
| 4082 | /*! |
| 4083 | @name Variant field class with a selector field |
| 4084 | @{ |
| 4085 | */ |
| 4086 | |
| 4087 | /*! |
| 4088 | @brief |
| 4089 | Status codes for |
| 4090 | bt_field_class_variant_with_selector_field_integer_unsigned_append_option() |
| 4091 | and |
| 4092 | bt_field_class_variant_with_selector_field_integer_signed_append_option(). |
| 4093 | */ |
| 4094 | typedef enum bt_field_class_variant_with_selector_field_integer_append_option_status { |
| 4095 | /*! |
| 4096 | @brief |
| 4097 | Success. |
| 4098 | */ |
| 4099 | BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 4100 | |
| 4101 | /*! |
| 4102 | @brief |
| 4103 | Out of memory. |
| 4104 | */ |
| 4105 | BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 4106 | } bt_field_class_variant_with_selector_field_integer_append_option_status; |
| 4107 | |
| 4108 | /*! |
| 4109 | @brief |
| 4110 | Borrows the selector field path from the \bt_var_fc (with a selector |
| 4111 | field) \bt_p{field_class}. |
| 4112 | |
| 4113 | See the \ref api-tir-fc-var-prop-sel-fp "selector field path" property. |
| 4114 | |
| 4115 | This property is only available when a \bt_struct_fc containing |
| 4116 | (recursively) \bt_p{field_class} is passed to one of: |
| 4117 | |
| 4118 | - bt_stream_class_set_packet_context_field_class() |
| 4119 | - bt_stream_class_set_event_common_context_field_class() |
| 4120 | - bt_event_class_set_specific_context_field_class() |
| 4121 | - bt_event_class_set_payload_field_class() |
| 4122 | |
| 4123 | In the meantime, this function returns \c NULL. |
| 4124 | |
| 4125 | @param[in] field_class |
| 4126 | Variant field class from which to borrow the selector field path. |
| 4127 | |
| 4128 | @returns |
| 4129 | Selector field path of \bt_p{field_class}. |
| 4130 | |
| 4131 | @bt_pre_not_null{field_class} |
| 4132 | @bt_pre_is_var_ws_fc{field_class} |
| 4133 | */ |
| 4134 | extern const bt_field_path * |
| 4135 | bt_field_class_variant_with_selector_field_borrow_selector_field_path_const( |
| 4136 | const bt_field_class *field_class); |
| 4137 | |
| 4138 | /*! @} */ |
| 4139 | |
| 4140 | /*! |
| 4141 | @name Variant field class with an unsigned integer selector field |
| 4142 | @{ |
| 4143 | */ |
| 4144 | |
| 4145 | /*! |
| 4146 | @brief |
| 4147 | Appends an option to the \bt_var_fc (with an unsigned integer |
| 4148 | selector field) \bt_p{field_class} having the name \bt_p{name}, |
| 4149 | the field class \bt_p{option_field_class}, and the |
| 4150 | \bt_p_uint_rg \bt_p{ranges}. |
| 4151 | |
| 4152 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4153 | |
| 4154 | @param[in] field_class |
| 4155 | Variant field class to which to append an option having |
| 4156 | the name \bt_p{name}, the field class \bt_p{option_field_class}, |
| 4157 | and the unsigned integer ranges \bt_p{ranges}. |
| 4158 | @param[in] name |
| 4159 | Name of the option to append to \bt_p{field_class} (copied). |
| 4160 | @param[in] option_field_class |
| 4161 | Field class of the option to append to \bt_p{field_class}. |
| 4162 | @param[in] ranges |
| 4163 | Unsigned integer ranges of the option to append to |
| 4164 | \bt_p{field_class}. |
| 4165 | |
| 4166 | @retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK |
| 4167 | Success. |
| 4168 | @retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR |
| 4169 | Out of memory. |
| 4170 | |
| 4171 | @bt_pre_not_null{field_class} |
| 4172 | @bt_pre_hot{field_class} |
| 4173 | @bt_pre_is_var_wuis_fc{field_class} |
| 4174 | @pre |
| 4175 | \bt_p{field_class} has no option with the name \bt_p{name}. |
| 4176 | @bt_pre_not_null{name} |
| 4177 | @bt_pre_not_null{option_field_class} |
| 4178 | @bt_pre_fc_not_in_tc{option_field_class} |
| 4179 | @bt_pre_not_null{Ĺ—anges} |
| 4180 | @pre |
| 4181 | \bt_p{ranges} contains one or more unsigned integer ranges. |
| 4182 | @pre |
| 4183 | The unsigned integer ranges in \bt_p{ranges} do not overlap |
| 4184 | any unsigned integer range of any existing option in |
| 4185 | \bt_p{field_class}. |
| 4186 | |
| 4187 | @bt_post_success_frozen{option_field_class} |
| 4188 | */ |
| 4189 | extern bt_field_class_variant_with_selector_field_integer_append_option_status |
| 4190 | bt_field_class_variant_with_selector_field_integer_unsigned_append_option( |
| 4191 | bt_field_class *field_class, const char *name, |
| 4192 | bt_field_class *option_field_class, |
| 4193 | const bt_integer_range_set_unsigned *ranges); |
| 4194 | |
| 4195 | /*! |
| 4196 | @brief |
| 4197 | Borrows the option at index \bt_p{index} from the |
| 4198 | \bt_var_fc (with an unsigned integer selector field) |
| 4199 | \bt_p{field_class}. |
| 4200 | |
| 4201 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4202 | |
| 4203 | @param[in] field_class |
| 4204 | Variant field class from which to borrow the option at |
| 4205 | index \bt_p{index}. |
| 4206 | @param[in] index |
| 4207 | Index of the option to borrow from \bt_p{field_class}. |
| 4208 | |
| 4209 | @returns |
| 4210 | @parblock |
| 4211 | \em Borrowed reference of the option of |
| 4212 | \bt_p{field_class} at index \bt_p{index}. |
| 4213 | |
| 4214 | The returned pointer remains valid as long as \bt_p{field_class} |
| 4215 | is not modified. |
| 4216 | @endparblock |
| 4217 | |
| 4218 | @bt_pre_not_null{field_class} |
| 4219 | @bt_pre_is_var_wuis_fc{field_class} |
| 4220 | @pre |
| 4221 | \bt_p{index} is less than the number of options in |
| 4222 | \bt_p{field_class} (as returned by |
| 4223 | bt_field_class_variant_get_option_count()). |
| 4224 | |
| 4225 | @sa bt_field_class_variant_get_option_count() — |
| 4226 | Returns the number of options contained in a variant field class. |
| 4227 | */ |
| 4228 | extern const bt_field_class_variant_with_selector_field_integer_unsigned_option * |
| 4229 | bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const( |
| 4230 | const bt_field_class *field_class, uint64_t index); |
| 4231 | |
| 4232 | /*! |
| 4233 | @brief |
| 4234 | Borrows the option having the name \bt_p{name} from the |
| 4235 | \bt_var_fc (with an unsigned integer selector field) |
| 4236 | \bt_p{field_class}. |
| 4237 | |
| 4238 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4239 | |
| 4240 | If there's no option having the name \bt_p{name} in |
| 4241 | \bt_p{field_class}, this function returns \c NULL. |
| 4242 | |
| 4243 | @param[in] field_class |
| 4244 | Variant field class from which to borrow the option having the |
| 4245 | name \bt_p{name}. |
| 4246 | @param[in] name |
| 4247 | Name of the option to borrow from \bt_p{field_class}. |
| 4248 | |
| 4249 | @returns |
| 4250 | @parblock |
| 4251 | \em Borrowed reference of the option of |
| 4252 | \bt_p{field_class} having the name \bt_p{name}, or \c NULL |
| 4253 | if none. |
| 4254 | |
| 4255 | The returned pointer remains valid as long as \bt_p{field_class} |
| 4256 | is not modified. |
| 4257 | @endparblock |
| 4258 | |
| 4259 | @bt_pre_not_null{field_class} |
| 4260 | @bt_pre_is_var_wuis_fc{field_class} |
| 4261 | @bt_pre_not_null{name} |
| 4262 | |
| 4263 | @sa bt_field_class_variant_borrow_option_by_name_const() — |
| 4264 | Borrows an option by name from a variant field class. |
| 4265 | */ |
| 4266 | extern const bt_field_class_variant_with_selector_field_integer_unsigned_option * |
| 4267 | bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const( |
| 4268 | const bt_field_class *field_class, const char *name); |
| 4269 | |
| 4270 | /*! @} */ |
| 4271 | |
| 4272 | /*! |
| 4273 | @name Variant field class (with an unsigned integer selector field) option |
| 4274 | @{ |
| 4275 | */ |
| 4276 | |
| 4277 | /*! |
| 4278 | @typedef struct bt_field_class_variant_with_selector_field_integer_unsigned_option bt_field_class_variant_with_selector_field_integer_unsigned_option; |
| 4279 | |
| 4280 | @brief |
| 4281 | Variant field class (with an unsigned integer selector field) option. |
| 4282 | */ |
| 4283 | |
| 4284 | /*! |
| 4285 | @brief |
| 4286 | Borrows the \bt_p_uint_rg from the \bt_var_fc (with an unsigned |
| 4287 | integer selector field) option \bt_p{option}. |
| 4288 | |
| 4289 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4290 | |
| 4291 | @param[in] option |
| 4292 | Variant field class option from which to borrow the |
| 4293 | unsigned integer ranges. |
| 4294 | |
| 4295 | @returns |
| 4296 | Unsigned integer ranges of \bt_p{option}. |
| 4297 | |
| 4298 | @bt_pre_not_null{option} |
| 4299 | */ |
| 4300 | extern const bt_integer_range_set_unsigned * |
| 4301 | bt_field_class_variant_with_selector_field_integer_unsigned_option_borrow_ranges_const( |
| 4302 | const bt_field_class_variant_with_selector_field_integer_unsigned_option *option); |
| 4303 | |
| 4304 | /*! |
| 4305 | @brief |
| 4306 | \ref api-fund-c-typing "Upcasts" the \bt_var_fc (with an |
| 4307 | unsigned integer selector field) option \bt_p{option} to the |
| 4308 | common #bt_field_class_variant_option type. |
| 4309 | |
| 4310 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4311 | |
| 4312 | @param[in] option |
| 4313 | @parblock |
| 4314 | Variant field class option to upcast. |
| 4315 | |
| 4316 | Can be \c NULL. |
| 4317 | @endparblock |
| 4318 | |
| 4319 | @returns |
| 4320 | \bt_p{option} as a common variant field class option. |
| 4321 | */ |
| 4322 | static inline |
| 4323 | const bt_field_class_variant_option * |
| 4324 | bt_field_class_variant_with_selector_field_integer_unsigned_option_as_option_const( |
| 4325 | const bt_field_class_variant_with_selector_field_integer_unsigned_option *option) |
| 4326 | { |
| 4327 | return __BT_UPCAST_CONST(bt_field_class_variant_option, option); |
| 4328 | } |
| 4329 | |
| 4330 | /*! @} */ |
| 4331 | |
| 4332 | /*! |
| 4333 | @name Variant field class with a signed integer selector field |
| 4334 | @{ |
| 4335 | */ |
| 4336 | |
| 4337 | /*! |
| 4338 | @brief |
| 4339 | Appends an option to the \bt_var_fc (with a signed integer |
| 4340 | selector field) \bt_p{field_class} having the name \bt_p{name}, |
| 4341 | the field class \bt_p{option_field_class}, and the |
| 4342 | \bt_p_sint_rg \bt_p{ranges}. |
| 4343 | |
| 4344 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4345 | |
| 4346 | @param[in] field_class |
| 4347 | Variant field class to which to append an option having |
| 4348 | the name \bt_p{name} and the field class \bt_p{option_field_class}, |
| 4349 | and the signed integer ranges \bt_p{ranges}. |
| 4350 | @param[in] name |
| 4351 | Name of the option to append to \bt_p{field_class} (copied). |
| 4352 | @param[in] option_field_class |
| 4353 | Field class of the option to append to \bt_p{field_class}. |
| 4354 | @param[in] ranges |
| 4355 | Signed integer ranges of the option to append to |
| 4356 | \bt_p{field_class}. |
| 4357 | |
| 4358 | @retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK |
| 4359 | Success. |
| 4360 | @retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR |
| 4361 | Out of memory. |
| 4362 | |
| 4363 | @bt_pre_not_null{field_class} |
| 4364 | @bt_pre_hot{field_class} |
| 4365 | @bt_pre_is_var_wsis_fc{field_class} |
| 4366 | @pre |
| 4367 | \bt_p{field_class} has no option with the name \bt_p{name}. |
| 4368 | @bt_pre_not_null{name} |
| 4369 | @bt_pre_not_null{option_field_class} |
| 4370 | @bt_pre_fc_not_in_tc{option_field_class} |
| 4371 | @bt_pre_not_null{Ĺ—anges} |
| 4372 | @pre |
| 4373 | \bt_p{ranges} contains one or more signed integer ranges. |
| 4374 | @pre |
| 4375 | The signed integer ranges in \bt_p{ranges} do not overlap with |
| 4376 | any signed integer range of any existing option in |
| 4377 | \bt_p{field_class}. |
| 4378 | |
| 4379 | @bt_post_success_frozen{option_field_class} |
| 4380 | */ |
| 4381 | extern bt_field_class_variant_with_selector_field_integer_append_option_status |
| 4382 | bt_field_class_variant_with_selector_field_integer_signed_append_option( |
| 4383 | bt_field_class *field_class, const char *name, |
| 4384 | bt_field_class *option_field_class, |
| 4385 | const bt_integer_range_set_signed *ranges); |
| 4386 | |
| 4387 | /*! |
| 4388 | @brief |
| 4389 | Borrows the option at index \bt_p{index} from the |
| 4390 | \bt_var_fc (with a signed integer selector field) |
| 4391 | \bt_p{field_class}. |
| 4392 | |
| 4393 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4394 | |
| 4395 | @param[in] field_class |
| 4396 | Variant field class from which to borrow the option at |
| 4397 | index \bt_p{index}. |
| 4398 | @param[in] index |
| 4399 | Index of the option to borrow from \bt_p{field_class}. |
| 4400 | |
| 4401 | @returns |
| 4402 | @parblock |
| 4403 | \em Borrowed reference of the option of |
| 4404 | \bt_p{field_class} at index \bt_p{index}. |
| 4405 | |
| 4406 | The returned pointer remains valid as long as \bt_p{field_class} |
| 4407 | is not modified. |
| 4408 | @endparblock |
| 4409 | |
| 4410 | @bt_pre_not_null{field_class} |
| 4411 | @bt_pre_is_var_wsis_fc{field_class} |
| 4412 | @pre |
| 4413 | \bt_p{index} is less than the number of options in |
| 4414 | \bt_p{field_class} (as returned by |
| 4415 | bt_field_class_variant_get_option_count()). |
| 4416 | |
| 4417 | @sa bt_field_class_variant_get_option_count() — |
| 4418 | Returns the number of options contained in a variant field class. |
| 4419 | */ |
| 4420 | extern const bt_field_class_variant_with_selector_field_integer_signed_option * |
| 4421 | bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const( |
| 4422 | const bt_field_class *field_class, uint64_t index); |
| 4423 | |
| 4424 | /*! |
| 4425 | @brief |
| 4426 | Borrows the option having the name \bt_p{name} from the |
| 4427 | \bt_var_fc (with a signed integer selector field) |
| 4428 | \bt_p{field_class}. |
| 4429 | |
| 4430 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4431 | |
| 4432 | If there's no option having the name \bt_p{name} in |
| 4433 | \bt_p{field_class}, this function returns \c NULL. |
| 4434 | |
| 4435 | @param[in] field_class |
| 4436 | Variant field class from which to borrow the option having the |
| 4437 | name \bt_p{name}. |
| 4438 | @param[in] name |
| 4439 | Name of the option to borrow from \bt_p{field_class}. |
| 4440 | |
| 4441 | @returns |
| 4442 | @parblock |
| 4443 | \em Borrowed reference of the option of |
| 4444 | \bt_p{field_class} having the name \bt_p{name}, or \c NULL |
| 4445 | if none. |
| 4446 | |
| 4447 | The returned pointer remains valid as long as \bt_p{field_class} |
| 4448 | is not modified. |
| 4449 | @endparblock |
| 4450 | |
| 4451 | @bt_pre_not_null{field_class} |
| 4452 | @bt_pre_is_var_wsis_fc{field_class} |
| 4453 | @bt_pre_not_null{name} |
| 4454 | |
| 4455 | @sa bt_field_class_variant_borrow_option_by_name_const() — |
| 4456 | Borrows an option by name from a variant field class. |
| 4457 | */ |
| 4458 | extern const bt_field_class_variant_with_selector_field_integer_signed_option * |
| 4459 | bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const( |
| 4460 | const bt_field_class *field_class, const char *name); |
| 4461 | |
| 4462 | /*! @} */ |
| 4463 | |
| 4464 | /*! |
| 4465 | @name Variant field class (with a signed integer selector field) option |
| 4466 | @{ |
| 4467 | */ |
| 4468 | |
| 4469 | /*! |
| 4470 | @typedef struct bt_field_class_variant_with_selector_field_integer_signed_option bt_field_class_variant_with_selector_field_integer_signed_option; |
| 4471 | |
| 4472 | @brief |
| 4473 | Variant field class (with a signed integer selector field) option. |
| 4474 | */ |
| 4475 | |
| 4476 | /*! |
| 4477 | @brief |
| 4478 | Borrows the \bt_p_sint_rg from the \bt_var_fc (with a signed |
| 4479 | integer selector field) option \bt_p{option}. |
| 4480 | |
| 4481 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4482 | |
| 4483 | @param[in] option |
| 4484 | Variant field class option from which to borrow the |
| 4485 | signed integer ranges. |
| 4486 | |
| 4487 | @returns |
| 4488 | Signed integer ranges of \bt_p{option}. |
| 4489 | |
| 4490 | @bt_pre_not_null{option} |
| 4491 | */ |
| 4492 | extern const bt_integer_range_set_signed * |
| 4493 | bt_field_class_variant_with_selector_field_integer_signed_option_borrow_ranges_const( |
| 4494 | const bt_field_class_variant_with_selector_field_integer_signed_option *option); |
| 4495 | |
| 4496 | /*! |
| 4497 | @brief |
| 4498 | \ref api-fund-c-typing "Upcasts" the \bt_var_fc (with a signed |
| 4499 | integer selector field) option \bt_p{option} to the |
| 4500 | common #bt_field_class_variant_option type. |
| 4501 | |
| 4502 | See the \ref api-tir-fc-var-prop-opts "options" property. |
| 4503 | |
| 4504 | @param[in] option |
| 4505 | @parblock |
| 4506 | Variant field class option to upcast. |
| 4507 | |
| 4508 | Can be \c NULL. |
| 4509 | @endparblock |
| 4510 | |
| 4511 | @returns |
| 4512 | \bt_p{option} as a common variant field class option. |
| 4513 | */ |
| 4514 | static inline |
| 4515 | const bt_field_class_variant_option * |
| 4516 | bt_field_class_variant_with_selector_field_integer_signed_option_as_option_const( |
| 4517 | const bt_field_class_variant_with_selector_field_integer_signed_option *option) |
| 4518 | { |
| 4519 | return __BT_UPCAST_CONST(bt_field_class_variant_option, option); |
| 4520 | } |
| 4521 | |
| 4522 | /*! @} */ |
| 4523 | |
| 4524 | /*! |
| 4525 | @name Reference count |
| 4526 | @{ |
| 4527 | */ |
| 4528 | |
| 4529 | /*! |
| 4530 | @brief |
| 4531 | Increments the \ref api-fund-shared-object "reference count" of |
| 4532 | the field class \bt_p{field_class}. |
| 4533 | |
| 4534 | @param[in] field_class |
| 4535 | @parblock |
| 4536 | Field class of which to increment the reference count. |
| 4537 | |
| 4538 | Can be \c NULL. |
| 4539 | @endparblock |
| 4540 | |
| 4541 | @sa bt_field_class_put_ref() — |
| 4542 | Decrements the reference count of a field class. |
| 4543 | */ |
| 4544 | extern void bt_field_class_get_ref(const bt_field_class *field_class); |
| 4545 | |
| 4546 | /*! |
| 4547 | @brief |
| 4548 | Decrements the \ref api-fund-shared-object "reference count" of |
| 4549 | the field class \bt_p{field_class}. |
| 4550 | |
| 4551 | @param[in] field_class |
| 4552 | @parblock |
| 4553 | Field class of which to decrement the reference count. |
| 4554 | |
| 4555 | Can be \c NULL. |
| 4556 | @endparblock |
| 4557 | |
| 4558 | @sa bt_field_class_get_ref() — |
| 4559 | Increments the reference count of a field class. |
| 4560 | */ |
| 4561 | extern void bt_field_class_put_ref(const bt_field_class *field_class); |
| 4562 | |
| 4563 | /*! |
| 4564 | @brief |
| 4565 | Decrements the reference count of the field class |
| 4566 | \bt_p{_field_class}, and then sets \bt_p{_field_class} to \c NULL. |
| 4567 | |
| 4568 | @param _field_class |
| 4569 | @parblock |
| 4570 | Field class of which to decrement the reference count. |
| 4571 | |
| 4572 | Can contain \c NULL. |
| 4573 | @endparblock |
| 4574 | |
| 4575 | @bt_pre_assign_expr{_field_class} |
| 4576 | */ |
| 4577 | #define BT_FIELD_CLASS_PUT_REF_AND_RESET(_field_class) \ |
| 4578 | do { \ |
| 4579 | bt_field_class_put_ref(_field_class); \ |
| 4580 | (_field_class) = NULL; \ |
| 4581 | } while (0) |
| 4582 | |
| 4583 | /*! |
| 4584 | @brief |
| 4585 | Decrements the reference count of the field class \bt_p{_dst}, sets |
| 4586 | \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL. |
| 4587 | |
| 4588 | This macro effectively moves a field class reference from the expression |
| 4589 | \bt_p{_src} to the expression \bt_p{_dst}, putting the existing |
| 4590 | \bt_p{_dst} reference. |
| 4591 | |
| 4592 | @param _dst |
| 4593 | @parblock |
| 4594 | Destination expression. |
| 4595 | |
| 4596 | Can contain \c NULL. |
| 4597 | @endparblock |
| 4598 | @param _src |
| 4599 | @parblock |
| 4600 | Source expression. |
| 4601 | |
| 4602 | Can contain \c NULL. |
| 4603 | @endparblock |
| 4604 | |
| 4605 | @bt_pre_assign_expr{_dst} |
| 4606 | @bt_pre_assign_expr{_src} |
| 4607 | */ |
| 4608 | #define BT_FIELD_CLASS_MOVE_REF(_dst, _src) \ |
| 4609 | do { \ |
| 4610 | bt_field_class_put_ref(_dst); \ |
| 4611 | (_dst) = (_src); \ |
| 4612 | (_src) = NULL; \ |
| 4613 | } while (0) |
| 4614 | |
| 4615 | /*! @} */ |
| 4616 | |
| 4617 | /*! @} */ |
| 4618 | |
| 4619 | #ifdef __cplusplus |
| 4620 | } |
| 4621 | #endif |
| 4622 | |
| 4623 | #endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */ |