include: add IWYU pragmas in private header files
[babeltrace.git] / include / babeltrace2 / trace-ir / field-class.h
CommitLineData
5cd6d0e5 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
5cd6d0e5 3 *
0235b0db 4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5cd6d0e5
PP
5 */
6
0235b0db
MJ
7#ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_H
8#define BABELTRACE2_TRACE_IR_FIELD_CLASS_H
9
f38da6ca
SM
10/* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11
4fa90f32
PP
12#ifndef __BT_IN_BABELTRACE_H
13# error "Please include <babeltrace2/babeltrace.h> instead."
14#endif
15
d24d5663
PP
16#include <stdint.h>
17#include <stddef.h>
18
3fadfbc0 19#include <babeltrace2/types.h>
40f4ba76 20
5cd6d0e5
PP
21#ifdef __cplusplus
22extern "C" {
23#endif
24
43c59509
PP
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
36Field classes are \ref api-tir "trace IR" metadata objects.
37
38There are many types of field classes. They can be divided into two main
39categories:
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
71Some field classes conceptually inherit other field classes, eventually
72making an inheritance hierarchy. For example, a \bt_sarray_fc
73\em is an array field class. Therefore, a static array field class has
74any property that an array field class has.
75
76The complete field class inheritance hierarchy is:
77
78@image html all-field-classes.png
79
80In 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
92Field classes are \ref api-fund-shared-object "shared objects": get a
93new reference with bt_field_class_get_ref() and put an existing
94reference with bt_field_class_put_ref().
95
96Some library functions \ref api-fund-freezing "freeze" field classes on
97success. The documentation of those functions indicate this
98postcondition.
99
100All the field class types share the same C type, #bt_field_class.
101
102Get the type enumerator of a field class with bt_field_class_get_type().
103Get whether or not a field class type conceptually \em is a given type
104with the inline bt_field_class_type_is() function.
105
106The following table shows the available type enumerators and creation
107functions 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
196You need a \bt_trace_cls to create a field class: create one from a
197\bt_self_comp with bt_trace_class_create().
198
199Outside the field class API, you can use field classes at four
200locations, 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
214When 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
226Once you have called one of the four functions above, the passed field
227class becomes \ref api-fund-freezing "frozen".
228
229<h1>Common field class property</h1>
230
231A 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
253A <strong><em>boolean field class</em></strong> is the class
254of \bt_p_bool_field.
255
256A boolean field contains a boolean value (#BT_TRUE or #BT_FALSE).
257
258Create a boolean field class with bt_field_class_bool_create().
259
260A 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
266A <strong><em>bit array field class</em></strong> is the class
267of \bt_p_ba_field.
268
269A bit array field contains a fixed-length array of bits.
270
271Create a bit array field class with bt_field_class_bit_array_create().
272
273A 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
300of \bt_p_int_field.
301
302Integer fields contain integral values.
303
304An integer field class is an \em abstract field class: you cannot create
305one. 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
325Integer 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
365of \bt_p_enum_field.
366
367Enumeration field classes \em are \bt_p_int_fc: they have the integer
368field classes properties.
369
370Enumeration fields \em are integer fields: they contain integral values.
371
372Enumeration field classes associate labels (strings) to specific
373ranges of integral values. This association is called an enumeration
374field class <em>mapping</em>.
375
376For example, if an enumeration field class maps the label \c SUGAR to
377the 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
379label <code>SUGAR</code>.
380
381An enumeration field class is an \em abstract field class: you cannot
382create 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
402Enumeration 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
474of \bt_p_real_field.
475
476Real fields contain
477<a href="https://en.wikipedia.org/wiki/Real_number">real</a>
478values (\c float or \c double types).
479
480A real field class is an \em abstract field class: you cannot create
481one. 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
501Real 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
507A <strong><em>string field class</em></strong> is the class
508of \bt_p_string_field.
509
510A string field contains an UTF-8 string value.
511
512Create a string field class with bt_field_class_string_create().
513
514A 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
521of \bt_p_array_field.
522
523Array fields contain zero or more fields which have the same class.
524
525An array field class is an \em abstract field class: you cannot create
526one. 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
588Array 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
612A <strong><em>structure field class</em></strong> is the class
613of a \bt_struct_field.
614
615A structure field contains an ordered list of zero or more members. Each
616structure field member is the instance of a structure field class
617member. A structure field class member has a name, a field class,
618and user attributes.
619
620Create a structure field class with bt_field_class_structure_create().
621
622A 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
680of \bt_p_opt_field.
681
682An option field either does or doesn't contain a field, called its
683optional field.
684
685An option field class is an \em abstract field class: you cannot create
686one. An option field class either has a selector field (it's linked to a
687selector field class; see
688\ref api-tir-fc-link "Field classes with links to other field classes")
689or 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
813Option field classes with a selector have the following common
814property:
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
829Option 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
854of \bt_p_var_field.
855
856A variant field contains a field amongst one or more possible fields.
857
858Variant field classes contain one or more options. Each variant field
859class option has a name, a field class, user attributes, and integer
860ranges, depending on the exact type.
861
862A variant field class is an \em abstract field class: you cannot create
863one. A variant field class either has a selector field (it's linked to a
864selector field class; see
865\ref api-tir-fc-link "Field classes with links to other field classes")
866or 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
932Variant field classes with a selector have the following common
933property:
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
948Variant 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
1033other, preceding field classes.
1034
1035When a field class&nbsp;A has a link to another field class&nbsp;B, then
1036an instance (\bt_field) of A has a link to an instance of B.
1037
1038This feature exists so that the linked field can contain the value of a
1039dynamic 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
1061Having a linked field class is <em>optional</em>: you always set the
1062field properties with a dedicated function anyway. For example, even if
1063a dynamic array field is linked to a preceding length field, you must
1064still set its length with bt_field_array_dynamic_set_length(). In that
1065case, the value of the length field must match what you pass to
1066bt_field_array_dynamic_set_length().
1067
1068The 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
1070a preceding, existing field represents the length of a dynamic array
1071field, then the sink component doesn't need to write the dynamic array
1072field's length twice. This is the case of the
1073<a href="https://diamon.org/ctf/">Common Trace Format</a>, for
1074example.
1075
1076@image html darray-link.png "A dynamic array field class linked to an unsigned integer field class."
1077
1078To link a field class&nbsp;A to a preceding field class&nbsp;B, pass
1079field class&nbsp;B when you create field class&nbsp;A. For example, pass
1080the \bt_uint_fc to bt_field_class_array_dynamic_create() to create a
1081\bt_darray_fc with a length field.
1082
1083When you call bt_stream_class_set_packet_context_field_class(),
1084bt_stream_class_set_event_common_context_field_class(),
1085bt_event_class_set_specific_context_field_class(), or
1086bt_event_class_set_payload_field_class() with a field class containing
1087a field class&nbsp;A with a linked field class&nbsp;B, the path to
1088B 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
1094A field path indicates how to reach a linked field from a given
1095root <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
1127The rules regarding field class&nbsp;A vs. field class&nbsp;B (linked
1128field 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*/
1202typedef 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*/
1499extern bt_field_class_type bt_field_class_get_type(
1500 const bt_field_class *field_class);
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
1507For example, an \bt_uint_fc conceptually \em is an integer field class,
1508so
1509
1510@code
1511bt_field_class_type_is(BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, BT_FIELD_CLASS_TYPE_INTEGER)
1512@endcode
1513
1514returns #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*/
1527static inline
1528bt_bool bt_field_class_type_is(const bt_field_class_type type,
1529 const bt_field_class_type other_type)
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
1546See 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*/
c6962c96
PP
1569extern void bt_field_class_set_user_attributes(
1570 bt_field_class *field_class, const bt_value *user_attributes);
1571
43c59509
PP
1572/*!
1573@brief
1574 Borrows the user attributes of the field class \bt_p{field_class}.
1575
1576See the \ref api-tir-fc-prop-user-attrs "user attributes" property.
1577
1578@note
1579 When you create a field class with one of the
1580 <code>bt_field_class_*_create()</code> functions, the field class's
1581 initial user attributes is an empty \bt_map_val.
1582
1583@param[in] field_class
1584 Field class from which to borrow the user attributes.
1585
1586@returns
1587 User attributes of \bt_p{field_class} (a \bt_map_val).
1588
1589@bt_pre_not_null{field_class}
1590
1591@sa bt_field_class_set_user_attributes() &mdash;
1592 Sets the user attributes of a field class.
1593@sa bt_field_class_borrow_user_attributes_const() &mdash;
1594 \c const version of this function.
1595*/
1596extern bt_value *bt_field_class_borrow_user_attributes(
1597 bt_field_class *field_class);
1598
1599/*!
1600@brief
1601 Borrows the user attributes of the field class \bt_p{field_class}
1602 (\c const version).
1603
1604See bt_field_class_borrow_user_attributes().
1605*/
1606extern const bt_value *bt_field_class_borrow_user_attributes_const(
1607 const bt_field_class *field_class);
1608
1609/*! @} */
1610
1611/*!
1612@name Boolean field class
1613@{
1614*/
1615
1616/*!
1617@brief
1618 Creates a \bt_bool_fc from the trace class \bt_p{trace_class}.
1619
1620On success, the returned boolean field class has the following
1621property value:
1622
1623<table>
1624 <tr>
1625 <th>Property
1626 <th>Value
1627 <tr>
1628 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
1629 <td>Empty \bt_map_val
1630</table>
1631
1632@param[in] trace_class
1633 Trace class from which to create a boolean field class.
1634
1635@returns
1636 New boolean field class reference, or \c NULL on memory error.
1637
1638@bt_pre_not_null{trace_class}
1639*/
1640extern bt_field_class *bt_field_class_bool_create(
1641 bt_trace_class *trace_class);
1642
1643/*!
1644@}
1645*/
1646
1647/*!
1648@name Bit array field class
1649@{
1650*/
1651
1652/*!
1653@brief
1654 Creates a \bt_ba_fc with the length \bt_p{length} from the trace
1655 class \bt_p{trace_class}.
1656
1657On success, the returned bit array field class has the following
1658property values:
1659
1660<table>
1661 <tr>
1662 <th>Property
1663 <th>Value
1664 <tr>
1665 <td>\ref api-tir-fc-ba-prop-len "Length"
1666 <td>\bt_p{length}
1667 <tr>
1668 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
1669 <td>Empty \bt_map_val
1670</table>
1671
1672@param[in] trace_class
1673 Trace class from which to create a bit array field class.
1674@param[in] length
1675 Length (number of bits) of the instances of the bit array field
1676 class to create.
1677
1678@returns
1679 New bit array field class reference, or \c NULL on memory error.
1680
1681@bt_pre_not_null{trace_class}
1682@pre
1683 0 < \bt_p{length} ≤ 64.
1684*/
1685extern bt_field_class *bt_field_class_bit_array_create(
1686 bt_trace_class *trace_class, uint64_t length);
1687
1688/*!
1689@brief
1690 Returns the length of the \bt_ba_fc \bt_p{field_class}.
1691
1692See the \ref api-tir-fc-ba-prop-len "length" property.
1693
1694@param[in] field_class
1695 Bit array field class of which to get the length.
1696
1697@returns
1698 Length of \bt_p{field_class}.
1699
1700@bt_pre_not_null{field_class}
1701@bt_pre_is_ba_fc{field_class}
1702*/
1703extern uint64_t bt_field_class_bit_array_get_length(
1704 const bt_field_class *field_class);
1705
1706/*!
1707@}
1708*/
1709
1710/*!
1711@name Integer field class
1712@{
1713*/
1714
1715/*!
1716@brief
1717 Sets the field value range of the \bt_int_fc \bt_p{field_class}
1718 to \bt_p{n}.
1719
1720See the \ref api-tir-fc-int-prop-size "field value range" property.
1721
1722@param[in] field_class
1723 Integer field class of which to set the field value range to
1724 \bt_p{n}.
1725@param[in] n
1726 @parblock
1727 \em N in:
1728
1729 <dl>
1730 <dt>Unsigned integer field class</dt>
1eca514c 1731 <dd>[0,&nbsp;2<sup><em>N</em></sup>&nbsp;−&nbsp;1]</dd>
43c59509
PP
1732
1733 <dt>Signed integer field class</dt>
1eca514c 1734 <dd>[−2<sup><em>N</em>&nbsp;−&nbsp;1</sup>,&nbsp;2<sup><em>N</em>&nbsp;−&nbsp;1</sup>&nbsp;−&nbsp;1]</dd>
43c59509
PP
1735 </dl>
1736 @endparblock
1737
1738@bt_pre_not_null{field_class}
1739@bt_pre_hot{field_class}
1740@bt_pre_is_int_fc{field_class}
1741@pre
b19bbc8a 1742 1 ⩽ \bt_p{n} ⩽ 64.
43c59509
PP
1743
1744@sa bt_field_class_integer_get_field_value_range() &mdash;
1745 Returns the field value range of an integer field class.
1746*/
1747extern void bt_field_class_integer_set_field_value_range(
1748 bt_field_class *field_class, uint64_t n);
1749
1750/*!
1751@brief
1752 Returns the field value range of the \bt_int_fc \bt_p{field_class}.
1753
1754See the \ref api-tir-fc-int-prop-size "field value range" property.
1755
1756@param[in] field_class
1757 Integer field class of which to get the field value range.
1758
1759@returns
1760 @parblock
1761 Field value range of \bt_p{field_class}, that is, \em N in:
1762
1763 <dl>
1764 <dt>Unsigned integer field class</dt>
1eca514c 1765 <dd>[0,&nbsp;2<sup><em>N</em></sup>&nbsp;−&nbsp;1]</dd>
43c59509
PP
1766
1767 <dt>Signed integer field class</dt>
1eca514c 1768 <dd>[−2<sup><em>N</em></sup>,&nbsp;2<sup><em>N</em></sup>&nbsp;−&nbsp;1]</dd>
43c59509
PP
1769 </dl>
1770 @endparblock
1771
1772@bt_pre_not_null{field_class}
1773@bt_pre_is_int_fc{field_class}
1774
1775@sa bt_field_class_integer_set_field_value_range() &mdash;
1776 Sets the field value range of an integer field class.
1777*/
1778extern uint64_t bt_field_class_integer_get_field_value_range(
1779 const bt_field_class *field_class);
1780
1781/*!
1782@brief
1783 Integer field class preferred display bases.
1784*/
1785typedef enum bt_field_class_integer_preferred_display_base {
1786 /*!
1787 @brief
1788 Binary (2).
1789 */
1790 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY = 2,
1791
1792 /*!
1793 @brief
1794 Octal (8).
1795 */
1796 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL = 8,
1797
1798 /*!
1799 @brief
1800 Decimal (10).
1801 */
1802 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL = 10,
1803
1804 /*!
1805 @brief
1806 Hexadecimal (16).
1807 */
1808 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL = 16,
1809} bt_field_class_integer_preferred_display_base;
1810
1811/*!
1812@brief
1813 Sets the preferred display base of the \bt_int_fc \bt_p{field_class}
1814 to \bt_p{preferred_display_base}.
1815
1816See the \ref api-tir-fc-int-prop-base "preferred display base" property.
1817
1818@param[in] field_class
1819 Integer field class of which to set the preferred display base to
1820 \bt_p{preferred_display_base}.
1821@param[in] preferred_display_base
1822 New preferred display base of \bt_p{field_class}.
1823
1824@bt_pre_not_null{field_class}
1825@bt_pre_hot{field_class}
1826@bt_pre_is_int_fc{field_class}
1827
1828@sa bt_field_class_integer_get_preferred_display_base() &mdash;
1829 Returns the preferred display base of an integer field class.
1830*/
1831extern void bt_field_class_integer_set_preferred_display_base(
1832 bt_field_class *field_class,
1833 bt_field_class_integer_preferred_display_base preferred_display_base);
1834
1835/*!
1836@brief
1837 Returns the preferred display base of the \bt_int_fc
1838 \bt_p{field_class}.
1839
1840See the \ref api-tir-fc-int-prop-base "preferred display base" property.
1841
1842@param[in] field_class
1843 Integer field class of which to get the preferred display base.
1844
1845@retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY
1846 2 (binary)
1847@retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL
1848 8 (octal)
1849@retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
1850 10 (decimal)
1851@retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL
1852 16 (hexadecimal)
1853
1854@bt_pre_not_null{field_class}
1855@bt_pre_is_int_fc{field_class}
1856
1857@sa bt_field_class_integer_set_preferred_display_base() &mdash;
1858 Sets the preferred display base of an integer field class.
1859*/
1860extern bt_field_class_integer_preferred_display_base
1861bt_field_class_integer_get_preferred_display_base(
1862 const bt_field_class *field_class);
1863
1864/*! @} */
1865
1866/*!
1867@name Unsigned integer field class
1868@{
1869*/
1870
1871/*!
1872@brief
1873 Creates an \bt_uint_fc from the trace class \bt_p{trace_class}.
1874
1875On success, the returned unsigned integer field class has the following
1876property values:
1877
1878<table>
1879 <tr>
1880 <th>Property
1881 <th>Value
1882 <tr>
1883 <td>\ref api-tir-fc-int-prop-size "Field value range"
1eca514c 1884 <td>[0,&nbsp;2<sup>64</sup>&nbsp;−&nbsp;1]
43c59509
PP
1885 <tr>
1886 <td>\ref api-tir-fc-int-prop-base "Preferred display base"
1887 <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
1888 <tr>
1889 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
1890 <td>Empty \bt_map_val
1891</table>
1892
1893@param[in] trace_class
1894 Trace class from which to create an unsigned integer field class.
1895
1896@returns
1897 New unsigned integer field class reference, or \c NULL on memory error.
1898
1899@bt_pre_not_null{trace_class}
1900*/
1901extern bt_field_class *bt_field_class_integer_unsigned_create(
1902 bt_trace_class *trace_class);
1903
1904/*! @} */
1905
1906/*!
1907@name Signed integer field class
1908@{
1909*/
1910
1911/*!
1912@brief
1913 Creates an \bt_sint_fc from the trace class \bt_p{trace_class}.
1914
1915On success, the returned signed integer field class has the following
1916property values:
1917
1918<table>
1919 <tr>
1920 <th>Property
1921 <th>Value
1922 <tr>
1923 <td>\ref api-tir-fc-int-prop-size "Field value range"
1eca514c 1924 <td>[−2<sup>63</sup>,&nbsp;2<sup>63</sup>&nbsp;−&nbsp;1]
43c59509
PP
1925 <tr>
1926 <td>\ref api-tir-fc-int-prop-base "Preferred display base"
1927 <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
1928 <tr>
1929 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
1930 <td>Empty \bt_map_val
1931</table>
1932
1933@param[in] trace_class
1934 Trace class from which to create a signed integer field class.
1935
1936@returns
1937 New signed integer field class reference, or \c NULL on memory error.
1938
1939@bt_pre_not_null{trace_class}
1940*/
1941extern bt_field_class *bt_field_class_integer_signed_create(
1942 bt_trace_class *trace_class);
1943
1944/*! @} */
1945
1946/*!
1947@name Single-precision real field class
1948@{
1949*/
1950
1951/*!
1952@brief
1953 Creates a single-precision \bt_real_fc from the trace class
1954 \bt_p{trace_class}.
1955
1956On success, the returned single-precision real field class has the
1957following property value:
1958
1959<table>
1960 <tr>
1961 <th>Property
1962 <th>Value
1963 <tr>
1964 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
1965 <td>Empty \bt_map_val
1966</table>
1967
1968@param[in] trace_class
1969 Trace class from which to create a single-preicision real
1970 field class.
1971
1972@returns
1973 New single-precision real field class reference, or \c NULL on
1974 memory error.
1975
1976@bt_pre_not_null{trace_class}
1977*/
1978extern bt_field_class *bt_field_class_real_single_precision_create(
1979 bt_trace_class *trace_class);
1980
1981/*! @} */
1982
1983/*!
1984@name Double-precision real field class
1985@{
1986*/
1987
1988/*!
1989@brief
1990 Creates a double-precision \bt_real_fc from the trace class
1991 \bt_p{trace_class}.
1992
1993On success, the returned double-precision real field class has the
1994following property value:
1995
1996<table>
1997 <tr>
1998 <th>Property
1999 <th>Value
2000 <tr>
2001 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2002 <td>Empty \bt_map_val
2003</table>
2004
2005@param[in] trace_class
2006 Trace class from which to create a double-preicision real
2007 field class.
2008
2009@returns
2010 New double-precision real field class reference, or \c NULL on
2011 memory error.
2012
2013@bt_pre_not_null{trace_class}
2014*/
2015extern bt_field_class *bt_field_class_real_double_precision_create(
2016 bt_trace_class *trace_class);
2017
2018/*! @} */
2019
2020/*!
2021@name Enumeration field class
2022@{
2023*/
2024
2025/*!
2026@brief
2027 Array of \c const \bt_enum_fc labels.
2028
2029Returned by bt_field_class_enumeration_unsigned_get_mapping_labels_for_value()
2030and bt_field_class_enumeration_signed_get_mapping_labels_for_value().
2031*/
2032typedef char const * const *bt_field_class_enumeration_mapping_label_array;
2033
2034/*!
2035@brief
2036 Status codes for
2037 bt_field_class_enumeration_unsigned_get_mapping_labels_for_value()
2038 and
2039 bt_field_class_enumeration_signed_get_mapping_labels_for_value().
2040*/
2041typedef enum bt_field_class_enumeration_get_mapping_labels_for_value_status {
2042 /*!
2043 @brief
2044 Success.
2045 */
2046 BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK = __BT_FUNC_STATUS_OK,
2047
2048 /*!
2049 @brief
2050 Out of memory.
2051 */
2052 BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
2053} bt_field_class_enumeration_get_mapping_labels_for_value_status;
2054
2055/*!
2056@brief
2057 Status codes for bt_field_class_enumeration_unsigned_add_mapping()
2058 and bt_field_class_enumeration_signed_add_mapping().
2059*/
2060typedef enum bt_field_class_enumeration_add_mapping_status {
2061 /*!
2062 @brief
2063 Success.
2064 */
2065 BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK = __BT_FUNC_STATUS_OK,
2066
2067 /*!
2068 @brief
2069 Out of memory.
2070 */
2071 BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
2072} bt_field_class_enumeration_add_mapping_status;
2073
2074/*! @} */
2075
2076/*!
2077@name Enumeration field class mapping
2078@{
2079*/
2080
2081/*!
2082@typedef struct bt_field_class_enumeration_mapping bt_field_class_enumeration_mapping;
2083
2084@brief
2085 Enumeration field class mapping.
2086*/
2087
2088/*!
2089@brief
2090 Returns the number of mappings contained in the \bt_enum_fc
2091 \bt_p{field_class}.
2092
2093See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2094
2095@param[in] field_class
2096 Enumeration field class of which to get the number of contained
2097 mappings.
2098
2099@returns
2100 Number of contained mappings in \bt_p{field_class}.
2101
2102@bt_pre_not_null{field_class}
2103@bt_pre_is_enum_fc{field_class}
2104*/
2105extern uint64_t bt_field_class_enumeration_get_mapping_count(
2106 const bt_field_class *field_class);
2107
2108/*!
2109@brief
2110 Returns the label of the \bt_enum_fc mapping \bt_p{mapping}.
2111
2112See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2113
2114@param[in] mapping
2115 Enumeration field class mapping of which to get the label.
2116
2117@returns
2118 @parblock
2119 Label of \bt_p{mapping}.
2120
2121 The returned pointer remains valid as long as \bt_p{mapping} exists.
2122 @endparblock
2123
2124@bt_pre_not_null{mapping}
2125*/
2126extern const char *bt_field_class_enumeration_mapping_get_label(
2127 const bt_field_class_enumeration_mapping *mapping);
2128
2129/*! @} */
2130
2131/*!
2132@name Unsigned enumeration field class
2133@{
2134*/
2135
2136/*!
2137@brief
2138 Creates an \bt_uenum_fc from the trace class \bt_p{trace_class}.
2139
2140On success, the returned unsigned enumeration field class has the
2141following property values:
2142
2143<table>
2144 <tr>
2145 <th>Property
2146 <th>Value
2147 <tr>
2148 <td>\ref api-tir-fc-int-prop-size "Field value range"
1eca514c 2149 <td>[0,&nbsp;2<sup>64</sup>&nbsp;−&nbsp;1]
43c59509
PP
2150 <tr>
2151 <td>\ref api-tir-fc-int-prop-base "Preferred display base"
2152 <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
2153 <tr>
2154 <td>\ref api-tir-fc-enum-prop-mappings "Mappings"
2155 <td>\em None
2156 <tr>
2157 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2158 <td>Empty \bt_map_val
2159</table>
2160
2161@param[in] trace_class
2162 Trace class from which to create an unsigned enumeration field
2163 class.
2164
2165@returns
2166 New unsigned enumeration field class reference, or \c NULL on memory
2167 error.
2168
2169@bt_pre_not_null{trace_class}
2170*/
2171extern bt_field_class *bt_field_class_enumeration_unsigned_create(
2172 bt_trace_class *trace_class);
2173
2174/*!
2175@brief
2176 Adds a mapping to the \bt_uenum_fc \bt_p{field_class} having the
2177 label \bt_p{label} and the unsigned integer ranges \bt_p{ranges}.
2178
2179See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2180
2181@param[in] field_class
2182 Unsigned enumeration field class to which to add a mapping having
2183 the label \bt_p{label} and the integer ranges \bt_p{ranges}.
2184@param[in] label
2185 Label of the mapping to add to \bt_p{field_class} (copied).
2186@param[in] ranges
2187 Unsigned integer ranges of the mapping to add to
2188 \bt_p{field_class}.
2189
2190@retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK
2191 Success.
2192@retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR
2193 Out of memory.
2194
2195@bt_pre_not_null{field_class}
2196@bt_pre_hot{field_class}
2197@bt_pre_is_uenum_fc{field_class}
2198@bt_pre_not_null{label}
2199@pre
2200 \bt_p{field_class} has no mapping with the label \bt_p{label}.
2201@bt_pre_not_null{ranges}
2202@pre
2203 \bt_p{ranges} contains one or more unsigned integer ranges.
2204*/
2205extern bt_field_class_enumeration_add_mapping_status
2206bt_field_class_enumeration_unsigned_add_mapping(
2207 bt_field_class *field_class, const char *label,
2208 const bt_integer_range_set_unsigned *ranges);
2209
2210/*!
2211@brief
2212 Borrows the mapping at index \bt_p{index} from the
2213 \bt_uenum_fc \bt_p{field_class}.
2214
2215See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2216
2217@param[in] field_class
2218 Unsigned enumeration field class from which to borrow the mapping at
2219 index \bt_p{index}.
2220@param[in] index
2221 Index of the mapping to borrow from \bt_p{field_class}.
2222
2223@returns
2224 @parblock
2225 \em Borrowed reference of the mapping of
2226 \bt_p{field_class} at index \bt_p{index}.
2227
2228 The returned pointer remains valid as long as \bt_p{field_class}
2229 is not modified.
2230 @endparblock
2231
2232@bt_pre_not_null{field_class}
2233@bt_pre_is_uenum_fc{field_class}
2234@pre
2235 \bt_p{index} is less than the number of mappings in
2236 \bt_p{field_class} (as returned by
2237 bt_field_class_enumeration_get_mapping_count()).
2238
2239@sa bt_field_class_enumeration_get_mapping_count() &mdash;
2240 Returns the number of mappings contained in an
2241 enumeration field class.
2242*/
2243extern const bt_field_class_enumeration_unsigned_mapping *
2244bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const(
2245 const bt_field_class *field_class, uint64_t index);
2246
2247/*!
2248@brief
2249 Borrows the mapping having the label \bt_p{label} from the
2250 \bt_uenum_fc \bt_p{field_class}.
2251
2252See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2253
2254If there's no mapping having the label \bt_p{label} in
2255\bt_p{field_class}, this function returns \c NULL.
2256
2257@param[in] field_class
2258 Unsigned enumeration field class from which to borrow the mapping
2259 having the label \bt_p{label}.
2260@param[in] label
2261 Label of the mapping to borrow from \bt_p{field_class}.
2262
2263@returns
2264 @parblock
2265 \em Borrowed reference of the mapping of
2266 \bt_p{field_class} having the label \bt_p{label}, or \c NULL
2267 if none.
2268
2269 The returned pointer remains valid as long as \bt_p{field_class}
2270 is not modified.
2271 @endparblock
2272
2273@bt_pre_not_null{field_class}
2274@bt_pre_is_uenum_fc{field_class}
2275@bt_pre_not_null{label}
2276*/
2277extern const bt_field_class_enumeration_unsigned_mapping *
2278bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const(
2279 const bt_field_class *field_class, const char *label);
2280
2281/*!
2282@brief
2283 Returns an array of all the labels of the mappings of the
2284 \bt_uenum_fc \bt_p{field_class} of which the \bt_p_uint_rg contain
2285 the integral value \bt_p{value}.
2286
2287See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2288
2289This function sets \bt_p{*labels} to the resulting array and
2290\bt_p{*count} to the number of labels in \bt_p{*labels}.
2291
2292On success, if there's no mapping ranges containing the value
2293\bt_p{value}, \bt_p{*count} is 0.
2294
2295@param[in] field_class
2296 Unsigned enumeration field class from which to get the labels of the
2297 mappings of which the ranges contain \bt_p{value}.
2298@param[in] value
2299 Value for which to get the mapped labels in \bt_p{field_class}.
2300@param[out] labels
2301 @parblock
2302 <strong>On success</strong>, \bt_p{*labels}
2303 is an array of labels of the mappings of \bt_p{field_class}
2304 containing \bt_p{value}.
2305
2306 The number of labels in \bt_p{*labels} is \bt_p{*count}.
2307
2308 The array is owned by \bt_p{field_class} and remains valid as long
45397ca4
PP
2309 as:
2310
2311 - \bt_p{field_class} is not modified.
2312 - You don't call this function again with \bt_p{field_class}.
43c59509
PP
2313 @endparblock
2314@param[out] count
2315 <strong>On success</strong>, \bt_p{*count} is the number of labels
2316 in \bt_p{*labels} (can be 0).
2317
2318@retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK
2319 Success.
2320@retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR
2321 Out of memory.
2322
2323@bt_pre_not_null{field_class}
2324@bt_pre_is_uenum_fc{field_class}
2325@bt_pre_not_null{labels}
2326@bt_pre_not_null{count}
2327*/
2328extern bt_field_class_enumeration_get_mapping_labels_for_value_status
2329bt_field_class_enumeration_unsigned_get_mapping_labels_for_value(
2330 const bt_field_class *field_class, uint64_t value,
2331 bt_field_class_enumeration_mapping_label_array *labels,
2332 uint64_t *count);
2333
2334/*! @} */
2335
2336/*!
2337@name Unsigned enumeration field class mapping
2338@{
2339*/
2340
2341/*!
2342@typedef struct bt_field_class_enumeration_unsigned_mapping bt_field_class_enumeration_unsigned_mapping;
2343
2344@brief
2345 Unsigned enumeration field class mapping.
2346*/
2347
2348/*!
2349@brief
2350 Borrows the \bt_p_uint_rg from the \bt_uenum_fc mapping
2351 \bt_p{mapping}.
2352
2353See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2354
2355@param[in] mapping
2356 Unsigned enumeration field class mapping from which to borrow the
2357 unsigned integer ranges.
2358
2359@returns
2360 Unsigned integer ranges of \bt_p{mapping}.
2361
2362@bt_pre_not_null{mapping}
2363*/
2364extern const bt_integer_range_set_unsigned *
2365bt_field_class_enumeration_unsigned_mapping_borrow_ranges_const(
2366 const bt_field_class_enumeration_unsigned_mapping *mapping);
2367
2368/*!
2369@brief
2370 \ref api-fund-c-typing "Upcasts" the \bt_uenum_fc mapping
2371 \bt_p{mapping} to the common #bt_field_class_enumeration_mapping
2372 type.
2373
2374See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2375
2376@param[in] mapping
2377 @parblock
2378 Unsigned enumeration field class mapping to upcast.
2379
2380 Can be \c NULL.
2381 @endparblock
2382
2383@returns
2384 \bt_p{mapping} as a common enumeration field class mapping.
2385*/
2386static inline
2387const bt_field_class_enumeration_mapping *
2388bt_field_class_enumeration_unsigned_mapping_as_mapping_const(
2389 const bt_field_class_enumeration_unsigned_mapping *mapping)
2390{
2391 return __BT_UPCAST_CONST(bt_field_class_enumeration_mapping, mapping);
2392}
2393
2394/*! @} */
2395
2396/*!
2397@name Signed enumeration field class
2398@{
2399*/
2400
2401/*!
2402@brief
2403 Creates a \bt_senum_fc from the trace class \bt_p{trace_class}.
2404
2405On success, the returned signed enumeration field class has the
2406following property values:
2407
2408<table>
2409 <tr>
2410 <th>Property
2411 <th>Value
2412 <tr>
2413 <td>\ref api-tir-fc-int-prop-size "Field value range"
1eca514c 2414 <td>[−2<sup>63</sup>,&nbsp;2<sup>63</sup>&nbsp;−&nbsp;1]
43c59509
PP
2415 <tr>
2416 <td>\ref api-tir-fc-int-prop-base "Preferred display base"
2417 <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
2418 <tr>
2419 <td>\ref api-tir-fc-enum-prop-mappings "Mappings"
2420 <td>\em None
2421 <tr>
2422 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2423 <td>Empty \bt_map_val
2424</table>
2425
2426@param[in] trace_class
2427 Trace class from which to create a signed enumeration field
2428 class.
2429
2430@returns
2431 New signed enumeration field class reference, or \c NULL on memory
2432 error.
2433
2434@bt_pre_not_null{trace_class}
2435*/
2436extern bt_field_class *bt_field_class_enumeration_signed_create(
2437 bt_trace_class *trace_class);
2438
2439/*!
2440@brief
2441 Adds a mapping to the \bt_senum_fc \bt_p{field_class} having the
2442 label \bt_p{label} and the \bt_p_sint_rg \bt_p{ranges}.
2443
2444See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2445
2446@param[in] field_class
2447 Signed enumeration field class to which to add a mapping having
2448 the label \bt_p{label} and the integer ranges \bt_p{ranges}.
2449@param[in] label
2450 Label of the mapping to add to \bt_p{field_class} (copied).
2451@param[in] ranges
2452 Signed integer ranges of the mapping to add to
2453 \bt_p{field_class}.
2454
2455@retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK
2456 Success.
2457@retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR
2458 Out of memory.
2459
2460@bt_pre_not_null{field_class}
2461@bt_pre_hot{field_class}
2462@bt_pre_is_senum_fc{field_class}
2463@bt_pre_not_null{label}
2464@pre
2465 \bt_p{field_class} has no mapping with the label \bt_p{label}.
2466@bt_pre_not_null{ranges}
2467@pre
2468 \bt_p{ranges} contains one or more signed integer ranges.
2469*/
2470extern bt_field_class_enumeration_add_mapping_status
2471bt_field_class_enumeration_signed_add_mapping(
2472 bt_field_class *field_class, const char *label,
2473 const bt_integer_range_set_signed *ranges);
2474
2475/*!
2476@brief
2477 Borrows the mapping at index \bt_p{index} from the
2478 \bt_senum_fc \bt_p{field_class}.
2479
2480See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2481
2482@param[in] field_class
2483 Signed enumeration field class from which to borrow the mapping at
2484 index \bt_p{index}.
2485@param[in] index
2486 Index of the mapping to borrow from \bt_p{field_class}.
2487
2488@returns
2489 @parblock
2490 \em Borrowed reference of the mapping of
2491 \bt_p{field_class} at index \bt_p{index}.
2492
2493 The returned pointer remains valid as long as \bt_p{field_class}
2494 is not modified.
2495 @endparblock
2496
2497@bt_pre_not_null{field_class}
2498@bt_pre_is_senum_fc{field_class}
2499@pre
2500 \bt_p{index} is less than the number of mappings in
2501 \bt_p{field_class} (as returned by
2502 bt_field_class_enumeration_get_mapping_count()).
2503
2504@sa bt_field_class_enumeration_get_mapping_count() &mdash;
2505 Returns the number of mappings contained in an
2506 enumeration field class.
2507*/
2508extern const bt_field_class_enumeration_signed_mapping *
2509bt_field_class_enumeration_signed_borrow_mapping_by_index_const(
2510 const bt_field_class *field_class, uint64_t index);
2511
2512/*!
2513@brief
2514 Borrows the mapping having the label \bt_p{label} from the
2515 \bt_senum_fc \bt_p{field_class}.
2516
2517See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2518
2519If there's no mapping having the label \bt_p{label} in
2520\bt_p{field_class}, this function returns \c NULL.
2521
2522@param[in] field_class
2523 Signed enumeration field class from which to borrow the mapping
2524 having the label \bt_p{label}.
2525@param[in] label
2526 Label of the mapping to borrow from \bt_p{field_class}.
2527
2528@returns
2529 @parblock
2530 \em Borrowed reference of the mapping of
2531 \bt_p{field_class} having the label \bt_p{label}, or \c NULL
2532 if none.
2533
2534 The returned pointer remains valid as long as \bt_p{field_class}
2535 is not modified.
2536 @endparblock
2537
2538@bt_pre_not_null{field_class}
2539@bt_pre_is_senum_fc{field_class}
2540@bt_pre_not_null{label}
2541*/
2542extern const bt_field_class_enumeration_signed_mapping *
2543bt_field_class_enumeration_signed_borrow_mapping_by_label_const(
2544 const bt_field_class *field_class, const char *label);
2545
2546/*!
2547@brief
2548 Returns an array of all the labels of the mappings of the
2549 \bt_senum_fc \bt_p{field_class} of which the \bt_p_sint_rg contain
2550 the integral value \bt_p{value}.
2551
2552See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2553
2554This function sets \bt_p{*labels} to the resulting array and
2555\bt_p{*count} to the number of labels in \bt_p{*labels}.
2556
2557On success, if there's no mapping ranges containing the value
2558\bt_p{value}, \bt_p{*count} is 0.
2559
2560@param[in] field_class
2561 Signed enumeration field class from which to get the labels of the
2562 mappings of which the ranges contain \bt_p{value}.
2563@param[in] value
2564 Value for which to get the mapped labels in \bt_p{field_class}.
2565@param[out] labels
2566 @parblock
2567 <strong>On success</strong>, \bt_p{*labels}
2568 is an array of labels of the mappings of \bt_p{field_class}
2569 containing \bt_p{value}.
2570
2571 The number of labels in \bt_p{*labels} is \bt_p{*count}.
2572
2573 The array is owned by \bt_p{field_class} and remains valid as long
45397ca4
PP
2574 as:
2575
2576 - \bt_p{field_class} is not modified.
2577 - You don't call this function again with \bt_p{field_class}.
43c59509
PP
2578 @endparblock
2579@param[out] count
2580 <strong>On success</strong>, \bt_p{*count} is the number of labels
2581 in \bt_p{*labels} (can be 0).
2582
2583@retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK
2584 Success.
2585@retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR
2586 Out of memory.
2587
2588@bt_pre_not_null{field_class}
2589@bt_pre_is_senum_fc{field_class}
2590@bt_pre_not_null{labels}
2591@bt_pre_not_null{count}
2592*/
2593extern bt_field_class_enumeration_get_mapping_labels_for_value_status
2594bt_field_class_enumeration_signed_get_mapping_labels_for_value(
2595 const bt_field_class *field_class, int64_t value,
2596 bt_field_class_enumeration_mapping_label_array *labels,
2597 uint64_t *count);
2598
2599/*! @} */
2600
2601/*!
2602@name Signed enumeration field class mapping
2603@{
2604*/
2605
2606/*!
2607@typedef struct bt_field_class_enumeration_signed_mapping bt_field_class_enumeration_signed_mapping;
2608
2609@brief
2610 Signed enumeration field class mapping.
2611*/
2612
2613/*!
2614@brief
2615 Borrows the \bt_p_sint_rg from the \bt_senum_fc mapping
2616 \bt_p{mapping}.
2617
2618See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2619
2620@param[in] mapping
2621 Signed enumeration field class mapping from which to borrow the
2622 signed integer ranges.
2623
2624@returns
2625 Signed integer ranges of \bt_p{mapping}.
2626
2627@bt_pre_not_null{mapping}
2628*/
2629extern const bt_integer_range_set_signed *
2630bt_field_class_enumeration_signed_mapping_borrow_ranges_const(
2631 const bt_field_class_enumeration_signed_mapping *mapping);
2632
2633/*!
2634@brief
2635 \ref api-fund-c-typing "Upcasts" the \bt_senum_fc mapping
2636 \bt_p{mapping} to the common #bt_field_class_enumeration_mapping
2637 type.
2638
2639See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2640
2641@param[in] mapping
2642 @parblock
2643 Signed enumeration field class mapping to upcast.
2644
2645 Can be \c NULL.
2646 @endparblock
2647
2648@returns
2649 \bt_p{mapping} as a common enumeration field class mapping.
2650*/
2651static inline
2652const bt_field_class_enumeration_mapping *
2653bt_field_class_enumeration_signed_mapping_as_mapping_const(
2654 const bt_field_class_enumeration_signed_mapping *mapping)
2655{
2656 return __BT_UPCAST_CONST(bt_field_class_enumeration_mapping, mapping);
2657}
2658
2659/*! @} */
2660
2661/*!
2662@name String field class
2663@{
2664*/
2665
2666/*!
2667@brief
2668 Creates a \bt_string_fc from the trace class \bt_p{trace_class}.
2669
2670On success, the returned string field class has the following property
2671value:
2672
2673<table>
2674 <tr>
2675 <th>Property
2676 <th>Value
2677 <tr>
2678 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2679 <td>Empty \bt_map_val
2680</table>
2681
2682@param[in] trace_class
2683 Trace class from which to create a string field class.
2684
2685@returns
2686 New string field class reference, or \c NULL on memory error.
2687
2688@bt_pre_not_null{trace_class}
2689*/
2690extern bt_field_class *bt_field_class_string_create(
2691 bt_trace_class *trace_class);
2692
2693/*! @} */
2694
2695/*!
2696@name Array field class
2697@{
2698*/
2699
2700/*!
2701@brief
2702 Borrows the element field class from the \bt_array_fc
2703 \bt_p{field_class}.
2704
2705See the \ref api-tir-fc-array-prop-elem-fc "element field class"
2706property.
2707
2708@param[in] field_class
2709 Array field class from which to borrow the element field class.
2710
2711@returns
2712 Element field class of \bt_p{field_class}.
2713
2714@bt_pre_not_null{field_class}
2715@bt_pre_is_array_fc{field_class}
2716
2717@sa bt_field_class_array_borrow_element_field_class_const() &mdash;
2718 \c const version of this function.
2719*/
2720extern bt_field_class *bt_field_class_array_borrow_element_field_class(
2721 bt_field_class *field_class);
2722
2723/*!
2724@brief
2725 Borrows the element field class from the \bt_array_fc
2726 \bt_p{field_class} (\c const version).
2727
2728See bt_field_class_array_borrow_element_field_class().
2729*/
2730extern const bt_field_class *
2731bt_field_class_array_borrow_element_field_class_const(
2732 const bt_field_class *field_class);
2733
2734/*! @} */
2735
2736/*!
2737@name Static array field class
2738@{
2739*/
2740
2741/*!
2742@brief
2743 Creates a \bt_sarray_fc having the element field class
2744 \bt_p{element_field_class} and the length \bt_p{length} from the
2745 trace class \bt_p{trace_class}.
2746
2747On success, the returned static array field class has the following
2748property values:
2749
2750<table>
2751 <tr>
2752 <th>Property
2753 <th>Value
2754 <tr>
2755 <td>\ref api-tir-fc-array-prop-elem-fc "Element field class"
2756 <td>\bt_p{element_field_class}
2757 <tr>
2758 <td>\ref api-tir-fc-sarray-prop-len "Length"
2759 <td>\bt_p{length}
2760 <tr>
2761 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2762 <td>Empty \bt_map_val
2763</table>
2764
2765@param[in] trace_class
2766 Trace class from which to create a static array field class.
2767@param[in] element_field_class
2768 Class of the element fields of the instances of the static array
2769 field class to create.
2770@param[in] length
2771 Length of the instances of the static array field class to create.
2772
2773@returns
2774 New static array field class reference, or \c NULL on memory error.
2775
2776@bt_pre_not_null{trace_class}
2777@bt_pre_not_null{element_field_class}
2778bt_pre_fc_not_in_tc{element_field_class}
2779
2780@bt_post_success_frozen{element_field_class}
2781*/
2782extern bt_field_class *bt_field_class_array_static_create(
2783 bt_trace_class *trace_class,
2784 bt_field_class *element_field_class, uint64_t length);
2785
2786/*!
2787@brief
2788 Returns the length of the \bt_sarray_fc \bt_p{field_class}.
2789
2790See the \ref api-tir-fc-sarray-prop-len "length" property.
2791
2792@param[in] field_class
2793 Static array field class of which to get the length.
2794
2795@returns
2796 Length of \bt_p{field_class}.
2797
2798@bt_pre_not_null{field_class}
2799@bt_pre_is_sarray_fc{field_class}
2800*/
2801extern uint64_t bt_field_class_array_static_get_length(
2802 const bt_field_class *field_class);
2803
2804/*! @} */
2805
2806/*!
2807@name Dynamic array field class
2808@{
2809*/
2810
2811/*!
2812@brief
2813 Creates a \bt_darray_fc having the element field class
2814 \bt_p{element_field_class} from the trace class \bt_p{trace_class}.
2815
2816If \bt_p{length_field_class} is not \c NULL, then the created dynamic
2817array field class has a linked length field class.
2818See
2819\ref api-tir-fc-link "Field classes with links to other field classes"
2820to learn more.
2821
2822On success, the returned dynamic array field class has the following
2823property values:
2824
2825<table>
2826 <tr>
2827 <th>Property
2828 <th>Value
2829 <tr>
2830 <td>\ref api-tir-fc-array-prop-elem-fc "Element field class"
2831 <td>\bt_p{element_field_class}
2832 <tr>
2833 <td>\ref api-tir-fc-darray-prop-len-fp "Length field path"
2834 <td>
2835 \em None (if \bt_p{length_field_class} is not \c NULL, this
2836 property becomes available when the returned field class becomes
2837 part of an \bt_ev_cls or of a \bt_stream_cls)
2838 <tr>
2839 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2840 <td>Empty \bt_map_val
2841</table>
2842
2843@param[in] trace_class
2844 Trace class from which to create a dynamic array field class.
2845@param[in] element_field_class
2846 Class of the element fields of the instances of the dynamic array
2847 field class to create.
2848@param[in] length_field_class
2849 @parblock
2850 Linked length field class of the dynamic array field class to
2851 create.
2852
2853 Can be \c NULL.
2854 @endparblock
2855
2856@returns
2857 New dynamic array field class reference, or \c NULL on memory error.
2858
2859@bt_pre_not_null{trace_class}
2860@bt_pre_not_null{element_field_class}
2861@bt_pre_fc_not_in_tc{element_field_class}
2862@pre
2863 <strong>If \bt_p{length_field_class} is not \c NULL</strong>,
2864 \bt_p{length_field_class} is an \bt_uint_fc.
2865
2866@bt_post_success_frozen{element_field_class}
2867@bt_post_success_frozen{length_field_class}
2868*/
2869extern bt_field_class *bt_field_class_array_dynamic_create(
2870 bt_trace_class *trace_class,
2871 bt_field_class *element_field_class,
2872 bt_field_class *length_field_class);
2873
2874/*! @} */
2875
2876/*!
2877@name Dynamic array field class with length field
2878@{
2879*/
2880
2881/*!
2882@brief
2883 Borrows the length field path from the \bt_darray_fc (with a length
2884 field) \bt_p{field_class}.
2885
2886See the \ref api-tir-fc-darray-prop-len-fp "length field path" property.
2887
2888This property is only available when a \bt_struct_fc containing
2889(recursively) \bt_p{field_class} is passed to one of:
2890
2891- bt_stream_class_set_packet_context_field_class()
2892- bt_stream_class_set_event_common_context_field_class()
2893- bt_event_class_set_specific_context_field_class()
2894- bt_event_class_set_payload_field_class()
2895
2896In the meantime, this function returns \c NULL.
2897
2898@param[in] field_class
2899 Dynamic array field class from which to borrow the length
2900 field path.
2901
2902@returns
2903 Length field path of \bt_p{field_class}.
2904
2905@bt_pre_not_null{field_class}
2906@bt_pre_is_darray_wl_fc{field_class}
2907*/
2908extern const bt_field_path *
2909bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const(
2910 const bt_field_class *field_class);
2911
2912/*! @} */
2913
2914/*!
2915@name Structure field class
2916@{
2917*/
2918
2919/*!
2920@brief
2921 Creates a \bt_struct_fc from the trace class \bt_p{trace_class}.
2922
2923On success, the returned structure field class has the following
2924property values:
2925
2926<table>
2927 <tr>
2928 <th>Property
2929 <th>Value
2930 <tr>
2931 <td>\ref api-tir-fc-struct-prop-members "Members"
2932 <td>\em None
2933 <tr>
2934 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2935 <td>Empty \bt_map_val
2936</table>
2937
2938@param[in] trace_class
2939 Trace class from which to create a structure field class.
2940
2941@returns
2942 New structure field class reference, or \c NULL on memory error.
2943
2944@bt_pre_not_null{trace_class}
2945*/
2946extern bt_field_class *bt_field_class_structure_create(
2947 bt_trace_class *trace_class);
2948
2949/*!
2950@brief
2951 Status codes for bt_field_class_structure_append_member().
2952*/
2953typedef enum bt_field_class_structure_append_member_status {
2954 /*!
2955 @brief
2956 Success.
2957 */
2958 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK = __BT_FUNC_STATUS_OK,
2959
2960 /*!
2961 @brief
2962 Out of memory.
2963 */
2964 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
2965} bt_field_class_structure_append_member_status;
2966
2967/*!
2968@brief
2969 Appends a member to the \bt_struct_fc \bt_p{field_class} having the
2970 name \bt_p{name} and the field class \bt_p{member_field_class}.
2971
2972See the \ref api-tir-fc-struct-prop-members "members" property.
2973
2974@param[in] field_class
2975 Structure field class to which to append a member having
2976 the name \bt_p{name} and the field class \bt_p{member_field_class}.
2977@param[in] name
2978 Name of the member to append to \bt_p{field_class} (copied).
2979@param[in] member_field_class
2980 Field class of the member to append to \bt_p{field_class}.
2981
2982@retval #BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK
2983 Success.
2984@retval #BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR
2985 Out of memory.
2986
2987@bt_pre_not_null{field_class}
2988@bt_pre_hot{field_class}
2989@bt_pre_is_struct_fc{field_class}
2990@pre
2991 \bt_p{field_class} has no member with the name \bt_p{name}.
2992@bt_pre_not_null{name}
2993@bt_pre_not_null{member_field_class}
2994@bt_pre_fc_not_in_tc{member_field_class}
2995
2996@bt_post_success_frozen{member_field_class}
2997*/
2998extern bt_field_class_structure_append_member_status
2999bt_field_class_structure_append_member(
3000 bt_field_class *field_class,
3001 const char *name, bt_field_class *member_field_class);
3002
3003/*!
3004@brief
3005 Returns the number of members contained in the \bt_struct_fc
3006 \bt_p{field_class}.
3007
3008See the \ref api-tir-fc-struct-prop-members "members" property.
3009
3010@param[in] field_class
3011 Structure field class of which to get the number of contained
3012 members.
3013
3014@returns
3015 Number of contained members in \bt_p{field_class}.
3016
3017@bt_pre_not_null{field_class}
3018@bt_pre_is_struct_fc{field_class}
3019*/
3020extern uint64_t bt_field_class_structure_get_member_count(
3021 const bt_field_class *field_class);
3022
3023/*!
3024@brief
3025 Borrows the member at index \bt_p{index} from the
3026 \bt_struct_fc \bt_p{field_class}.
3027
3028See the \ref api-tir-fc-struct-prop-members "members" property.
3029
3030@param[in] field_class
3031 Structure field class from which to borrow the member at
3032 index \bt_p{index}.
3033@param[in] index
3034 Index of the member to borrow from \bt_p{field_class}.
3035
3036@returns
3037 @parblock
3038 \em Borrowed reference of the member of
3039 \bt_p{field_class} at index \bt_p{index}.
3040
3041 The returned pointer remains valid as long as \bt_p{field_class}
3042 is not modified.
3043 @endparblock
3044
3045@bt_pre_not_null{field_class}
3046@bt_pre_is_struct_fc{field_class}
3047@pre
3048 \bt_p{index} is less than the number of members in
3049 \bt_p{field_class} (as returned by
3050 bt_field_class_structure_get_member_count()).
3051
3052@sa bt_field_class_structure_get_member_count() &mdash;
3053 Returns the number of members contained in a structure field class.
3054@sa bt_field_class_structure_borrow_member_by_index_const() &mdash;
3055 \c const version of this function.
3056*/
3057extern bt_field_class_structure_member *
3058bt_field_class_structure_borrow_member_by_index(
3059 bt_field_class *field_class, uint64_t index);
3060
3061/*!
3062@brief
3063 Borrows the member at index \bt_p{index} from the
3064 \bt_struct_fc \bt_p{field_class} (\c const version).
3065
3066See bt_field_class_structure_borrow_member_by_index().
3067*/
3068extern const bt_field_class_structure_member *
3069bt_field_class_structure_borrow_member_by_index_const(
3070 const bt_field_class *field_class, uint64_t index);
3071
3072/*!
3073@brief
3074 Borrows the member having the name \bt_p{name} from the
3075 \bt_struct_fc \bt_p{field_class}.
3076
3077See the \ref api-tir-fc-struct-prop-members "members" property.
3078
3079If there's no member having the name \bt_p{name} in
3080\bt_p{field_class}, this function returns \c NULL.
3081
3082@param[in] field_class
3083 Structure field class from which to borrow the member having the
3084 name \bt_p{name}.
3085@param[in] name
3086 Name of the member to borrow from \bt_p{field_class}.
3087
3088@returns
3089 @parblock
3090 \em Borrowed reference of the member of
3091 \bt_p{field_class} having the name \bt_p{name}, or \c NULL
3092 if none.
3093
3094 The returned pointer remains valid as long as \bt_p{field_class}
3095 is not modified.
3096 @endparblock
3097
3098@bt_pre_not_null{field_class}
3099@bt_pre_is_struct_fc{field_class}
3100@bt_pre_not_null{name}
3101
3102@sa bt_field_class_structure_borrow_member_by_name_const() &mdash;
3103 \c const version of this function.
3104*/
3105extern bt_field_class_structure_member *
3106bt_field_class_structure_borrow_member_by_name(
3107 bt_field_class *field_class, const char *name);
3108
3109/*!
3110@brief
3111 Borrows the member having the name \bt_p{name} from the
3112 \bt_struct_fc \bt_p{field_class} (\c const version).
3113
3114See bt_field_class_structure_borrow_member_by_name().
3115*/
3116extern const bt_field_class_structure_member *
3117bt_field_class_structure_borrow_member_by_name_const(
3118 const bt_field_class *field_class, const char *name);
3119
3120/*! @} */
3121
3122/*!
3123@name Structure field class member
3124@{
3125*/
3126
3127/*!
3128@typedef struct bt_field_class_structure_member bt_field_class_structure_member;
3129
3130@brief
3131 Structure field class member.
3132*/
3133
3134/*!
3135@brief
3136 Returns the name of the \bt_struct_fc member \bt_p{member}.
3137
3138See the \ref api-tir-fc-struct-prop-members "members" property.
3139
3140@param[in] member
3141 Structure field class member of which to get the name.
3142
3143@returns
3144 @parblock
3145 Name of \bt_p{member}.
3146
3147 The returned pointer remains valid as long as \bt_p{member} exists.
3148 @endparblock
3149
3150@bt_pre_not_null{member}
3151*/
3152extern const char *bt_field_class_structure_member_get_name(
3153 const bt_field_class_structure_member *member);
3154
3155/*!
3156@brief
3157 Borrows the field class from the \bt_struct_fc member
3158 \bt_p{member}.
3159
3160See the \ref api-tir-fc-struct-prop-members "members" property.
3161
3162@param[in] member
3163 Structure field class member from which to borrow the field class.
3164
3165@returns
3166 Field class of \bt_p{member}.
3167
3168@bt_pre_not_null{member}
3169
3170@sa bt_field_class_structure_member_borrow_field_class_const() &mdash;
3171 \c const version of this function.
3172*/
3173extern bt_field_class *
3174bt_field_class_structure_member_borrow_field_class(
3175 bt_field_class_structure_member *member);
3176
3177/*!
3178@brief
3179 Borrows the field class from the \bt_struct_fc member
3180 \bt_p{member} (\c const version).
3181
3182See bt_field_class_structure_member_borrow_field_class().
3183*/
3184extern const bt_field_class *
3185bt_field_class_structure_member_borrow_field_class_const(
3186 const bt_field_class_structure_member *member);
3187
3188/*!
3189@brief
3190 Sets the user attributes of the \bt_struct_fc member \bt_p{member}
3191 to \bt_p{user_attributes}.
3192
3193See the \ref api-tir-fc-struct-prop-members "members" property.
3194
3195@note
3196 When you append a member to a structure field class with
3197 bt_field_class_structure_append_member(), the member's
3198 initial user attributes is an empty \bt_map_val. Therefore you can
3199 borrow it with
3200 bt_field_class_structure_member_borrow_user_attributes() and fill it
3201 directly instead of setting a new one with this function.
3202
3203@param[in] member
3204 Structure field class member of which to set the user attributes to
3205 \bt_p{user_attributes}.
3206@param[in] user_attributes
3207 New user attributes of \bt_p{member}.
3208
3209@bt_pre_not_null{member}
3210@bt_pre_hot{member}
3211@bt_pre_not_null{user_attributes}
3212@bt_pre_is_map_val{user_attributes}
3213
3214@sa bt_field_class_structure_member_borrow_user_attributes() &mdash;
3215 Borrows the user attributes of a structure field class member.
3216*/
3217extern void bt_field_class_structure_member_set_user_attributes(
3218 bt_field_class_structure_member *member,
3219 const bt_value *user_attributes);
3220
3221/*!
3222@brief
3223 Borrows the user attributes of the \bt_struct_fc member
3224 \bt_p{member}.
3225
3226See the \ref api-tir-fc-struct-prop-members "members" property.
3227
3228@note
3229 When you append a member to a structure field class with
3230 bt_field_class_structure_append_member(), the member's
3231 initial user attributes is an empty \bt_map_val.
3232
3233@param[in] member
3234 Structure field class member from which to borrow the user
3235 attributes.
3236
3237@returns
3238 User attributes of \bt_p{member} (a \bt_map_val).
3239
3240@bt_pre_not_null{member}
3241
3242@sa bt_field_class_structure_member_set_user_attributes() &mdash;
3243 Sets the user attributes of a structure field class member.
3244@sa bt_field_class_structure_member_borrow_user_attributes_const() &mdash;
3245 \c const version of this function.
3246*/
3247extern bt_value *
3248bt_field_class_structure_member_borrow_user_attributes(
3249 bt_field_class_structure_member *member);
3250
3251/*!
3252@brief
3253 Borrows the user attributes of the \bt_struct_fc member
3254 \bt_p{member} (\c const version).
3255
3256See bt_field_class_structure_member_borrow_user_attributes().
3257*/
3258extern const bt_value *
3259bt_field_class_structure_member_borrow_user_attributes_const(
3260 const bt_field_class_structure_member *member);
3261
3262/*! @} */
3263
3264/*!
3265@name Option field class
3266@{
3267*/
3268
3269/*!
3270@brief
3271 Borrows the optional field class from the \bt_opt_fc
3272 \bt_p{field_class}.
3273
3274See the \ref api-tir-fc-opt-prop-fc "optional field class" property.
3275
3276@param[in] field_class
3277 Option field class from which to borrow the optional field class.
3278
3279@returns
3280 Optional field class of \bt_p{field_class}.
3281
3282@bt_pre_not_null{field_class}
3283@bt_pre_is_opt_fc{field_class}
3284
3285@sa bt_field_class_option_borrow_field_class_const() &mdash;
3286 \c const version of this function.
3287*/
3288extern bt_field_class *bt_field_class_option_borrow_field_class(
3289 bt_field_class *field_class);
3290
3291/*!
3292@brief
3293 Borrows the optional field class from the \bt_opt_fc
3294 \bt_p{field_class} (\c const version).
3295
3296See bt_field_class_option_borrow_field_class().
3297*/
3298extern const bt_field_class *
3299bt_field_class_option_borrow_field_class_const(
3300 const bt_field_class *field_class);
3301
3302/*! @} */
3303
3304/*!
3305@name Option field class without a selector field
3306@{
3307*/
3308
3309/*!
3310@brief
3311 Creates an \bt_opt_fc (without a selector field) having the optional
3312 field class \bt_p{optional_field_class} from the trace class
3313 \bt_p{trace_class}.
3314
3315On success, the returned option field class has the following property
3316values:
3317
3318<table>
3319 <tr>
3320 <th>Property
3321 <th>Value
3322 <tr>
3323 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
3324 <td>\bt_p{optional_field_class}
3325 <tr>
3326 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3327 <td>Empty \bt_map_val
3328</table>
3329
3330@param[in] trace_class
3331 Trace class from which to create an option field class.
3332@param[in] optional_field_class
3333 Class of the optional fields of the instances of the option field
3334 class to create.
3335
3336@returns
3337 New option field class reference, or \c NULL on memory error.
3338
3339@bt_pre_not_null{trace_class}
3340@bt_pre_not_null{optional_field_class}
3341@bt_pre_fc_not_in_tc{optional_field_class}
3342
3343@bt_post_success_frozen{optional_field_class}
3344*/
3345extern bt_field_class *bt_field_class_option_without_selector_create(
3346 bt_trace_class *trace_class,
3347 bt_field_class *optional_field_class);
3348
3349/*! @} */
3350
3351/*!
3352@name Option field class with a selector field
3353@{
3354*/
3355
3356/*!
3357@brief
3358 Borrows the selector field path from the \bt_opt_fc (with a selector
3359 field) \bt_p{field_class}.
3360
3361See the \ref api-tir-fc-opt-prop-sel-fp "selector field path" property.
3362
3363This property is only available when a \bt_struct_fc containing
3364(recursively) \bt_p{field_class} is passed to one of:
3365
3366- bt_stream_class_set_packet_context_field_class()
3367- bt_stream_class_set_event_common_context_field_class()
3368- bt_event_class_set_specific_context_field_class()
3369- bt_event_class_set_payload_field_class()
3370
3371In the meantime, this function returns \c NULL.
3372
3373@param[in] field_class
3374 Option field class from which to borrow the selector field path.
3375
3376@returns
3377 Selector field path of \bt_p{field_class}.
3378
3379@bt_pre_not_null{field_class}
3380@bt_pre_is_opt_ws_fc{field_class}
3381*/
3382extern const bt_field_path *
3383bt_field_class_option_with_selector_field_borrow_selector_field_path_const(
3384 const bt_field_class *field_class);
3385
3386/*! @} */
3387
3388/*!
3389@name Option field class with a boolean selector field
3390@{
3391*/
3392
3393/*!
3394@brief
3395 Creates an \bt_opt_fc (with a boolean selector field) having the
3396 optional field class \bt_p{optional_field_class} from the trace
3397 class \bt_p{trace_class}.
3398
3399On success, the returned option field class has the following property
3400values:
3401
3402<table>
3403 <tr>
3404 <th>Property
3405 <th>Value
3406 <tr>
3407 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
3408 <td>\bt_p{optional_field_class}
3409 <tr>
3410 <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path"
3411 <td>
3412 \em None (this property becomes available when the returned field
3413 class becomes part of an \bt_ev_cls or of a \bt_stream_cls)
3414 <tr>
3415 <td>\ref api-tir-fc-opt-prop-sel-rev "Selector is reversed?"
3416 <td>#BT_FALSE
3417 <tr>
3418 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3419 <td>Empty \bt_map_val
3420</table>
3421
3422@param[in] trace_class
3423 Trace class from which to create an option field class.
3424@param[in] optional_field_class
3425 Class of the optional fields of the instances of the option field
3426 class to create.
3427@param[in] selector_field_class
3428 Linked selector field class of the option field class to create.
3429
3430@returns
3431 New option field class reference, or \c NULL on memory error.
3432
3433@bt_pre_not_null{trace_class}
3434@bt_pre_not_null{optional_field_class}
3435@bt_pre_fc_not_in_tc{optional_field_class}
3436@bt_pre_not_null{selector_field_class}
3437@pre
3438 \bt_p{selector_field_class} is a \bt_bool_fc.
3439
3440@bt_post_success_frozen{optional_field_class}
3441@bt_post_success_frozen{selector_field_class}
3442*/
3443extern bt_field_class *bt_field_class_option_with_selector_field_bool_create(
3444 bt_trace_class *trace_class,
3445 bt_field_class *optional_field_class,
3446 bt_field_class *selector_field_class);
3447
3448/*!
3449@brief
3450 Sets whether or not the selector of the \bt_opt_fc (with a boolean
3451 selector field) \bt_p{field_class} is reversed.
3452
3453See the \ref api-tir-fc-opt-prop-sel-rev "selector is reversed?"
3454property.
3455
3456@param[in] field_class
3457 Option field class of which to set whether or not its selector
3458 is reversed.
3459@param[in] selector_is_reversed
3460 #BT_TRUE to make \bt_p{field_class} have a reversed selector.
3461
3462@bt_pre_not_null{field_class}
3463@bt_pre_hot{field_class}
3464@bt_pre_is_opt_wbs_fc{field_class}
3465
3466@sa bt_field_class_option_with_selector_field_bool_selector_is_reversed() &mdash;
3467 Returns whether or not the selector of an option field class (with
3468 a boolean selector field) is reversed.
3469*/
3470extern void
3471bt_field_class_option_with_selector_field_bool_set_selector_is_reversed(
3472 bt_field_class *field_class, bt_bool selector_is_reversed);
3473
3474/*!
3475@brief
3476 Returns whether or not the selector of the
3477 \bt_opt_fc (with a boolean selector field) is reversed.
3478
3479See the \ref api-tir-fc-opt-prop-sel-rev "selector is reversed?"
3480property.
3481
3482@param[in] field_class
3483 Option field class of which to get whether or not its selector is
3484 reversed.
3485
3486@returns
3487 #BT_TRUE if the selector of \bt_p{field_class} is reversed.
3488
3489@bt_pre_not_null{field_class}
3490@bt_pre_is_opt_wbs_fc{field_class}
3491
3492@sa bt_field_class_option_with_selector_field_bool_set_selector_is_reversed() &mdash;
3493 Sets whether or not the selector of an option field class (with
3494 a boolean selector field) is reversed.
3495*/
3496extern bt_bool
3497bt_field_class_option_with_selector_field_bool_selector_is_reversed(
3498 const bt_field_class *field_class);
3499
3500/*! @} */
3501
3502/*!
3503@name Option field class with an unsigned integer selector field
3504@{
3505*/
3506
3507/*!
3508@brief
3509 Creates an \bt_opt_fc (with an unsigned integer selector field)
3510 having the optional field class \bt_p{optional_field_class} from the
3511 trace class \bt_p{trace_class}.
3512
3513On success, the returned option field class has the following property
3514values:
3515
3516<table>
3517 <tr>
3518 <th>Property
3519 <th>Value
3520 <tr>
3521 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
3522 <td>\bt_p{optional_field_class}
3523 <tr>
3524 <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path"
3525 <td>
3526 \em None (this property becomes available when the returned field
3527 class becomes part of an \bt_ev_cls or of a \bt_stream_cls)
3528 <tr>
3529 <td>\ref api-tir-fc-opt-prop-uint-rs "Selector's unsigned integer ranges"
3530 <td>\bt_p{ranges}
3531 <tr>
3532 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3533 <td>Empty \bt_map_val
3534</table>
3535
3536@param[in] trace_class
3537 Trace class from which to create an option field class.
3538@param[in] optional_field_class
3539 Class of the optional fields of the instances of the option field
3540 class to create.
3541@param[in] selector_field_class
3542 Linked selector field class of the option field class to create.
3543@param[in] ranges
3544 Selector's unsigned integer ranges of the option field class to
3545 create.
3546
3547@returns
3548 New option field class reference, or \c NULL on memory error.
3549
3550@bt_pre_not_null{trace_class}
3551@bt_pre_not_null{optional_field_class}
3552@bt_pre_fc_not_in_tc{optional_field_class}
3553@bt_pre_not_null{selector_field_class}
3554@pre
3555 \bt_p{selector_field_class} is a \bt_uint_fc.
3556@bt_pre_not_null{ranges}
3557@pre
3558 \bt_p{ranges} contains one or more \bt_p_uint_rg.
3559
3560@bt_post_success_frozen{optional_field_class}
3561@bt_post_success_frozen{selector_field_class}
3562@bt_post_success_frozen{ranges}
3563*/
3564extern bt_field_class *
3565bt_field_class_option_with_selector_field_integer_unsigned_create(
3566 bt_trace_class *trace_class,
3567 bt_field_class *optional_field_class,
3568 bt_field_class *selector_field_class,
3569 const bt_integer_range_set_unsigned *ranges);
3570
3571/*!
3572@brief
3573 Borrows the \bt_p_uint_rg from the \bt_opt_fc (with an unsigned
3574 integer selector field) \bt_p{field_class}.
3575
3576See the
3577\ref api-tir-fc-opt-prop-uint-rs "selector's unsigned integer ranges"
3578property.
3579
3580@param[in] field_class
3581 Option field class from which to borrow the unsigned integer ranges.
3582
3583@returns
3584 Unsigned integer ranges of \bt_p{field_class}.
3585
3586@bt_pre_not_null{field_class}
3587@bt_pre_is_opt_wuis_fc{field_class}
3588*/
3589extern const bt_integer_range_set_unsigned *
3590bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const(
3591 const bt_field_class *field_class);
3592
3593/*! @} */
3594
3595/*!
3596@name Option field class with a signed integer selector field
3597@{
3598*/
3599
3600/*!
3601@brief
3602 Creates an \bt_opt_fc (with a signed integer selector field)
3603 having the optional field class \bt_p{optional_field_class} from the
3604 trace class \bt_p{trace_class}.
3605
3606On success, the returned option field class has the following property
3607values:
3608
3609<table>
3610 <tr>
3611 <th>Property
3612 <th>Value
3613 <tr>
3614 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
3615 <td>\bt_p{optional_field_class}
3616 <tr>
3617 <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path"
3618 <td>
3619 \em None (this property becomes available when the returned field
3620 class becomes part of an \bt_ev_cls or of a \bt_stream_cls)
3621 <tr>
3622 <td>\ref api-tir-fc-opt-prop-sint-rs "Selector's signed integer ranges"
3623 <td>\bt_p{ranges}
3624 <tr>
3625 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3626 <td>Empty \bt_map_val
3627</table>
3628
3629@param[in] trace_class
3630 Trace class from which to create an option field class.
3631@param[in] optional_field_class
3632 Class of the optional fields of the instances of the option field
3633 class to create.
3634@param[in] selector_field_class
3635 Linked selector field class of the option field class to create.
3636@param[in] ranges
3637 Selector's signed integer ranges of the option field class to
3638 create.
3639
3640@returns
3641 New option field class reference, or \c NULL on memory error.
3642
3643@bt_pre_not_null{trace_class}
3644@bt_pre_not_null{optional_field_class}
3645@bt_pre_fc_not_in_tc{optional_field_class}
3646@bt_pre_not_null{selector_field_class}
3647@pre
3648 \bt_p{selector_field_class} is a \bt_uint_fc.
3649@bt_pre_not_null{ranges}
3650@pre
3651 \bt_p{ranges} contains one or more \bt_p_uint_rg.
3652
3653@bt_post_success_frozen{optional_field_class}
3654@bt_post_success_frozen{selector_field_class}
3655@bt_post_success_frozen{ranges}
3656*/
3657extern bt_field_class *
3658bt_field_class_option_with_selector_field_integer_signed_create(
3659 bt_trace_class *trace_class,
3660 bt_field_class *optional_field_class,
3661 bt_field_class *selector_field_class,
3662 const bt_integer_range_set_signed *ranges);
3663
3664/*!
3665@brief
3666 Borrows the \bt_p_sint_rg from the \bt_opt_fc (with a signed
3667 integer selector field) \bt_p{field_class}.
c6962c96 3668
43c59509
PP
3669See the
3670\ref api-tir-fc-opt-prop-sint-rs "selector's signed integer ranges"
3671property.
5cebbe7f 3672
43c59509
PP
3673@param[in] field_class
3674 Option field class from which to borrow the signed integer ranges.
1094efa4 3675
43c59509
PP
3676@returns
3677 Signed integer ranges of \bt_p{field_class}.
5cd6d0e5 3678
43c59509
PP
3679@bt_pre_not_null{field_class}
3680@bt_pre_is_opt_wsis_fc{field_class}
3681*/
3682extern const bt_integer_range_set_signed *
3683bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const(
3684 const bt_field_class *field_class);
40f4ba76 3685
43c59509 3686/*! @} */
40f4ba76 3687
43c59509
PP
3688/*!
3689@name Variant field class
3690@{
3691*/
40f4ba76 3692
43c59509
PP
3693/*!
3694@brief
3695 Creates a \bt_var_fc from the trace class \bt_p{trace_class}.
40f4ba76 3696
43c59509
PP
3697If \bt_p{selector_field_class} is not \c NULL, then the created variant
3698field class has a linked selector field class.
3699See
3700\ref api-tir-fc-link "Field classes with links to other field classes"
3701to learn more.
40f4ba76 3702
43c59509
PP
3703On success, the returned variant field class has the following
3704property values:
40f4ba76 3705
43c59509
PP
3706<table>
3707 <tr>
3708 <th>Property
3709 <th>Value
3710 <tr>
3711 <td>\ref api-tir-fc-var-prop-sel-fp "Selector field path"
3712 <td>
3713 \em None (if \bt_p{selector_field_class} is not \c NULL, this
3714 property becomes available when the returned field class becomes
3715 part of an \bt_ev_cls or of a \bt_stream_cls)
3716 <tr>
3717 <td>\ref api-tir-fc-var-prop-opts "Options"
3718 <td>\em None
3719 <tr>
3720 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3721 <td>Empty \bt_map_val
3722</table>
40f4ba76 3723
43c59509
PP
3724@param[in] trace_class
3725 Trace class from which to create a variant field class.
3726@param[in] selector_field_class
3727 @parblock
3728 Linked selector field class of the variant field class to create.
d24d5663 3729
43c59509
PP
3730 Can be \c NULL.
3731 @endparblock
40f4ba76 3732
43c59509
PP
3733@returns
3734 New variant field class reference, or \c NULL on memory error.
40f4ba76 3735
43c59509
PP
3736@bt_pre_not_null{trace_class}
3737@pre
3738 <strong>If \bt_p{selector_field_class} is not \c NULL</strong>,
3739 \bt_p{selector_field_class} is an \bt_int_fc.
40f4ba76 3740
43c59509
PP
3741@bt_post_success_frozen{element_field_class}
3742@bt_post_success_frozen{selector_field_class}
3743*/
3744extern bt_field_class *bt_field_class_variant_create(
3745 bt_trace_class *trace_class,
3746 bt_field_class *selector_field_class);
40f4ba76 3747
43c59509
PP
3748/*!
3749@brief
3750 Returns the number of options contained in the \bt_var_fc
3751 \bt_p{field_class}.
d24d5663 3752
43c59509 3753See the \ref api-tir-fc-var-prop-opts "options" property.
40f4ba76 3754
43c59509
PP
3755@param[in] field_class
3756 Variant field class of which to get the number of contained
3757 options.
3758
3759@returns
3760 Number of contained options in \bt_p{field_class}.
3761
3762@bt_pre_not_null{field_class}
3763@bt_pre_is_var_fc{field_class}
3764*/
3765extern uint64_t bt_field_class_variant_get_option_count(
3766 const bt_field_class *field_class);
3767
3768/*!
3769@brief
3770 Borrows the option at index \bt_p{index} from the
3771 \bt_var_fc \bt_p{field_class}.
3772
3773See the \ref api-tir-fc-var-prop-opts "options" property.
3774
3775@param[in] field_class
3776 Variant field class from which to borrow the option at
3777 index \bt_p{index}.
3778@param[in] index
3779 Index of the option to borrow from \bt_p{field_class}.
3780
3781@returns
3782 @parblock
3783 \em Borrowed reference of the option of
3784 \bt_p{field_class} at index \bt_p{index}.
3785
3786 The returned pointer remains valid as long as \bt_p{field_class}
3787 is not modified.
3788 @endparblock
3789
3790@bt_pre_not_null{field_class}
3791@bt_pre_is_var_fc{field_class}
3792@pre
3793 \bt_p{index} is less than the number of options in
3794 \bt_p{field_class} (as returned by
3795 bt_field_class_variant_get_option_count()).
3796
3797@sa bt_field_class_variant_get_option_count() &mdash;
3798 Returns the number of options contained in a variant field class.
3799@sa bt_field_class_variant_borrow_option_by_index_const() &mdash;
3800 \c const version of this function.
3801*/
3802extern bt_field_class_variant_option *
3803bt_field_class_variant_borrow_option_by_index(
1e6fd1d7 3804 bt_field_class *field_class, uint64_t index);
740faaf4 3805
43c59509
PP
3806/*!
3807@brief
3808 Borrows the option at index \bt_p{index} from the
3809 \bt_var_fc \bt_p{field_class} (\c const version).
3810
3811See bt_field_class_variant_borrow_option_by_index().
3812*/
3813extern const bt_field_class_variant_option *
3814bt_field_class_variant_borrow_option_by_index_const(
3815 const bt_field_class *field_class, uint64_t index);
3816
3817/*!
3818@brief
3819 Borrows the option having the name \bt_p{name} from the
3820 \bt_var_fc \bt_p{field_class}.
3821
3822See the \ref api-tir-fc-var-prop-opts "options" property.
3823
3824If there's no option having the name \bt_p{name} in
3825\bt_p{field_class}, this function returns \c NULL.
3826
3827@param[in] field_class
3828 Variant field class from which to borrow the option having the
3829 name \bt_p{name}.
3830@param[in] name
3831 Name of the option to borrow from \bt_p{field_class}.
3832
3833@returns
3834 @parblock
3835 \em Borrowed reference of the option of
3836 \bt_p{field_class} having the name \bt_p{name}, or \c NULL
3837 if none.
3838
3839 The returned pointer remains valid as long as \bt_p{field_class}
3840 is not modified.
3841 @endparblock
3842
3843@bt_pre_not_null{field_class}
3844@bt_pre_is_var_fc{field_class}
3845@bt_pre_not_null{name}
3846
3847@sa bt_field_class_variant_borrow_option_by_name_const() &mdash;
3848 \c const version of this function.
3849*/
3850extern bt_field_class_variant_option *
3851bt_field_class_variant_borrow_option_by_name(
740faaf4
PP
3852 bt_field_class *field_class, const char *name);
3853
43c59509
PP
3854/*!
3855@brief
3856 Borrows the option having the name \bt_p{name} from the
3857 \bt_var_fc \bt_p{field_class} (\c const version).
bcd7ef6f 3858
43c59509
PP
3859See bt_field_class_variant_borrow_option_by_name().
3860*/
3861extern const bt_field_class_variant_option *
3862bt_field_class_variant_borrow_option_by_name_const(
3863 const bt_field_class *field_class, const char *name);
c6962c96 3864
43c59509
PP
3865/*! @} */
3866
3867/*!
3868@name Variant field class option
3869@{
3870*/
3871
3872/*!
3873@typedef struct bt_field_class_variant_option bt_field_class_variant_option;
3874
3875@brief
3876 Variant field class option.
3877*/
3878
3879/*!
3880@brief
3881 Returns the name of the \bt_var_fc option \bt_p{option}.
3882
3883See the \ref api-tir-fc-var-prop-opts "options" property.
3884
3885@param[in] option
3886 Variant field class option of which to get the name.
3887
3888@returns
3889 @parblock
3890 Name of \bt_p{option}.
3891
3892 The returned pointer remains valid as long as \bt_p{option} exists.
3893 @endparblock
3894
3895@bt_pre_not_null{option}
3896*/
3897extern const char *bt_field_class_variant_option_get_name(
3898 const bt_field_class_variant_option *option);
3899
3900/*!
3901@brief
3902 Borrows the field class from the \bt_var_fc option
3903 \bt_p{option}.
3904
3905See the \ref api-tir-fc-var-prop-opts "options" property.
3906
3907@param[in] option
3908 Variant field class option from which to borrow the field class.
3909
3910@returns
3911 Field class of \bt_p{option}.
3912
3913@bt_pre_not_null{option}
3914
3915@sa bt_field_class_variant_option_borrow_field_class_const() &mdash;
3916 \c const version of this function.
3917*/
3918extern bt_field_class *bt_field_class_variant_option_borrow_field_class(
3919 bt_field_class_variant_option *option);
3920
3921/*!
3922@brief
3923 Borrows the field class from the \bt_var_fc option
3924 \bt_p{option} (\c const version).
3925
3926See bt_field_class_variant_option_borrow_field_class().
3927*/
3928extern const bt_field_class *
3929bt_field_class_variant_option_borrow_field_class_const(
3930 const bt_field_class_variant_option *option);
3931
3932/*!
3933@brief
3934 Sets the user attributes of the \bt_var_fc option \bt_p{option}
3935 to \bt_p{user_attributes}.
3936
3937See the \ref api-tir-fc-var-prop-opts "options" property.
3938
3939@note
3940 When you append an option to a variant field class with
3941 bt_field_class_variant_without_selector_append_option(),
3942 bt_field_class_variant_with_selector_field_integer_unsigned_append_option(),
3943 or
3944 bt_field_class_variant_with_selector_field_integer_signed_append_option(),
3945 the option's initial user attributes is an empty \bt_map_val.
3946 Therefore you can borrow it with
3947 bt_field_class_variant_option_borrow_user_attributes() and fill it
3948 directly instead of setting a new one with this function.
3949
3950@param[in] option
3951 Variant field class option of which to set the user attributes to
3952 \bt_p{user_attributes}.
3953@param[in] user_attributes
3954 New user attributes of \bt_p{option}.
3955
3956@bt_pre_not_null{option}
3957@bt_pre_hot{option}
3958@bt_pre_not_null{user_attributes}
3959@bt_pre_is_map_val{user_attributes}
3960
3961@sa bt_field_class_variant_option_borrow_user_attributes() &mdash;
3962 Borrows the user attributes of a variant field class option.
3963*/
3964extern void bt_field_class_variant_option_set_user_attributes(
3965 bt_field_class_variant_option *option,
c6962c96
PP
3966 const bt_value *user_attributes);
3967
43c59509
PP
3968/*!
3969@brief
3970 Borrows the user attributes of the \bt_var_fc option \bt_p{option}.
40f4ba76 3971
43c59509 3972See the \ref api-tir-fc-var-prop-opts "options" property.
40f4ba76 3973
43c59509
PP
3974@note
3975 When you append an option to a variant field class with
3976 bt_field_class_variant_without_selector_append_option(),
3977 bt_field_class_variant_with_selector_field_integer_unsigned_append_option(),
3978 or
3979 bt_field_class_variant_with_selector_field_integer_signed_append_option(),
3980 the option's initial user attributes is an empty \bt_map_val.
740faaf4 3981
43c59509
PP
3982@param[in] option
3983 Variant field class option from which to borrow the user
3984 attributes.
0aa006b7 3985
43c59509
PP
3986@returns
3987 User attributes of \bt_p{option} (a \bt_map_val).
b38aea74 3988
43c59509 3989@bt_pre_not_null{option}
0aa006b7 3990
43c59509
PP
3991@sa bt_field_class_variant_option_set_user_attributes() &mdash;
3992 Sets the user attributes of a variant field class option.
3993@sa bt_field_class_variant_option_borrow_user_attributes_const() &mdash;
3994 \c const version of this function.
3995*/
3996extern bt_value *bt_field_class_variant_option_borrow_user_attributes(
3997 bt_field_class_variant_option *option);
0aa006b7 3998
43c59509
PP
3999/*!
4000@brief
4001 Borrows the user attributes of the \bt_var_fc option \bt_p{option}
4002 (\c const version).
0aa006b7 4003
43c59509
PP
4004See bt_field_class_variant_option_borrow_user_attributes().
4005*/
4006extern const bt_value *bt_field_class_variant_option_borrow_user_attributes_const(
4007 const bt_field_class_variant_option *option);
bcd7ef6f 4008
43c59509
PP
4009/*! @} */
4010
4011/*!
4012@name Variant field class without a selector field
4013@{
4014*/
40f4ba76 4015
43c59509
PP
4016/*!
4017@brief
4018 Status codes for
4019 bt_field_class_variant_without_selector_append_option().
4020*/
45c51519 4021typedef enum bt_field_class_variant_without_selector_append_option_status {
43c59509
PP
4022 /*!
4023 @brief
4024 Success.
4025 */
de821fe5 4026 BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK,
43c59509
PP
4027
4028 /*!
4029 @brief
4030 Out of memory.
4031 */
4032 BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
45c51519 4033} bt_field_class_variant_without_selector_append_option_status;
d24d5663 4034
43c59509
PP
4035/*!
4036@brief
4037 Appends an option to the \bt_var_fc (without a selector field)
4038 \bt_p{field_class} having the name \bt_p{name} and the
4039 field class \bt_p{option_field_class}.
4040
4041See the \ref api-tir-fc-var-prop-opts "options" property.
4042
4043@param[in] field_class
4044 Variant field class to which to append an option having
4045 the name \bt_p{name} and the field class \bt_p{option_field_class}.
4046@param[in] name
4047 Name of the option to append to \bt_p{field_class} (copied).
4048@param[in] option_field_class
4049 Field class of the option to append to \bt_p{field_class}.
4050
4051@retval #BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK
4052 Success.
4053@retval #BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR
4054 Out of memory.
4055
4056@bt_pre_not_null{field_class}
4057@bt_pre_hot{field_class}
4058@bt_pre_is_var_wos_fc{field_class}
4059@pre
4060 \bt_p{field_class} has no option with the name \bt_p{name}.
4061@bt_pre_not_null{name}
4062@bt_pre_not_null{option_field_class}
4063@bt_pre_fc_not_in_tc{option_field_class}
4064
4065@bt_post_success_frozen{option_field_class}
4066*/
45c51519
PP
4067extern bt_field_class_variant_without_selector_append_option_status
4068bt_field_class_variant_without_selector_append_option(
43c59509
PP
4069 bt_field_class *field_class, const char *name,
4070 bt_field_class *option_field_class);
4071
4072/*! @} */
5cd6d0e5 4073
43c59509
PP
4074/*!
4075@name Variant field class with a selector field
4076@{
4077*/
4078
4079/*!
4080@brief
4081 Status codes for
4082 bt_field_class_variant_with_selector_field_integer_unsigned_append_option()
4083 and
4084 bt_field_class_variant_with_selector_field_integer_signed_append_option().
4085*/
de821fe5 4086typedef enum bt_field_class_variant_with_selector_field_integer_append_option_status {
43c59509
PP
4087 /*!
4088 @brief
4089 Success.
4090 */
de821fe5 4091 BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK,
43c59509
PP
4092
4093 /*!
4094 @brief
4095 Out of memory.
4096 */
4097 BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
de821fe5 4098} bt_field_class_variant_with_selector_field_integer_append_option_status;
740faaf4 4099
43c59509
PP
4100/*!
4101@brief
4102 Borrows the selector field path from the \bt_var_fc (with a selector
4103 field) \bt_p{field_class}.
4104
4105See the \ref api-tir-fc-var-prop-sel-fp "selector field path" property.
4106
4107This property is only available when a \bt_struct_fc containing
4108(recursively) \bt_p{field_class} is passed to one of:
4109
4110- bt_stream_class_set_packet_context_field_class()
4111- bt_stream_class_set_event_common_context_field_class()
4112- bt_event_class_set_specific_context_field_class()
4113- bt_event_class_set_payload_field_class()
4114
4115In the meantime, this function returns \c NULL.
4116
4117@param[in] field_class
4118 Variant field class from which to borrow the selector field path.
4119
4120@returns
4121 Selector field path of \bt_p{field_class}.
4122
4123@bt_pre_not_null{field_class}
4124@bt_pre_is_var_ws_fc{field_class}
4125*/
4126extern const bt_field_path *
4127bt_field_class_variant_with_selector_field_borrow_selector_field_path_const(
4128 const bt_field_class *field_class);
4129
4130/*! @} */
4131
4132/*!
4133@name Variant field class with an unsigned integer selector field
4134@{
4135*/
4136
4137/*!
4138@brief
4139 Appends an option to the \bt_var_fc (with an unsigned integer
4140 selector field) \bt_p{field_class} having the name \bt_p{name},
4141 the field class \bt_p{option_field_class}, and the
4142 \bt_p_uint_rg \bt_p{ranges}.
4143
4144See the \ref api-tir-fc-var-prop-opts "options" property.
4145
4146@param[in] field_class
4147 Variant field class to which to append an option having
4148 the name \bt_p{name}, the field class \bt_p{option_field_class},
4149 and the unsigned integer ranges \bt_p{ranges}.
4150@param[in] name
4151 Name of the option to append to \bt_p{field_class} (copied).
4152@param[in] option_field_class
4153 Field class of the option to append to \bt_p{field_class}.
4154@param[in] ranges
4155 Unsigned integer ranges of the option to append to
4156 \bt_p{field_class}.
4157
4158@retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK
4159 Success.
4160@retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR
4161 Out of memory.
4162
4163@bt_pre_not_null{field_class}
4164@bt_pre_hot{field_class}
4165@bt_pre_is_var_wuis_fc{field_class}
4166@pre
4167 \bt_p{field_class} has no option with the name \bt_p{name}.
4168@bt_pre_not_null{name}
4169@bt_pre_not_null{option_field_class}
4170@bt_pre_fc_not_in_tc{option_field_class}
4171@bt_pre_not_null{Å—anges}
4172@pre
4173 \bt_p{ranges} contains one or more unsigned integer ranges.
4174@pre
4175 The unsigned integer ranges in \bt_p{ranges} do not overlap
4176 any unsigned integer range of any existing option in
4177 \bt_p{field_class}.
4178
4179@bt_post_success_frozen{option_field_class}
4180*/
de821fe5
PP
4181extern bt_field_class_variant_with_selector_field_integer_append_option_status
4182bt_field_class_variant_with_selector_field_integer_unsigned_append_option(
43c59509
PP
4183 bt_field_class *field_class, const char *name,
4184 bt_field_class *option_field_class,
4185 const bt_integer_range_set_unsigned *ranges);
4186
4187/*!
4188@brief
4189 Borrows the option at index \bt_p{index} from the
4190 \bt_var_fc (with an unsigned integer selector field)
4191 \bt_p{field_class}.
4192
4193See the \ref api-tir-fc-var-prop-opts "options" property.
4194
4195@param[in] field_class
4196 Variant field class from which to borrow the option at
4197 index \bt_p{index}.
4198@param[in] index
4199 Index of the option to borrow from \bt_p{field_class}.
4200
4201@returns
4202 @parblock
4203 \em Borrowed reference of the option of
4204 \bt_p{field_class} at index \bt_p{index}.
4205
4206 The returned pointer remains valid as long as \bt_p{field_class}
4207 is not modified.
4208 @endparblock
4209
4210@bt_pre_not_null{field_class}
4211@bt_pre_is_var_wuis_fc{field_class}
4212@pre
4213 \bt_p{index} is less than the number of options in
4214 \bt_p{field_class} (as returned by
4215 bt_field_class_variant_get_option_count()).
4216
4217@sa bt_field_class_variant_get_option_count() &mdash;
4218 Returns the number of options contained in a variant field class.
4219*/
4220extern const bt_field_class_variant_with_selector_field_integer_unsigned_option *
4221bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const(
4222 const bt_field_class *field_class, uint64_t index);
4223
4224/*!
4225@brief
4226 Borrows the option having the name \bt_p{name} from the
4227 \bt_var_fc (with an unsigned integer selector field)
4228 \bt_p{field_class}.
4229
4230See the \ref api-tir-fc-var-prop-opts "options" property.
4231
4232If there's no option having the name \bt_p{name} in
4233\bt_p{field_class}, this function returns \c NULL.
4234
4235@param[in] field_class
4236 Variant field class from which to borrow the option having the
4237 name \bt_p{name}.
4238@param[in] name
4239 Name of the option to borrow from \bt_p{field_class}.
4240
4241@returns
4242 @parblock
4243 \em Borrowed reference of the option of
4244 \bt_p{field_class} having the name \bt_p{name}, or \c NULL
4245 if none.
4246
4247 The returned pointer remains valid as long as \bt_p{field_class}
4248 is not modified.
4249 @endparblock
4250
4251@bt_pre_not_null{field_class}
4252@bt_pre_is_var_wuis_fc{field_class}
4253@bt_pre_not_null{name}
4254
4255@sa bt_field_class_variant_borrow_option_by_name_const() &mdash;
4256 Borrows an option by name from a variant field class.
4257*/
4258extern const bt_field_class_variant_with_selector_field_integer_unsigned_option *
4259bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const(
4260 const bt_field_class *field_class, const char *name);
4261
4262/*! @} */
4263
4264/*!
4265@name Variant field class (with an unsigned integer selector field) option
4266@{
4267*/
4268
4269/*!
4270@typedef struct bt_field_class_variant_with_selector_field_integer_unsigned_option bt_field_class_variant_with_selector_field_integer_unsigned_option;
4271
4272@brief
4273 Variant field class (with an unsigned integer selector field) option.
4274*/
4275
4276/*!
4277@brief
4278 Borrows the \bt_p_uint_rg from the \bt_var_fc (with an unsigned
4279 integer selector field) option \bt_p{option}.
4280
4281See the \ref api-tir-fc-var-prop-opts "options" property.
4282
4283@param[in] option
4284 Variant field class option from which to borrow the
4285 unsigned integer ranges.
4286
4287@returns
4288 Unsigned integer ranges of \bt_p{option}.
4289
4290@bt_pre_not_null{option}
4291*/
4292extern const bt_integer_range_set_unsigned *
4293bt_field_class_variant_with_selector_field_integer_unsigned_option_borrow_ranges_const(
4294 const bt_field_class_variant_with_selector_field_integer_unsigned_option *option);
4295
4296/*!
4297@brief
4298 \ref api-fund-c-typing "Upcasts" the \bt_var_fc (with an
4299 unsigned integer selector field) option \bt_p{option} to the
4300 common #bt_field_class_variant_option type.
4301
4302See the \ref api-tir-fc-var-prop-opts "options" property.
4303
4304@param[in] option
4305 @parblock
4306 Variant field class option to upcast.
4307
4308 Can be \c NULL.
4309 @endparblock
4310
4311@returns
4312 \bt_p{option} as a common variant field class option.
4313*/
4314static inline
4315const bt_field_class_variant_option *
4316bt_field_class_variant_with_selector_field_integer_unsigned_option_as_option_const(
4317 const bt_field_class_variant_with_selector_field_integer_unsigned_option *option)
4318{
4319 return __BT_UPCAST_CONST(bt_field_class_variant_option, option);
4320}
4321
4322/*! @} */
4323
4324/*!
4325@name Variant field class with a signed integer selector field
4326@{
4327*/
4328
4329/*!
4330@brief
4331 Appends an option to the \bt_var_fc (with a signed integer
4332 selector field) \bt_p{field_class} having the name \bt_p{name},
4333 the field class \bt_p{option_field_class}, and the
4334 \bt_p_sint_rg \bt_p{ranges}.
4335
4336See the \ref api-tir-fc-var-prop-opts "options" property.
1e6fd1d7 4337
43c59509
PP
4338@param[in] field_class
4339 Variant field class to which to append an option having
4340 the name \bt_p{name} and the field class \bt_p{option_field_class},
4341 and the signed integer ranges \bt_p{ranges}.
4342@param[in] name
4343 Name of the option to append to \bt_p{field_class} (copied).
4344@param[in] option_field_class
4345 Field class of the option to append to \bt_p{field_class}.
4346@param[in] ranges
4347 Signed integer ranges of the option to append to
4348 \bt_p{field_class}.
4349
4350@retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK
4351 Success.
4352@retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR
4353 Out of memory.
4354
4355@bt_pre_not_null{field_class}
4356@bt_pre_hot{field_class}
4357@bt_pre_is_var_wsis_fc{field_class}
4358@pre
4359 \bt_p{field_class} has no option with the name \bt_p{name}.
4360@bt_pre_not_null{name}
4361@bt_pre_not_null{option_field_class}
4362@bt_pre_fc_not_in_tc{option_field_class}
4363@bt_pre_not_null{Å—anges}
4364@pre
4365 \bt_p{ranges} contains one or more signed integer ranges.
4366@pre
4367 The signed integer ranges in \bt_p{ranges} do not overlap with
4368 any signed integer range of any existing option in
4369 \bt_p{field_class}.
4370
4371@bt_post_success_frozen{option_field_class}
4372*/
de821fe5
PP
4373extern bt_field_class_variant_with_selector_field_integer_append_option_status
4374bt_field_class_variant_with_selector_field_integer_signed_append_option(
43c59509
PP
4375 bt_field_class *field_class, const char *name,
4376 bt_field_class *option_field_class,
4377 const bt_integer_range_set_signed *ranges);
740faaf4 4378
43c59509
PP
4379/*!
4380@brief
4381 Borrows the option at index \bt_p{index} from the
4382 \bt_var_fc (with a signed integer selector field)
4383 \bt_p{field_class}.
c6fe8c40 4384
43c59509 4385See the \ref api-tir-fc-var-prop-opts "options" property.
c6fe8c40 4386
43c59509
PP
4387@param[in] field_class
4388 Variant field class from which to borrow the option at
4389 index \bt_p{index}.
4390@param[in] index
4391 Index of the option to borrow from \bt_p{field_class}.
bcd7ef6f 4392
43c59509
PP
4393@returns
4394 @parblock
4395 \em Borrowed reference of the option of
4396 \bt_p{field_class} at index \bt_p{index}.
c6962c96 4397
43c59509
PP
4398 The returned pointer remains valid as long as \bt_p{field_class}
4399 is not modified.
4400 @endparblock
4401
4402@bt_pre_not_null{field_class}
4403@bt_pre_is_var_wsis_fc{field_class}
4404@pre
4405 \bt_p{index} is less than the number of options in
4406 \bt_p{field_class} (as returned by
4407 bt_field_class_variant_get_option_count()).
4408
4409@sa bt_field_class_variant_get_option_count() &mdash;
4410 Returns the number of options contained in a variant field class.
4411*/
4412extern const bt_field_class_variant_with_selector_field_integer_signed_option *
4413bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const(
4414 const bt_field_class *field_class, uint64_t index);
4415
4416/*!
4417@brief
4418 Borrows the option having the name \bt_p{name} from the
4419 \bt_var_fc (with a signed integer selector field)
4420 \bt_p{field_class}.
4421
4422See the \ref api-tir-fc-var-prop-opts "options" property.
4423
4424If there's no option having the name \bt_p{name} in
4425\bt_p{field_class}, this function returns \c NULL.
4426
4427@param[in] field_class
4428 Variant field class from which to borrow the option having the
4429 name \bt_p{name}.
4430@param[in] name
4431 Name of the option to borrow from \bt_p{field_class}.
4432
4433@returns
4434 @parblock
4435 \em Borrowed reference of the option of
4436 \bt_p{field_class} having the name \bt_p{name}, or \c NULL
4437 if none.
4438
4439 The returned pointer remains valid as long as \bt_p{field_class}
4440 is not modified.
4441 @endparblock
4442
4443@bt_pre_not_null{field_class}
4444@bt_pre_is_var_wsis_fc{field_class}
4445@bt_pre_not_null{name}
4446
4447@sa bt_field_class_variant_borrow_option_by_name_const() &mdash;
4448 Borrows an option by name from a variant field class.
4449*/
4450extern const bt_field_class_variant_with_selector_field_integer_signed_option *
4451bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const(
4452 const bt_field_class *field_class, const char *name);
4453
4454/*! @} */
4455
4456/*!
4457@name Variant field class (with a signed integer selector field) option
4458@{
4459*/
4460
4461/*!
4462@typedef struct bt_field_class_variant_with_selector_field_integer_signed_option bt_field_class_variant_with_selector_field_integer_signed_option;
4463
4464@brief
4465 Variant field class (with a signed integer selector field) option.
4466*/
4467
4468/*!
4469@brief
4470 Borrows the \bt_p_sint_rg from the \bt_var_fc (with a signed
4471 integer selector field) option \bt_p{option}.
4472
4473See the \ref api-tir-fc-var-prop-opts "options" property.
4474
4475@param[in] option
4476 Variant field class option from which to borrow the
4477 signed integer ranges.
4478
4479@returns
4480 Signed integer ranges of \bt_p{option}.
4481
4482@bt_pre_not_null{option}
4483*/
4484extern const bt_integer_range_set_signed *
4485bt_field_class_variant_with_selector_field_integer_signed_option_borrow_ranges_const(
4486 const bt_field_class_variant_with_selector_field_integer_signed_option *option);
4487
4488/*!
4489@brief
4490 \ref api-fund-c-typing "Upcasts" the \bt_var_fc (with a signed
4491 integer selector field) option \bt_p{option} to the
4492 common #bt_field_class_variant_option type.
4493
4494See the \ref api-tir-fc-var-prop-opts "options" property.
4495
4496@param[in] option
4497 @parblock
4498 Variant field class option to upcast.
4499
4500 Can be \c NULL.
4501 @endparblock
4502
4503@returns
4504 \bt_p{option} as a common variant field class option.
4505*/
4506static inline
4507const bt_field_class_variant_option *
4508bt_field_class_variant_with_selector_field_integer_signed_option_as_option_const(
4509 const bt_field_class_variant_with_selector_field_integer_signed_option *option)
4510{
4511 return __BT_UPCAST_CONST(bt_field_class_variant_option, option);
4512}
4513
4514/*! @} */
4515
4516/*!
4517@name Reference count
4518@{
4519*/
4520
4521/*!
4522@brief
4523 Increments the \ref api-fund-shared-object "reference count" of
4524 the field class \bt_p{field_class}.
4525
4526@param[in] field_class
4527 @parblock
4528 Field class of which to increment the reference count.
4529
4530 Can be \c NULL.
4531 @endparblock
4532
4533@sa bt_field_class_put_ref() &mdash;
4534 Decrements the reference count of a field class.
4535*/
4536extern void bt_field_class_get_ref(const bt_field_class *field_class);
4537
4538/*!
4539@brief
4540 Decrements the \ref api-fund-shared-object "reference count" of
4541 the field class \bt_p{field_class}.
4542
4543@param[in] field_class
4544 @parblock
4545 Field class of which to decrement the reference count.
4546
4547 Can be \c NULL.
4548 @endparblock
4549
4550@sa bt_field_class_get_ref() &mdash;
4551 Increments the reference count of a field class.
4552*/
4553extern void bt_field_class_put_ref(const bt_field_class *field_class);
4554
4555/*!
4556@brief
4557 Decrements the reference count of the field class
4558 \bt_p{_field_class}, and then sets \bt_p{_field_class} to \c NULL.
4559
4560@param _field_class
4561 @parblock
4562 Field class of which to decrement the reference count.
4563
4564 Can contain \c NULL.
4565 @endparblock
4566
4567@bt_pre_assign_expr{_field_class}
4568*/
4569#define BT_FIELD_CLASS_PUT_REF_AND_RESET(_field_class) \
4570 do { \
4571 bt_field_class_put_ref(_field_class); \
4572 (_field_class) = NULL; \
4573 } while (0)
4574
4575/*!
4576@brief
4577 Decrements the reference count of the field class \bt_p{_dst}, sets
4578 \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL.
4579
4580This macro effectively moves a field class reference from the expression
4581\bt_p{_src} to the expression \bt_p{_dst}, putting the existing
4582\bt_p{_dst} reference.
4583
4584@param _dst
4585 @parblock
4586 Destination expression.
4587
4588 Can contain \c NULL.
4589 @endparblock
4590@param _src
4591 @parblock
4592 Source expression.
4593
4594 Can contain \c NULL.
4595 @endparblock
4596
4597@bt_pre_assign_expr{_dst}
4598@bt_pre_assign_expr{_src}
4599*/
4600#define BT_FIELD_CLASS_MOVE_REF(_dst, _src) \
4601 do { \
4602 bt_field_class_put_ref(_dst); \
4603 (_dst) = (_src); \
4604 (_src) = NULL; \
4605 } while (0)
4606
4607/*! @} */
4608
4609/*! @} */
c6962c96 4610
5cd6d0e5
PP
4611#ifdef __cplusplus
4612}
4613#endif
4614
924dc299 4615#endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */
This page took 0.244458 seconds and 4 git commands to generate.