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