flt.utils.muxer: add IWYU pragma
[babeltrace.git] / include / babeltrace2 / trace-ir / field-class.h
... / ...
CommitLineData
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5 */
6
7#ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_H
8#define BABELTRACE2_TRACE_IR_FIELD_CLASS_H
9
10/* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11
12#ifndef __BT_IN_BABELTRACE_H
13# error "Please include <babeltrace2/babeltrace.h> instead."
14#endif
15
16#include <stdint.h>
17#include <stddef.h>
18
19#include <babeltrace2/types.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/*!
26@defgroup api-tir-fc Field classes
27@ingroup api-tir
28
29@brief
30 Classes of \bt_p_field.
31
32<strong><em>Field classes</em></strong> are the classes of \bt_p_field:
33
34@image html field-class-zoom.png
35
36Field classes are \ref api-tir "trace IR" metadata objects.
37
38There are many types of field classes. They can be divided into two main
39categories:
40
41<dl>
42 <dt>Scalar</dt>
43 <dd>
44 Classes of fields which contain a simple value.
45
46 The scalar field classes are:
47
48 - \ref api-tir-fc-bool "Boolean"
49 - \ref api-tir-fc-ba "Bit array"
50 - \ref api-tir-fc-int "Integer" (unsigned and signed)
51 - \ref api-tir-fc-enum "Enumeration" (unsigned and signed)
52 - \ref api-tir-fc-real "Real" (single-precision and double-precision)
53 - \ref api-tir-fc-string "String"
54 - \ref api-tir-fc-blob "BLOB" (static and dynamic)
55 </dd>
56
57 <dt>Container</dt>
58 <dd>
59 Classes of fields which contain other fields.
60
61 The container field classes are:
62
63 - \ref api-tir-fc-array "Array" (static and dynamic)
64 - \ref api-tir-fc-struct "Structure"
65 - \ref api-tir-fc-opt "Option"
66 - \ref api-tir-fc-var "Variant"
67 </dd>
68</dl>
69
70@image html fc-to-field.png "Fields (green) are instances of field classes (orange)."
71
72Some field classes conceptually inherit other field classes, eventually
73making an inheritance hierarchy. For example, a \bt_sarray_fc
74\em is an array field class. Therefore, a static array field class has
75any property that an array field class has.
76
77The complete field class inheritance hierarchy is:
78
79@image html all-field-classes.png
80
81In the illustration above:
82
83- You can create any field class with a dark background with
84 a dedicated <code>bt_field_class_*_create()</code> function.
85
86- A field class with a pale background is an \em abstract field class:
87 you cannot create it, but it has properties, therefore there are
88 functions which apply to it.
89
90 For example, bt_field_class_integer_set_preferred_display_base()
91 applies to any \bt_int_fc.
92
93Field classes are \ref api-fund-shared-object "shared objects": get a
94new reference with bt_field_class_get_ref() and put an existing
95reference with bt_field_class_put_ref().
96
97Some library functions \ref api-fund-freezing "freeze" field classes on
98success. The documentation of those functions indicate this
99postcondition.
100
101All the field class types share the same C type, #bt_field_class.
102
103Get the type enumerator of a field class with bt_field_class_get_type().
104Get whether or not a field class type conceptually \em is a given type
105with the inline bt_field_class_type_is() function.
106
107The following table shows the available type enumerators and creation
108functions for each type of \em concrete (non-abstract) field class:
109
110<table>
111 <tr>
112 <th>Name
113 <th>Type enumerator
114 <th>Creation function(s)
115 <tr>
116 <td><em>\ref api-tir-fc-bool "Boolean"</em>
117 <td>#BT_FIELD_CLASS_TYPE_BOOL
118 <td>bt_field_class_bool_create()
119 <tr>
120 <td><em>\ref api-tir-fc-ba "Bit array"</em>
121 <td>#BT_FIELD_CLASS_TYPE_BIT_ARRAY
122 <td>bt_field_class_bit_array_create()
123 <tr>
124 <td><em>Unsigned \ref api-tir-fc-int "integer"</em>
125 <td>#BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER
126 <td>bt_field_class_integer_unsigned_create()
127 <tr>
128 <td><em>Signed \ref api-tir-fc-int "integer"</em>
129 <td>#BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
130 <td>bt_field_class_integer_signed_create()
131 <tr>
132 <td><em>Unsigned \ref api-tir-fc-enum "enumeration"</em>
133 <td>#BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
134 <td>bt_field_class_enumeration_unsigned_create()
135 <tr>
136 <td><em>Signed \ref api-tir-fc-enum "enumeration"</em>
137 <td>#BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
138 <td>bt_field_class_enumeration_signed_create()
139 <tr>
140 <td><em>Single-precision \ref api-tir-fc-real "real"</em>
141 <td>#BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL
142 <td>bt_field_class_real_single_precision_create()
143 <tr>
144 <td><em>Double-precision \ref api-tir-fc-real "real"</em>
145 <td>#BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL
146 <td>bt_field_class_real_double_precision_create()
147 <tr>
148 <td><em>\ref api-tir-fc-string "String"</em>
149 <td>#BT_FIELD_CLASS_TYPE_STRING
150 <td>bt_field_class_string_create()
151 <tr>
152 <td><em>Static \ref api-tir-fc-blob "BLOB"</em>
153 <td>#BT_FIELD_CLASS_TYPE_STATIC_BLOB
154 <td>bt_field_class_blob_static_create()
155 <tr>
156 <td>
157 <em>Dynamic \ref api-tir-fc-blob "BLOB"
158 (instances without a linked length field)</em>
159 <td>#BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB_WITHOUT_LENGTH_FIELD
160 <td>bt_field_class_blob_dynamic_without_length_field_location_create()
161 <tr>
162 <td>
163 <em>Dynamic \ref api-tir-fc-blob "BLOB"
164 (instances with a linked length field)</em>
165 <td>#BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB_WITH_LENGTH_FIELD
166 <td>bt_field_class_blob_dynamic_with_length_field_location_create()
167 <tr>
168 <td><em>Static \ref api-tir-fc-array "array"</em>
169 <td>#BT_FIELD_CLASS_TYPE_STATIC_ARRAY
170 <td>bt_field_class_array_static_create()
171 <tr>
172 <td>
173 <em>Dynamic \ref api-tir-fc-array "array"
174 (instances without a linked length field)</em>
175 <td>#BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD
176 <td>
177 - bt_field_class_array_dynamic_create()
178 - bt_field_class_array_dynamic_without_length_field_location_create()
179 <tr>
180 <td>
181 <em>Dynamic \ref api-tir-fc-array "array"
182 (instances with a linked length field)</em>
183 <td>#BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD
184 <td>
185 - bt_field_class_array_dynamic_create()
186 - bt_field_class_array_dynamic_with_length_field_location_create()
187 <tr>
188 <td><em>\ref api-tir-fc-struct "Structure"</em>
189 <td>#BT_FIELD_CLASS_TYPE_STRUCTURE
190 <td>bt_field_class_structure_create()
191 <tr>
192 <td>
193 <em>\ref api-tir-fc-opt "Option"
194 (instances without a linked selector field)</em>
195 <td>#BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD
196 <td>
197 - bt_field_class_option_without_selector_create()
198 - bt_field_class_option_without_selector_field_location_create()
199 <tr>
200 <td>
201 <em>\ref api-tir-fc-opt "Option"
202 (instances with a linked boolean selector field)</em>
203 <td>#BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD
204 <td>
205 - bt_field_class_option_with_selector_field_bool_create()
206 - bt_field_class_option_with_selector_field_location_bool_create()
207 <tr>
208 <td>
209 <em>\ref api-tir-fc-opt "Option"
210 (instances with a linked unsigned integer selector field)</em>
211 <td>#BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD
212 <td>
213 - bt_field_class_option_with_selector_field_integer_unsigned_create()
214 - bt_field_class_option_with_selector_field_location_integer_unsigned_create()
215 <tr>
216 <td>
217 <em>\ref api-tir-fc-opt "Option"
218 (instances with a linked signed integer selector field)</em>
219 <td>#BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD
220 <td>
221 - bt_field_class_option_with_selector_field_integer_signed_create()
222 - bt_field_class_option_with_selector_field_location_integer_signed_create()
223 <tr>
224 <td>
225 <em>\ref api-tir-fc-var "Variant"
226 (instances without a linked selector field)</em>
227 <td>#BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD
228 <td>
229 - bt_field_class_variant_create()
230 - bt_field_class_variant_without_selector_field_location_create()
231 <tr>
232 <td>
233 <em>\ref api-tir-fc-var "Variant"
234 (instances with a linked unsigned integer selector field)</em>
235 <td>#BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD
236 <td>
237 - bt_field_class_variant_create()
238 - bt_field_class_variant_with_selector_field_location_integer_unsigned_create()
239 <tr>
240 <td>
241 <em>\ref api-tir-fc-var "Variant"
242 (instances with a linked signed integer selector field)</em>
243 <td>#BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD
244 <td>
245 - bt_field_class_variant_create()
246 - bt_field_class_variant_with_selector_field_location_integer_signed_create()
247</table>
248
249You need a \bt_trace_cls to create a field class: create one from a
250\bt_self_comp with bt_trace_class_create().
251
252Outside the field class API, you can use field classes at four
253locations, called <em>scopes</em>, within the trace IR API:
254
255- To set the packet context field class of a \bt_stream_cls with
256 bt_stream_class_set_packet_context_field_class().
257
258- To set the event common context field class of a stream class with
259 bt_stream_class_set_event_common_context_field_class().
260
261- To set the specific context field class of an \bt_ev_cls with
262 bt_event_class_set_specific_context_field_class().
263
264- To set the payload field class of an event class with
265 bt_event_class_set_payload_field_class().
266
267When you call one of the four functions above:
268
269- The passed field class must be a \bt_struct_fc.
270
271- You must \em not have already called any of the four functions above
272 with the passed field class or with any of its contained field
273 classes.
274
275- If an instance of any of the field classes recursively contained in
276 the passed field class has a
277 \ref api-tir-fc-link "link to an anterior field", it must
278 honor the field link rules.
279
280Once you have called one of the four functions above, the passed field
281class becomes \ref api-fund-freezing "frozen".
282
283<h1>Common field class property</h1>
284
285A field class has the following common property:
286
287<dl>
288 <dt>
289 \anchor api-tir-fc-prop-user-attrs
290 \bt_dt_opt User attributes
291 </dt>
292 <dd>
293 User attributes of the field class.
294
295 User attributes are custom attributes attached to a field class.
296
297 Use bt_field_class_set_user_attributes(),
298 bt_field_class_borrow_user_attributes(), and
299 bt_field_class_borrow_user_attributes_const().
300 </dd>
301</dl>
302
303<h1>\anchor api-tir-fc-bool Boolean field class</h1>
304
305@image html fc-bool.png
306
307A <strong><em>boolean field class</em></strong> is the class
308of \bt_p_bool_field.
309
310A boolean field contains a boolean value (#BT_TRUE or #BT_FALSE).
311
312Create a boolean field class with bt_field_class_bool_create().
313
314A boolean field class has no specific properties.
315
316<h1>\anchor api-tir-fc-ba Bit array field class</h1>
317
318@image html fc-ba.png
319
320A <strong><em>bit array field class</em></strong> is the class
321of \bt_p_ba_field.
322
323A bit array field contains a fixed-length array of bits.
324
325Create a bit array field class with bt_field_class_bit_array_create().
326
327A bit array field class has the following property:
328
329<dl>
330 <dt>
331 \anchor api-tir-fc-ba-prop-len
332 Length
333 </dt>
334 <dd>
335 Number of bits contained in the instances (bit array fields) of
336 the bit array field class.
337
338 As of \bt_name_version_min_maj, the maximum length of a bit array
339 field is 64.
340
341 You cannot change the length once the bit array field class is
342 created.
343
344 Get a bit array field class's length with
345 bt_field_class_bit_array_get_length().
346 </dd>
347
348 <dt>
349 \anchor api-tir-fc-ba-prop-flags
350 \bt_dt_opt Flags
351 (only available when the field class was created from a
352 \bt_trace_cls which was created
353 from a \bt_comp which belongs to a trace processing \bt_graph
354 with the effective \bt_mip version&nbsp;1)
355 </dt>
356 <dd>
357 Set of flags of the bit array field class.
358
359 A bit array field class flag is a label (string) and an
360 \bt_uint_rs, a set of bit index ranges. In the value of an
361 instance (a \bt_ba_field) returned by
362 bt_field_bit_array_get_value_as_integer(), the least significant
363 bit's index is&nbsp;0.
364
365 The integer ranges of a given flag or of multiple flags of
366 the same bit array field class can overlap. For example,
367 a bit array field class can have those two flags:
368
369 - <code>GALLERY</code>: [1,&nbsp;4], [8,&nbsp;14]
370 - <code>LUNCH</code>: [3,&nbsp;6]
371
372 In that case, the bit indexes&nbsp;2 and&nbsp;12 correspond to the
373 label <code>GALLERY</code>, the bit index&nbsp;5 to the label
374 <code>LUNCH</code>, and the bit index&nbsp;3 to the labels
375 \c GALLERY \em and <code>LUNCH</code>.
376
377 Given some bit flag field value (as an integer), a flag is said to
378 be <strong><em>active</em></strong> when <em>at least one</em> of
379 its bit indexes is the index of a set bit of the value. For example,
380 given the 8-bit bit array field value
381
382 @code{.unparsed}
383 [true, false, true, true, false, true, false, true]
384 @endcode
385
386 where the first element is the first bit of the bit array field (the
387 value as an integer being 0xad):
388
389 - A flag targeting bits 1, 3, and&nbsp;6 would be active because
390 bit&nbsp;3 is set.
391
392 - A flag targeting bits 1 and&nbsp;4 wouldn't be active because both
393 bits are cleared.
394
395 Two flags of the same bit array field class cannot have the
396 same label.
397
398 Add a flag to a bit array field class with
399 bt_field_class_bit_array_add_flag().
400
401 Get the number of flags in a bit array field class with
402 bt_field_class_bit_array_get_flag_count().
403
404 Borrow a flag from a bit array field class with
405 bt_field_class_bit_array_borrow_flag_by_index_const()
406 and
407 bt_field_class_bit_array_borrow_flag_by_label_const().
408
409 A bit array field class flag is a
410 \ref api-fund-unique-object "unique object": it
411 belongs to the bit array field class which contains it.
412
413 The type of a bit array field class flag is
414 #bt_field_class_bit_array_flag.
415
416 Get the label of a bit array field class flag with
417 bt_field_class_bit_array_flag_get_label().
418
419 Borrow the bit index range set of a bit array field class flag
420 with bt_field_class_bit_array_flag_borrow_index_ranges_const().
421
422 Get the labels of all the active flags of a bit array field class
423 for the set bits of some integral value with
424 bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer().
425 </dd>
426</dl>
427
428<h1>\anchor api-tir-fc-int Integer field classes</h1>
429
430@image html fc-int.png
431
432<strong><em>Integer field classes</em></strong> are classes
433of \bt_p_int_field.
434
435Integer fields contain integral values.
436
437An integer field class is an \em abstract field class: you cannot create
438one. The concrete integer field classes are:
439
440<dl>
441 <dt>Unsigned integer field class</dt>
442 <dd>
443 Its instances (unsigned integer fields) contain an unsigned integral
444 value (\c uint64_t).
445
446 Create with bt_field_class_integer_unsigned_create().
447 </dd>
448
449 <dt>Signed integer field class</dt>
450 <dd>
451 Its instances (signed integer fields) contain a signed integral
452 value (\c int64_t).
453
454 Create with bt_field_class_integer_signed_create().
455 </dd>
456</dl>
457
458Integer field classes have the following common properties:
459
460<dl>
461 <dt>
462 \anchor api-tir-fc-int-prop-size
463 Field value range
464 </dt>
465 <dd>
466 Expected range of values that the instances (integer fields)
467 of the integer field class can contain.
468
469 For example, if the field value range of an unsigned integer
470 field class is [0,&nbsp;16383], then its unsigned integer fields
471 can only contain the values from 0 to 16383.
472
473 \bt_cp_sink_comp can benefit from this property to make some space
474 optimizations when writing trace data.
475
476 Use bt_field_class_integer_set_field_value_range() and
477 bt_field_class_integer_get_field_value_range().
478 </dd>
479
480 <dt>
481 \anchor api-tir-fc-int-prop-base
482 Preferred display base
483 </dt>
484 <dd>
485 Preferred base (2, 8, 10, or 16) to use when displaying the
486 instances (integer fields) of the integer field class.
487
488 Use bt_field_class_integer_set_preferred_display_base() and
489 bt_field_class_integer_get_preferred_display_base().
490 </dd>
491</dl>
492
493<h2>\anchor api-tir-fc-enum Enumeration field classes</h2>
494
495@image html fc-enum.png
496
497<strong><em>Enumeration field classes</em></strong> are classes
498of \bt_p_enum_field.
499
500Enumeration field classes \em are \bt_p_int_fc: they have the integer
501field classes properties.
502
503Enumeration fields \em are integer fields: they contain integral values.
504
505Enumeration field classes associate labels (strings) to specific
506ranges of integral values. This association is called an enumeration
507field class <em>mapping</em>.
508
509For example, if an enumeration field class maps the label \c SUGAR to
510the integer ranges [1,&nbsp;19] and [25,&nbsp;31], then an instance
511(enumeration field) of this field class with the value 15 or 28 has the
512label <code>SUGAR</code>.
513
514An enumeration field class is an \em abstract field class: you cannot
515create one. The concrete enumeration field classes are:
516
517<dl>
518 <dt>Unsigned enumeration field class</dt>
519 <dd>
520 Its instances (unsigned enumeration fields) contain an unsigned
521 value (\c uint64_t).
522
523 Create with bt_field_class_enumeration_unsigned_create().
524 </dd>
525
526 <dt>Signed enumeration field class</dt>
527 <dd>
528 Its instances (signed enumeration fields) contain a signed value
529 (\c int64_t).
530
531 Create with bt_field_class_enumeration_signed_create().
532 </dd>
533</dl>
534
535Enumeration field classes have the following common property:
536
537<dl>
538 <dt>
539 \anchor api-tir-fc-enum-prop-mappings
540 Mappings
541 </dt>
542 <dd>
543 Set of mappings of the enumeration field class.
544
545 An enumeration field class mapping is a label (string) and an
546 \bt_int_rs.
547
548 The integer ranges of a given mapping or of multiple mappings of
549 the same enumeration field class can overlap. For example,
550 an enumeration field class can have those two mappings:
551
552 - <code>CALORIES</code>: [1,&nbsp;11], [15,&nbsp;37]
553 - <code>SODIUM</code>: [7,&nbsp;13]
554
555 In that case, the values&nbsp;2 and&nbsp;30 correspond to the label
556 <code>CALORIES</code>, the value&nbsp;12 to the label
557 <code>SODIUM</code>, and the value&nbsp;10 to the labels
558 \c CALORIES \em and <code>SODIUM</code>.
559
560 Two mappings of the same enumeration field class cannot have the
561 same label.
562
563 Add a mapping to an enumeration field class with
564 bt_field_class_enumeration_unsigned_add_mapping() or
565 bt_field_class_enumeration_signed_add_mapping().
566
567 Get the number of mappings in an enumeration field class with
568 bt_field_class_enumeration_get_mapping_count().
569
570 Borrow a mapping from an enumeration field class with
571 bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const(),
572 bt_field_class_enumeration_signed_borrow_mapping_by_index_const(),
573 bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const(),
574 and
575 bt_field_class_enumeration_signed_borrow_mapping_by_label_const().
576
577 An enumeration field class mapping is a
578 \ref api-fund-unique-object "unique object": it
579 belongs to the enumeration field class which contains it.
580
581 There are two enumeration field class mapping types, depending on
582 the field class's type:
583 #bt_field_class_enumeration_unsigned_mapping and
584 #bt_field_class_enumeration_signed_mapping.
585
586 There is also the #bt_field_class_enumeration_mapping type for
587 common properties and operations (for example,
588 bt_field_class_enumeration_mapping_get_label()).
589 \ref api-fund-c-typing "Upcast" a specific enumeration field class
590 mapping to the #bt_field_class_enumeration_mapping type with
591 bt_field_class_enumeration_unsigned_mapping_as_mapping_const() or
592 bt_field_class_enumeration_signed_mapping_as_mapping_const().
593
594 Get all the enumeration field class labels mapped to a given integer
595 value with
596 bt_field_class_enumeration_unsigned_get_mapping_labels_for_value()
597 and
598 bt_field_class_enumeration_signed_get_mapping_labels_for_value().
599 </dd>
600</dl>
601
602<h1>\anchor api-tir-fc-real Real field classes</h1>
603
604@image html fc-real.png
605
606<strong><em>Real field classes</em></strong> are classes
607of \bt_p_real_field.
608
609Real fields contain
610<a href="https://en.wikipedia.org/wiki/Real_number">real</a>
611values (\c float or \c double types).
612
613A real field class is an \em abstract field class: you cannot create
614one. The concrete real field classes are:
615
616<dl>
617 <dt>Single-precision real field class</dt>
618 <dd>
619 Its instances (single-precision real fields) contain a \c float
620 value.
621
622 Create with bt_field_class_real_single_precision_create().
623 </dd>
624
625 <dt>Double-precision real field class</dt>
626 <dd>
627 Its instances (double-precision real fields) contain a \c double
628 value.
629
630 Create with bt_field_class_real_double_precision_create().
631 </dd>
632</dl>
633
634Real field classes have no specific properties.
635
636<h1>\anchor api-tir-fc-string String field class</h1>
637
638@image html fc-string.png
639
640A <strong><em>string field class</em></strong> is the class
641of \bt_p_string_field.
642
643A string field contains an UTF-8 string value.
644
645Create a string field class with bt_field_class_string_create().
646
647A string field class has no specific properties.
648
649<h1>\anchor api-tir-fc-blob BLOB field classes</h1>
650
651@image html fc-blob.png
652
653<strong><em>BLOB field classes</em></strong> are
654classes of \bt_p_blob_field.
655
656BLOB fields contain zero or more bytes of binary data.
657
658@note
659 BLOB field classes are only available when the \bt_trace_cls from
660 which you create them was created from a \bt_comp which belongs
661 to a trace processing \bt_graph with the effective \bt_mip
662 version&nbsp;1.
663
664A BLOB field class is an \em abstract field class: you cannot create
665one. The concrete BLOB field classes are:
666
667<dl>
668 <dt>Static BLOB field class</dt>
669 <dd>
670 Its instances (static BLOB fields) contain a fixed number of bytes.
671
672 Create with bt_field_class_blob_static_create().
673
674 A static BLOB field class has the following specific property:
675
676 <dl>
677 <dt>
678 \anchor api-tir-fc-sblob-prop-len
679 Length
680 </dt>
681 <dd>
682 Number of bytes contained in the instances (static BLOB
683 fields) of the static BLOB field class.
684
685 You cannot change the length once the static BLOB field class is
686 created.
687
688 Get a static BLOB field class's length with
689 bt_field_class_blob_static_get_length().
690 </dd>
691 </dl>
692 </dd>
693
694 <dt>Dynamic BLOB field class</dt>
695 <dd>
696 Its instances (dynamic BLOB fields) contain a variable number
697 of bytes.
698
699 There are two types of dynamic BLOB field classes: instances
700 without or with a linked length field. See
701 \ref api-tir-fc-link "Fields with links to other fields"
702 to learn more.
703
704 @image html dblob-link.png "A dynamic blob field linked to an unsigned integer length field."
705
706 Create with
707 bt_field_class_blob_dynamic_without_length_field_location_create()
708 or bt_field_class_blob_dynamic_with_length_field_location_create().
709
710 The class of a dynamic BLOB field with a linked length field has
711 the following specific property:
712
713 <dl>
714 <dt>
715 \anchor api-tir-fc-dblob-prop-len-fl
716 Length field location
717 </dt>
718 <dd>
719 \bt_c_field_loc to locate the linked length field of an
720 instance.
721
722 Get a dynamic BLOB field class's length field location with
723 bt_field_class_blob_dynamic_with_length_field_borrow_length_field_location_const().
724 </dd>
725 </dl>
726 </dd>
727</dl>
728
729BLOB field classes have the following common property:
730
731<dl>
732 <dt>
733 \anchor api-tir-fc-blob-prop-media-type
734 Media type
735 </dt>
736 <dd>
737 <a href="https://datatracker.ietf.org/doc/html/rfc2046">IANA media type</a>
738 of instances of the BLOB field class.
739
740 Use bt_field_class_blob_set_media_type() and
741 bt_field_class_blob_get_media_type().
742 </dd>
743</dl>
744
745<h1>\anchor api-tir-fc-array Array field classes</h1>
746
747@image html fc-array.png
748
749<strong><em>Array field classes</em></strong> are classes
750of \bt_p_array_field.
751
752Array fields contain zero or more fields which have the same class.
753
754An array field class is an \em abstract field class: you cannot create
755one. The concrete array field classes are:
756
757<dl>
758 <dt>Static array field class</dt>
759 <dd>
760 Its instances (static array fields) contain a fixed number of
761 fields.
762
763 Create with bt_field_class_array_static_create().
764
765 A static array field class has the following specific property:
766
767 <dl>
768 <dt>
769 \anchor api-tir-fc-sarray-prop-len
770 Length
771 </dt>
772 <dd>
773 Number of fields contained in the instances (static array
774 fields) of the static array field class.
775
776 You cannot change the length once the static array field class
777 is created.
778
779 Get a static array field class's length with
780 bt_field_class_array_static_get_length().
781 </dd>
782 </dl>
783 </dd>
784
785 <dt>Dynamic array field class</dt>
786 <dd>
787 Its instances (dynamic array fields) contain a variable number
788 of fields.
789
790 There are two types of dynamic array field classes: instances
791 without or with a linked length field. See
792 \ref api-tir-fc-link "Fields with links to other fields"
793 to learn more.
794
795 @image html darray-link.png "A dynamic array field linked to an unsigned integer length field."
796
797 Create with, depending on the effective \bt_mip (MIP) version of the
798 trace processing \bt_graph:
799
800 <dl>
801 <dt>MIP&nbsp;0</dt>
802 <dd>bt_field_class_array_dynamic_create().</dt>
803
804 <dt>MIP&nbsp;1</dt>
805 <dd>
806 bt_field_class_array_dynamic_without_length_field_location_create()
807 or
808 bt_field_class_array_dynamic_with_length_field_location_create().
809 </dd>
810 </dl>
811
812 The class of a dynamic array field with a linked length field has
813 one of the following specific properties, depending on the
814 effective MIP version of the trace processing graph:
815
816 <dl>
817 <dt>
818 \anchor api-tir-fc-darray-prop-len-fp
819 MIP&nbsp;0: Length field path
820 </dt>
821 <dd>
822 \bt_c_field_path to locate the linked length field of
823 an instance.
824
825 Borrow a dynamic array field class's length field path with
826 bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const().
827 </dd>
828
829 <dt>
830 \anchor api-tir-fc-darray-prop-len-fl
831 MIP&nbsp;1: Length field location
832 </dt>
833 <dd>
834 \bt_c_field_loc to locate the linked length field of an
835 instance.
836
837 Borrow a dynamic array field class's length field location with
838 bt_field_class_array_dynamic_with_length_field_borrow_length_field_location_const().
839 </dd>
840 </dl>
841 </dd>
842</dl>
843
844Array field classes have the following common property:
845
846<dl>
847 <dt>
848 \anchor api-tir-fc-array-prop-elem-fc
849 Element field class
850 </dt>
851 <dd>
852 Class of the fields contained in the instances (array fields) of the
853 array field class.
854
855 You cannot change the element field class once the array field class
856 is created.
857
858 Borrow an array field class's element field class with
859 bt_field_class_array_borrow_element_field_class() and
860 bt_field_class_array_borrow_element_field_class_const().
861 </dd>
862</dl>
863
864<h1>\anchor api-tir-fc-struct Structure field class</h1>
865
866@image html fc-struct.png
867
868A <strong><em>structure field class</em></strong> is the class
869of a \bt_struct_field.
870
871A structure field contains an ordered list of zero or more members. Each
872structure field member is the instance of a structure field class
873member. A structure field class member has a name, a field class,
874and user attributes.
875
876Create a structure field class with bt_field_class_structure_create().
877
878A structure field class has the following specific property:
879
880<dl>
881 <dt>
882 \anchor api-tir-fc-struct-prop-members
883 Members
884 </dt>
885 <dd>
886 Ordered list of members (zero or more) of the structure field class.
887
888 Each member has:
889
890 - A name, unique amongst all the member names of the same
891 structure field class.
892 - A field class.
893 - User attributes.
894
895 The instances (structure fields) of a structure field class have
896 members which are instances of the corresponding structure field
897 class members.
898
899 Append a member to a structure field class with
900 bt_field_class_structure_append_member().
901
902 Borrow a member from a structure field class with
903 bt_field_class_structure_borrow_member_by_index(),
904 bt_field_class_structure_borrow_member_by_name(),
905 bt_field_class_structure_borrow_member_by_index_const(), and
906 bt_field_class_structure_borrow_member_by_name_const().
907
908 A structure field class member is a
909 \ref api-fund-unique-object "unique object": it
910 belongs to the structure field class which contains it.
911
912 The type of a structure field class member is
913 #bt_field_class_structure_member.
914
915 Get a structure field class member's name with
916 bt_field_class_structure_member_get_name().
917
918 Borrow a structure field class member's field class with
919 bt_field_class_structure_member_borrow_field_class() and
920 bt_field_class_structure_member_borrow_field_class_const().
921
922 Set a structure field class member's user attributes with
923 bt_field_class_structure_member_set_user_attributes().
924
925 Borrow a structure field class member's user attributes with
926 bt_field_class_structure_member_borrow_user_attributes() and
927 bt_field_class_structure_member_borrow_user_attributes_const().
928 </dd>
929</dl>
930
931<h1>\anchor api-tir-fc-opt Option field classes</h1>
932
933@image html fc-opt.png
934
935<strong><em>Option field classes</em></strong> are classes
936of \bt_p_opt_field.
937
938An option field either does or doesn't \em contain a field, called its
939optional field.
940
941An option field class is an \em abstract field class: you cannot create
942one. An instance of an option field class either has a linked selector
943field (see \ref api-tir-fc-link "Fields with links to other fields")
944or none. Therefore, the concrete option field classes are:
945
946<dl>
947 <dt>Option field class (instances without a linked selector field)</dt>
948 <dd>
949 Create with, depending on the effective \bt_mip (MIP) version
950 of the trace processing \bt_graph:
951
952 <dl>
953 <dt>MIP&nbsp;0</dt>
954 <dd>bt_field_class_option_without_selector_create()</dt>
955
956 <dt>MIP&nbsp;1</dt>
957 <dd>bt_field_class_option_without_selector_field_location_create()</dd>
958 </dl>
959
960 The class of an option field without a linked selector field has no
961 specific properties.
962 </dd>
963
964 <dt>Option field class (instances with a linked boolean selector field)</dt>
965 <dd>
966 The linked selector field of an option field class's instance
967 (an option field) is a \bt_bool_field.
968
969 @image html opt-link.png "Option field class with a boolean selector field."
970
971 Create with, depending on the effective \bt_mip (MIP) version:
972
973 <dl>
974 <dt>MIP&nbsp;0</dt>
975 <dd>bt_field_class_option_with_selector_field_bool_create()</dt>
976
977 <dt>MIP&nbsp;1</dt>
978 <dd>bt_field_class_option_with_selector_field_location_bool_create()</dd>
979 </dl>
980
981 The class of an option field with a linked boolean selector field
982 has the following specific property:
983
984 <dl>
985 <dt>
986 \anchor api-tir-fc-opt-prop-sel-rev
987 Selector is reversed?
988 </dt>
989 <dd>
990 Whether or not the linked boolean selector field make the
991 option field class's instance (an option field) \em contain a
992 field when it's #BT_TRUE or when it's #BT_FALSE.
993
994 If this property is #BT_TRUE, then if the linked selector field
995 has the value #BT_FALSE, the option field contains a field.
996
997 Use
998 bt_field_class_option_with_selector_field_bool_set_selector_is_reversed()
999 and
1000 bt_field_class_option_with_selector_field_bool_selector_is_reversed().
1001 </dd>
1002 </dl>
1003 </dd>
1004
1005 <dt>Option field class (instances with a linked unsigned integer selector field)</dt>
1006 <dd>
1007 The linked selector field of an option field class's instance
1008 (an option field) is an \bt_uint_field.
1009
1010 Create with, depending on the effective \bt_mip (MIP) version
1011 of the trace processing \bt_graph:
1012
1013 <dl>
1014 <dt>MIP&nbsp;0</dt>
1015 <dd>bt_field_class_option_with_selector_field_integer_unsigned_create()</dt>
1016
1017 <dt>MIP&nbsp;1</dt>
1018 <dd>bt_field_class_option_with_selector_field_location_integer_unsigned_create()</dd>
1019 </dl>
1020
1021 Pass an \bt_uint_rs on creation to set which values of the selector
1022 field can make the option field contain a field.
1023
1024 The class of an option field with a linked unsigned integer selector
1025 field has the following specific property:
1026
1027 <dl>
1028 <dt>
1029 \anchor api-tir-fc-opt-prop-uint-rs
1030 Selector's unsigned integer ranges
1031 </dt>
1032 <dd>
1033 If the linked unsigned integer selector field of an option
1034 field class's instance (an option field) has a value which
1035 intersects with the selector's unsigned integer ranges, then
1036 the option field \em contains a field.
1037
1038 You cannot change the selector's unsigned integer ranges once
1039 the option field class is created.
1040
1041 Borrow the selector's unsigned integer ranges from such an
1042 option field class with
1043 bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const().
1044 </dd>
1045 </dl>
1046 </dd>
1047
1048 <dt>Option field class (instances with a linked signed integer selector field)</dt>
1049 <dd>
1050 The linked selector field of an option field class's instance
1051 (an option field) is a \bt_sint_field.
1052
1053 Create with, depending on the effective \bt_mip (MIP) version of
1054 the trace processing \bt_graph:
1055
1056 <dl>
1057 <dt>MIP&nbsp;0</dt>
1058 <dd>bt_field_class_option_with_selector_field_integer_signed_create()</dt>
1059
1060 <dt>MIP&nbsp;1</dt>
1061 <dd>bt_field_class_option_with_selector_field_location_integer_signed_create()</dd>
1062 </dl>
1063
1064 Pass a \bt_sint_rs on creation to set which values of the selector
1065 field can make the option field contain a field.
1066
1067 The class of an option field class with a linked signed integer
1068 selector field has the following specific property:
1069
1070 <dl>
1071 <dt>
1072 \anchor api-tir-fc-opt-prop-sint-rs
1073 Selector's signed integer ranges
1074 </dt>
1075 <dd>
1076 If the linked signed integer selector field of an option
1077 field class's instance (an option field) has a value which
1078 intersects with the selector's signed integer ranges, then
1079 the option field \em contains a field.
1080
1081 You cannot change the selector's signed integer ranges once
1082 the option field class is created.
1083
1084 Borrow the selector's signed integer ranges from such an
1085 option field class with
1086 bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const().
1087 </dd>
1088 </dl>
1089 </dd>
1090</dl>
1091
1092The classes of option fields with a linked selector field have one of
1093the following common properties, depending on the effective
1094\bt_mip (MIP) version of the trace processing \bt_graph:
1095
1096<dl>
1097 <dt>
1098 \anchor api-tir-fc-opt-prop-sel-fp
1099 MIP&nbsp;0: Selector field path
1100 </dt>
1101 <dd>
1102 \bt_c_field_path to locate the linked selector field of an instance.
1103
1104 Borrow such an option field class's selector field path with
1105 bt_field_class_option_with_selector_field_borrow_selector_field_path_const().
1106 </dd>
1107
1108 <dt>
1109 \anchor api-tir-fc-opt-prop-sel-fl
1110 MIP&nbsp;1: Selector field location
1111 </dt>
1112 <dd>
1113 \bt_c_field_loc to locate the linked selector field of an instance.
1114
1115 Borrow such an option field class's selector field location with
1116 bt_field_class_option_with_selector_field_borrow_selector_field_location_const().
1117 </dd>
1118</dl>
1119
1120Option field classes have the following common property:
1121
1122<dl>
1123 <dt>
1124 \anchor api-tir-fc-opt-prop-fc
1125 Optional field class
1126 </dt>
1127 <dd>
1128 Class of the optional field of an instance (option field) of the
1129 option field class.
1130
1131 You cannot change the optional field class once the option field
1132 class is created.
1133
1134 Borrow an option field class's optional field class with
1135 bt_field_class_option_borrow_field_class() and
1136 bt_field_class_option_borrow_field_class_const().
1137 </dd>
1138</dl>
1139
1140<h1>\anchor api-tir-fc-var Variant field classes</h1>
1141
1142@image html fc-var.png
1143
1144<strong><em>Variant field classes</em></strong> are classes
1145of \bt_p_var_field.
1146
1147A variant field contains a field amongst one or more possible fields.
1148
1149Variant field classes contain one or more options. Each variant field
1150class option has a name, a field class, user attributes, and integer
1151ranges, depending on the exact type.
1152
1153A variant field class is an \em abstract field class: you cannot create
1154one. An instance of a variant field class either has a linked selector
1155field (see \ref api-tir-fc-link "Fields with links to other fields")
1156or none. Therefore, the concrete variant field classes are:
1157
1158<dl>
1159 <dt>Variant field class (instances without a linked selector field)</dt>
1160 <dd>
1161 Create with, depending on the effective \bt_mip (MIP) version
1162 of the trace processing \bt_graph:
1163
1164 <dl>
1165 <dt>MIP&nbsp;0</dt>
1166 <dd>
1167 bt_field_class_variant_create(), passing \c NULL as
1168 the selector field class.
1169 </dt>
1170
1171 <dt>MIP&nbsp;1</dt>
1172 <dd>bt_field_class_variant_without_selector_field_location_create().</dd>
1173 </dl>
1174
1175 Append an option to such a variant field class with
1176 bt_field_class_variant_without_selector_append_option().
1177
1178 The class of a variant field without a linked selector field has no
1179 specific properties.
1180 </dd>
1181
1182 <dt>Variant field class (instances with a linked unsigned selector field)</dt>
1183 <dd>
1184 The linked selector field of a variant field class's instance
1185 (a variant field) is an \bt_uint_field.
1186
1187 @image html var-link.png "A variant field linked to an unsigned integer selector field."
1188
1189 Create with, depending on the effective \bt_mip (MIP) version of the
1190 trace processing \bt_graph:
1191
1192 <dl>
1193 <dt>MIP&nbsp;0</dt>
1194 <dd>
1195 bt_field_class_variant_create(), passing an unsigned integer
1196 field class as the selector field class.
1197 </dt>
1198
1199 <dt>MIP&nbsp;1</dt>
1200 <dd>bt_field_class_variant_with_selector_field_location_integer_unsigned_create().</dd>
1201 </dl>
1202
1203 Append an option to such a variant field class with
1204 bt_field_class_variant_with_selector_field_integer_unsigned_append_option().
1205
1206 Pass an \bt_uint_rs when you append an option to set which values of
1207 the selector field can make the variant field have a given
1208 current option.
1209
1210 Borrow such a variant field class's option with
1211 bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const()
1212 and
1213 bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const().
1214 </dd>
1215
1216 <dt>Variant field class (instances with a linked signed selector field)</dt>
1217 <dd>
1218 The linked selector field of a variant field class's instance
1219 (a variant field) is a \bt_sint_field.
1220
1221 Create with, depending on the effective \bt_mip (MIP) version of the
1222 trace processing \bt_graph:
1223
1224 <dl>
1225 <dt>MIP&nbsp;0</dt>
1226 <dd>
1227 bt_field_class_variant_create(), passing an signed integer
1228 field class as the selector field class.
1229 </dt>
1230
1231 <dt>MIP&nbsp;1</dt>
1232 <dd>bt_field_class_variant_with_selector_field_location_integer_signed_create().</dd>
1233 </dl>
1234
1235 Append an option to such a variant field class with
1236 bt_field_class_variant_with_selector_field_integer_signed_append_option().
1237
1238 Pass a \bt_sint_rs when you append an option to set which values of
1239 the selector field can make the variant field have a given
1240 current option.
1241
1242 Borrow such a variant field class's option with
1243 bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const()
1244 and
1245 bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const().
1246 </dd>
1247</dl>
1248
1249The classes of variant fields with a linked selector field have one of
1250the following common properties, depending on the effective
1251\bt_mip (MIP) version of the trace processing \bt_graph:
1252
1253<dl>
1254 <dt>
1255 \anchor api-tir-fc-var-prop-sel-fp
1256 MIP&nbsp;0: Selector field path
1257 </dt>
1258 <dd>
1259 \bt_c_field_path to locate the linked selector field of an instance.
1260
1261 Borrow such a variant field class's selector field path with
1262 bt_field_class_variant_with_selector_field_borrow_selector_field_path_const().
1263 </dd>
1264
1265 <dt>
1266 \anchor api-tir-fc-var-prop-sel-fl
1267 MIP&nbsp;1: Selector field location
1268 </dt>
1269 <dd>
1270 \bt_c_field_loc to locate the linked selector field of an instance.
1271
1272 Borrow such a variant field class's selector field location with
1273 bt_field_class_variant_with_selector_field_borrow_selector_field_location_const().
1274 </dd>
1275</dl>
1276
1277Variant field classes have the following common property:
1278
1279<dl>
1280 <dt>
1281 \anchor api-tir-fc-var-prop-opts
1282 Options
1283 </dt>
1284 <dd>
1285 Options of the variant field class.
1286
1287 Each option has:
1288
1289 - A name, unique amongst all the option names of the same
1290 variant field class.
1291
1292 The name is optional when the effective \bt_mip version of the
1293 trace processing \bt_graph is&nbsp;1.
1294
1295 - A field class.
1296
1297 - User attributes.
1298
1299 If an instance of the variant field class is linked to a selector
1300 field, then each option also has an \bt_int_rs. In that case, the
1301 ranges of a given option cannot overlap any range of any other
1302 option.
1303
1304 A variant field class must contain at least one option.
1305
1306 Depending on whether or not an instance of the variant field class
1307 has a linked selector field, append an option to a variant field
1308 class with bt_field_class_variant_without_selector_append_option(),
1309 bt_field_class_variant_with_selector_field_integer_unsigned_append_option(),
1310 or
1311 bt_field_class_variant_with_selector_field_integer_signed_append_option().
1312
1313 Get the number of options contained in a variant field class
1314 with bt_field_class_variant_get_option_count().
1315
1316 A variant field class option is a
1317 \ref api-fund-unique-object "unique object": it
1318 belongs to the variant field class which contains it.
1319
1320 Borrow any variant field class's option with
1321 bt_field_class_variant_borrow_option_by_index(),
1322 bt_field_class_variant_borrow_option_by_name(),
1323 bt_field_class_variant_borrow_option_by_index_const(), and
1324 bt_field_class_variant_borrow_option_by_name_const().
1325
1326 Those functions return the common #bt_field_class_variant_option
1327 type. Get the name of a variant field class option with
1328 bt_field_class_variant_option_get_name(). Borrow a variant field
1329 class option's field class with
1330 bt_field_class_variant_option_borrow_field_class() and
1331 bt_field_class_variant_option_borrow_field_class_const().
1332
1333 Borrow the option of the class of a variant field with a linked
1334 selector field with
1335 bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const(),
1336 bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const(),
1337 bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const(), or
1338 bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const(),
1339 depending on the selector field class's type.
1340
1341 Those functions return the
1342 #bt_field_class_variant_with_selector_field_integer_unsigned_option or
1343 #bt_field_class_variant_with_selector_field_integer_signed_option type.
1344 \ref api-fund-c-typing "Upcast" those types to the
1345 #bt_field_class_variant_option type with
1346 bt_field_class_variant_with_selector_field_integer_unsigned_option_as_option_const()
1347 or
1348 bt_field_class_variant_with_selector_field_integer_signed_option_as_option_const().
1349
1350 Borrow the option's ranges from the class of a variant field with a
1351 linked selector field with
1352 bt_field_class_variant_with_selector_field_integer_unsigned_option_borrow_ranges_const()
1353 or
1354 bt_field_class_variant_with_selector_field_integer_signed_option_borrow_ranges_const().
1355
1356 Set a variant field class option's user attributes with
1357 bt_field_class_variant_option_set_user_attributes().
1358
1359 Borrow a variant field class option's user attributes with
1360 bt_field_class_variant_option_borrow_user_attributes() and
1361 bt_field_class_variant_option_borrow_user_attributes_const().
1362 </dd>
1363</dl>
1364
1365<h1>\anchor api-tir-fc-link Fields with links to other fields</h1>
1366
1367An instance of a \bt_dblob_fc, a \bt_darray_fc, a \bt_opt_fc, or a
1368\bt_var_fc \em may have a link to another, anterior field within the
1369same \bt_pkt or \bt_ev.
1370
1371This feature exists so that the linked field can contain the value of a
1372dynamic property of the "dependent" field. Those properties are:
1373
1374<dl>
1375 <dt>\bt_c_dblob_field</dt>
1376 <dd>
1377 The linked field, a \bt_uint_field, contains the \b length (number
1378 of bytes) of the dynamic BLOB field.
1379 </dd>
1380
1381 <dt>\bt_c_darray_field</dt>
1382 <dd>
1383 The linked field, a \bt_uint_field, contains the \b length (number
1384 of elements) of the dynamic array field.
1385 </dd>
1386
1387 <dt>\bt_c_opt_field</dt>
1388 <dd>
1389 The linked field, either a \bt_bool_field or an \bt_int_field,
1390 indicates whether or not the option field has a field.
1391 </dd>
1392
1393 <dt>\bt_c_var_field</dt>
1394 <dd>
1395 The linked field, an \bt_int_field, indicates the variant field's
1396 current selected field.
1397 </dd>
1398</dl>
1399
1400Having a linked field is <em>optional</em>: you always set the field
1401properties with a dedicated function anyway. For example, even if a
1402dynamic array field is linked to an anterior length field, you must
1403still set its integral length with bt_field_array_dynamic_set_length().
1404In that case, the value of the linked length field \em must match what
1405you pass to bt_field_array_dynamic_set_length().
1406
1407The purpose of this feature is to eventually save space when a
1408\bt_sink_comp writes trace files: if, for example, the trace format can
1409convey that an anterior, existing field represents the length of a
1410dynamic array field, then the sink component doesn't need to write the
1411dynamic array field's length twice. This is the case of the
1412<a href="https://diamon.org/ctf/">Common Trace Format</a>, for example.
1413
1414@image html darray-link.png "A dynamic array field linked to an unsigned integer length field."
1415
1416How exactly you link a dependent field to another field at the field
1417class level depends on the effective \bt_mip (MIP) version of the trace
1418processing \bt_graph:
1419
1420<dl>
1421 <dt>MIP&nbsp;0: \bt_c_field_path API
1422 <dd>
1423 Pass the class of the linked field when you create the class of the
1424 dependent field.
1425
1426 For example, pass the unsigned integer length field class to
1427 bt_field_class_array_dynamic_create() to create a class of
1428 \bt_darray_field with a linked length field.
1429
1430 Then, when you call
1431 bt_stream_class_set_packet_context_field_class(),
1432 bt_stream_class_set_event_common_context_field_class(),
1433 bt_event_class_set_specific_context_field_class(), or
1434 bt_event_class_set_payload_field_class() with a field class
1435 containing a dependent field class with the class a linked field,
1436 the path to the linked field becomes available in the dependent
1437 field class. The functions to borrow said field path are:
1438
1439 - bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const()
1440 - bt_field_class_option_with_selector_field_borrow_selector_field_path_const()
1441 - bt_field_class_variant_with_selector_field_borrow_selector_field_path_const()
1442 </dd>
1443
1444 <dt>MIP&nbsp;1: \bt_c_field_loc API
1445 <dd>
1446 Pass the field location when you create the class of the
1447 dependent field.
1448
1449 For example, pass the length field location to
1450 bt_field_class_array_dynamic_with_length_field_location_create() to
1451 create a class of \bt_darray_field with a linked length field.
1452
1453 The functions to borrow the field location of a field class are:
1454
1455 - bt_field_class_blob_dynamic_with_length_field_borrow_length_field_location_const()
1456 - bt_field_class_array_dynamic_with_length_field_borrow_length_field_location_const()
1457 - bt_field_class_option_with_selector_field_borrow_selector_field_location_const()
1458 - bt_field_class_variant_with_selector_field_borrow_selector_field_location_const()
1459 </dd>
1460</dl>
1461
1462Both \bt_p_field_path (MIP&nbsp;0 API) and \bt_p_field_loc (MIP&nbsp;1
1463API) indicate how to reach the linked field of a dependent field from
1464some specific root <em>scope</em> (the starting point). The available
1465scopes are:
1466
1467<dl>
1468 <dt>#BT_FIELD_PATH_SCOPE_PACKET_CONTEXT</dt>
1469 <dt>#BT_FIELD_LOCATION_SCOPE_PACKET_CONTEXT</dt>
1470 <dd>
1471 Context field of the current \bt_pkt.
1472
1473 See bt_packet_borrow_context_field_const().
1474 </dd>
1475
1476 <dt>#BT_FIELD_PATH_SCOPE_EVENT_COMMON_CONTEXT</dt>
1477 <dt>#BT_FIELD_LOCATION_SCOPE_EVENT_COMMON_CONTEXT</dt>
1478 <dd>
1479 Common context field of the current \bt_ev.
1480
1481 See bt_event_borrow_common_context_field_const().
1482 </dd>
1483
1484 <dt>#BT_FIELD_PATH_SCOPE_EVENT_SPECIFIC_CONTEXT</dt>
1485 <dt>#BT_FIELD_LOCATION_SCOPE_EVENT_SPECIFIC_CONTEXT</dt>
1486 <dd>
1487 Specific context field of the current event.
1488
1489 See bt_event_borrow_specific_context_field_const().
1490 </dd>
1491
1492 <dt>#BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD</dt>
1493 <dt>#BT_FIELD_LOCATION_SCOPE_EVENT_PAYLOAD</dt>
1494 <dd>
1495 Payload field of the current event.
1496
1497 See bt_event_borrow_payload_field_const().
1498 </dd>
1499</dl>
1500
1501The difference between a field path and a field location is that a field
1502path works with \bt_struct_field member \em indexes while a field
1503location works with structure field member <em>names</em>. The latter is
1504more versatile because many fields may be candidates for the
1505length/selector field of a dependent field (when they're all part of the
1506same \bt_var_field).
1507
1508The rules regarding the dependent field&nbsp;\bt_var{A} vs. the linked
1509field&nbsp;\bt_var{B} are:
1510
1511- If \bt_var{A} is within some packet context field, then \bt_var{B}
1512 must also be in the same packet context field.
1513
1514 See bt_stream_class_set_packet_context_field_class().
1515
1516- If \bt_var{A} is within some common event context field, then
1517 \bt_var{B} must be in one of:
1518
1519 - The same common event context field.
1520 - The context field of the same packet.
1521
1522 See bt_stream_class_set_event_common_context_field_class().
1523
1524- If \bt_var{A} is within some specific event context field, then
1525 \bt_var{B} must be in one of:
1526
1527 - The same specific event context field.
1528 - The common context field of the same event.
1529 - The context field of the same packet.
1530
1531 See bt_event_class_set_specific_context_field_class().
1532
1533- If \bt_var{A} is within some event payload field, then \bt_var{B} must
1534 be in one of:
1535
1536 - The same event payload field.
1537 - The specific context field of the same event.
1538 - The common context field of the same event.
1539 - The context field of the same packet.
1540
1541 See bt_event_class_set_payload_field_class().
1542
1543- If both \bt_var{A} and \bt_var{B} are in the same scope, then:
1544
1545 - The lowest common ancestor field of \bt_var{A} and \bt_var{B} must
1546 be a structure field.
1547
1548 - \bt_var{B} must precede \bt_var{A}.
1549
1550 Considering that the members of a structure field are ordered,
1551 then \bt_var{B} must be part of a member that's before the member
1552 which contains \bt_var{A} in their lowest common ancestor
1553 structure field.
1554
1555 - <strong>Under MIP&nbsp;0</strong>, the path from the lowest common
1556 ancestor structure field of \bt_var{A} and \bt_var{B} to \bt_var{A}
1557 and to \bt_var{B} must only contain structure fields.
1558
1559 - <strong>Under MIP&nbsp;1</strong>, the path from the lowest common
1560 ancestor structure field of \bt_var{A} and \bt_var{B} to \bt_var{A}
1561 and to \bt_var{B} must only contain structure and variant fields.
1562
1563- If \bt_var{A} is in a different scope than \bt_var{B}, then:
1564
1565 - <strong>Under MIP&nbsp;0</strong>, the path from the root scope of
1566 \bt_var{B} to \bt_var{B} must only contain structure fields.
1567
1568 - <strong>Under MIP&nbsp;1</strong>, the path from the root scope of
1569 \bt_var{B} to \bt_var{B} must only contain structure and variant
1570 fields.
1571*/
1572
1573/*! @{ */
1574
1575/*!
1576@name Type
1577@{
1578
1579@typedef struct bt_field_class bt_field_class;
1580
1581@brief
1582 Field class.
1583
1584@}
1585*/
1586
1587/*!
1588@name Type query
1589@{
1590*/
1591
1592/*!
1593@brief
1594 Field class type enumerators.
1595*/
1596typedef enum bt_field_class_type {
1597 /*!
1598 @brief
1599 \bt_c_bool_fc.
1600 */
1601 BT_FIELD_CLASS_TYPE_BOOL = 1ULL << 0,
1602
1603 /*!
1604 @brief
1605 \bt_c_ba_fc.
1606 */
1607 BT_FIELD_CLASS_TYPE_BIT_ARRAY = 1ULL << 1,
1608
1609 /*!
1610 @brief
1611 \bt_c_int_fc.
1612
1613 No field class has this type: use it with
1614 bt_field_class_type_is().
1615 */
1616 BT_FIELD_CLASS_TYPE_INTEGER = 1ULL << 2,
1617
1618 /*!
1619 @brief
1620 \bt_c_uint_fc.
1621
1622 This type conceptually inherits #BT_FIELD_CLASS_TYPE_INTEGER.
1623 */
1624 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER = (1ULL << 3) | BT_FIELD_CLASS_TYPE_INTEGER,
1625
1626 /*!
1627 @brief
1628 \bt_c_sint_fc.
1629
1630 This type conceptually inherits #BT_FIELD_CLASS_TYPE_INTEGER.
1631 */
1632 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER = (1ULL << 4) | BT_FIELD_CLASS_TYPE_INTEGER,
1633
1634 /*!
1635 @brief
1636 \bt_c_enum_fc.
1637
1638 This type conceptually inherits #BT_FIELD_CLASS_TYPE_INTEGER.
1639
1640 No field class has this type: use it with
1641 bt_field_class_type_is().
1642 */
1643 BT_FIELD_CLASS_TYPE_ENUMERATION = 1ULL << 5,
1644
1645 /*!
1646 @brief
1647 \bt_c_uenum_fc.
1648
1649 This type conceptually inherits #BT_FIELD_CLASS_TYPE_ENUMERATION
1650 and #BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER.
1651 */
1652 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION = BT_FIELD_CLASS_TYPE_ENUMERATION | BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER,
1653
1654 /*!
1655 @brief
1656 \bt_c_senum_fc.
1657
1658 This type conceptually inherits #BT_FIELD_CLASS_TYPE_ENUMERATION
1659 and #BT_FIELD_CLASS_TYPE_SIGNED_INTEGER.
1660 */
1661 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION = BT_FIELD_CLASS_TYPE_ENUMERATION | BT_FIELD_CLASS_TYPE_SIGNED_INTEGER,
1662
1663 /*!
1664 @brief
1665 \bt_c_real_fc.
1666
1667 No field class has this type: use it with
1668 bt_field_class_type_is().
1669 */
1670 BT_FIELD_CLASS_TYPE_REAL = 1ULL << 6,
1671
1672 /*!
1673 @brief
1674 Single-precision \bt_real_fc.
1675
1676 This type conceptually inherits #BT_FIELD_CLASS_TYPE_REAL.
1677 */
1678 BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL = (1ULL << 7) | BT_FIELD_CLASS_TYPE_REAL,
1679
1680 /*!
1681 @brief
1682 Double-precision \bt_real_fc.
1683
1684 This type conceptually inherits #BT_FIELD_CLASS_TYPE_REAL.
1685 */
1686 BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL = (1ULL << 8) | BT_FIELD_CLASS_TYPE_REAL,
1687
1688 /*!
1689 @brief
1690 \bt_c_string_fc..
1691 */
1692 BT_FIELD_CLASS_TYPE_STRING = 1ULL << 9,
1693
1694 /*!
1695 @brief
1696 \bt_c_blob_fc.
1697
1698 No field class has this type: use it with
1699 bt_field_class_type_is().
1700 */
1701 BT_FIELD_CLASS_TYPE_BLOB = (1ULL << 29),
1702
1703 /*!
1704 @brief
1705 \bt_c_sblob_fc.
1706
1707 This type conceptually inherits #BT_FIELD_CLASS_TYPE_BLOB.
1708 */
1709 BT_FIELD_CLASS_TYPE_STATIC_BLOB = (1ULL << 30) | BT_FIELD_CLASS_TYPE_BLOB,
1710
1711 /*!
1712 @brief
1713 \bt_c_dblob_fc.
1714
1715 This type conceptually inherits #BT_FIELD_CLASS_TYPE_BLOB.
1716
1717 No field class has this type: use it with
1718 bt_field_class_type_is().
1719 */
1720 BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB = (1ULL << 31) | BT_FIELD_CLASS_TYPE_BLOB,
1721
1722 /*!
1723 @brief
1724 \bt_c_dblob_fc (instances without a linked length field).
1725
1726 This type conceptually inherits
1727 #BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB.
1728 */
1729 BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB_WITHOUT_LENGTH_FIELD = (1ULL << 32) | BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB,
1730
1731 /*!
1732 @brief
1733 \bt_c_dblob_fc (instances with a linked length field).
1734
1735 This type conceptually inherits
1736 #BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB.
1737 */
1738 BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB_WITH_LENGTH_FIELD = (1ULL << 33) | BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB,
1739
1740 /*!
1741 @brief
1742 \bt_c_struct_fc.
1743 */
1744 BT_FIELD_CLASS_TYPE_STRUCTURE = 1ULL << 10,
1745
1746 /*!
1747 @brief
1748 \bt_c_array_fc.
1749
1750 No field class has this type: use it with
1751 bt_field_class_type_is().
1752 */
1753 BT_FIELD_CLASS_TYPE_ARRAY = 1ULL << 11,
1754
1755 /*!
1756 @brief
1757 \bt_c_sarray_fc.
1758
1759 This type conceptually inherits #BT_FIELD_CLASS_TYPE_ARRAY.
1760 */
1761 BT_FIELD_CLASS_TYPE_STATIC_ARRAY = (1ULL << 12) | BT_FIELD_CLASS_TYPE_ARRAY,
1762
1763 /*!
1764 @brief
1765 \bt_c_darray_fc.
1766
1767 This type conceptually inherits #BT_FIELD_CLASS_TYPE_ARRAY.
1768
1769 No field class has this type: use it with
1770 bt_field_class_type_is().
1771 */
1772 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY = (1ULL << 13) | BT_FIELD_CLASS_TYPE_ARRAY,
1773
1774 /*!
1775 @brief
1776 \bt_c_darray_fc (instances without a linked length field).
1777
1778 This type conceptually inherits
1779 #BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY.
1780 */
1781 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD = (1ULL << 14) | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
1782
1783 /*!
1784 @brief
1785 \bt_c_darray_fc (instances with a linked length field).
1786
1787 This type conceptually inherits
1788 #BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY.
1789 */
1790 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD = (1ULL << 15) | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
1791
1792 /*!
1793 @brief
1794 \bt_c_opt_fc.
1795
1796 No field class has this type: use it with
1797 bt_field_class_type_is().
1798 */
1799 BT_FIELD_CLASS_TYPE_OPTION = 1ULL << 16,
1800
1801 /*!
1802 @brief
1803 \bt_c_opt_fc (instances without a linked selector field).
1804 */
1805 BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD = (1ULL << 17) | BT_FIELD_CLASS_TYPE_OPTION,
1806
1807 /*!
1808 @brief
1809 \bt_c_opt_fc (instances with a linked selector field).
1810
1811 This type conceptually inherits #BT_FIELD_CLASS_TYPE_OPTION.
1812
1813 No field class has this type: use it with
1814 bt_field_class_type_is().
1815 */
1816 BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD = (1ULL << 18) | BT_FIELD_CLASS_TYPE_OPTION,
1817
1818 /*!
1819 @brief
1820 \bt_c_opt_fc (instances with a linked boolean selector field).
1821
1822 This type conceptually inherits
1823 #BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD.
1824 */
1825 BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD = (1ULL << 19) | BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD,
1826
1827 /*!
1828 @brief
1829 \bt_c_opt_fc (instances with a linked integer selector field).
1830
1831 This type conceptually inherits
1832 #BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD.
1833
1834 No field class has this type: use it with
1835 bt_field_class_type_is().
1836 */
1837 BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD = (1ULL << 20) | BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD,
1838
1839 /*!
1840 @brief
1841 \bt_c_opt_fc (instances with a linked unsigned integer selector field).
1842
1843 This type conceptually inherits
1844 #BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD.
1845 */
1846 BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 21) | BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD,
1847
1848 /*!
1849 @brief
1850 \bt_c_opt_fc (instances with a linked signed integer selector field).
1851
1852 This type conceptually inherits
1853 #BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD.
1854 */
1855 BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 22) | BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD,
1856
1857 /*!
1858 @brief
1859 \bt_c_var_fc.
1860
1861 No field class has this type: use it with
1862 bt_field_class_type_is().
1863 */
1864 BT_FIELD_CLASS_TYPE_VARIANT = 1ULL << 23,
1865
1866 /*!
1867 @brief
1868 \bt_c_var_fc (instances without a linked selector field).
1869 */
1870 BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD = (1ULL << 24) | BT_FIELD_CLASS_TYPE_VARIANT,
1871
1872 /*!
1873 @brief
1874 \bt_c_var_fc (instances with a linked selector field).
1875
1876 This type conceptually inherits
1877 #BT_FIELD_CLASS_TYPE_VARIANT.
1878
1879 No field class has this type: use it with
1880 bt_field_class_type_is().
1881 */
1882 BT_FIELD_CLASS_TYPE_VARIANT_WITH_SELECTOR_FIELD = (1ULL << 25) | BT_FIELD_CLASS_TYPE_VARIANT,
1883
1884 /*!
1885 @brief
1886 \bt_c_var_fc (instances with a linked integer selector field).
1887
1888 This type conceptually inherits
1889 #BT_FIELD_CLASS_TYPE_VARIANT_WITH_SELECTOR_FIELD.
1890
1891 No field class has this type: use it with
1892 bt_field_class_type_is().
1893 */
1894 BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD = (1ULL << 26) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_SELECTOR_FIELD,
1895
1896 /*!
1897 @brief
1898 \bt_c_opt_fc (instances with a linked unsigned integer selector field).
1899
1900 This type conceptually inherits
1901 #BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD.
1902 */
1903 BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 27) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD,
1904
1905 /*!
1906 @brief
1907 \bt_c_opt_fc (instances with a linked signed integer selector field).
1908
1909 This type conceptually inherits
1910 #BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD.
1911 */
1912 BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 28) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD,
1913
1914 /*
1915 * Make sure the enumeration type is a 64-bit integer in case
1916 * the project needs field class types in the future.
1917 *
1918 * This is not part of the API.
1919 */
1920 __BT_FIELD_CLASS_TYPE_BIG_VALUE = 1ULL << 62,
1921} bt_field_class_type;
1922
1923/*!
1924@brief
1925 Returns the type enumerator of the field class \bt_p{field_class}.
1926
1927@param[in] field_class
1928 Field class of which to get the type enumerator
1929
1930@returns
1931 Type enumerator of \bt_p{field_class}.
1932
1933@bt_pre_not_null{field_class}
1934
1935@sa bt_field_class_type_is() &mdash;
1936 Returns whether or not the type of a field class conceptually is a
1937 given type.
1938*/
1939extern bt_field_class_type bt_field_class_get_type(
1940 const bt_field_class *field_class) __BT_NOEXCEPT;
1941
1942/*!
1943@brief
1944 Returns whether or not the field class type \bt_p{type} conceptually
1945 \em is the field class type \bt_p{other_type}.
1946
1947For example, an \bt_uint_fc conceptually \em is an integer field class,
1948so
1949
1950@code
1951bt_field_class_type_is(BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, BT_FIELD_CLASS_TYPE_INTEGER)
1952@endcode
1953
1954returns #BT_TRUE.
1955
1956@param[in] type
1957 Field class type to check against \bt_p{other_type}.
1958@param[in] other_type
1959 Field class type against which to check \bt_p{type}.
1960
1961@returns
1962 #BT_TRUE if \bt_p{type} conceptually \em is \bt_p{other_type}.
1963
1964@sa bt_field_class_get_type() &mdash;
1965 Returns the type enumerator of a field class.
1966*/
1967static inline
1968bt_bool bt_field_class_type_is(const bt_field_class_type type,
1969 const bt_field_class_type other_type) __BT_NOEXCEPT
1970{
1971 return (type & other_type) == other_type;
1972}
1973
1974/*! @} */
1975
1976/*!
1977@name Common property
1978@{
1979*/
1980
1981/*!
1982@brief
1983 Sets the user attributes of the field class \bt_p{field_class} to
1984 \bt_p{user_attributes}.
1985
1986See the \ref api-tir-fc-prop-user-attrs "user attributes" property.
1987
1988@note
1989 When you create a field class with one of the
1990 <code>bt_field_class_*_create()</code> functions, the field class's
1991 initial user attributes is an empty \bt_map_val. Therefore you can
1992 borrow it with bt_field_class_borrow_user_attributes() and fill it
1993 directly instead of setting a new one with this function.
1994
1995@param[in] field_class
1996 Field class of which to set the user attributes to
1997 \bt_p{user_attributes}.
1998@param[in] user_attributes
1999 New user attributes of \bt_p{field_class}.
2000
2001@bt_pre_not_null{field_class}
2002@bt_pre_hot{field_class}
2003@bt_pre_not_null{user_attributes}
2004@bt_pre_is_map_val{user_attributes}
2005
2006@sa bt_field_class_borrow_user_attributes() &mdash;
2007 Borrows the user attributes of a field class.
2008*/
2009extern void bt_field_class_set_user_attributes(
2010 bt_field_class *field_class,
2011 const bt_value *user_attributes) __BT_NOEXCEPT;
2012
2013/*!
2014@brief
2015 Borrows the user attributes of the field class \bt_p{field_class}.
2016
2017See the \ref api-tir-fc-prop-user-attrs "user attributes" property.
2018
2019@note
2020 When you create a field class with one of the
2021 <code>bt_field_class_*_create()</code> functions, the field class's
2022 initial user attributes is an empty \bt_map_val.
2023
2024@param[in] field_class
2025 Field class from which to borrow the user attributes.
2026
2027@returns
2028 User attributes of \bt_p{field_class} (a \bt_map_val).
2029
2030@bt_pre_not_null{field_class}
2031
2032@sa bt_field_class_set_user_attributes() &mdash;
2033 Sets the user attributes of a field class.
2034@sa bt_field_class_borrow_user_attributes_const() &mdash;
2035 \c const version of this function.
2036*/
2037extern bt_value *bt_field_class_borrow_user_attributes(
2038 bt_field_class *field_class) __BT_NOEXCEPT;
2039
2040/*!
2041@brief
2042 Borrows the user attributes of the field class \bt_p{field_class}
2043 (\c const version).
2044
2045See bt_field_class_borrow_user_attributes().
2046*/
2047extern const bt_value *bt_field_class_borrow_user_attributes_const(
2048 const bt_field_class *field_class) __BT_NOEXCEPT;
2049
2050/*! @} */
2051
2052/*!
2053@name Boolean field class
2054@{
2055*/
2056
2057/*!
2058@brief
2059 Creates a \bt_bool_fc from the trace class \bt_p{trace_class}.
2060
2061On success, the returned boolean field class has the following
2062property value:
2063
2064<table>
2065 <tr>
2066 <th>Property
2067 <th>Value
2068 <tr>
2069 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2070 <td>Empty \bt_map_val
2071</table>
2072
2073@param[in] trace_class
2074 Trace class from which to create a boolean field class.
2075
2076@returns
2077 New boolean field class reference, or \c NULL on memory error.
2078
2079@bt_pre_not_null{trace_class}
2080*/
2081extern bt_field_class *bt_field_class_bool_create(
2082 bt_trace_class *trace_class) __BT_NOEXCEPT;
2083
2084/*!
2085@}
2086*/
2087
2088/*!
2089@name Bit array field class
2090@{
2091*/
2092
2093/*!
2094@brief
2095 Creates a \bt_ba_fc with the length \bt_p{length} from the trace
2096 class \bt_p{trace_class}.
2097
2098On success, the returned bit array field class has the following
2099property values:
2100
2101<table>
2102 <tr>
2103 <th>Property
2104 <th>Value
2105 <tr>
2106 <td>\ref api-tir-fc-ba-prop-len "Length"
2107 <td>\bt_p{length}
2108 <tr>
2109 <td>
2110 \bt_mip version&nbsp;1:
2111 \ref api-tir-fc-ba-prop-flags "flags"
2112 <td>\em None
2113 <tr>
2114 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2115 <td>Empty \bt_map_val
2116</table>
2117
2118@param[in] trace_class
2119 Trace class from which to create a bit array field class.
2120@param[in] length
2121 Length (number of bits) of the instances of the bit array field
2122 class to create.
2123
2124@returns
2125 New bit array field class reference, or \c NULL on memory error.
2126
2127@bt_pre_not_null{trace_class}
2128@pre
2129 0 < \bt_p{length} ≤ 64.
2130*/
2131extern bt_field_class *bt_field_class_bit_array_create(
2132 bt_trace_class *trace_class, uint64_t length) __BT_NOEXCEPT;
2133
2134/*!
2135@brief
2136 Returns the length of the \bt_ba_fc \bt_p{field_class}.
2137
2138See the \ref api-tir-fc-ba-prop-len "length" property.
2139
2140@param[in] field_class
2141 Bit array field class of which to get the length.
2142
2143@returns
2144 Length of \bt_p{field_class}.
2145
2146@bt_pre_not_null{field_class}
2147@bt_pre_is_ba_fc{field_class}
2148*/
2149extern uint64_t bt_field_class_bit_array_get_length(
2150 const bt_field_class *field_class) __BT_NOEXCEPT;
2151
2152/*!
2153@brief
2154 Status codes for bt_field_class_bit_array_add_flag().
2155*/
2156typedef enum bt_field_class_bit_array_add_flag_status {
2157 /*!
2158 @brief
2159 Success.
2160 */
2161 BT_FIELD_CLASS_BIT_ARRAY_ADD_FLAG_STATUS_OK = __BT_FUNC_STATUS_OK,
2162
2163 /*!
2164 @brief
2165 Out of memory.
2166 */
2167 BT_FIELD_CLASS_BIT_ARRAY_ADD_FLAG_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
2168
2169} bt_field_class_bit_array_add_flag_status;
2170
2171/*!
2172@brief
2173 Adds a flag to the \bt_ba_fc \bt_p{field_class} having the
2174 label \bt_p{label} and the bit index ranges \bt_p{index_ranges}.
2175
2176See the \ref api-tir-fc-ba-prop-flags "flags" property.
2177
2178@param[in] field_class
2179 Bit array field class to which to add a flag having
2180 the label \bt_p{label} and the bit index ranges \bt_p{index_ranges}.
2181@param[in] label
2182 Label of the flag to add to \bt_p{field_class} (copied).
2183@param[in] ranges
2184 Bit index ranges of the flag to add to \bt_p{field_class}.
2185
2186@retval #BT_FIELD_CLASS_BIT_ARRAY_ADD_FLAG_STATUS_OK
2187 Success.
2188@retval #BT_FIELD_CLASS_BIT_ARRAY_ADD_FLAG_STATUS_MEMORY_ERROR
2189 Out of memory.
2190
2191@bt_pre_not_null{field_class}
2192@bt_pre_hot{field_class}
2193@bt_pre_is_ba_fc{field_class}
2194@bt_pre_fc_with_mip{field_class, 1}
2195@bt_pre_not_null{label}
2196@pre
2197 \bt_p{field_class} has no flag with the label \bt_p{label}.
2198@bt_pre_not_null{ranges}
2199@pre
2200 \bt_p{index_ranges} contains one or more unsigned integer ranges.
2201@pre
2202 No \link bt_integer_range_unsigned_get_upper() upper value\endlink
2203 of any range in \bt_p{index_ranges} is greater than or
2204 equal to the
2205 \link bt_field_class_bit_array_get_length() length\endlink of
2206 \bt_p{field_class}.
2207*/
2208extern bt_field_class_bit_array_add_flag_status
2209bt_field_class_bit_array_add_flag(
2210 bt_field_class *field_class, const char *label,
2211 const bt_integer_range_set_unsigned *index_ranges) __BT_NOEXCEPT;
2212
2213/*!
2214@brief
2215 Returns the number of flags contained in the \bt_ba_fc
2216 \bt_p{field_class}.
2217
2218See the \ref api-tir-fc-ba-prop-flags "flags" property.
2219
2220@param[in] field_class
2221 Bit array field class of which to get the number of contained
2222 flags.
2223
2224@returns
2225 Number of contained flags in \bt_p{field_class}.
2226
2227@bt_pre_not_null{field_class}
2228@bt_pre_is_ba_fc{field_class}
2229@bt_pre_fc_with_mip{field_class, 1}
2230*/
2231extern uint64_t bt_field_class_bit_array_get_flag_count(
2232 const bt_field_class *field_class) __BT_NOEXCEPT;
2233
2234/*!
2235@brief
2236 Borrows the flag at index \bt_p{index} from the
2237 \bt_ba_fc \bt_p{field_class}.
2238
2239See the \ref api-tir-fc-ba-prop-flags "flags" property.
2240
2241@param[in] field_class
2242 Bit array field class from which to borrow the flag at
2243 index \bt_p{index}.
2244@param[in] index
2245 Index of the flag to borrow from \bt_p{field_class}.
2246
2247@returns
2248 @parblock
2249 \em Borrowed reference of the flag of
2250 \bt_p{field_class} at index \bt_p{index}.
2251
2252 The returned pointer remains valid as long as \bt_p{field_class}
2253 is not modified.
2254 @endparblock
2255
2256@bt_pre_not_null{field_class}
2257@bt_pre_is_ba_fc{field_class}
2258@bt_pre_fc_with_mip{field_class, 1}
2259@pre
2260 \bt_p{index} is less than the
2261 \link bt_field_class_bit_array_get_flag_count() number of flags\endlink
2262 in \bt_p{field_class}.
2263
2264@sa bt_field_class_bit_array_get_flag_count() &mdash;
2265 Returns the number of flags contained in a
2266 bit array field class.
2267*/
2268extern const bt_field_class_bit_array_flag *
2269bt_field_class_bit_array_borrow_flag_by_index_const(
2270 const bt_field_class *field_class, uint64_t index) __BT_NOEXCEPT;
2271
2272/*!
2273@brief
2274 Borrows the flag having the label \bt_p{label} from the
2275 \bt_ba_fc \bt_p{field_class}.
2276
2277See the \ref api-tir-fc-ba-prop-flags "flags" property.
2278
2279If there's no flag having the label \bt_p{label} in
2280\bt_p{field_class}, this function returns \c NULL.
2281
2282@param[in] field_class
2283 Bit array field class from which to borrow the flag
2284 having the label \bt_p{label}.
2285@param[in] label
2286 Label of the flag to borrow from \bt_p{field_class}.
2287
2288@returns
2289 @parblock
2290 \em Borrowed reference of the flag of
2291 \bt_p{field_class} having the label \bt_p{label}, or \c NULL
2292 if none.
2293
2294 The returned pointer remains valid as long as \bt_p{field_class}
2295 is not modified.
2296 @endparblock
2297
2298@bt_pre_not_null{field_class}
2299@bt_pre_is_ba_fc{field_class}
2300@bt_pre_fc_with_mip{field_class, 1}
2301@bt_pre_not_null{label}
2302*/
2303extern const bt_field_class_bit_array_flag *
2304bt_field_class_bit_array_borrow_flag_by_label_const(
2305 const bt_field_class *field_class, const char *label) __BT_NOEXCEPT;
2306
2307/*!
2308@brief
2309 Array of \c const \bt_ba_fc flag labels.
2310
2311Returned by bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer().
2312*/
2313typedef char const * const *bt_field_class_bit_array_flag_label_array;
2314
2315/*!
2316@brief
2317 Status codes for
2318 bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer().
2319*/
2320typedef enum bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer_status {
2321 /*!
2322 @brief
2323 Success.
2324 */
2325 BT_FIELD_CLASS_BIT_ARRAY_GET_ACTIVE_FLAG_LABELS_FOR_VALUE_AS_INTEGER_STATUS_OK = __BT_FUNC_STATUS_OK,
2326
2327 /*!
2328 @brief
2329 Out of memory.
2330 */
2331 BT_FIELD_CLASS_BIT_ARRAY_GET_ACTIVE_FLAG_LABELS_FOR_VALUE_AS_INTEGER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
2332} bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer_status;
2333
2334/*!
2335@brief
2336 Returns the labels of all the active flags of the
2337 \bt_ba_fc \bt_p{field_class} for the set bits of
2338 \bt_p{value_as_integer} (a bit array field value as an integer).
2339
2340See the \ref api-tir-fc-ba-prop-flags "flags" property.
2341
2342This function sets \bt_p{*labels} to the resulting array and
2343\bt_p{*count} to the number of labels in \bt_p{*labels}.
2344
2345On success, if there's no active flags for \bt_p{value_as_integer},
2346\bt_p{*count} is 0.
2347
2348@param[in] field_class
2349 Bit array field class from which to get the labels of the
2350 active flags for \bt_p{value_as_integer}.
2351@param[in] value_as_integer
2352 @parblock
2353 Bits, as an integer, for which to get the labels of the active flags
2354 of \bt_p{field_class}.
2355
2356 In this integral value, the index of the least significant bit
2357 is&nbsp;0.
2358 @endparblock
2359@param[out] labels
2360 @parblock
2361 <strong>On success</strong>, \bt_p{*labels}
2362 is an array of labels of the active flags of \bt_p{field_class}
2363 for \bt_p{value}.
2364
2365 The number of labels in \bt_p{*labels} is \bt_p{*count}.
2366
2367 The array is owned by \bt_p{field_class} and remains valid as long
2368 as:
2369
2370 - \bt_p{field_class} is not modified.
2371 - You don't call this function again with \bt_p{field_class}.
2372 @endparblock
2373@param[out] count
2374 <strong>On success</strong>, \bt_p{*count} is the number of labels
2375 in \bt_p{*labels} (can be&nbsp;0).
2376
2377@retval #BT_FIELD_CLASS_BIT_ARRAY_GET_ACTIVE_FLAG_LABELS_FOR_VALUE_AS_INTEGER_STATUS_OK
2378 Success.
2379@retval #BT_FIELD_CLASS_BIT_ARRAY_GET_ACTIVE_FLAG_LABELS_FOR_VALUE_AS_INTEGER_STATUS_MEMORY_ERROR
2380 Out of memory.
2381
2382@bt_pre_not_null{field_class}
2383@bt_pre_is_ba_fc{field_class}
2384@bt_pre_fc_with_mip{field_class, 1}
2385@bt_pre_not_null{labels}
2386@bt_pre_not_null{count}
2387*/
2388extern bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer_status
2389bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer(
2390 const bt_field_class *field_class, uint64_t value_as_integer,
2391 bt_field_class_bit_array_flag_label_array *labels,
2392 uint64_t *count) __BT_NOEXCEPT;
2393
2394/*!
2395@brief
2396 Returns the label of the \bt_ba_fc flag \bt_p{flag}.
2397
2398See the \ref api-tir-fc-ba-prop-flags "flags" property.
2399
2400@param[in] flag
2401 Bit array field class flag of which to get the label.
2402
2403@returns
2404 @parblock
2405 Label of \bt_p{flag}.
2406
2407 The returned pointer remains valid as long as \bt_p{flag} exists.
2408 @endparblock
2409
2410@bt_pre_not_null{flag}
2411*/
2412extern const char *bt_field_class_bit_array_flag_get_label(
2413 const bt_field_class_bit_array_flag *flag) __BT_NOEXCEPT;
2414
2415/*!
2416@brief
2417 Borrows the bit index ranges from the \bt_ba_fc flag \bt_p{flag}.
2418
2419See the \ref api-tir-fc-ba-prop-flags "flags" property.
2420
2421@param[in] flag
2422 Bit array field class flag from which to borrow the
2423 bit index ranges.
2424
2425@returns
2426 Bit index ranges of \bt_p{flag}.
2427
2428@bt_pre_not_null{flag}
2429*/
2430extern const bt_integer_range_set_unsigned *
2431bt_field_class_bit_array_flag_borrow_index_ranges_const(
2432 const bt_field_class_bit_array_flag *flag) __BT_NOEXCEPT;
2433
2434/*!
2435@}
2436*/
2437
2438/*!
2439@name Integer field class
2440@{
2441*/
2442
2443/*!
2444@brief
2445 Sets the field value range of the \bt_int_fc \bt_p{field_class}
2446 to \bt_p{n}.
2447
2448See the \ref api-tir-fc-int-prop-size "field value range" property.
2449
2450@param[in] field_class
2451 Integer field class of which to set the field value range to
2452 \bt_p{n}.
2453@param[in] n
2454 @parblock
2455 \em N in:
2456
2457 <dl>
2458 <dt>Unsigned integer field class</dt>
2459 <dd>[0,&nbsp;2<sup><em>N</em></sup>&nbsp;−&nbsp;1]</dd>
2460
2461 <dt>Signed integer field class</dt>
2462 <dd>[−2<sup><em>N</em>&nbsp;−&nbsp;1</sup>,&nbsp;2<sup><em>N</em>&nbsp;−&nbsp;1</sup>&nbsp;−&nbsp;1]</dd>
2463 </dl>
2464 @endparblock
2465
2466@bt_pre_not_null{field_class}
2467@bt_pre_hot{field_class}
2468@bt_pre_is_int_fc{field_class}
2469@pre
2470 1 ⩽ \bt_p{n} ⩽ 64.
2471
2472@sa bt_field_class_integer_get_field_value_range() &mdash;
2473 Returns the field value range of an integer field class.
2474*/
2475extern void bt_field_class_integer_set_field_value_range(
2476 bt_field_class *field_class, uint64_t n) __BT_NOEXCEPT;
2477
2478/*!
2479@brief
2480 Returns the field value range of the \bt_int_fc \bt_p{field_class}.
2481
2482See the \ref api-tir-fc-int-prop-size "field value range" property.
2483
2484@param[in] field_class
2485 Integer field class of which to get the field value range.
2486
2487@returns
2488 @parblock
2489 Field value range of \bt_p{field_class}, that is, \em N in:
2490
2491 <dl>
2492 <dt>Unsigned integer field class</dt>
2493 <dd>[0,&nbsp;2<sup><em>N</em></sup>&nbsp;−&nbsp;1]</dd>
2494
2495 <dt>Signed integer field class</dt>
2496 <dd>[−2<sup><em>N</em></sup>,&nbsp;2<sup><em>N</em></sup>&nbsp;−&nbsp;1]</dd>
2497 </dl>
2498 @endparblock
2499
2500@bt_pre_not_null{field_class}
2501@bt_pre_is_int_fc{field_class}
2502
2503@sa bt_field_class_integer_set_field_value_range() &mdash;
2504 Sets the field value range of an integer field class.
2505*/
2506extern uint64_t bt_field_class_integer_get_field_value_range(
2507 const bt_field_class *field_class) __BT_NOEXCEPT;
2508
2509/*!
2510@brief
2511 Integer field class preferred display bases.
2512*/
2513typedef enum bt_field_class_integer_preferred_display_base {
2514 /*!
2515 @brief
2516 Binary (2).
2517 */
2518 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY = 2,
2519
2520 /*!
2521 @brief
2522 Octal (8).
2523 */
2524 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL = 8,
2525
2526 /*!
2527 @brief
2528 Decimal (10).
2529 */
2530 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL = 10,
2531
2532 /*!
2533 @brief
2534 Hexadecimal (16).
2535 */
2536 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL = 16,
2537} bt_field_class_integer_preferred_display_base;
2538
2539/*!
2540@brief
2541 Sets the preferred display base of the \bt_int_fc \bt_p{field_class}
2542 to \bt_p{preferred_display_base}.
2543
2544See the \ref api-tir-fc-int-prop-base "preferred display base" property.
2545
2546@param[in] field_class
2547 Integer field class of which to set the preferred display base to
2548 \bt_p{preferred_display_base}.
2549@param[in] preferred_display_base
2550 New preferred display base of \bt_p{field_class}.
2551
2552@bt_pre_not_null{field_class}
2553@bt_pre_hot{field_class}
2554@bt_pre_is_int_fc{field_class}
2555
2556@sa bt_field_class_integer_get_preferred_display_base() &mdash;
2557 Returns the preferred display base of an integer field class.
2558*/
2559extern void bt_field_class_integer_set_preferred_display_base(
2560 bt_field_class *field_class,
2561 bt_field_class_integer_preferred_display_base preferred_display_base)
2562 __BT_NOEXCEPT;
2563
2564/*!
2565@brief
2566 Returns the preferred display base of the \bt_int_fc
2567 \bt_p{field_class}.
2568
2569See the \ref api-tir-fc-int-prop-base "preferred display base" property.
2570
2571@param[in] field_class
2572 Integer field class of which to get the preferred display base.
2573
2574@retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY
2575 2 (binary)
2576@retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL
2577 8 (octal)
2578@retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
2579 10 (decimal)
2580@retval #BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL
2581 16 (hexadecimal)
2582
2583@bt_pre_not_null{field_class}
2584@bt_pre_is_int_fc{field_class}
2585
2586@sa bt_field_class_integer_set_preferred_display_base() &mdash;
2587 Sets the preferred display base of an integer field class.
2588*/
2589extern bt_field_class_integer_preferred_display_base
2590bt_field_class_integer_get_preferred_display_base(
2591 const bt_field_class *field_class) __BT_NOEXCEPT;
2592
2593/*! @} */
2594
2595/*!
2596@name Unsigned integer field class
2597@{
2598*/
2599
2600/*!
2601@brief
2602 Creates an \bt_uint_fc from the trace class \bt_p{trace_class}.
2603
2604On success, the returned unsigned integer field class has the following
2605property values:
2606
2607<table>
2608 <tr>
2609 <th>Property
2610 <th>Value
2611 <tr>
2612 <td>\ref api-tir-fc-int-prop-size "Field value range"
2613 <td>[0,&nbsp;2<sup>64</sup>&nbsp;−&nbsp;1]
2614 <tr>
2615 <td>\ref api-tir-fc-int-prop-base "Preferred display base"
2616 <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
2617 <tr>
2618 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2619 <td>Empty \bt_map_val
2620</table>
2621
2622@param[in] trace_class
2623 Trace class from which to create an unsigned integer field class.
2624
2625@returns
2626 New unsigned integer field class reference, or \c NULL on memory error.
2627
2628@bt_pre_not_null{trace_class}
2629*/
2630extern bt_field_class *bt_field_class_integer_unsigned_create(
2631 bt_trace_class *trace_class) __BT_NOEXCEPT;
2632
2633/*! @} */
2634
2635/*!
2636@name Signed integer field class
2637@{
2638*/
2639
2640/*!
2641@brief
2642 Creates an \bt_sint_fc from the trace class \bt_p{trace_class}.
2643
2644On success, the returned signed integer field class has the following
2645property values:
2646
2647<table>
2648 <tr>
2649 <th>Property
2650 <th>Value
2651 <tr>
2652 <td>\ref api-tir-fc-int-prop-size "Field value range"
2653 <td>[−2<sup>63</sup>,&nbsp;2<sup>63</sup>&nbsp;−&nbsp;1]
2654 <tr>
2655 <td>\ref api-tir-fc-int-prop-base "Preferred display base"
2656 <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
2657 <tr>
2658 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2659 <td>Empty \bt_map_val
2660</table>
2661
2662@param[in] trace_class
2663 Trace class from which to create a signed integer field class.
2664
2665@returns
2666 New signed integer field class reference, or \c NULL on memory error.
2667
2668@bt_pre_not_null{trace_class}
2669*/
2670extern bt_field_class *bt_field_class_integer_signed_create(
2671 bt_trace_class *trace_class) __BT_NOEXCEPT;
2672
2673/*! @} */
2674
2675/*!
2676@name Single-precision real field class
2677@{
2678*/
2679
2680/*!
2681@brief
2682 Creates a single-precision \bt_real_fc from the trace class
2683 \bt_p{trace_class}.
2684
2685On success, the returned single-precision real field class has the
2686following property value:
2687
2688<table>
2689 <tr>
2690 <th>Property
2691 <th>Value
2692 <tr>
2693 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2694 <td>Empty \bt_map_val
2695</table>
2696
2697@param[in] trace_class
2698 Trace class from which to create a single-preicision real
2699 field class.
2700
2701@returns
2702 New single-precision real field class reference, or \c NULL on
2703 memory error.
2704
2705@bt_pre_not_null{trace_class}
2706*/
2707extern bt_field_class *bt_field_class_real_single_precision_create(
2708 bt_trace_class *trace_class) __BT_NOEXCEPT;
2709
2710/*! @} */
2711
2712/*!
2713@name Double-precision real field class
2714@{
2715*/
2716
2717/*!
2718@brief
2719 Creates a double-precision \bt_real_fc from the trace class
2720 \bt_p{trace_class}.
2721
2722On success, the returned double-precision real field class has the
2723following property value:
2724
2725<table>
2726 <tr>
2727 <th>Property
2728 <th>Value
2729 <tr>
2730 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2731 <td>Empty \bt_map_val
2732</table>
2733
2734@param[in] trace_class
2735 Trace class from which to create a double-preicision real
2736 field class.
2737
2738@returns
2739 New double-precision real field class reference, or \c NULL on
2740 memory error.
2741
2742@bt_pre_not_null{trace_class}
2743*/
2744extern bt_field_class *bt_field_class_real_double_precision_create(
2745 bt_trace_class *trace_class) __BT_NOEXCEPT;
2746
2747/*! @} */
2748
2749/*!
2750@name Enumeration field class
2751@{
2752*/
2753
2754/*!
2755@brief
2756 Array of \c const \bt_enum_fc mapping labels.
2757
2758Returned by bt_field_class_enumeration_unsigned_get_mapping_labels_for_value()
2759and bt_field_class_enumeration_signed_get_mapping_labels_for_value().
2760*/
2761typedef char const * const *bt_field_class_enumeration_mapping_label_array;
2762
2763/*!
2764@brief
2765 Status codes for
2766 bt_field_class_enumeration_unsigned_get_mapping_labels_for_value()
2767 and
2768 bt_field_class_enumeration_signed_get_mapping_labels_for_value().
2769*/
2770typedef enum bt_field_class_enumeration_get_mapping_labels_for_value_status {
2771 /*!
2772 @brief
2773 Success.
2774 */
2775 BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK = __BT_FUNC_STATUS_OK,
2776
2777 /*!
2778 @brief
2779 Out of memory.
2780 */
2781 BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
2782} bt_field_class_enumeration_get_mapping_labels_for_value_status;
2783
2784/*!
2785@brief
2786 Status codes for bt_field_class_enumeration_unsigned_add_mapping()
2787 and bt_field_class_enumeration_signed_add_mapping().
2788*/
2789typedef enum bt_field_class_enumeration_add_mapping_status {
2790 /*!
2791 @brief
2792 Success.
2793 */
2794 BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK = __BT_FUNC_STATUS_OK,
2795
2796 /*!
2797 @brief
2798 Out of memory.
2799 */
2800 BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
2801} bt_field_class_enumeration_add_mapping_status;
2802
2803/*! @} */
2804
2805/*!
2806@name Enumeration field class mapping
2807@{
2808*/
2809
2810/*!
2811@typedef struct bt_field_class_enumeration_mapping bt_field_class_enumeration_mapping;
2812
2813@brief
2814 Enumeration field class mapping.
2815*/
2816
2817/*!
2818@brief
2819 Returns the number of mappings contained in the \bt_enum_fc
2820 \bt_p{field_class}.
2821
2822See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2823
2824@param[in] field_class
2825 Enumeration field class of which to get the number of contained
2826 mappings.
2827
2828@returns
2829 Number of contained mappings in \bt_p{field_class}.
2830
2831@bt_pre_not_null{field_class}
2832@bt_pre_is_enum_fc{field_class}
2833*/
2834extern uint64_t bt_field_class_enumeration_get_mapping_count(
2835 const bt_field_class *field_class) __BT_NOEXCEPT;
2836
2837/*!
2838@brief
2839 Returns the label of the \bt_enum_fc mapping \bt_p{mapping}.
2840
2841See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2842
2843@param[in] mapping
2844 Enumeration field class mapping of which to get the label.
2845
2846@returns
2847 @parblock
2848 Label of \bt_p{mapping}.
2849
2850 The returned pointer remains valid as long as \bt_p{mapping} exists.
2851 @endparblock
2852
2853@bt_pre_not_null{mapping}
2854*/
2855extern const char *bt_field_class_enumeration_mapping_get_label(
2856 const bt_field_class_enumeration_mapping *mapping)
2857 __BT_NOEXCEPT;
2858
2859/*! @} */
2860
2861/*!
2862@name Unsigned enumeration field class
2863@{
2864*/
2865
2866/*!
2867@brief
2868 Creates an \bt_uenum_fc from the trace class \bt_p{trace_class}.
2869
2870On success, the returned unsigned enumeration field class has the
2871following property values:
2872
2873<table>
2874 <tr>
2875 <th>Property
2876 <th>Value
2877 <tr>
2878 <td>\ref api-tir-fc-int-prop-size "Field value range"
2879 <td>[0,&nbsp;2<sup>64</sup>&nbsp;−&nbsp;1]
2880 <tr>
2881 <td>\ref api-tir-fc-int-prop-base "Preferred display base"
2882 <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
2883 <tr>
2884 <td>\ref api-tir-fc-enum-prop-mappings "Mappings"
2885 <td>\em None
2886 <tr>
2887 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
2888 <td>Empty \bt_map_val
2889</table>
2890
2891@param[in] trace_class
2892 Trace class from which to create an unsigned enumeration field
2893 class.
2894
2895@returns
2896 New unsigned enumeration field class reference, or \c NULL on memory
2897 error.
2898
2899@bt_pre_not_null{trace_class}
2900*/
2901extern bt_field_class *bt_field_class_enumeration_unsigned_create(
2902 bt_trace_class *trace_class) __BT_NOEXCEPT;
2903
2904/*!
2905@brief
2906 Adds a mapping to the \bt_uenum_fc \bt_p{field_class} having the
2907 label \bt_p{label} and the unsigned integer ranges \bt_p{ranges}.
2908
2909See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2910
2911@param[in] field_class
2912 Unsigned enumeration field class to which to add a mapping having
2913 the label \bt_p{label} and the integer ranges \bt_p{ranges}.
2914@param[in] label
2915 Label of the mapping to add to \bt_p{field_class} (copied).
2916@param[in] ranges
2917 Unsigned integer ranges of the mapping to add to
2918 \bt_p{field_class}.
2919
2920@retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK
2921 Success.
2922@retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR
2923 Out of memory.
2924
2925@bt_pre_not_null{field_class}
2926@bt_pre_hot{field_class}
2927@bt_pre_is_uenum_fc{field_class}
2928@bt_pre_not_null{label}
2929@pre
2930 \bt_p{field_class} has no mapping with the label \bt_p{label}.
2931@bt_pre_not_null{ranges}
2932@pre
2933 \bt_p{ranges} contains one or more unsigned integer ranges.
2934*/
2935extern bt_field_class_enumeration_add_mapping_status
2936bt_field_class_enumeration_unsigned_add_mapping(
2937 bt_field_class *field_class, const char *label,
2938 const bt_integer_range_set_unsigned *ranges) __BT_NOEXCEPT;
2939
2940/*!
2941@brief
2942 Borrows the mapping at index \bt_p{index} from the
2943 \bt_uenum_fc \bt_p{field_class}.
2944
2945See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2946
2947@param[in] field_class
2948 Unsigned enumeration field class from which to borrow the mapping at
2949 index \bt_p{index}.
2950@param[in] index
2951 Index of the mapping to borrow from \bt_p{field_class}.
2952
2953@returns
2954 @parblock
2955 \em Borrowed reference of the mapping of
2956 \bt_p{field_class} at index \bt_p{index}.
2957
2958 The returned pointer remains valid as long as \bt_p{field_class}
2959 is not modified.
2960 @endparblock
2961
2962@bt_pre_not_null{field_class}
2963@bt_pre_is_uenum_fc{field_class}
2964@pre
2965 \bt_p{index} is less than the number of mappings in
2966 \bt_p{field_class} (as returned by
2967 bt_field_class_enumeration_get_mapping_count()).
2968
2969@sa bt_field_class_enumeration_get_mapping_count() &mdash;
2970 Returns the number of mappings contained in an
2971 enumeration field class.
2972*/
2973extern const bt_field_class_enumeration_unsigned_mapping *
2974bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const(
2975 const bt_field_class *field_class, uint64_t index)
2976 __BT_NOEXCEPT;
2977
2978/*!
2979@brief
2980 Borrows the mapping having the label \bt_p{label} from the
2981 \bt_uenum_fc \bt_p{field_class}.
2982
2983See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
2984
2985If there's no mapping having the label \bt_p{label} in
2986\bt_p{field_class}, this function returns \c NULL.
2987
2988@param[in] field_class
2989 Unsigned enumeration field class from which to borrow the mapping
2990 having the label \bt_p{label}.
2991@param[in] label
2992 Label of the mapping to borrow from \bt_p{field_class}.
2993
2994@returns
2995 @parblock
2996 \em Borrowed reference of the mapping of
2997 \bt_p{field_class} having the label \bt_p{label}, or \c NULL
2998 if none.
2999
3000 The returned pointer remains valid as long as \bt_p{field_class}
3001 is not modified.
3002 @endparblock
3003
3004@bt_pre_not_null{field_class}
3005@bt_pre_is_uenum_fc{field_class}
3006@bt_pre_not_null{label}
3007*/
3008extern const bt_field_class_enumeration_unsigned_mapping *
3009bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const(
3010 const bt_field_class *field_class, const char *label)
3011 __BT_NOEXCEPT;
3012
3013/*!
3014@brief
3015 Returns an array of all the labels of the mappings of the
3016 \bt_uenum_fc \bt_p{field_class} of which the \bt_p_uint_rg contain
3017 the integral value \bt_p{value}.
3018
3019See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3020
3021This function sets \bt_p{*labels} to the resulting array and
3022\bt_p{*count} to the number of labels in \bt_p{*labels}.
3023
3024On success, if there's no mapping ranges containing the value
3025\bt_p{value}, \bt_p{*count} is 0.
3026
3027@param[in] field_class
3028 Unsigned enumeration field class from which to get the labels of the
3029 mappings of which the ranges contain \bt_p{value}.
3030@param[in] value
3031 Value for which to get the mapped labels in \bt_p{field_class}.
3032@param[out] labels
3033 @parblock
3034 <strong>On success</strong>, \bt_p{*labels}
3035 is an array of labels of the mappings of \bt_p{field_class}
3036 containing \bt_p{value}.
3037
3038 The number of labels in \bt_p{*labels} is \bt_p{*count}.
3039
3040 The array is owned by \bt_p{field_class} and remains valid as long
3041 as:
3042
3043 - \bt_p{field_class} is not modified.
3044 - You don't call this function again with \bt_p{field_class}.
3045 @endparblock
3046@param[out] count
3047 <strong>On success</strong>, \bt_p{*count} is the number of labels
3048 in \bt_p{*labels} (can be 0).
3049
3050@retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK
3051 Success.
3052@retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR
3053 Out of memory.
3054
3055@bt_pre_not_null{field_class}
3056@bt_pre_is_uenum_fc{field_class}
3057@bt_pre_not_null{labels}
3058@bt_pre_not_null{count}
3059*/
3060extern bt_field_class_enumeration_get_mapping_labels_for_value_status
3061bt_field_class_enumeration_unsigned_get_mapping_labels_for_value(
3062 const bt_field_class *field_class, uint64_t value,
3063 bt_field_class_enumeration_mapping_label_array *labels,
3064 uint64_t *count) __BT_NOEXCEPT;
3065
3066/*! @} */
3067
3068/*!
3069@name Unsigned enumeration field class mapping
3070@{
3071*/
3072
3073/*!
3074@typedef struct bt_field_class_enumeration_unsigned_mapping bt_field_class_enumeration_unsigned_mapping;
3075
3076@brief
3077 Unsigned enumeration field class mapping.
3078*/
3079
3080/*!
3081@brief
3082 Borrows the \bt_p_uint_rg from the \bt_uenum_fc mapping
3083 \bt_p{mapping}.
3084
3085See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3086
3087@param[in] mapping
3088 Unsigned enumeration field class mapping from which to borrow the
3089 unsigned integer ranges.
3090
3091@returns
3092 Unsigned integer ranges of \bt_p{mapping}.
3093
3094@bt_pre_not_null{mapping}
3095*/
3096extern const bt_integer_range_set_unsigned *
3097bt_field_class_enumeration_unsigned_mapping_borrow_ranges_const(
3098 const bt_field_class_enumeration_unsigned_mapping *mapping)
3099 __BT_NOEXCEPT;
3100
3101/*!
3102@brief
3103 \ref api-fund-c-typing "Upcasts" the \bt_uenum_fc mapping
3104 \bt_p{mapping} to the common #bt_field_class_enumeration_mapping
3105 type.
3106
3107See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3108
3109@param[in] mapping
3110 @parblock
3111 Unsigned enumeration field class mapping to upcast.
3112
3113 Can be \c NULL.
3114 @endparblock
3115
3116@returns
3117 \bt_p{mapping} as a common enumeration field class mapping.
3118*/
3119static inline
3120const bt_field_class_enumeration_mapping *
3121bt_field_class_enumeration_unsigned_mapping_as_mapping_const(
3122 const bt_field_class_enumeration_unsigned_mapping *mapping)
3123 __BT_NOEXCEPT
3124{
3125 return __BT_UPCAST_CONST(bt_field_class_enumeration_mapping, mapping);
3126}
3127
3128/*! @} */
3129
3130/*!
3131@name Signed enumeration field class
3132@{
3133*/
3134
3135/*!
3136@brief
3137 Creates a \bt_senum_fc from the trace class \bt_p{trace_class}.
3138
3139On success, the returned signed enumeration field class has the
3140following property values:
3141
3142<table>
3143 <tr>
3144 <th>Property
3145 <th>Value
3146 <tr>
3147 <td>\ref api-tir-fc-int-prop-size "Field value range"
3148 <td>[−2<sup>63</sup>,&nbsp;2<sup>63</sup>&nbsp;−&nbsp;1]
3149 <tr>
3150 <td>\ref api-tir-fc-int-prop-base "Preferred display base"
3151 <td>#BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
3152 <tr>
3153 <td>\ref api-tir-fc-enum-prop-mappings "Mappings"
3154 <td>\em None
3155 <tr>
3156 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3157 <td>Empty \bt_map_val
3158</table>
3159
3160@param[in] trace_class
3161 Trace class from which to create a signed enumeration field
3162 class.
3163
3164@returns
3165 New signed enumeration field class reference, or \c NULL on memory
3166 error.
3167
3168@bt_pre_not_null{trace_class}
3169*/
3170extern bt_field_class *bt_field_class_enumeration_signed_create(
3171 bt_trace_class *trace_class) __BT_NOEXCEPT;
3172
3173/*!
3174@brief
3175 Adds a mapping to the \bt_senum_fc \bt_p{field_class} having the
3176 label \bt_p{label} and the \bt_p_sint_rg \bt_p{ranges}.
3177
3178See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3179
3180@param[in] field_class
3181 Signed enumeration field class to which to add a mapping having
3182 the label \bt_p{label} and the integer ranges \bt_p{ranges}.
3183@param[in] label
3184 Label of the mapping to add to \bt_p{field_class} (copied).
3185@param[in] ranges
3186 Signed integer ranges of the mapping to add to
3187 \bt_p{field_class}.
3188
3189@retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK
3190 Success.
3191@retval #BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR
3192 Out of memory.
3193
3194@bt_pre_not_null{field_class}
3195@bt_pre_hot{field_class}
3196@bt_pre_is_senum_fc{field_class}
3197@bt_pre_not_null{label}
3198@pre
3199 \bt_p{field_class} has no mapping with the label \bt_p{label}.
3200@bt_pre_not_null{ranges}
3201@pre
3202 \bt_p{ranges} contains one or more signed integer ranges.
3203*/
3204extern bt_field_class_enumeration_add_mapping_status
3205bt_field_class_enumeration_signed_add_mapping(
3206 bt_field_class *field_class, const char *label,
3207 const bt_integer_range_set_signed *ranges) __BT_NOEXCEPT;
3208
3209/*!
3210@brief
3211 Borrows the mapping at index \bt_p{index} from the
3212 \bt_senum_fc \bt_p{field_class}.
3213
3214See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3215
3216@param[in] field_class
3217 Signed enumeration field class from which to borrow the mapping at
3218 index \bt_p{index}.
3219@param[in] index
3220 Index of the mapping to borrow from \bt_p{field_class}.
3221
3222@returns
3223 @parblock
3224 \em Borrowed reference of the mapping of
3225 \bt_p{field_class} at index \bt_p{index}.
3226
3227 The returned pointer remains valid as long as \bt_p{field_class}
3228 is not modified.
3229 @endparblock
3230
3231@bt_pre_not_null{field_class}
3232@bt_pre_is_senum_fc{field_class}
3233@pre
3234 \bt_p{index} is less than the number of mappings in
3235 \bt_p{field_class} (as returned by
3236 bt_field_class_enumeration_get_mapping_count()).
3237
3238@sa bt_field_class_enumeration_get_mapping_count() &mdash;
3239 Returns the number of mappings contained in an
3240 enumeration field class.
3241*/
3242extern const bt_field_class_enumeration_signed_mapping *
3243bt_field_class_enumeration_signed_borrow_mapping_by_index_const(
3244 const bt_field_class *field_class, uint64_t index)
3245 __BT_NOEXCEPT;
3246
3247/*!
3248@brief
3249 Borrows the mapping having the label \bt_p{label} from the
3250 \bt_senum_fc \bt_p{field_class}.
3251
3252See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3253
3254If there's no mapping having the label \bt_p{label} in
3255\bt_p{field_class}, this function returns \c NULL.
3256
3257@param[in] field_class
3258 Signed enumeration field class from which to borrow the mapping
3259 having the label \bt_p{label}.
3260@param[in] label
3261 Label of the mapping to borrow from \bt_p{field_class}.
3262
3263@returns
3264 @parblock
3265 \em Borrowed reference of the mapping of
3266 \bt_p{field_class} having the label \bt_p{label}, or \c NULL
3267 if none.
3268
3269 The returned pointer remains valid as long as \bt_p{field_class}
3270 is not modified.
3271 @endparblock
3272
3273@bt_pre_not_null{field_class}
3274@bt_pre_is_senum_fc{field_class}
3275@bt_pre_not_null{label}
3276*/
3277extern const bt_field_class_enumeration_signed_mapping *
3278bt_field_class_enumeration_signed_borrow_mapping_by_label_const(
3279 const bt_field_class *field_class, const char *label)
3280 __BT_NOEXCEPT;
3281
3282/*!
3283@brief
3284 Returns an array of all the labels of the mappings of the
3285 \bt_senum_fc \bt_p{field_class} of which the \bt_p_sint_rg contain
3286 the integral value \bt_p{value}.
3287
3288See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3289
3290This function sets \bt_p{*labels} to the resulting array and
3291\bt_p{*count} to the number of labels in \bt_p{*labels}.
3292
3293On success, if there's no mapping ranges containing the value
3294\bt_p{value}, \bt_p{*count} is 0.
3295
3296@param[in] field_class
3297 Signed enumeration field class from which to get the labels of the
3298 mappings of which the ranges contain \bt_p{value}.
3299@param[in] value
3300 Value for which to get the mapped labels in \bt_p{field_class}.
3301@param[out] labels
3302 @parblock
3303 <strong>On success</strong>, \bt_p{*labels}
3304 is an array of labels of the mappings of \bt_p{field_class}
3305 containing \bt_p{value}.
3306
3307 The number of labels in \bt_p{*labels} is \bt_p{*count}.
3308
3309 The array is owned by \bt_p{field_class} and remains valid as long
3310 as:
3311
3312 - \bt_p{field_class} is not modified.
3313 - You don't call this function again with \bt_p{field_class}.
3314 @endparblock
3315@param[out] count
3316 <strong>On success</strong>, \bt_p{*count} is the number of labels
3317 in \bt_p{*labels} (can be 0).
3318
3319@retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK
3320 Success.
3321@retval #BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR
3322 Out of memory.
3323
3324@bt_pre_not_null{field_class}
3325@bt_pre_is_senum_fc{field_class}
3326@bt_pre_not_null{labels}
3327@bt_pre_not_null{count}
3328*/
3329extern bt_field_class_enumeration_get_mapping_labels_for_value_status
3330bt_field_class_enumeration_signed_get_mapping_labels_for_value(
3331 const bt_field_class *field_class, int64_t value,
3332 bt_field_class_enumeration_mapping_label_array *labels,
3333 uint64_t *count) __BT_NOEXCEPT;
3334
3335/*! @} */
3336
3337/*!
3338@name Signed enumeration field class mapping
3339@{
3340*/
3341
3342/*!
3343@typedef struct bt_field_class_enumeration_signed_mapping bt_field_class_enumeration_signed_mapping;
3344
3345@brief
3346 Signed enumeration field class mapping.
3347*/
3348
3349/*!
3350@brief
3351 Borrows the \bt_p_sint_rg from the \bt_senum_fc mapping
3352 \bt_p{mapping}.
3353
3354See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3355
3356@param[in] mapping
3357 Signed enumeration field class mapping from which to borrow the
3358 signed integer ranges.
3359
3360@returns
3361 Signed integer ranges of \bt_p{mapping}.
3362
3363@bt_pre_not_null{mapping}
3364*/
3365extern const bt_integer_range_set_signed *
3366bt_field_class_enumeration_signed_mapping_borrow_ranges_const(
3367 const bt_field_class_enumeration_signed_mapping *mapping)
3368 __BT_NOEXCEPT;
3369
3370/*!
3371@brief
3372 \ref api-fund-c-typing "Upcasts" the \bt_senum_fc mapping
3373 \bt_p{mapping} to the common #bt_field_class_enumeration_mapping
3374 type.
3375
3376See the \ref api-tir-fc-enum-prop-mappings "mappings" property.
3377
3378@param[in] mapping
3379 @parblock
3380 Signed enumeration field class mapping to upcast.
3381
3382 Can be \c NULL.
3383 @endparblock
3384
3385@returns
3386 \bt_p{mapping} as a common enumeration field class mapping.
3387*/
3388static inline
3389const bt_field_class_enumeration_mapping *
3390bt_field_class_enumeration_signed_mapping_as_mapping_const(
3391 const bt_field_class_enumeration_signed_mapping *mapping)
3392 __BT_NOEXCEPT
3393{
3394 return __BT_UPCAST_CONST(bt_field_class_enumeration_mapping, mapping);
3395}
3396
3397/*! @} */
3398
3399/*!
3400@name String field class
3401@{
3402*/
3403
3404/*!
3405@brief
3406 Creates a \bt_string_fc from the trace class \bt_p{trace_class}.
3407
3408On success, the returned string field class has the following property
3409value:
3410
3411<table>
3412 <tr>
3413 <th>Property
3414 <th>Value
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 a string field class.
3422
3423@returns
3424 New string field class reference, or \c NULL on memory error.
3425
3426@bt_pre_not_null{trace_class}
3427*/
3428extern bt_field_class *bt_field_class_string_create(
3429 bt_trace_class *trace_class) __BT_NOEXCEPT;
3430
3431/*! @} */
3432
3433/*!
3434@name BLOB field class
3435@{
3436*/
3437
3438/*!
3439@brief
3440 Creates a \bt_sblob_fc having the length \bt_p{length} from the
3441 trace class \bt_p{trace_class}.
3442
3443On success, the returned static BLOB field class has the following
3444property values:
3445
3446<table>
3447 <tr>
3448 <th>Property
3449 <th>Value
3450 <tr>
3451 <td>\ref api-tir-fc-sarray-prop-len "Length"
3452 <td>\bt_p{length}
3453 <tr>
3454 <td>\ref api-tir-fc-blob-prop-media-type "Media type"
3455 <td><code>application/octet-stream</code>
3456 <tr>
3457 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3458 <td>Empty \bt_map_val
3459</table>
3460
3461@param[in] trace_class
3462 Trace class from which to create a static BLOB field class.
3463@param[in] length
3464 Length (number of bytes) of the instances of the static BLOB
3465 field class to create.
3466
3467@returns
3468 New static BLOB field class reference, or \c NULL on memory error.
3469
3470@bt_pre_not_null{trace_class}
3471@bt_pre_tc_with_mip{trace_class, 1}
3472
3473@sa bt_field_class_blob_dynamic_without_length_field_location_create() &mdash;
3474 Creates a class of dynamic BLOB field without a linked length field.
3475@sa bt_field_class_blob_dynamic_with_length_field_location_create() &mdash;
3476 Creates a class of dynamic BLOB field with a linked length field.
3477*/
3478extern bt_field_class *bt_field_class_blob_static_create(
3479 bt_trace_class *trace_class, uint64_t length) __BT_NOEXCEPT;
3480
3481/*!
3482@brief
3483 Creates a \bt_dblob_fc (instances without a linked length field)
3484 from the trace class \bt_p{trace_class}.
3485
3486On success, the returned dynamic BLOB field class has the following
3487property values:
3488
3489<table>
3490 <tr>
3491 <th>Property
3492 <th>Value
3493 <tr>
3494 <td>\ref api-tir-fc-dblob-prop-len-fl "Length field location"
3495 <td>
3496 \em None
3497 <tr>
3498 <td>\ref api-tir-fc-blob-prop-media-type "Media type"
3499 <td><code>application/octet-stream</code>
3500 <tr>
3501 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3502 <td>Empty \bt_map_val
3503</table>
3504
3505@param[in] trace_class
3506 Trace class from which to create a dynamic BLOB field class.
3507
3508@returns
3509 New dynamic BLOB field class reference (without a length field),
3510 or \c NULL on memory error.
3511
3512@bt_pre_not_null{trace_class}
3513@bt_pre_tc_with_mip{trace_class, 1}
3514
3515@sa bt_field_class_blob_dynamic_with_length_field_location_create() &mdash;
3516 Creates a class of dynamic BLOB field with a linked length field.
3517*/
3518extern bt_field_class *
3519bt_field_class_blob_dynamic_without_length_field_location_create(
3520 bt_trace_class *trace_class) __BT_NOEXCEPT;
3521
3522/*!
3523@brief
3524 Creates a \bt_dblob_fc (instances with a linked length field)
3525 having the length \bt_field_loc \bt_p{length_field_location} from
3526 the trace class \bt_p{trace_class}.
3527
3528On success, the returned dynamic BLOB field class has the following
3529property values:
3530
3531<table>
3532 <tr>
3533 <th>Property
3534 <th>Value
3535 <tr>
3536 <td>\ref api-tir-fc-dblob-prop-len-fl "Length field location"
3537 <td>
3538 \bt_p{length_field_location}.
3539
3540 See \ref api-tir-fc-link "Fields with links to other fields"
3541 to learn more.
3542 <tr>
3543 <td>\ref api-tir-fc-blob-prop-media-type "Media type"
3544 <td><code>application/octet-stream</code>
3545 <tr>
3546 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3547 <td>Empty \bt_map_val
3548</table>
3549
3550@param[in] trace_class
3551 Trace class from which to create a dynamic BLOB field class.
3552@param[in] length_field_location
3553 Length field location of the dynamic BLOB field class to create.
3554
3555@returns
3556 New dynamic BLOB field class reference (instances with a linked
3557 length field), or \c NULL on memory error.
3558
3559@bt_pre_not_null{trace_class}
3560@bt_pre_tc_with_mip{trace_class, 1}
3561@bt_pre_not_null{length_field_location}
3562
3563@sa bt_field_class_blob_dynamic_without_length_field_location_create() &mdash;
3564 Creates a class of dynamic BLOB field without a linked
3565 length field.
3566*/
3567extern bt_field_class *
3568bt_field_class_blob_dynamic_with_length_field_location_create(
3569 bt_trace_class *trace_class,
3570 const bt_field_location *length_field_location) __BT_NOEXCEPT;
3571
3572/*!
3573@brief
3574 Returns the length of the \bt_sblob_fc \bt_p{field_class}.
3575
3576See the \ref api-tir-fc-sblob-prop-len "length" property.
3577
3578@param[in] field_class
3579 Static BLOB field class of which to get the length (number of bytes
3580 in instances).
3581
3582@returns
3583 Length of \bt_p{field_class}.
3584
3585@bt_pre_not_null{field_class}
3586@bt_pre_is_sblob_fc{field_class}
3587@bt_pre_fc_with_mip{field_class, 1}
3588*/
3589extern uint64_t bt_field_class_blob_static_get_length(
3590 const bt_field_class *field_class) __BT_NOEXCEPT;
3591
3592/*!
3593@brief
3594 Borrows the length field location from the \bt_dblob_fc (instances
3595 with a linked length field) \bt_p{field_class}.
3596
3597See the \ref api-tir-fc-dblob-prop-len-fl "length field location"
3598property.
3599
3600@param[in] field_class
3601 Dynamic BLOB field class from which to borrow the length
3602 field location.
3603
3604@returns
3605 Length field location of \bt_p{field_class}.
3606
3607@bt_pre_not_null{field_class}
3608@bt_pre_is_dblob_wl_fc{field_class}
3609@bt_pre_fc_with_mip{field_class, 1}
3610*/
3611extern const bt_field_location *
3612bt_field_class_blob_dynamic_with_length_field_borrow_length_field_location_const(
3613 const bt_field_class *field_class) __BT_NOEXCEPT;
3614
3615/*!
3616@brief
3617 Status codes for bt_field_class_blob_set_media_type().
3618*/
3619typedef enum bt_field_class_blob_set_media_type_status {
3620 /*!
3621 @brief
3622 Success.
3623 */
3624 BT_FIELD_CLASS_BLOB_SET_MEDIA_TYPE_STATUS_OK = __BT_FUNC_STATUS_OK,
3625
3626 /*!
3627 @brief
3628 Out of memory.
3629 */
3630 BT_FIELD_CLASS_BLOB_SET_MEDIA_TYPE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
3631} bt_field_class_blob_set_media_type_status;
3632
3633/*!
3634@brief
3635 Sets the IANA media type of the \bt_blob_fc \bt_p{field_class}
3636 to a copy of \bt_p{media_type}.
3637
3638See the \ref api-tir-fc-blob-prop-media-type "media type" property.
3639
3640@param[in] field_class
3641 BLOB field class of which to set the media type to a copy of
3642 \bt_p{media_type}.
3643@param[in] media_type
3644 New media type of \bt_p{field_class} (copied).
3645
3646@retval #BT_FIELD_CLASS_BLOB_SET_MEDIA_TYPE_STATUS_OK
3647 Success.
3648@retval #BT_FIELD_CLASS_BLOB_SET_MEDIA_TYPE_STATUS_MEMORY_ERROR
3649 Out of memory.
3650
3651@bt_pre_not_null{field_class}
3652@bt_pre_hot{field_class}
3653@bt_pre_is_blob_fc{field_class}
3654@bt_pre_fc_with_mip{field_class, 1}
3655
3656@sa bt_field_class_blob_get_media_type() &mdash;
3657 Returns the IANA media type of BLOB field class.
3658*/
3659extern bt_field_class_blob_set_media_type_status
3660bt_field_class_blob_set_media_type(bt_field_class *field_class,
3661 const char *media_type) __BT_NOEXCEPT;
3662
3663/*!
3664@brief
3665 Returns the IANA media type of the \bt_blob_fc \bt_p{field_class}.
3666
3667See the \ref api-tir-fc-blob-prop-media-type "media type" property.
3668
3669If \bt_p{field_class} has no media type, this function returns \c NULL.
3670
3671@param[in] field_class
3672 BLOB field class of which to get the media type.
3673
3674@returns
3675 @parblock
3676 Media type of \bt_p{field_class}, or \c NULL if none.
3677
3678 The returned pointer remains valid as long as \bt_p{field_class}
3679 is not modified.
3680 @endparblock
3681
3682@bt_pre_not_null{field_class}
3683@bt_pre_is_blob_fc{field_class}
3684@bt_pre_fc_with_mip{field_class, 1}
3685
3686@sa bt_field_class_blob_set_media_type() &mdash;
3687 Sets the media type of a BLOB field class.
3688*/
3689extern const char *bt_field_class_blob_get_media_type(
3690 const bt_field_class *field_class) __BT_NOEXCEPT;
3691
3692/*! @} */
3693
3694/*!
3695@name Array field class
3696@{
3697*/
3698
3699/*!
3700@brief
3701 Borrows the element field class from the \bt_array_fc
3702 \bt_p{field_class}.
3703
3704See the \ref api-tir-fc-array-prop-elem-fc "element field class"
3705property.
3706
3707@param[in] field_class
3708 Array field class from which to borrow the element field class.
3709
3710@returns
3711 Element field class of \bt_p{field_class}.
3712
3713@bt_pre_not_null{field_class}
3714@bt_pre_is_array_fc{field_class}
3715
3716@sa bt_field_class_array_borrow_element_field_class_const() &mdash;
3717 \c const version of this function.
3718*/
3719extern bt_field_class *bt_field_class_array_borrow_element_field_class(
3720 bt_field_class *field_class) __BT_NOEXCEPT;
3721
3722/*!
3723@brief
3724 Borrows the element field class from the \bt_array_fc
3725 \bt_p{field_class} (\c const version).
3726
3727See bt_field_class_array_borrow_element_field_class().
3728*/
3729extern const bt_field_class *
3730bt_field_class_array_borrow_element_field_class_const(
3731 const bt_field_class *field_class) __BT_NOEXCEPT;
3732
3733/*! @} */
3734
3735/*!
3736@name Static array field class
3737@{
3738*/
3739
3740/*!
3741@brief
3742 Creates a \bt_sarray_fc having the element field class
3743 \bt_p{element_field_class} and the length \bt_p{length} from the
3744 trace class \bt_p{trace_class}.
3745
3746On success, the returned static array field class has the following
3747property values:
3748
3749<table>
3750 <tr>
3751 <th>Property
3752 <th>Value
3753 <tr>
3754 <td>\ref api-tir-fc-array-prop-elem-fc "Element field class"
3755 <td>\bt_p{element_field_class}
3756 <tr>
3757 <td>\ref api-tir-fc-sarray-prop-len "Length"
3758 <td>\bt_p{length}
3759 <tr>
3760 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3761 <td>Empty \bt_map_val
3762</table>
3763
3764@param[in] trace_class
3765 Trace class from which to create a static array field class.
3766@param[in] element_field_class
3767 Class of the element fields of the instances of the static array
3768 field class to create.
3769@param[in] length
3770 Length of the instances of the static array field class to create.
3771
3772@returns
3773 New static array field class reference, or \c NULL on memory error.
3774
3775@bt_pre_not_null{trace_class}
3776@bt_pre_not_null{element_field_class}
3777@bt_pre_fc_not_in_tc{element_field_class}
3778
3779@bt_post_success_frozen{element_field_class}
3780*/
3781extern bt_field_class *bt_field_class_array_static_create(
3782 bt_trace_class *trace_class,
3783 bt_field_class *element_field_class, uint64_t length)
3784 __BT_NOEXCEPT;
3785
3786/*!
3787@brief
3788 Returns the length of the \bt_sarray_fc \bt_p{field_class}.
3789
3790See the \ref api-tir-fc-sarray-prop-len "length" property.
3791
3792@param[in] field_class
3793 Static array field class of which to get the length.
3794
3795@returns
3796 Length of \bt_p{field_class}.
3797
3798@bt_pre_not_null{field_class}
3799@bt_pre_is_sarray_fc{field_class}
3800*/
3801extern uint64_t bt_field_class_array_static_get_length(
3802 const bt_field_class *field_class) __BT_NOEXCEPT;
3803
3804/*! @} */
3805
3806/*!
3807@name Dynamic array field class
3808@{
3809*/
3810
3811/*!
3812@brief
3813 Creates a \bt_darray_fc having the element field class
3814 \bt_p{element_field_class} from the trace class \bt_p{trace_class}.
3815
3816@note
3817 @parblock
3818 This function is only available when \bt_p{trace_class} was created
3819 from a \bt_self_comp which belongs to a trace processing \bt_graph
3820 with the effective \bt_mip version&nbsp;0.
3821
3822 To create a dynamic array field class from a trace class which was
3823 created from a self component which belongs to a trace processing
3824 graph with the effective MIP version&nbsp;1, use
3825 bt_field_class_array_dynamic_without_length_field_location_create()
3826 or bt_field_class_array_dynamic_with_length_field_location_create().
3827 @endparblock
3828
3829If \bt_p{length_field_class} is not \c NULL, then an instance of
3830the created dynamic array field class has a linked length field.
3831See \ref api-tir-fc-link "Fields with links to other fields"
3832to learn more.
3833
3834On success, the returned dynamic array field class has the following
3835property values:
3836
3837<table>
3838 <tr>
3839 <th>Property
3840 <th>Value
3841 <tr>
3842 <td>\ref api-tir-fc-array-prop-elem-fc "Element field class"
3843 <td>\bt_p{element_field_class}
3844 <tr>
3845 <td>\ref api-tir-fc-darray-prop-len-fp "Length field path"
3846 <td>
3847 \em None (if \bt_p{length_field_class} is not \c NULL, this
3848 property becomes available when the returned field class becomes
3849 part of an \bt_ev_cls or of a \bt_stream_cls)
3850 <tr>
3851 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3852 <td>Empty \bt_map_val
3853</table>
3854
3855@param[in] trace_class
3856 Trace class from which to create a dynamic array field class.
3857@param[in] element_field_class
3858 Class of the element fields of the instances of the dynamic array
3859 field class to create.
3860@param[in] length_field_class
3861 @parblock
3862 Class of a linked length field of an instance of the dynamic array
3863 field class to create.
3864
3865 Can be \c NULL.
3866 @endparblock
3867
3868@returns
3869 New dynamic array field class reference, or \c NULL on memory error.
3870
3871@bt_pre_not_null{trace_class}
3872@bt_pre_tc_with_mip{trace_class, 0}
3873@bt_pre_not_null{element_field_class}
3874@bt_pre_fc_not_in_tc{element_field_class}
3875@pre
3876 <strong>If \bt_p{length_field_class} is not \c NULL</strong>,
3877 \bt_p{length_field_class} is an \bt_uint_fc.
3878
3879@bt_post_success_frozen{element_field_class}
3880@bt_post_success_frozen{length_field_class}
3881
3882@sa bt_field_class_array_dynamic_without_length_field_location_create() &mdash;
3883 Creates a class of dynamic array field without a linked length field
3884 (\bt_mip version&nbsp;1).
3885@sa bt_field_class_array_dynamic_with_length_field_location_create() &mdash;
3886 Creates a class of dynamic array field with a linked length field
3887 (\bt_mip version&nbsp;1).
3888*/
3889extern bt_field_class *bt_field_class_array_dynamic_create(
3890 bt_trace_class *trace_class,
3891 bt_field_class *element_field_class,
3892 bt_field_class *length_field_class) __BT_NOEXCEPT;
3893
3894/*!
3895@brief
3896 Creates a \bt_darray_fc (instances without a linked length field)
3897 having the element field class \bt_p{element_field_class} from the
3898 trace class \bt_p{trace_class}.
3899
3900On success, the returned dynamic array field class has the following
3901property values:
3902
3903<table>
3904 <tr>
3905 <th>Property
3906 <th>Value
3907 <tr>
3908 <td>\ref api-tir-fc-array-prop-elem-fc "Element field class"
3909 <td>\bt_p{element_field_class}
3910 <tr>
3911 <td>\ref api-tir-fc-darray-prop-len-fl "Length field location"
3912 <td>
3913 \em None
3914 <tr>
3915 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3916 <td>Empty \bt_map_val
3917</table>
3918
3919@param[in] trace_class
3920 Trace class from which to create a dynamic array field class.
3921@param[in] element_field_class
3922 Class of the element fields of the instances of the dynamic array
3923 field class to create.
3924
3925@returns
3926 New dynamic array field class reference (without a length field),
3927 or \c NULL on memory error.
3928
3929@bt_pre_not_null{trace_class}
3930@bt_pre_tc_with_mip{trace_class, 1}
3931@bt_pre_not_null{element_field_class}
3932@bt_pre_fc_not_in_tc{element_field_class}
3933
3934@bt_post_success_frozen{element_field_class}
3935
3936@sa bt_field_class_array_dynamic_with_length_field_location_create() &mdash;
3937 Creates a class of dynamic array field with a linked length field.
3938*/
3939extern bt_field_class *bt_field_class_array_dynamic_without_length_field_location_create(
3940 bt_trace_class *trace_class,
3941 bt_field_class *element_field_class);
3942
3943/*! @} */
3944
3945/*!
3946@name Dynamic array field class: instances with linked length field
3947@{
3948*/
3949
3950/*!
3951@brief
3952 Creates a \bt_darray_fc (instances with a linked length field)
3953 having the element field class \bt_p{element_field_class} and the
3954 length \bt_field_loc \bt_p{length_field_location} from the
3955 trace class \bt_p{trace_class}.
3956
3957On success, the returned dynamic array field class has the following
3958property values:
3959
3960<table>
3961 <tr>
3962 <th>Property
3963 <th>Value
3964 <tr>
3965 <td>\ref api-tir-fc-array-prop-elem-fc "Element field class"
3966 <td>\bt_p{element_field_class}
3967 <tr>
3968 <td>\ref api-tir-fc-darray-prop-len-fl "Length field location"
3969 <td>
3970 \bt_p{length_field_location}.
3971
3972 See \ref api-tir-fc-link "Fields with links to other fields"
3973 to learn more.
3974 <tr>
3975 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
3976 <td>Empty \bt_map_val
3977</table>
3978
3979@param[in] trace_class
3980 Trace class from which to create a dynamic array field class.
3981@param[in] element_field_class
3982 Class of the element fields of the instances of the dynamic array
3983 field class to create.
3984@param[in] length_field_location
3985 Length field location of the dynamic array field class to create.
3986
3987@returns
3988 New dynamic array field class reference (instances with a linked
3989 length field), or \c NULL on memory error.
3990
3991@bt_pre_not_null{trace_class}
3992@bt_pre_tc_with_mip{trace_class, 1}
3993@bt_pre_not_null{element_field_class}
3994@bt_pre_fc_not_in_tc{element_field_class}
3995@bt_pre_not_null{length_field_location}
3996
3997@bt_post_success_frozen{element_field_class}
3998
3999@sa bt_field_class_array_dynamic_without_length_field_location_create() &mdash;
4000 Creates a class of dynamic array field without a linked
4001 length field.
4002*/
4003extern bt_field_class *bt_field_class_array_dynamic_with_length_field_location_create(
4004 bt_trace_class *trace_class,
4005 bt_field_class *element_field_class,
4006 const bt_field_location *length_field_location);
4007
4008/*!
4009@brief
4010 Borrows the length field path from the \bt_darray_fc (instances with
4011 a linked length field) \bt_p{field_class}.
4012
4013See the \ref api-tir-fc-darray-prop-len-fp "length field path" property.
4014
4015This property is only available when all the following are true:
4016
4017- \bt_p{field_class} was created with
4018 bt_field_class_array_dynamic_create() with \bt_p{length_field_class}
4019 set to an \bt_uint_fc (not \c NULL).
4020
4021- A \bt_struct_fc containing (recursively) \bt_p{field_class} is passed
4022 to one of:
4023
4024 - bt_stream_class_set_packet_context_field_class()
4025 - bt_stream_class_set_event_common_context_field_class()
4026 - bt_event_class_set_specific_context_field_class()
4027 - bt_event_class_set_payload_field_class()
4028
4029 In the meantime, this function returns \c NULL.
4030
4031@param[in] field_class
4032 Dynamic array field class from which to borrow the length
4033 field path.
4034
4035@returns
4036 Length field path of \bt_p{field_class}.
4037
4038@bt_pre_not_null{field_class}
4039@bt_pre_is_darray_wl_fc{field_class}
4040@bt_pre_fc_with_mip{field_class, 0}
4041*/
4042extern const bt_field_path *
4043bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const(
4044 const bt_field_class *field_class) __BT_NOEXCEPT;
4045
4046/*!
4047@brief
4048 Borrows the length field location from the \bt_darray_fc (instances
4049 with a linked length field) \bt_p{field_class}.
4050
4051See the \ref api-tir-fc-darray-prop-len-fl "length field location"
4052property.
4053
4054This property is only available when \bt_p{field_class} was created
4055with bt_field_class_array_dynamic_with_length_field_location_create().
4056
4057@param[in] field_class
4058 Dynamic array field class from which to borrow the length
4059 field location.
4060
4061@returns
4062 Length field location of \bt_p{field_class}.
4063
4064@bt_pre_not_null{field_class}
4065@bt_pre_is_darray_wl_fc{field_class}
4066@bt_pre_fc_with_mip{field_class, 1}
4067*/
4068extern const bt_field_location *
4069bt_field_class_array_dynamic_with_length_field_borrow_length_field_location_const(
4070 const bt_field_class *field_class);
4071
4072/*! @} */
4073
4074/*!
4075@name Structure field class
4076@{
4077*/
4078
4079/*!
4080@brief
4081 Creates a \bt_struct_fc from the trace class \bt_p{trace_class}.
4082
4083On success, the returned structure field class has the following
4084property values:
4085
4086<table>
4087 <tr>
4088 <th>Property
4089 <th>Value
4090 <tr>
4091 <td>\ref api-tir-fc-struct-prop-members "Members"
4092 <td>\em None
4093 <tr>
4094 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
4095 <td>Empty \bt_map_val
4096</table>
4097
4098@param[in] trace_class
4099 Trace class from which to create a structure field class.
4100
4101@returns
4102 New structure field class reference, or \c NULL on memory error.
4103
4104@bt_pre_not_null{trace_class}
4105*/
4106extern bt_field_class *bt_field_class_structure_create(
4107 bt_trace_class *trace_class) __BT_NOEXCEPT;
4108
4109/*!
4110@brief
4111 Status codes for bt_field_class_structure_append_member().
4112*/
4113typedef enum bt_field_class_structure_append_member_status {
4114 /*!
4115 @brief
4116 Success.
4117 */
4118 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK = __BT_FUNC_STATUS_OK,
4119
4120 /*!
4121 @brief
4122 Out of memory.
4123 */
4124 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
4125} bt_field_class_structure_append_member_status;
4126
4127/*!
4128@brief
4129 Appends a member to the \bt_struct_fc \bt_p{field_class} having the
4130 name \bt_p{name} and the field class \bt_p{member_field_class}.
4131
4132See the \ref api-tir-fc-struct-prop-members "members" property.
4133
4134@param[in] field_class
4135 Structure field class to which to append a member having
4136 the name \bt_p{name} and the field class \bt_p{member_field_class}.
4137@param[in] name
4138 Name of the member to append to \bt_p{field_class} (copied).
4139@param[in] member_field_class
4140 Field class of the member to append to \bt_p{field_class}.
4141
4142@retval #BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK
4143 Success.
4144@retval #BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR
4145 Out of memory.
4146
4147@bt_pre_not_null{field_class}
4148@bt_pre_hot{field_class}
4149@bt_pre_is_struct_fc{field_class}
4150@pre
4151 \bt_p{field_class} has no member with the name \bt_p{name}.
4152@bt_pre_not_null{name}
4153@bt_pre_not_null{member_field_class}
4154@bt_pre_fc_not_in_tc{member_field_class}
4155
4156@bt_post_success_frozen{member_field_class}
4157*/
4158extern bt_field_class_structure_append_member_status
4159bt_field_class_structure_append_member(
4160 bt_field_class *field_class,
4161 const char *name, bt_field_class *member_field_class)
4162 __BT_NOEXCEPT;
4163
4164/*!
4165@brief
4166 Returns the number of members contained in the \bt_struct_fc
4167 \bt_p{field_class}.
4168
4169See the \ref api-tir-fc-struct-prop-members "members" property.
4170
4171@param[in] field_class
4172 Structure field class of which to get the number of contained
4173 members.
4174
4175@returns
4176 Number of contained members in \bt_p{field_class}.
4177
4178@bt_pre_not_null{field_class}
4179@bt_pre_is_struct_fc{field_class}
4180*/
4181extern uint64_t bt_field_class_structure_get_member_count(
4182 const bt_field_class *field_class) __BT_NOEXCEPT;
4183
4184/*!
4185@brief
4186 Borrows the member at index \bt_p{index} from the
4187 \bt_struct_fc \bt_p{field_class}.
4188
4189See the \ref api-tir-fc-struct-prop-members "members" property.
4190
4191@param[in] field_class
4192 Structure field class from which to borrow the member at
4193 index \bt_p{index}.
4194@param[in] index
4195 Index of the member to borrow from \bt_p{field_class}.
4196
4197@returns
4198 @parblock
4199 \em Borrowed reference of the member of
4200 \bt_p{field_class} at index \bt_p{index}.
4201
4202 The returned pointer remains valid as long as \bt_p{field_class}
4203 is not modified.
4204 @endparblock
4205
4206@bt_pre_not_null{field_class}
4207@bt_pre_is_struct_fc{field_class}
4208@pre
4209 \bt_p{index} is less than the number of members in
4210 \bt_p{field_class} (as returned by
4211 bt_field_class_structure_get_member_count()).
4212
4213@sa bt_field_class_structure_get_member_count() &mdash;
4214 Returns the number of members contained in a structure field class.
4215@sa bt_field_class_structure_borrow_member_by_index_const() &mdash;
4216 \c const version of this function.
4217*/
4218extern bt_field_class_structure_member *
4219bt_field_class_structure_borrow_member_by_index(
4220 bt_field_class *field_class, uint64_t index) __BT_NOEXCEPT;
4221
4222/*!
4223@brief
4224 Borrows the member at index \bt_p{index} from the
4225 \bt_struct_fc \bt_p{field_class} (\c const version).
4226
4227See bt_field_class_structure_borrow_member_by_index().
4228*/
4229extern const bt_field_class_structure_member *
4230bt_field_class_structure_borrow_member_by_index_const(
4231 const bt_field_class *field_class, uint64_t index)
4232 __BT_NOEXCEPT;
4233
4234/*!
4235@brief
4236 Borrows the member having the name \bt_p{name} from the
4237 \bt_struct_fc \bt_p{field_class}.
4238
4239See the \ref api-tir-fc-struct-prop-members "members" property.
4240
4241If there's no member having the name \bt_p{name} in
4242\bt_p{field_class}, this function returns \c NULL.
4243
4244@param[in] field_class
4245 Structure field class from which to borrow the member having the
4246 name \bt_p{name}.
4247@param[in] name
4248 Name of the member to borrow from \bt_p{field_class}.
4249
4250@returns
4251 @parblock
4252 \em Borrowed reference of the member of
4253 \bt_p{field_class} having the name \bt_p{name}, or \c NULL
4254 if none.
4255
4256 The returned pointer remains valid as long as \bt_p{field_class}
4257 is not modified.
4258 @endparblock
4259
4260@bt_pre_not_null{field_class}
4261@bt_pre_is_struct_fc{field_class}
4262@bt_pre_not_null{name}
4263
4264@sa bt_field_class_structure_borrow_member_by_name_const() &mdash;
4265 \c const version of this function.
4266*/
4267extern bt_field_class_structure_member *
4268bt_field_class_structure_borrow_member_by_name(
4269 bt_field_class *field_class, const char *name) __BT_NOEXCEPT;
4270
4271/*!
4272@brief
4273 Borrows the member having the name \bt_p{name} from the
4274 \bt_struct_fc \bt_p{field_class} (\c const version).
4275
4276See bt_field_class_structure_borrow_member_by_name().
4277*/
4278extern const bt_field_class_structure_member *
4279bt_field_class_structure_borrow_member_by_name_const(
4280 const bt_field_class *field_class, const char *name)
4281 __BT_NOEXCEPT;
4282
4283/*! @} */
4284
4285/*!
4286@name Structure field class member
4287@{
4288*/
4289
4290/*!
4291@typedef struct bt_field_class_structure_member bt_field_class_structure_member;
4292
4293@brief
4294 Structure field class member.
4295*/
4296
4297/*!
4298@brief
4299 Returns the name of the \bt_struct_fc member \bt_p{member}.
4300
4301See the \ref api-tir-fc-struct-prop-members "members" property.
4302
4303@param[in] member
4304 Structure field class member of which to get the name.
4305
4306@returns
4307 @parblock
4308 Name of \bt_p{member}.
4309
4310 The returned pointer remains valid as long as \bt_p{member} exists.
4311 @endparblock
4312
4313@bt_pre_not_null{member}
4314*/
4315extern const char *bt_field_class_structure_member_get_name(
4316 const bt_field_class_structure_member *member) __BT_NOEXCEPT;
4317
4318/*!
4319@brief
4320 Borrows the field class from the \bt_struct_fc member
4321 \bt_p{member}.
4322
4323See the \ref api-tir-fc-struct-prop-members "members" property.
4324
4325@param[in] member
4326 Structure field class member from which to borrow the field class.
4327
4328@returns
4329 Field class of \bt_p{member}.
4330
4331@bt_pre_not_null{member}
4332
4333@sa bt_field_class_structure_member_borrow_field_class_const() &mdash;
4334 \c const version of this function.
4335*/
4336extern bt_field_class *
4337bt_field_class_structure_member_borrow_field_class(
4338 bt_field_class_structure_member *member) __BT_NOEXCEPT;
4339
4340/*!
4341@brief
4342 Borrows the field class from the \bt_struct_fc member
4343 \bt_p{member} (\c const version).
4344
4345See bt_field_class_structure_member_borrow_field_class().
4346*/
4347extern const bt_field_class *
4348bt_field_class_structure_member_borrow_field_class_const(
4349 const bt_field_class_structure_member *member) __BT_NOEXCEPT;
4350
4351/*!
4352@brief
4353 Sets the user attributes of the \bt_struct_fc member \bt_p{member}
4354 to \bt_p{user_attributes}.
4355
4356See the \ref api-tir-fc-struct-prop-members "members" property.
4357
4358@note
4359 When you append a member to a structure field class with
4360 bt_field_class_structure_append_member(), the member's
4361 initial user attributes is an empty \bt_map_val. Therefore you can
4362 borrow it with
4363 bt_field_class_structure_member_borrow_user_attributes() and fill it
4364 directly instead of setting a new one with this function.
4365
4366@param[in] member
4367 Structure field class member of which to set the user attributes to
4368 \bt_p{user_attributes}.
4369@param[in] user_attributes
4370 New user attributes of \bt_p{member}.
4371
4372@bt_pre_not_null{member}
4373@bt_pre_hot{member}
4374@bt_pre_not_null{user_attributes}
4375@bt_pre_is_map_val{user_attributes}
4376
4377@sa bt_field_class_structure_member_borrow_user_attributes() &mdash;
4378 Borrows the user attributes of a structure field class member.
4379*/
4380extern void bt_field_class_structure_member_set_user_attributes(
4381 bt_field_class_structure_member *member,
4382 const bt_value *user_attributes) __BT_NOEXCEPT;
4383
4384/*!
4385@brief
4386 Borrows the user attributes of the \bt_struct_fc member
4387 \bt_p{member}.
4388
4389See the \ref api-tir-fc-struct-prop-members "members" property.
4390
4391@note
4392 When you append a member to a structure field class with
4393 bt_field_class_structure_append_member(), the member's
4394 initial user attributes is an empty \bt_map_val.
4395
4396@param[in] member
4397 Structure field class member from which to borrow the user
4398 attributes.
4399
4400@returns
4401 User attributes of \bt_p{member} (a \bt_map_val).
4402
4403@bt_pre_not_null{member}
4404
4405@sa bt_field_class_structure_member_set_user_attributes() &mdash;
4406 Sets the user attributes of a structure field class member.
4407@sa bt_field_class_structure_member_borrow_user_attributes_const() &mdash;
4408 \c const version of this function.
4409*/
4410extern bt_value *
4411bt_field_class_structure_member_borrow_user_attributes(
4412 bt_field_class_structure_member *member) __BT_NOEXCEPT;
4413
4414/*!
4415@brief
4416 Borrows the user attributes of the \bt_struct_fc member
4417 \bt_p{member} (\c const version).
4418
4419See bt_field_class_structure_member_borrow_user_attributes().
4420*/
4421extern const bt_value *
4422bt_field_class_structure_member_borrow_user_attributes_const(
4423 const bt_field_class_structure_member *member) __BT_NOEXCEPT;
4424
4425/*! @} */
4426
4427/*!
4428@name Option field class
4429@{
4430*/
4431
4432/*!
4433@brief
4434 Borrows the optional field class from the \bt_opt_fc
4435 \bt_p{field_class}.
4436
4437See the \ref api-tir-fc-opt-prop-fc "optional field class" property.
4438
4439@param[in] field_class
4440 Option field class from which to borrow the optional field class.
4441
4442@returns
4443 Optional field class of \bt_p{field_class}.
4444
4445@bt_pre_not_null{field_class}
4446@bt_pre_is_opt_fc{field_class}
4447
4448@sa bt_field_class_option_borrow_field_class_const() &mdash;
4449 \c const version of this function.
4450*/
4451extern bt_field_class *bt_field_class_option_borrow_field_class(
4452 bt_field_class *field_class) __BT_NOEXCEPT;
4453
4454/*!
4455@brief
4456 Borrows the optional field class from the \bt_opt_fc
4457 \bt_p{field_class} (\c const version).
4458
4459See bt_field_class_option_borrow_field_class().
4460*/
4461extern const bt_field_class *
4462bt_field_class_option_borrow_field_class_const(
4463 const bt_field_class *field_class) __BT_NOEXCEPT;
4464
4465/*! @} */
4466
4467/*!
4468@name Option field class: instances without a linked selector field
4469@{
4470*/
4471
4472/*!
4473@brief
4474 Creates an \bt_opt_fc (instances without a linked selector field)
4475 having the optional field class \bt_p{optional_field_class} from the
4476 trace class \bt_p{trace_class}.
4477
4478@note
4479 @parblock
4480 This function is only available when \bt_p{trace_class} was created
4481 from a \bt_self_comp which belongs to a trace processing \bt_graph
4482 with the effective \bt_mip version&nbsp;0.
4483
4484 To create a similar option field class from a trace class which was
4485 created from a self component which belongs to a trace processing
4486 graph with the effective MIP version&nbsp;1, use
4487 bt_field_class_option_without_selector_field_location_create().
4488 @endparblock
4489
4490On success, the returned option field class has the following property
4491values:
4492
4493<table>
4494 <tr>
4495 <th>Property
4496 <th>Value
4497 <tr>
4498 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
4499 <td>\bt_p{optional_field_class}
4500 <tr>
4501 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
4502 <td>Empty \bt_map_val
4503</table>
4504
4505@param[in] trace_class
4506 Trace class from which to create an option field class.
4507@param[in] optional_field_class
4508 Class of the optional fields of the instances of the option field
4509 class to create.
4510
4511@returns
4512 New option field class reference, or \c NULL on memory error.
4513
4514@bt_pre_not_null{trace_class}
4515@bt_pre_tc_with_mip{trace_class, 0}
4516@bt_pre_not_null{optional_field_class}
4517@bt_pre_fc_not_in_tc{optional_field_class}
4518
4519@bt_post_success_frozen{optional_field_class}
4520
4521@sa bt_field_class_option_without_selector_field_location_create() &mdash;
4522 Creates a class of option field without a linked selector field
4523 (\bt_mip version&nbsp;1).
4524*/
4525extern bt_field_class *bt_field_class_option_without_selector_create(
4526 bt_trace_class *trace_class,
4527 bt_field_class *optional_field_class) __BT_NOEXCEPT;
4528
4529/*!
4530@brief
4531 Creates an \bt_opt_fc (instances without a linked selector
4532 field) having the optional field class \bt_p{optional_field_class}
4533 from the trace class \bt_p{trace_class}.
4534
4535On success, the returned option field class has the following property
4536values:
4537
4538<table>
4539 <tr>
4540 <th>Property
4541 <th>Value
4542 <tr>
4543 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
4544 <td>\bt_p{optional_field_class}
4545 <tr>
4546 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
4547 <td>Empty \bt_map_val
4548</table>
4549
4550@param[in] trace_class
4551 Trace class from which to create an option field class.
4552@param[in] optional_field_class
4553 Class of the optional fields of the instances of the option field
4554 class to create.
4555
4556@returns
4557 New option field class reference, or \c NULL on memory error.
4558
4559@bt_pre_not_null{trace_class}
4560@bt_pre_tc_with_mip{trace_class, 1}
4561@bt_pre_not_null{optional_field_class}
4562@bt_pre_fc_not_in_tc{optional_field_class}
4563
4564@bt_post_success_frozen{optional_field_class}
4565
4566@sa bt_field_class_option_with_selector_field_location_bool_create() &mdash;
4567 Creates a class of option field with a linked boolean selector field.
4568@sa bt_field_class_option_with_selector_field_location_integer_unsigned_create() &mdash;
4569 Creates a class of option field with a linked unsigned integer
4570 selector field.
4571@sa bt_field_class_option_with_selector_field_location_integer_signed_create() &mdash;
4572 Creates a class of option field with a linked signed integer
4573 selector field.
4574*/
4575extern bt_field_class *bt_field_class_option_without_selector_field_location_create(
4576 bt_trace_class *trace_class,
4577 bt_field_class *optional_field_class) __BT_NOEXCEPT;
4578
4579/*! @} */
4580
4581/*!
4582@name Option field class: instances with a linked selector field
4583@{
4584*/
4585
4586/*!
4587@brief
4588 Borrows the selector field path from the \bt_opt_fc (instances
4589 with a linked selector field) \bt_p{field_class}.
4590
4591See the \ref api-tir-fc-opt-prop-sel-fp "selector field path" property.
4592
4593This property is only available when all the following are true:
4594
4595- \bt_p{field_class} was created with
4596 bt_field_class_option_with_selector_field_bool_create(),
4597 bt_field_class_option_with_selector_field_integer_unsigned_create(),
4598 or bt_field_class_option_with_selector_field_integer_signed_create().
4599
4600- A \bt_struct_fc containing (recursively) \bt_p{field_class} is passed
4601 to one of:
4602
4603 - bt_stream_class_set_packet_context_field_class()
4604 - bt_stream_class_set_event_common_context_field_class()
4605 - bt_event_class_set_specific_context_field_class()
4606 - bt_event_class_set_payload_field_class()
4607
4608 In the meantime, this function returns \c NULL.
4609
4610@param[in] field_class
4611 Option field class from which to borrow the selector field path.
4612
4613@returns
4614 Selector field path of \bt_p{field_class}.
4615
4616@bt_pre_not_null{field_class}
4617@bt_pre_is_opt_ws_fc{field_class}
4618@bt_pre_fc_with_mip{field_class, 0}
4619*/
4620extern const bt_field_path *
4621bt_field_class_option_with_selector_field_borrow_selector_field_path_const(
4622 const bt_field_class *field_class) __BT_NOEXCEPT;
4623
4624/*!
4625@brief
4626 Borrows the selector field location from the \bt_opt_fc (instances
4627 with a linked selector field) \bt_p{field_class}.
4628
4629See the \ref api-tir-fc-opt-prop-sel-fl "selector field location"
4630property.
4631
4632This property is only available when \bt_p{field_class} was created
4633with bt_field_class_option_with_selector_field_location_bool_create(),
4634
4635
4636@param[in] field_class
4637 Option field class from which to borrow the selector field location.
4638
4639@returns
4640 Selector field location of \bt_p{field_class}.
4641
4642@bt_pre_not_null{field_class}
4643@bt_pre_is_opt_ws_fc{field_class}
4644@bt_pre_fc_with_mip{field_class, 1}
4645*/
4646extern const bt_field_location *
4647bt_field_class_option_with_selector_field_borrow_selector_field_location_const(
4648 const bt_field_class *field_class) __BT_NOEXCEPT;
4649
4650/*! @} */
4651
4652/*!
4653@name Option field class: instances with a linked boolean selector field
4654@{
4655*/
4656
4657/*!
4658@brief
4659 Creates an \bt_opt_fc (instances with a linked boolean selector
4660 field) having the optional field class \bt_p{optional_field_class}
4661 from the trace class \bt_p{trace_class}.
4662
4663@note
4664 @parblock
4665 This function is only available when \bt_p{trace_class} was created
4666 from a \bt_self_comp which belongs to a trace processing \bt_graph
4667 with the effective \bt_mip version&nbsp;0.
4668
4669 To create a similar option field class from a trace class which was
4670 created from a self component which belongs to a trace processing
4671 graph with the effective MIP version&nbsp;1, use
4672 bt_field_class_option_with_selector_field_location_bool_create().
4673 @endparblock
4674
4675On success, the returned option field class has the following property
4676values:
4677
4678<table>
4679 <tr>
4680 <th>Property
4681 <th>Value
4682 <tr>
4683 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
4684 <td>\bt_p{optional_field_class}
4685 <tr>
4686 <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path"
4687 <td>
4688 \em None (this property becomes available when the returned field
4689 class becomes part of an \bt_ev_cls or of a \bt_stream_cls)
4690 <tr>
4691 <td>\ref api-tir-fc-opt-prop-sel-rev "Selector is reversed?"
4692 <td>#BT_FALSE
4693 <tr>
4694 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
4695 <td>Empty \bt_map_val
4696</table>
4697
4698@param[in] trace_class
4699 Trace class from which to create an option field class.
4700@param[in] optional_field_class
4701 Class of the optional fields of the instances of the option field
4702 class to create.
4703@param[in] selector_field_class
4704 Class of a linked boolean selector field of an instance of the
4705 option field class to create.
4706
4707@returns
4708 New option field class reference, or \c NULL on memory error.
4709
4710@bt_pre_not_null{trace_class}
4711@bt_pre_tc_with_mip{trace_class, 0}
4712@bt_pre_not_null{optional_field_class}
4713@bt_pre_fc_not_in_tc{optional_field_class}
4714@bt_pre_not_null{selector_field_class}
4715@pre
4716 \bt_p{selector_field_class} is a \bt_bool_fc.
4717
4718@bt_post_success_frozen{optional_field_class}
4719@bt_post_success_frozen{selector_field_class}
4720
4721@sa bt_field_class_option_with_selector_field_location_bool_create() &mdash;
4722 Creates a class of option field with a linked boolean selector field
4723 (\bt_mip version&nbsp;1).
4724*/
4725extern bt_field_class *bt_field_class_option_with_selector_field_bool_create(
4726 bt_trace_class *trace_class,
4727 bt_field_class *optional_field_class,
4728 bt_field_class *selector_field_class) __BT_NOEXCEPT;
4729
4730/*!
4731@brief
4732 Creates an \bt_opt_fc (instances with a linked boolean selector
4733 field) having the optional field class \bt_p{optional_field_class}
4734 and the selector \bt_field_loc \bt_p{selector_field_location} from
4735 the trace class \bt_p{trace_class}.
4736
4737On success, the returned option field class has the following property
4738values:
4739
4740<table>
4741 <tr>
4742 <th>Property
4743 <th>Value
4744 <tr>
4745 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
4746 <td>\bt_p{optional_field_class}
4747 <tr>
4748 <td>\ref api-tir-fc-opt-prop-sel-fl "Selector field location"
4749 <td>
4750 \bt_p{selector_field_location}.
4751
4752 See \ref api-tir-fc-link "Fields with links to other fields"
4753 to learn more.
4754 <tr>
4755 <td>\ref api-tir-fc-opt-prop-sel-rev "Selector is reversed?"
4756 <td>#BT_FALSE
4757 <tr>
4758 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
4759 <td>Empty \bt_map_val
4760</table>
4761
4762@param[in] trace_class
4763 Trace class from which to create an option field class.
4764@param[in] optional_field_class
4765 Class of the optional fields of the instances of the option field
4766 class to create.
4767@param[in] selector_field_location
4768 Selector field location of the option field class to create.
4769
4770@returns
4771 New option field class reference, or \c NULL on memory error.
4772
4773@bt_pre_not_null{trace_class}
4774@bt_pre_tc_with_mip{trace_class, 1}
4775@bt_pre_not_null{optional_field_class}
4776@bt_pre_fc_not_in_tc{optional_field_class}
4777@bt_pre_not_null{selector_field_location}
4778
4779@bt_post_success_frozen{optional_field_class}
4780@bt_post_success_frozen{selector_field_class}
4781
4782@sa bt_field_class_option_without_selector_field_location_create() &mdash;
4783 Creates a class of option field without a linked selector field.
4784@sa bt_field_class_option_with_selector_field_location_integer_unsigned_create() &mdash;
4785 Creates a class of option field with a linked unsigned integer
4786 selector field.
4787@sa bt_field_class_option_with_selector_field_location_integer_signed_create() &mdash;
4788 Creates a class of option field with a linked signed integer
4789 selector field.
4790*/
4791extern bt_field_class *bt_field_class_option_with_selector_field_location_bool_create(
4792 bt_trace_class *trace_class,
4793 bt_field_class *optional_field_class,
4794 const bt_field_location *selector_field_location) __BT_NOEXCEPT;
4795
4796/*!
4797@brief
4798 Sets whether or not the selector of the \bt_opt_fc (with a boolean
4799 selector field) \bt_p{field_class} is reversed.
4800
4801See the \ref api-tir-fc-opt-prop-sel-rev "selector is reversed?"
4802property.
4803
4804@param[in] field_class
4805 Option field class of which to set whether or not its selector
4806 is reversed.
4807@param[in] selector_is_reversed
4808 #BT_TRUE to make \bt_p{field_class} have a reversed selector.
4809
4810@bt_pre_not_null{field_class}
4811@bt_pre_hot{field_class}
4812@bt_pre_is_opt_wbs_fc{field_class}
4813
4814@sa bt_field_class_option_with_selector_field_bool_selector_is_reversed() &mdash;
4815 Returns whether or not the selector of an option field class (with
4816 a boolean selector field) is reversed.
4817*/
4818extern void
4819bt_field_class_option_with_selector_field_bool_set_selector_is_reversed(
4820 bt_field_class *field_class, bt_bool selector_is_reversed)
4821 __BT_NOEXCEPT;
4822
4823/*!
4824@brief
4825 Returns whether or not the selector of the
4826 \bt_opt_fc (with a boolean selector field) is reversed.
4827
4828See the \ref api-tir-fc-opt-prop-sel-rev "selector is reversed?"
4829property.
4830
4831@param[in] field_class
4832 Option field class of which to get whether or not its selector is
4833 reversed.
4834
4835@returns
4836 #BT_TRUE if the selector of \bt_p{field_class} is reversed.
4837
4838@bt_pre_not_null{field_class}
4839@bt_pre_is_opt_wbs_fc{field_class}
4840
4841@sa bt_field_class_option_with_selector_field_bool_set_selector_is_reversed() &mdash;
4842 Sets whether or not the selector of an option field class (with
4843 a boolean selector field) is reversed.
4844*/
4845extern bt_bool
4846bt_field_class_option_with_selector_field_bool_selector_is_reversed(
4847 const bt_field_class *field_class) __BT_NOEXCEPT;
4848
4849/*! @} */
4850
4851/*!
4852@name Option field class: instances with a linked unsigned integer selector field
4853@{
4854*/
4855
4856/*!
4857@brief
4858 Creates an \bt_opt_fc (instances with a linked unsigned integer
4859 selector field) having the optional field class
4860 \bt_p{optional_field_class} from the trace class \bt_p{trace_class}.
4861
4862@note
4863 @parblock
4864 This function is only available when \bt_p{trace_class} was created
4865 from a \bt_self_comp which belongs to a trace processing \bt_graph
4866 with the effective \bt_mip version&nbsp;0.
4867
4868 To create a similar option field class from a trace class which was
4869 created from a self component which belongs to a trace processing
4870 graph with the effective MIP version&nbsp;1, use
4871 bt_field_class_option_with_selector_field_location_integer_unsigned_create().
4872 @endparblock
4873
4874On success, the returned option field class has the following property
4875values:
4876
4877<table>
4878 <tr>
4879 <th>Property
4880 <th>Value
4881 <tr>
4882 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
4883 <td>\bt_p{optional_field_class}
4884 <tr>
4885 <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path"
4886 <td>
4887 \em None (this property becomes available when the returned field
4888 class becomes part of an \bt_ev_cls or of a \bt_stream_cls)
4889 <tr>
4890 <td>\ref api-tir-fc-opt-prop-uint-rs "Selector's unsigned integer ranges"
4891 <td>\bt_p{ranges}
4892 <tr>
4893 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
4894 <td>Empty \bt_map_val
4895</table>
4896
4897@param[in] trace_class
4898 Trace class from which to create an option field class.
4899@param[in] optional_field_class
4900 Class of the optional fields of the instances of the option field
4901 class to create.
4902@param[in] selector_field_class
4903 Linked selector field class of the option field class to create.
4904@param[in] ranges
4905 Selector's unsigned integer ranges of the option field class to
4906 create.
4907
4908@returns
4909 New option field class reference, or \c NULL on memory error.
4910
4911@bt_pre_not_null{trace_class}
4912@bt_pre_tc_with_mip{trace_class, 0}
4913@bt_pre_not_null{optional_field_class}
4914@bt_pre_fc_not_in_tc{optional_field_class}
4915@bt_pre_not_null{selector_field_class}
4916@pre
4917 \bt_p{selector_field_class} is an \bt_uint_fc.
4918@bt_pre_not_null{ranges}
4919@pre
4920 \bt_p{ranges} contains one or more \bt_p_uint_rg.
4921
4922@bt_post_success_frozen{optional_field_class}
4923@bt_post_success_frozen{selector_field_class}
4924@bt_post_success_frozen{ranges}
4925
4926@sa bt_field_class_option_with_selector_field_location_integer_unsigned_create() &mdash;
4927 Creates a class of option field with a linked unsigned integer
4928 selector field (\bt_mip version&nbsp;1).
4929*/
4930extern bt_field_class *
4931bt_field_class_option_with_selector_field_integer_unsigned_create(
4932 bt_trace_class *trace_class,
4933 bt_field_class *optional_field_class,
4934 bt_field_class *selector_field_class,
4935 const bt_integer_range_set_unsigned *ranges)
4936 __BT_NOEXCEPT;
4937
4938/*!
4939@brief
4940 Creates an \bt_opt_fc (instances with a linked unsigned integer
4941 selector field) having the optional field class
4942 \bt_p{optional_field_class} and the selector \bt_field_loc
4943 \bt_p{selector_field_location} from the trace class
4944 \bt_p{trace_class}.
4945
4946On success, the returned option field class has the following property
4947values:
4948
4949<table>
4950 <tr>
4951 <th>Property
4952 <th>Value
4953 <tr>
4954 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
4955 <td>\bt_p{optional_field_class}
4956 <tr>
4957 <td>\ref api-tir-fc-opt-prop-sel-fl "Selector field location"
4958 <td>
4959 \bt_p{selector_field_location}.
4960
4961 See \ref api-tir-fc-link "Fields with links to other fields"
4962 to learn more.
4963 <tr>
4964 <td>\ref api-tir-fc-opt-prop-uint-rs "Selector's unsigned integer ranges"
4965 <td>\bt_p{ranges}
4966 <tr>
4967 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
4968 <td>Empty \bt_map_val
4969</table>
4970
4971@param[in] trace_class
4972 Trace class from which to create an option field class.
4973@param[in] optional_field_class
4974 Class of the optional fields of the instances of the option field
4975 class to create.
4976@param[in] selector_field_location
4977 Selector field location of the option field class to create.
4978@param[in] ranges
4979 Selector's unsigned integer ranges of the option field class to
4980 create.
4981
4982@returns
4983 New option field class reference, or \c NULL on memory error.
4984
4985@bt_pre_not_null{trace_class}
4986@bt_pre_tc_with_mip{trace_class, 1}
4987@bt_pre_not_null{optional_field_class}
4988@bt_pre_fc_not_in_tc{optional_field_class}
4989@bt_pre_not_null{selector_field_location}
4990@bt_pre_not_null{ranges}
4991@pre
4992 \bt_p{ranges} contains one or more \bt_p_uint_rg.
4993
4994@bt_post_success_frozen{optional_field_class}
4995@bt_post_success_frozen{ranges}
4996
4997@sa bt_field_class_option_without_selector_field_location_create() &mdash;
4998 Creates a class of option field without a linked selector field.
4999@sa bt_field_class_option_with_selector_field_location_bool_create() &mdash;
5000 Creates a class of option field with a linked boolean selector field.
5001@sa bt_field_class_option_with_selector_field_location_integer_signed_create() &mdash;
5002 Creates a class of option field with a linked signed integer
5003 selector field.
5004*/
5005extern bt_field_class *
5006bt_field_class_option_with_selector_field_location_integer_unsigned_create(
5007 bt_trace_class *trace_class,
5008 bt_field_class *optional_field_class,
5009 const bt_field_location *selector_field_location,
5010 const bt_integer_range_set_unsigned *ranges) __BT_NOEXCEPT;
5011
5012/*!
5013@brief
5014 Borrows the \bt_p_uint_rg from the \bt_opt_fc (with an unsigned
5015 integer selector field) \bt_p{field_class}.
5016
5017See the
5018\ref api-tir-fc-opt-prop-uint-rs "selector's unsigned integer ranges"
5019property.
5020
5021@param[in] field_class
5022 Option field class from which to borrow the unsigned integer ranges.
5023
5024@returns
5025 Unsigned integer ranges of \bt_p{field_class}.
5026
5027@bt_pre_not_null{field_class}
5028@bt_pre_is_opt_wuis_fc{field_class}
5029*/
5030extern const bt_integer_range_set_unsigned *
5031bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const(
5032 const bt_field_class *field_class) __BT_NOEXCEPT;
5033
5034/*! @} */
5035
5036/*!
5037@name Option field class: instances with a linked signed integer selector field
5038@{
5039*/
5040
5041/*!
5042@brief
5043 Creates an \bt_opt_fc (instances with a linked signed integer
5044 selector field) having the optional field class
5045 \bt_p{optional_field_class} from the trace class \bt_p{trace_class}.
5046
5047@note
5048 @parblock
5049 This function is only available when \bt_p{trace_class} was created
5050 from a \bt_self_comp which belongs to a trace processing \bt_graph
5051 with the effective \bt_mip version&nbsp;0.
5052
5053 To create a similar option field class from a trace class which was
5054 created from a self component which belongs to a trace processing
5055 graph with the effective MIP version&nbsp;1, use
5056 bt_field_class_option_with_selector_field_location_integer_signed_create().
5057 @endparblock
5058
5059On success, the returned option field class has the following property
5060values:
5061
5062<table>
5063 <tr>
5064 <th>Property
5065 <th>Value
5066 <tr>
5067 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
5068 <td>\bt_p{optional_field_class}
5069 <tr>
5070 <td>\ref api-tir-fc-opt-prop-sel-fp "Selector field path"
5071 <td>
5072 \em None (this property becomes available when the returned field
5073 class becomes part of an \bt_ev_cls or of a \bt_stream_cls)
5074 <tr>
5075 <td>\ref api-tir-fc-opt-prop-sint-rs "Selector's signed integer ranges"
5076 <td>\bt_p{ranges}
5077 <tr>
5078 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
5079 <td>Empty \bt_map_val
5080</table>
5081
5082@param[in] trace_class
5083 Trace class from which to create an option field class.
5084@param[in] optional_field_class
5085 Class of the optional fields of the instances of the option field
5086 class to create.
5087@param[in] selector_field_class
5088 Linked selector field class of the option field class to create.
5089@param[in] ranges
5090 Selector's signed integer ranges of the option field class to
5091 create.
5092
5093@returns
5094 New option field class reference, or \c NULL on memory error.
5095
5096@bt_pre_not_null{trace_class}
5097@bt_pre_tc_with_mip{trace_class, 0}
5098@bt_pre_not_null{optional_field_class}
5099@bt_pre_fc_not_in_tc{optional_field_class}
5100@bt_pre_not_null{selector_field_class}
5101@pre
5102 \bt_p{selector_field_class} is an \bt_uint_fc.
5103@bt_pre_not_null{ranges}
5104@pre
5105 \bt_p{ranges} contains one or more \bt_p_uint_rg.
5106
5107@bt_post_success_frozen{optional_field_class}
5108@bt_post_success_frozen{selector_field_class}
5109@bt_post_success_frozen{ranges}
5110
5111@sa bt_field_class_option_with_selector_field_location_integer_signed_create() &mdash;
5112 Creates an option field class with a linked signed integer
5113 selector field (\bt_mip version&nbsp;1).
5114*/
5115extern bt_field_class *
5116bt_field_class_option_with_selector_field_integer_signed_create(
5117 bt_trace_class *trace_class,
5118 bt_field_class *optional_field_class,
5119 bt_field_class *selector_field_class,
5120 const bt_integer_range_set_signed *ranges) __BT_NOEXCEPT;
5121
5122/*!
5123@brief
5124 Creates an \bt_opt_fc (instances with a linked signed integer
5125 selector field) having the optional field class
5126 \bt_p{optional_field_class} and the selector \bt_field_loc
5127 \bt_p{selector_field_location} from the trace class
5128 \bt_p{trace_class}.
5129
5130On success, the returned option field class has the following property
5131values:
5132
5133<table>
5134 <tr>
5135 <th>Property
5136 <th>Value
5137 <tr>
5138 <td>\ref api-tir-fc-opt-prop-fc "Optional field class"
5139 <td>\bt_p{optional_field_class}
5140 <tr>
5141 <td>\ref api-tir-fc-opt-prop-sel-fl "Selector field location"
5142 <td>
5143 \bt_p{selector_field_location}.
5144
5145 See \ref api-tir-fc-link "Fields with links to other fields"
5146 to learn more.
5147 <tr>
5148 <td>\ref api-tir-fc-opt-prop-uint-rs "Selector's signed integer ranges"
5149 <td>\bt_p{ranges}
5150 <tr>
5151 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
5152 <td>Empty \bt_map_val
5153</table>
5154
5155@param[in] trace_class
5156 Trace class from which to create an option field class.
5157@param[in] optional_field_class
5158 Class of the optional fields of the instances of the option field
5159 class to create.
5160@param[in] selector_field_location
5161 Selector field location of the option field class to create.
5162@param[in] ranges
5163 Selector's signed integer ranges of the option field class to
5164 create.
5165
5166@returns
5167 New option field class reference, or \c NULL on memory error.
5168
5169@bt_pre_not_null{trace_class}
5170@bt_pre_tc_with_mip{trace_class, 1}
5171@bt_pre_not_null{optional_field_class}
5172@bt_pre_fc_not_in_tc{optional_field_class}
5173@bt_pre_not_null{selector_field_location}
5174@bt_pre_not_null{ranges}
5175@pre
5176 \bt_p{ranges} contains one or more \bt_p_uint_rg.
5177
5178@bt_post_success_frozen{optional_field_class}
5179@bt_post_success_frozen{ranges}
5180
5181@sa bt_field_class_variant_without_selector_field_location_create() &mdash;
5182 Creates a class of option field without a linked selector field.
5183@sa bt_field_class_option_with_selector_field_location_bool_create() &mdash;
5184 Creates a class of option field with a linked boolean selector field.
5185@sa bt_field_class_option_with_selector_field_location_integer_unsigned_create() &mdash;
5186 Creates a class of option field with a linked unsigned integer
5187 selector field.
5188*/
5189extern bt_field_class *
5190bt_field_class_option_with_selector_field_location_integer_signed_create(
5191 bt_trace_class *trace_class,
5192 bt_field_class *optional_field_class,
5193 const bt_field_location *selector_field_class,
5194 const bt_integer_range_set_signed *ranges) __BT_NOEXCEPT;
5195
5196/*!
5197@brief
5198 Borrows the \bt_p_sint_rg from the \bt_opt_fc (with a signed
5199 integer selector field) \bt_p{field_class}.
5200
5201See the
5202\ref api-tir-fc-opt-prop-sint-rs "selector's signed integer ranges"
5203property.
5204
5205@param[in] field_class
5206 Option field class from which to borrow the signed integer ranges.
5207
5208@returns
5209 Signed integer ranges of \bt_p{field_class}.
5210
5211@bt_pre_not_null{field_class}
5212@bt_pre_is_opt_wsis_fc{field_class}
5213*/
5214extern const bt_integer_range_set_signed *
5215bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const(
5216 const bt_field_class *field_class) __BT_NOEXCEPT;
5217
5218/*! @} */
5219
5220/*!
5221@name Variant field class
5222@{
5223*/
5224
5225/*!
5226@brief
5227 Creates an empty \bt_var_fc from the trace class \bt_p{trace_class}.
5228
5229@note
5230 @parblock
5231 This function is only available when \bt_p{trace_class} was created
5232 from a \bt_self_comp which belongs to a trace processing \bt_graph
5233 with the effective \bt_mip version&nbsp;0.
5234
5235 To create a variant field class from a trace class which was
5236 created from a self component which belongs to a trace processing
5237 graph with the effective MIP version&nbsp;1, use
5238 bt_field_class_variant_without_selector_field_location_create(),
5239 bt_field_class_variant_with_selector_field_location_integer_unsigned_create(),
5240 or bt_field_class_variant_with_selector_field_location_integer_signed_create().
5241 @endparblock
5242
5243If \bt_p{selector_field_class} is not \c NULL, then an instance of
5244the created variant field class has a linked selector field.
5245See \ref api-tir-fc-link "Fields with links to other fields"
5246to learn more.
5247
5248On success, the returned variant field class has the following
5249property values:
5250
5251<table>
5252 <tr>
5253 <th>Property
5254 <th>Value
5255 <tr>
5256 <td>\ref api-tir-fc-var-prop-sel-fp "Selector field path"
5257 <td>
5258 \em None (if \bt_p{selector_field_class} is not \c NULL, this
5259 property becomes available when the returned field class becomes
5260 part of an \bt_ev_cls or of a \bt_stream_cls)
5261 <tr>
5262 <td>\ref api-tir-fc-var-prop-opts "Options"
5263 <td>\em None
5264 <tr>
5265 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
5266 <td>Empty \bt_map_val
5267</table>
5268
5269@param[in] trace_class
5270 Trace class from which to create a variant field class.
5271@param[in] selector_field_class
5272 @parblock
5273 Class of a linked selector field of an instance of the variant field
5274 class to create.
5275
5276 Can be \c NULL.
5277 @endparblock
5278
5279@returns
5280 New variant field class reference, or \c NULL on memory error.
5281
5282@bt_pre_not_null{trace_class}
5283@bt_pre_tc_with_mip{trace_class, 0}
5284@pre
5285 <strong>If \bt_p{selector_field_class} is not \c NULL</strong>,
5286 \bt_p{selector_field_class} is an \bt_int_fc.
5287
5288@bt_post_success_frozen{element_field_class}
5289@bt_post_success_frozen{selector_field_class}
5290
5291@sa bt_field_class_variant_without_selector_field_location_create() &mdash;
5292 Creates a class of variant field without a linked selector field
5293 (\bt_mip version&nbsp;1).
5294@sa bt_field_class_variant_with_selector_field_location_integer_unsigned_create() &mdash;
5295 Creates a class of variant field with a linked unsigned integer
5296 selector field (\bt_mip version&nbsp;1).
5297@sa bt_field_class_variant_with_selector_field_location_integer_signed_create() &mdash;
5298 Creates a class of variant field with a linked signed integer
5299 selector field (\bt_mip version&nbsp;1).
5300*/
5301extern bt_field_class *bt_field_class_variant_create(
5302 bt_trace_class *trace_class,
5303 bt_field_class *selector_field_class) __BT_NOEXCEPT;
5304
5305/*!
5306@brief
5307 Returns the number of options contained in the \bt_var_fc
5308 \bt_p{field_class}.
5309
5310See the \ref api-tir-fc-var-prop-opts "options" property.
5311
5312@param[in] field_class
5313 Variant field class of which to get the number of contained
5314 options.
5315
5316@returns
5317 Number of contained options in \bt_p{field_class}.
5318
5319@bt_pre_not_null{field_class}
5320@bt_pre_is_var_fc{field_class}
5321*/
5322extern uint64_t bt_field_class_variant_get_option_count(
5323 const bt_field_class *field_class) __BT_NOEXCEPT;
5324
5325/*!
5326@brief
5327 Borrows the option at index \bt_p{index} from the
5328 \bt_var_fc \bt_p{field_class}.
5329
5330See the \ref api-tir-fc-var-prop-opts "options" property.
5331
5332@param[in] field_class
5333 Variant field class from which to borrow the option at
5334 index \bt_p{index}.
5335@param[in] index
5336 Index of the option to borrow from \bt_p{field_class}.
5337
5338@returns
5339 @parblock
5340 \em Borrowed reference of the option of
5341 \bt_p{field_class} at index \bt_p{index}.
5342
5343 The returned pointer remains valid as long as \bt_p{field_class}
5344 is not modified.
5345 @endparblock
5346
5347@bt_pre_not_null{field_class}
5348@bt_pre_is_var_fc{field_class}
5349@pre
5350 \bt_p{index} is less than the number of options in
5351 \bt_p{field_class} (as returned by
5352 bt_field_class_variant_get_option_count()).
5353
5354@sa bt_field_class_variant_get_option_count() &mdash;
5355 Returns the number of options contained in a variant field class.
5356@sa bt_field_class_variant_borrow_option_by_index_const() &mdash;
5357 \c const version of this function.
5358*/
5359extern bt_field_class_variant_option *
5360bt_field_class_variant_borrow_option_by_index(
5361 bt_field_class *field_class, uint64_t index) __BT_NOEXCEPT;
5362
5363/*!
5364@brief
5365 Borrows the option at index \bt_p{index} from the
5366 \bt_var_fc \bt_p{field_class} (\c const version).
5367
5368See bt_field_class_variant_borrow_option_by_index().
5369*/
5370extern const bt_field_class_variant_option *
5371bt_field_class_variant_borrow_option_by_index_const(
5372 const bt_field_class *field_class, uint64_t index)
5373 __BT_NOEXCEPT;
5374
5375/*!
5376@brief
5377 Borrows the option having the name \bt_p{name} from the
5378 \bt_var_fc \bt_p{field_class}.
5379
5380See the \ref api-tir-fc-var-prop-opts "options" property.
5381
5382If there's no option having the name \bt_p{name} in
5383\bt_p{field_class}, this function returns \c NULL.
5384
5385@param[in] field_class
5386 Variant field class from which to borrow the option having the
5387 name \bt_p{name}.
5388@param[in] name
5389 Name of the option to borrow from \bt_p{field_class}.
5390
5391@returns
5392 @parblock
5393 \em Borrowed reference of the option of
5394 \bt_p{field_class} having the name \bt_p{name}, or \c NULL
5395 if none.
5396
5397 The returned pointer remains valid as long as \bt_p{field_class}
5398 is not modified.
5399 @endparblock
5400
5401@bt_pre_not_null{field_class}
5402@bt_pre_is_var_fc{field_class}
5403@bt_pre_not_null{name}
5404
5405@sa bt_field_class_variant_borrow_option_by_name_const() &mdash;
5406 \c const version of this function.
5407*/
5408extern bt_field_class_variant_option *
5409bt_field_class_variant_borrow_option_by_name(
5410 bt_field_class *field_class, const char *name) __BT_NOEXCEPT;
5411
5412/*!
5413@brief
5414 Borrows the option having the name \bt_p{name} from the
5415 \bt_var_fc \bt_p{field_class} (\c const version).
5416
5417See bt_field_class_variant_borrow_option_by_name().
5418*/
5419extern const bt_field_class_variant_option *
5420bt_field_class_variant_borrow_option_by_name_const(
5421 const bt_field_class *field_class, const char *name)
5422 __BT_NOEXCEPT;
5423
5424/*! @} */
5425
5426/*!
5427@name Variant field class option
5428@{
5429*/
5430
5431/*!
5432@typedef struct bt_field_class_variant_option bt_field_class_variant_option;
5433
5434@brief
5435 Variant field class option.
5436*/
5437
5438/*!
5439@brief
5440 Returns the name of the \bt_var_fc option \bt_p{option}.
5441
5442See the \ref api-tir-fc-var-prop-opts "options" property.
5443
5444This function may return \c NULL when the following are true:
5445
5446- The variant field class containing \bt_p{option} was created from a
5447 \bt_trace_cls which was created from a \bt_comp which belongs
5448 to a trace processing \bt_graph with the effective
5449 \bt_mip version&nbsp;1.
5450
5451- \bt_p{option} has no name.
5452
5453@param[in] option
5454 Variant field class option of which to get the name.
5455
5456@returns
5457 @parblock
5458 Name of \bt_p{option}, or \c NULL if none
5459 (possible under MIP&nbsp;1).
5460
5461 The returned pointer remains valid as long as \bt_p{option} exists.
5462 @endparblock
5463
5464@bt_pre_not_null{option}
5465*/
5466extern const char *bt_field_class_variant_option_get_name(
5467 const bt_field_class_variant_option *option) __BT_NOEXCEPT;
5468
5469/*!
5470@brief
5471 Borrows the field class from the \bt_var_fc option
5472 \bt_p{option}.
5473
5474See the \ref api-tir-fc-var-prop-opts "options" property.
5475
5476@param[in] option
5477 Variant field class option from which to borrow the field class.
5478
5479@returns
5480 Field class of \bt_p{option}.
5481
5482@bt_pre_not_null{option}
5483
5484@sa bt_field_class_variant_option_borrow_field_class_const() &mdash;
5485 \c const version of this function.
5486*/
5487extern bt_field_class *bt_field_class_variant_option_borrow_field_class(
5488 bt_field_class_variant_option *option) __BT_NOEXCEPT;
5489
5490/*!
5491@brief
5492 Borrows the field class from the \bt_var_fc option
5493 \bt_p{option} (\c const version).
5494
5495See bt_field_class_variant_option_borrow_field_class().
5496*/
5497extern const bt_field_class *
5498bt_field_class_variant_option_borrow_field_class_const(
5499 const bt_field_class_variant_option *option) __BT_NOEXCEPT;
5500
5501/*!
5502@brief
5503 Sets the user attributes of the \bt_var_fc option \bt_p{option}
5504 to \bt_p{user_attributes}.
5505
5506See the \ref api-tir-fc-var-prop-opts "options" property.
5507
5508@note
5509 When you append an option to a variant field class with
5510 bt_field_class_variant_without_selector_append_option(),
5511 bt_field_class_variant_with_selector_field_integer_unsigned_append_option(),
5512 or
5513 bt_field_class_variant_with_selector_field_integer_signed_append_option(),
5514 the option's initial user attributes is an empty \bt_map_val.
5515 Therefore you can borrow it with
5516 bt_field_class_variant_option_borrow_user_attributes() and fill it
5517 directly instead of setting a new one with this function.
5518
5519@param[in] option
5520 Variant field class option of which to set the user attributes to
5521 \bt_p{user_attributes}.
5522@param[in] user_attributes
5523 New user attributes of \bt_p{option}.
5524
5525@bt_pre_not_null{option}
5526@bt_pre_hot{option}
5527@bt_pre_not_null{user_attributes}
5528@bt_pre_is_map_val{user_attributes}
5529
5530@sa bt_field_class_variant_option_borrow_user_attributes() &mdash;
5531 Borrows the user attributes of a variant field class option.
5532*/
5533extern void bt_field_class_variant_option_set_user_attributes(
5534 bt_field_class_variant_option *option,
5535 const bt_value *user_attributes) __BT_NOEXCEPT;
5536
5537/*!
5538@brief
5539 Borrows the user attributes of the \bt_var_fc option \bt_p{option}.
5540
5541See the \ref api-tir-fc-var-prop-opts "options" property.
5542
5543@note
5544 When you append an option to a variant field class with
5545 bt_field_class_variant_without_selector_append_option(),
5546 bt_field_class_variant_with_selector_field_integer_unsigned_append_option(),
5547 or
5548 bt_field_class_variant_with_selector_field_integer_signed_append_option(),
5549 the option's initial user attributes is an empty \bt_map_val.
5550
5551@param[in] option
5552 Variant field class option from which to borrow the user
5553 attributes.
5554
5555@returns
5556 User attributes of \bt_p{option} (a \bt_map_val).
5557
5558@bt_pre_not_null{option}
5559
5560@sa bt_field_class_variant_option_set_user_attributes() &mdash;
5561 Sets the user attributes of a variant field class option.
5562@sa bt_field_class_variant_option_borrow_user_attributes_const() &mdash;
5563 \c const version of this function.
5564*/
5565extern bt_value *bt_field_class_variant_option_borrow_user_attributes(
5566 bt_field_class_variant_option *option) __BT_NOEXCEPT;
5567
5568/*!
5569@brief
5570 Borrows the user attributes of the \bt_var_fc option \bt_p{option}
5571 (\c const version).
5572
5573See bt_field_class_variant_option_borrow_user_attributes().
5574*/
5575extern const bt_value *bt_field_class_variant_option_borrow_user_attributes_const(
5576 const bt_field_class_variant_option *option) __BT_NOEXCEPT;
5577
5578/*! @} */
5579
5580/*!
5581@name Variant field class: instances without a linked selector field
5582@{
5583*/
5584
5585/*!
5586@brief
5587 Creates an empty \bt_var_fc (instances without a linked
5588 selector field) from the trace class \bt_p{trace_class}.
5589
5590On success, the returned variant field class has the following
5591property values:
5592
5593<table>
5594 <tr>
5595 <th>Property
5596 <th>Value
5597 <tr>
5598 <td>\ref api-tir-fc-var-prop-sel-fp "Selector field location"
5599 <td>
5600 \em None
5601 <tr>
5602 <td>\ref api-tir-fc-var-prop-opts "Options"
5603 <td>\em None
5604 <tr>
5605 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
5606 <td>Empty \bt_map_val
5607</table>
5608
5609@param[in] trace_class
5610 Trace class from which to create a variant field class.
5611
5612@returns
5613 New option field class reference, or \c NULL on memory error.
5614
5615@bt_pre_not_null{trace_class}
5616@bt_pre_tc_with_mip{trace_class, 1}
5617
5618@sa bt_field_class_variant_with_selector_field_location_integer_unsigned_create() &mdash;
5619 Creates a class of variant field with a linked unsigned integer
5620 selector field.
5621@sa bt_field_class_variant_with_selector_field_location_integer_signed_create() &mdash;
5622 Creates a class of variant field with a linked signed integer
5623 selector field.
5624*/
5625extern bt_field_class *bt_field_class_variant_without_selector_field_location_create(
5626 bt_trace_class *trace_class) __BT_NOEXCEPT;
5627
5628/*!
5629@brief
5630 Status codes for
5631 bt_field_class_variant_without_selector_append_option().
5632*/
5633typedef enum bt_field_class_variant_without_selector_append_option_status {
5634 /*!
5635 @brief
5636 Success.
5637 */
5638 BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK,
5639
5640 /*!
5641 @brief
5642 Out of memory.
5643 */
5644 BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
5645} bt_field_class_variant_without_selector_append_option_status;
5646
5647/*!
5648@brief
5649 Appends an option to the \bt_var_fc (instances without a linked
5650 selector field) \bt_p{field_class} having the name \bt_p{name} and
5651 the field class \bt_p{option_field_class}.
5652
5653See the \ref api-tir-fc-var-prop-opts "options" property.
5654
5655@param[in] field_class
5656 Variant field class to which to append an option having
5657 the name \bt_p{name} and the field class \bt_p{option_field_class}.
5658@param[in] name
5659 @parblock
5660 Name of the option to append to \bt_p{field_class} (copied).
5661
5662 Can be \c NULL when the effective \bt_mip version of the trace
5663 processing \bt_graph is&nbsp;1.
5664 @endparblock
5665@param[in] option_field_class
5666 Field class of the option to append to \bt_p{field_class}.
5667
5668@retval #BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK
5669 Success.
5670@retval #BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR
5671 Out of memory.
5672
5673@bt_pre_not_null{field_class}
5674@bt_pre_hot{field_class}
5675@bt_pre_is_var_wos_fc{field_class}
5676@pre
5677 <strong>If \bt_p{name} is not \c NULL</strong>, then
5678 \bt_p{field_class} has no option with the name \bt_p{name}.
5679@pre
5680 <strong>If \bt_p{field_class} was created from a
5681 \bt_trace_cls which was created from a \bt_comp which belongs
5682 to a trace processing \bt_graph with the effective \bt_mip
5683 version&nbsp;0</strong>, then \bt_p{name} is \em not \c NULL.
5684@bt_pre_not_null{option_field_class}
5685@bt_pre_fc_not_in_tc{option_field_class}
5686
5687@bt_post_success_frozen{option_field_class}
5688*/
5689extern bt_field_class_variant_without_selector_append_option_status
5690bt_field_class_variant_without_selector_append_option(
5691 bt_field_class *field_class, const char *name,
5692 bt_field_class *option_field_class) __BT_NOEXCEPT;
5693
5694/*! @} */
5695
5696/*!
5697@name Variant field class: instances with a linked selector field
5698@{
5699*/
5700
5701/*!
5702@brief
5703 Status codes for
5704 bt_field_class_variant_with_selector_field_integer_unsigned_append_option()
5705 and
5706 bt_field_class_variant_with_selector_field_integer_signed_append_option().
5707*/
5708typedef enum bt_field_class_variant_with_selector_field_integer_append_option_status {
5709 /*!
5710 @brief
5711 Success.
5712 */
5713 BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK,
5714
5715 /*!
5716 @brief
5717 Out of memory.
5718 */
5719 BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
5720} bt_field_class_variant_with_selector_field_integer_append_option_status;
5721
5722/*!
5723@brief
5724 Borrows the selector field path from the \bt_var_fc (instances with
5725 a linked selector field) \bt_p{field_class}.
5726
5727See the \ref api-tir-fc-var-prop-sel-fp "selector field path" property.
5728
5729This property is only available when all the following are true:
5730
5731- \bt_p{field_class} was created with
5732 bt_field_class_variant_create() with \bt_p{selector_field_class}
5733 set to an \bt_int_fc (not \c NULL).
5734
5735- A \bt_struct_fc containing (recursively) \bt_p{field_class} is passed
5736 to one of:
5737
5738 - bt_stream_class_set_packet_context_field_class()
5739 - bt_stream_class_set_event_common_context_field_class()
5740 - bt_event_class_set_specific_context_field_class()
5741 - bt_event_class_set_payload_field_class()
5742
5743 In the meantime, this function returns \c NULL.
5744
5745@param[in] field_class
5746 Variant field class from which to borrow the selector field path.
5747
5748@returns
5749 Selector field path of \bt_p{field_class}.
5750
5751@bt_pre_not_null{field_class}
5752@bt_pre_is_var_ws_fc{field_class}
5753@bt_pre_fc_with_mip{field_class, 0}
5754*/
5755extern const bt_field_path *
5756bt_field_class_variant_with_selector_field_borrow_selector_field_path_const(
5757 const bt_field_class *field_class) __BT_NOEXCEPT;
5758
5759/*!
5760@brief
5761 Borrows the selector field location from the \bt_var_fc (instances
5762 with a linked selector field) \bt_p{field_class}.
5763
5764See the \ref api-tir-fc-var-prop-sel-fl "selector field location"
5765property.
5766
5767This property is only available when \bt_p{field_class} was created with
5768bt_field_class_variant_with_selector_field_location_integer_unsigned_create()
5769or
5770bt_field_class_variant_with_selector_field_location_integer_signed_create().
5771
5772@param[in] field_class
5773 Option field class from which to borrow the selector field location.
5774
5775@returns
5776 Selector field location of \bt_p{field_class}.
5777
5778@bt_pre_not_null{field_class}
5779@bt_pre_is_var_ws_fc{field_class}
5780@bt_pre_fc_with_mip{field_class, 1}
5781*/
5782extern const bt_field_location *
5783bt_field_class_variant_with_selector_field_borrow_selector_field_location_const(
5784 const bt_field_class *field_class);
5785
5786/*! @} */
5787
5788/*!
5789@name Variant field class: instances with a linked unsigned integer selector field
5790@{
5791*/
5792
5793/*!
5794@brief
5795 Creates an empty \bt_var_fc (instances with a linked
5796 unsigned integer selector field) having the
5797 selector \bt_field_loc \bt_p{selector_field_location}
5798 from the trace class \bt_p{trace_class}.
5799
5800On success, the returned variant field class has the following
5801property values:
5802
5803<table>
5804 <tr>
5805 <th>Property
5806 <th>Value
5807 <tr>
5808 <td>\ref api-tir-fc-var-prop-sel-fp "Selector field location"
5809 <td>
5810 \bt_p{selector_field_location}.
5811
5812 See \ref api-tir-fc-link "Fields with links to other fields"
5813 to learn more.
5814 <tr>
5815 <td>\ref api-tir-fc-var-prop-opts "Options"
5816 <td>\em None
5817 <tr>
5818 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
5819 <td>Empty \bt_map_val
5820</table>
5821
5822@param[in] trace_class
5823 Trace class from which to create a variant field class.
5824@param[in] selector_field_location
5825 Selector field location of the variant field class to create.
5826
5827@returns
5828 New variant field class reference, or \c NULL on memory error.
5829
5830@bt_pre_not_null{trace_class}
5831@bt_pre_tc_with_mip{trace_class, 1}
5832@bt_pre_not_null{selector_field_location}
5833
5834@sa bt_field_class_variant_without_selector_field_location_create() &mdash;
5835 Creates a class of variant field without a linked selector field.
5836@sa bt_field_class_option_with_selector_field_location_integer_signed_create() &mdash;
5837 Creates a class of variant field with a linked signed integer
5838 selector field.
5839*/
5840extern bt_field_class *bt_field_class_variant_with_selector_field_location_integer_unsigned_create(
5841 bt_trace_class *trace_class,
5842 const bt_field_location *selector_field_location) __BT_NOEXCEPT;
5843
5844/*!
5845@brief
5846 Appends an option to the \bt_var_fc (instances with a linked
5847 unsigned integer selector field) \bt_p{field_class} having the name
5848 \bt_p{name}, the field class \bt_p{option_field_class}, and the
5849 \bt_p_uint_rg \bt_p{ranges}.
5850
5851See the \ref api-tir-fc-var-prop-opts "options" property.
5852
5853@param[in] field_class
5854 Variant field class to which to append an option having
5855 the name \bt_p{name}, the field class \bt_p{option_field_class},
5856 and the unsigned integer ranges \bt_p{ranges}.
5857@param[in] name
5858 @parblock
5859 Name of the option to append to \bt_p{field_class} (copied).
5860
5861 Can be \c NULL when the effective \bt_mip version of the trace
5862 processing \bt_graph is&nbsp;1.
5863 @endparblock
5864@param[in] option_field_class
5865 Field class of the option to append to \bt_p{field_class}.
5866@param[in] ranges
5867 Unsigned integer ranges of the option to append to
5868 \bt_p{field_class}.
5869
5870@retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK
5871 Success.
5872@retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR
5873 Out of memory.
5874
5875@bt_pre_not_null{field_class}
5876@bt_pre_hot{field_class}
5877@bt_pre_is_var_wuis_fc{field_class}
5878@pre
5879 <strong>If \bt_p{name} is not \c NULL</strong>, then
5880 \bt_p{field_class} has no option with the name \bt_p{name}.
5881@pre
5882 <strong>If \bt_p{field_class} was created from a
5883 \bt_trace_cls which was created from a \bt_comp which belongs
5884 to a trace processing \bt_graph with the effective \bt_mip
5885 version&nbsp;0</strong>, then \bt_p{name} is \em not \c NULL.
5886@bt_pre_not_null{option_field_class}
5887@bt_pre_fc_not_in_tc{option_field_class}
5888@bt_pre_not_null{ŗanges}
5889@pre
5890 \bt_p{ranges} contains one or more unsigned integer ranges.
5891@pre
5892 The unsigned integer ranges in \bt_p{ranges} do not overlap
5893 any unsigned integer range of any existing option in
5894 \bt_p{field_class}.
5895
5896@bt_post_success_frozen{option_field_class}
5897*/
5898extern bt_field_class_variant_with_selector_field_integer_append_option_status
5899bt_field_class_variant_with_selector_field_integer_unsigned_append_option(
5900 bt_field_class *field_class, const char *name,
5901 bt_field_class *option_field_class,
5902 const bt_integer_range_set_unsigned *ranges) __BT_NOEXCEPT;
5903
5904/*!
5905@brief
5906 Borrows the option at index \bt_p{index} from the
5907 \bt_var_fc (instances with a linked unsigned integer selector field)
5908 \bt_p{field_class}.
5909
5910See the \ref api-tir-fc-var-prop-opts "options" property.
5911
5912@param[in] field_class
5913 Variant field class from which to borrow the option at
5914 index \bt_p{index}.
5915@param[in] index
5916 Index of the option to borrow from \bt_p{field_class}.
5917
5918@returns
5919 @parblock
5920 \em Borrowed reference of the option of
5921 \bt_p{field_class} at index \bt_p{index}.
5922
5923 The returned pointer remains valid as long as \bt_p{field_class}
5924 is not modified.
5925 @endparblock
5926
5927@bt_pre_not_null{field_class}
5928@bt_pre_is_var_wuis_fc{field_class}
5929@pre
5930 \bt_p{index} is less than the number of options in
5931 \bt_p{field_class} (as returned by
5932 bt_field_class_variant_get_option_count()).
5933
5934@sa bt_field_class_variant_get_option_count() &mdash;
5935 Returns the number of options contained in a variant field class.
5936*/
5937extern const bt_field_class_variant_with_selector_field_integer_unsigned_option *
5938bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const(
5939 const bt_field_class *field_class, uint64_t index)
5940 __BT_NOEXCEPT;
5941
5942/*!
5943@brief
5944 Borrows the option having the name \bt_p{name} from the
5945 \bt_var_fc (instances with a linked unsigned integer selector field)
5946 \bt_p{field_class}.
5947
5948See the \ref api-tir-fc-var-prop-opts "options" property.
5949
5950If there's no option having the name \bt_p{name} in
5951\bt_p{field_class}, this function returns \c NULL.
5952
5953@param[in] field_class
5954 Variant field class from which to borrow the option having the
5955 name \bt_p{name}.
5956@param[in] name
5957 Name of the option to borrow from \bt_p{field_class}.
5958
5959@returns
5960 @parblock
5961 \em Borrowed reference of the option of
5962 \bt_p{field_class} having the name \bt_p{name}, or \c NULL
5963 if none.
5964
5965 The returned pointer remains valid as long as \bt_p{field_class}
5966 is not modified.
5967 @endparblock
5968
5969@bt_pre_not_null{field_class}
5970@bt_pre_is_var_wuis_fc{field_class}
5971@bt_pre_not_null{name}
5972
5973@sa bt_field_class_variant_borrow_option_by_name_const() &mdash;
5974 Borrows an option by name from a variant field class.
5975*/
5976extern const bt_field_class_variant_with_selector_field_integer_unsigned_option *
5977bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const(
5978 const bt_field_class *field_class, const char *name)
5979 __BT_NOEXCEPT;
5980
5981/*! @} */
5982
5983/*!
5984@name Variant field class option: instances with a linked unsigned integer selector field
5985@{
5986*/
5987
5988/*!
5989@typedef struct bt_field_class_variant_with_selector_field_integer_unsigned_option bt_field_class_variant_with_selector_field_integer_unsigned_option;
5990
5991@brief
5992 Variant field class option (instances with a linked unsigned integer selector field).
5993*/
5994
5995/*!
5996@brief
5997 Borrows the \bt_p_uint_rg from the \bt_var_fc option
5998 (instances with a linked unsigned integer selector field)
5999 \bt_p{option}.
6000
6001See the \ref api-tir-fc-var-prop-opts "options" property.
6002
6003@param[in] option
6004 Variant field class option from which to borrow the
6005 unsigned integer ranges.
6006
6007@returns
6008 Unsigned integer ranges of \bt_p{option}.
6009
6010@bt_pre_not_null{option}
6011*/
6012extern const bt_integer_range_set_unsigned *
6013bt_field_class_variant_with_selector_field_integer_unsigned_option_borrow_ranges_const(
6014 const bt_field_class_variant_with_selector_field_integer_unsigned_option *option)
6015 __BT_NOEXCEPT;
6016
6017/*!
6018@brief
6019 \ref api-fund-c-typing "Upcasts" the \bt_var_fc option (instances
6020 with a linked unsigned integer selector field) \bt_p{option} to the
6021 common #bt_field_class_variant_option type.
6022
6023See the \ref api-tir-fc-var-prop-opts "options" property.
6024
6025@param[in] option
6026 @parblock
6027 Variant field class option to upcast.
6028
6029 Can be \c NULL.
6030 @endparblock
6031
6032@returns
6033 \bt_p{option} as a common variant field class option.
6034*/
6035static inline
6036const bt_field_class_variant_option *
6037bt_field_class_variant_with_selector_field_integer_unsigned_option_as_option_const(
6038 const bt_field_class_variant_with_selector_field_integer_unsigned_option *option)
6039 __BT_NOEXCEPT
6040{
6041 return __BT_UPCAST_CONST(bt_field_class_variant_option, option);
6042}
6043
6044/*! @} */
6045
6046/*!
6047@name Variant field class: instances with a linked signed integer selector field
6048@{
6049*/
6050
6051/*!
6052@brief
6053 Creates an empty \bt_var_fc (instances with a linked
6054 signed integer selector field) having the
6055 selector \bt_field_loc \bt_p{selector_field_location}
6056 from the trace class \bt_p{trace_class}.
6057
6058On success, the returned variant field class has the following
6059property values:
6060
6061<table>
6062 <tr>
6063 <th>Property
6064 <th>Value
6065 <tr>
6066 <td>\ref api-tir-fc-var-prop-sel-fp "Selector field location"
6067 <td>
6068 \bt_p{selector_field_location}.
6069
6070 See \ref api-tir-fc-link "Fields with links to other fields"
6071 to learn more.
6072 <tr>
6073 <td>\ref api-tir-fc-var-prop-opts "Options"
6074 <td>\em None
6075 <tr>
6076 <td>\ref api-tir-fc-prop-user-attrs "User attributes"
6077 <td>Empty \bt_map_val
6078</table>
6079
6080@param[in] trace_class
6081 Trace class from which to create a variant field class.
6082@param[in] selector_field_location
6083 Selector field location of the variant field class to create.
6084
6085@returns
6086 New variant field class reference, or \c NULL on memory error.
6087
6088@bt_pre_not_null{trace_class}
6089@bt_pre_tc_with_mip{trace_class, 1}
6090@bt_pre_not_null{selector_field_location}
6091
6092@sa bt_field_class_variant_without_selector_field_location_create() &mdash;
6093 Creates a class of variant field without a linked selector field.
6094@sa bt_field_class_option_with_selector_field_location_integer_unsigned_create() &mdash;
6095 Creates a class of variant field with a linked unsigned integer
6096 selector field.
6097*/
6098extern bt_field_class *bt_field_class_variant_with_selector_field_location_integer_signed_create(
6099 bt_trace_class *trace_class,
6100 const bt_field_location *selector_field_location) __BT_NOEXCEPT;
6101
6102/*!
6103@brief
6104 Appends an option to the \bt_var_fc (instances with a linked signed
6105 integer selector field) \bt_p{field_class} having the name
6106 \bt_p{name}, the field class \bt_p{option_field_class}, and the
6107 \bt_p_sint_rg \bt_p{ranges}.
6108
6109See the \ref api-tir-fc-var-prop-opts "options" property.
6110
6111@param[in] field_class
6112 Variant field class to which to append an option having
6113 the name \bt_p{name} and the field class \bt_p{option_field_class},
6114 and the signed integer ranges \bt_p{ranges}.
6115@param[in] name
6116 @parblock
6117 Name of the option to append to \bt_p{field_class} (copied).
6118
6119 Can be \c NULL when the effective \bt_mip version of the trace
6120 processing \bt_graph is&nbsp;1.
6121 @endparblock
6122@param[in] option_field_class
6123 Field class of the option to append to \bt_p{field_class}.
6124@param[in] ranges
6125 Signed integer ranges of the option to append to
6126 \bt_p{field_class}.
6127
6128@retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK
6129 Success.
6130@retval #BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR
6131 Out of memory.
6132
6133@bt_pre_not_null{field_class}
6134@bt_pre_hot{field_class}
6135@bt_pre_is_var_wsis_fc{field_class}
6136@pre
6137 <strong>If \bt_p{name} is not \c NULL</strong>, then
6138 \bt_p{field_class} has no option with the name \bt_p{name}.
6139@pre
6140 <strong>If \bt_p{field_class} was created from a
6141 \bt_trace_cls which was created from a \bt_comp which belongs
6142 to a trace processing \bt_graph with the effective \bt_mip
6143 version&nbsp;0</strong>, then \bt_p{name} is \em not \c NULL.
6144@bt_pre_not_null{option_field_class}
6145@bt_pre_fc_not_in_tc{option_field_class}
6146@bt_pre_not_null{ŗanges}
6147@pre
6148 \bt_p{ranges} contains one or more signed integer ranges.
6149@pre
6150 The signed integer ranges in \bt_p{ranges} do not overlap with
6151 any signed integer range of any existing option in
6152 \bt_p{field_class}.
6153
6154@bt_post_success_frozen{option_field_class}
6155*/
6156extern bt_field_class_variant_with_selector_field_integer_append_option_status
6157bt_field_class_variant_with_selector_field_integer_signed_append_option(
6158 bt_field_class *field_class, const char *name,
6159 bt_field_class *option_field_class,
6160 const bt_integer_range_set_signed *ranges)
6161 __BT_NOEXCEPT;
6162
6163/*!
6164@brief
6165 Borrows the option at index \bt_p{index} from the
6166 \bt_var_fc (instances with a linked signed integer selector field)
6167 \bt_p{field_class}.
6168
6169See the \ref api-tir-fc-var-prop-opts "options" property.
6170
6171@param[in] field_class
6172 Variant field class from which to borrow the option at
6173 index \bt_p{index}.
6174@param[in] index
6175 Index of the option to borrow from \bt_p{field_class}.
6176
6177@returns
6178 @parblock
6179 \em Borrowed reference of the option of
6180 \bt_p{field_class} at index \bt_p{index}.
6181
6182 The returned pointer remains valid as long as \bt_p{field_class}
6183 is not modified.
6184 @endparblock
6185
6186@bt_pre_not_null{field_class}
6187@bt_pre_is_var_wsis_fc{field_class}
6188@pre
6189 \bt_p{index} is less than the number of options in
6190 \bt_p{field_class} (as returned by
6191 bt_field_class_variant_get_option_count()).
6192
6193@sa bt_field_class_variant_get_option_count() &mdash;
6194 Returns the number of options contained in a variant field class.
6195*/
6196extern const bt_field_class_variant_with_selector_field_integer_signed_option *
6197bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const(
6198 const bt_field_class *field_class, uint64_t index)
6199 __BT_NOEXCEPT;
6200
6201/*!
6202@brief
6203 Borrows the option having the name \bt_p{name} from the
6204 \bt_var_fc (instances with a linked signed integer selector field)
6205 \bt_p{field_class}.
6206
6207See the \ref api-tir-fc-var-prop-opts "options" property.
6208
6209If there's no option having the name \bt_p{name} in
6210\bt_p{field_class}, this function returns \c NULL.
6211
6212@param[in] field_class
6213 Variant field class from which to borrow the option having the
6214 name \bt_p{name}.
6215@param[in] name
6216 Name of the option to borrow from \bt_p{field_class}.
6217
6218@returns
6219 @parblock
6220 \em Borrowed reference of the option of
6221 \bt_p{field_class} having the name \bt_p{name}, or \c NULL
6222 if none.
6223
6224 The returned pointer remains valid as long as \bt_p{field_class}
6225 is not modified.
6226 @endparblock
6227
6228@bt_pre_not_null{field_class}
6229@bt_pre_is_var_wsis_fc{field_class}
6230@bt_pre_not_null{name}
6231
6232@sa bt_field_class_variant_borrow_option_by_name_const() &mdash;
6233 Borrows an option by name from a variant field class.
6234*/
6235extern const bt_field_class_variant_with_selector_field_integer_signed_option *
6236bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const(
6237 const bt_field_class *field_class, const char *name)
6238 __BT_NOEXCEPT;
6239
6240/*! @} */
6241
6242/*!
6243@name Variant field class option: instances with a linked signed integer selector field
6244@{
6245*/
6246
6247/*!
6248@typedef struct bt_field_class_variant_with_selector_field_integer_signed_option bt_field_class_variant_with_selector_field_integer_signed_option;
6249
6250@brief
6251 Variant field class option (instances with a linked signed integer selector field).
6252*/
6253
6254/*!
6255@brief
6256 Borrows the \bt_p_sint_rg from the \bt_var_fc option
6257 (instances with a linked signed integer selector field)
6258 \bt_p{option}.
6259
6260See the \ref api-tir-fc-var-prop-opts "options" property.
6261
6262@param[in] option
6263 Variant field class option from which to borrow the
6264 signed integer ranges.
6265
6266@returns
6267 Signed integer ranges of \bt_p{option}.
6268
6269@bt_pre_not_null{option}
6270*/
6271extern const bt_integer_range_set_signed *
6272bt_field_class_variant_with_selector_field_integer_signed_option_borrow_ranges_const(
6273 const bt_field_class_variant_with_selector_field_integer_signed_option *option)
6274 __BT_NOEXCEPT;
6275
6276/*!
6277@brief
6278 \ref api-fund-c-typing "Upcasts" the \bt_var_fc option
6279 (instances with a linked signed integer selector field)
6280 \bt_p{option} to the common #bt_field_class_variant_option type.
6281
6282See the \ref api-tir-fc-var-prop-opts "options" property.
6283
6284@param[in] option
6285 @parblock
6286 Variant field class option to upcast.
6287
6288 Can be \c NULL.
6289 @endparblock
6290
6291@returns
6292 \bt_p{option} as a common variant field class option.
6293*/
6294static inline
6295const bt_field_class_variant_option *
6296bt_field_class_variant_with_selector_field_integer_signed_option_as_option_const(
6297 const bt_field_class_variant_with_selector_field_integer_signed_option *option)
6298 __BT_NOEXCEPT
6299{
6300 return __BT_UPCAST_CONST(bt_field_class_variant_option, option);
6301}
6302
6303/*! @} */
6304
6305/*!
6306@name Reference count
6307@{
6308*/
6309
6310/*!
6311@brief
6312 Increments the \ref api-fund-shared-object "reference count" of
6313 the field class \bt_p{field_class}.
6314
6315@param[in] field_class
6316 @parblock
6317 Field class of which to increment the reference count.
6318
6319 Can be \c NULL.
6320 @endparblock
6321
6322@sa bt_field_class_put_ref() &mdash;
6323 Decrements the reference count of a field class.
6324*/
6325extern void bt_field_class_get_ref(
6326 const bt_field_class *field_class) __BT_NOEXCEPT;
6327
6328/*!
6329@brief
6330 Decrements the \ref api-fund-shared-object "reference count" of
6331 the field class \bt_p{field_class}.
6332
6333@param[in] field_class
6334 @parblock
6335 Field class of which to decrement the reference count.
6336
6337 Can be \c NULL.
6338 @endparblock
6339
6340@sa bt_field_class_get_ref() &mdash;
6341 Increments the reference count of a field class.
6342*/
6343extern void bt_field_class_put_ref(
6344 const bt_field_class *field_class) __BT_NOEXCEPT;
6345
6346/*!
6347@brief
6348 Decrements the reference count of the field class
6349 \bt_p{_field_class}, and then sets \bt_p{_field_class} to \c NULL.
6350
6351@param _field_class
6352 @parblock
6353 Field class of which to decrement the reference count.
6354
6355 Can contain \c NULL.
6356 @endparblock
6357
6358@bt_pre_assign_expr{_field_class}
6359*/
6360#define BT_FIELD_CLASS_PUT_REF_AND_RESET(_field_class) \
6361 do { \
6362 bt_field_class_put_ref(_field_class); \
6363 (_field_class) = NULL; \
6364 } while (0)
6365
6366/*!
6367@brief
6368 Decrements the reference count of the field class \bt_p{_dst}, sets
6369 \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL.
6370
6371This macro effectively moves a field class reference from the expression
6372\bt_p{_src} to the expression \bt_p{_dst}, putting the existing
6373\bt_p{_dst} reference.
6374
6375@param _dst
6376 @parblock
6377 Destination expression.
6378
6379 Can contain \c NULL.
6380 @endparblock
6381@param _src
6382 @parblock
6383 Source expression.
6384
6385 Can contain \c NULL.
6386 @endparblock
6387
6388@bt_pre_assign_expr{_dst}
6389@bt_pre_assign_expr{_src}
6390*/
6391#define BT_FIELD_CLASS_MOVE_REF(_dst, _src) \
6392 do { \
6393 bt_field_class_put_ref(_dst); \
6394 (_dst) = (_src); \
6395 (_src) = NULL; \
6396 } while (0)
6397
6398/*! @} */
6399
6400/*! @} */
6401
6402#ifdef __cplusplus
6403}
6404#endif
6405
6406#endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */
This page took 0.042627 seconds and 5 git commands to generate.