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