2 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
3 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 #define BT_LOG_TAG "FIELD-CLASSES"
25 #include "lib/lib-logging.h"
27 #include "lib/assert-pre.h"
28 #include <babeltrace2/trace-ir/field-class.h>
29 #include <babeltrace2/trace-ir/field-class-const.h>
30 #include <babeltrace2/trace-ir/field-const.h>
31 #include <babeltrace2/trace-ir/field.h>
32 #include <babeltrace2/trace-ir/clock-class.h>
33 #include "lib/object.h"
34 #include "compat/compiler.h"
35 #include "compat/endian.h"
36 #include "common/assert.h"
37 #include "compat/glib.h"
42 #include "clock-class.h"
43 #include "field-class.h"
45 #include "field-path.h"
48 enum bt_field_class_type
bt_field_class_get_type(
49 const struct bt_field_class
*fc
)
51 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
56 void init_field_class(struct bt_field_class
*fc
, enum bt_field_class_type type
,
57 bt_object_release_func release_func
)
60 BT_ASSERT(bt_field_class_has_known_type(fc
));
61 BT_ASSERT(release_func
);
62 bt_object_init_shared(&fc
->base
, release_func
);
67 void init_integer_field_class(struct bt_field_class_integer
*fc
,
68 enum bt_field_class_type type
,
69 bt_object_release_func release_func
)
71 init_field_class((void *) fc
, type
, release_func
);
73 fc
->base
= BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
;
77 void destroy_integer_field_class(struct bt_object
*obj
)
80 BT_LIB_LOGD("Destroying integer field class object: %!+F", obj
);
85 struct bt_field_class
*create_integer_field_class(bt_trace_class
*trace_class
,
86 enum bt_field_class_type type
)
88 struct bt_field_class_integer
*int_fc
= NULL
;
90 BT_ASSERT_PRE_NON_NULL(trace_class
, "Trace class");
91 BT_LOGD("Creating default integer field class object: type=%s",
92 bt_common_field_class_type_string(type
));
93 int_fc
= g_new0(struct bt_field_class_integer
, 1);
95 BT_LOGE_STR("Failed to allocate one integer field class.");
99 init_integer_field_class(int_fc
, type
, destroy_integer_field_class
);
100 BT_LIB_LOGD("Created integer field class object: %!+F", int_fc
);
104 BT_OBJECT_PUT_REF_AND_RESET(int_fc
);
107 return (void *) int_fc
;
110 struct bt_field_class
*bt_field_class_unsigned_integer_create(
111 bt_trace_class
*trace_class
)
113 return create_integer_field_class(trace_class
,
114 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER
);
117 struct bt_field_class
*bt_field_class_signed_integer_create(
118 bt_trace_class
*trace_class
)
120 return create_integer_field_class(trace_class
,
121 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
);
124 uint64_t bt_field_class_integer_get_field_value_range(
125 const struct bt_field_class
*fc
)
127 const struct bt_field_class_integer
*int_fc
= (const void *) fc
;
129 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
130 BT_ASSERT_PRE_FC_IS_INT(fc
, "Field class");
131 return int_fc
->range
;
136 bool size_is_valid_for_enumeration_field_class(struct bt_field_class
*fc
,
143 void bt_field_class_integer_set_field_value_range(
144 struct bt_field_class
*fc
, uint64_t size
)
146 struct bt_field_class_integer
*int_fc
= (void *) fc
;
148 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
149 BT_ASSERT_PRE_FC_IS_INT(fc
, "Field class");
150 BT_ASSERT_PRE_FC_HOT(fc
, "Field class");
151 BT_ASSERT_PRE(size
<= 64,
152 "Unsupported size for integer field class's field value range "
153 "(maximum is 64): size=%" PRIu64
, size
);
155 int_fc
->common
.type
== BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER
||
156 int_fc
->common
.type
== BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
||
157 size_is_valid_for_enumeration_field_class(fc
, size
),
158 "Invalid field value range for enumeration field class: "
159 "at least one of the current mapping ranges contains values "
160 "which are outside this range: %!+F, size=%" PRIu64
, fc
, size
);
161 int_fc
->range
= size
;
162 BT_LIB_LOGV("Set integer field class's field value range: %!+F", fc
);
165 enum bt_field_class_integer_preferred_display_base
166 bt_field_class_integer_get_preferred_display_base(const struct bt_field_class
*fc
)
168 const struct bt_field_class_integer
*int_fc
= (const void *) fc
;
170 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
171 BT_ASSERT_PRE_FC_IS_INT(fc
, "Field class");
175 void bt_field_class_integer_set_preferred_display_base(
176 struct bt_field_class
*fc
,
177 enum bt_field_class_integer_preferred_display_base base
)
179 struct bt_field_class_integer
*int_fc
= (void *) fc
;
181 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
182 BT_ASSERT_PRE_FC_IS_INT(fc
, "Field class");
183 BT_ASSERT_PRE_FC_HOT(fc
, "Field class");
185 BT_LIB_LOGV("Set integer field class's preferred display base: %!+F", fc
);
189 void finalize_enumeration_field_class_mapping(
190 struct bt_field_class_enumeration_mapping
*mapping
)
194 if (mapping
->label
) {
195 g_string_free(mapping
->label
, TRUE
);
198 if (mapping
->ranges
) {
199 g_array_free(mapping
->ranges
, TRUE
);
204 void destroy_enumeration_field_class(struct bt_object
*obj
)
206 struct bt_field_class_enumeration
*fc
= (void *) obj
;
209 BT_LIB_LOGD("Destroying enumeration field class object: %!+F", fc
);
214 for (i
= 0; i
< fc
->mappings
->len
; i
++) {
215 finalize_enumeration_field_class_mapping(
216 BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(fc
, i
));
219 g_array_free(fc
->mappings
, TRUE
);
224 g_ptr_array_free(fc
->label_buf
, TRUE
);
225 fc
->label_buf
= NULL
;
232 struct bt_field_class
*create_enumeration_field_class(
233 bt_trace_class
*trace_class
, enum bt_field_class_type type
)
235 struct bt_field_class_enumeration
*enum_fc
= NULL
;
237 BT_ASSERT_PRE_NON_NULL(trace_class
, "Trace class");
238 BT_LOGD("Creating default enumeration field class object: type=%s",
239 bt_common_field_class_type_string(type
));
240 enum_fc
= g_new0(struct bt_field_class_enumeration
, 1);
242 BT_LOGE_STR("Failed to allocate one enumeration field class.");
246 init_integer_field_class((void *) enum_fc
, type
,
247 destroy_enumeration_field_class
);
248 enum_fc
->mappings
= g_array_new(FALSE
, TRUE
,
249 sizeof(struct bt_field_class_enumeration_mapping
));
250 if (!enum_fc
->mappings
) {
251 BT_LOGE_STR("Failed to allocate a GArray.");
255 enum_fc
->label_buf
= g_ptr_array_new();
256 if (!enum_fc
->label_buf
) {
257 BT_LOGE_STR("Failed to allocate a GArray.");
261 BT_LIB_LOGD("Created enumeration field class object: %!+F", enum_fc
);
265 BT_OBJECT_PUT_REF_AND_RESET(enum_fc
);
268 return (void *) enum_fc
;
271 struct bt_field_class
*bt_field_class_unsigned_enumeration_create(
272 bt_trace_class
*trace_class
)
274 return create_enumeration_field_class(trace_class
,
275 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
);
278 struct bt_field_class
*bt_field_class_signed_enumeration_create(
279 bt_trace_class
*trace_class
)
281 return create_enumeration_field_class(trace_class
,
282 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
);
285 uint64_t bt_field_class_enumeration_get_mapping_count(
286 const struct bt_field_class
*fc
)
288 const struct bt_field_class_enumeration
*enum_fc
= (const void *) fc
;
290 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
291 BT_ASSERT_PRE_FC_IS_ENUM(fc
, "Field class");
292 return (uint64_t) enum_fc
->mappings
->len
;
295 const struct bt_field_class_unsigned_enumeration_mapping
*
296 bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const(
297 const struct bt_field_class
*fc
, uint64_t index
)
299 const struct bt_field_class_enumeration
*enum_fc
= (const void *) fc
;
301 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
302 BT_ASSERT_PRE_VALID_INDEX(index
, enum_fc
->mappings
->len
);
303 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
,
305 return (const void *) BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(fc
, index
);
308 const struct bt_field_class_signed_enumeration_mapping
*
309 bt_field_class_signed_enumeration_borrow_mapping_by_index_const(
310 const struct bt_field_class
*fc
, uint64_t index
)
312 const struct bt_field_class_enumeration
*enum_fc
= (const void *) fc
;
314 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
315 BT_ASSERT_PRE_VALID_INDEX(index
, enum_fc
->mappings
->len
);
316 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
,
318 return (const void *) BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(fc
, index
);
321 const char *bt_field_class_enumeration_mapping_get_label(
322 const struct bt_field_class_enumeration_mapping
*mapping
)
324 BT_ASSERT_PRE_NON_NULL(mapping
, "Enumeration field class mapping");
325 return mapping
->label
->str
;
328 uint64_t bt_field_class_enumeration_mapping_get_range_count(
329 const struct bt_field_class_enumeration_mapping
*mapping
)
331 BT_ASSERT_PRE_NON_NULL(mapping
, "Enumeration field class mapping");
332 return (uint64_t) mapping
->ranges
->len
;
336 void get_enumeration_field_class_mapping_range_at_index(
337 const struct bt_field_class_enumeration_mapping
*mapping
,
338 uint64_t index
, uint64_t *lower
, uint64_t *upper
)
340 const struct bt_field_class_enumeration_mapping_range
*range
;
342 BT_ASSERT_PRE_NON_NULL(mapping
, "Ranges");
343 BT_ASSERT_PRE_NON_NULL(lower
, "Range's lower (output)");
344 BT_ASSERT_PRE_NON_NULL(upper
, "Range's upper (output)");
345 BT_ASSERT_PRE_VALID_INDEX(index
, mapping
->ranges
->len
);
346 range
= BT_FIELD_CLASS_ENUM_MAPPING_RANGE_AT_INDEX(mapping
, index
);
347 *lower
= range
->lower
.u
;
348 *upper
= range
->upper
.u
;
351 void bt_field_class_unsigned_enumeration_mapping_get_range_by_index(
352 const struct bt_field_class_unsigned_enumeration_mapping
*ranges
,
353 uint64_t index
, uint64_t *lower
, uint64_t *upper
)
355 get_enumeration_field_class_mapping_range_at_index(
356 (const void *) ranges
, index
, lower
, upper
);
359 void bt_field_class_signed_enumeration_mapping_get_range_by_index(
360 const struct bt_field_class_signed_enumeration_mapping
*ranges
,
361 uint64_t index
, int64_t *lower
, int64_t *upper
)
363 get_enumeration_field_class_mapping_range_at_index(
364 (const void *) ranges
, index
,
365 (uint64_t *) lower
, (uint64_t *) upper
);
368 enum bt_field_class_status
369 bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
370 const struct bt_field_class
*fc
, uint64_t value
,
371 bt_field_class_enumeration_mapping_label_array
*label_array
,
374 const struct bt_field_class_enumeration
*enum_fc
= (const void *) fc
;
377 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
378 BT_ASSERT_PRE_NON_NULL(label_array
, "Label array (output)");
379 BT_ASSERT_PRE_NON_NULL(count
, "Count (output)");
380 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
,
382 g_ptr_array_set_size(enum_fc
->label_buf
, 0);
384 for (i
= 0; i
< enum_fc
->mappings
->len
; i
++) {
386 const struct bt_field_class_enumeration_mapping
*mapping
=
387 BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(enum_fc
, i
);
389 for (j
= 0; j
< mapping
->ranges
->len
; j
++) {
390 const struct bt_field_class_enumeration_mapping_range
*range
=
391 BT_FIELD_CLASS_ENUM_MAPPING_RANGE_AT_INDEX(
394 if (value
>= range
->lower
.u
&&
395 value
<= range
->upper
.u
) {
396 g_ptr_array_add(enum_fc
->label_buf
,
397 mapping
->label
->str
);
403 *label_array
= (void *) enum_fc
->label_buf
->pdata
;
404 *count
= (uint64_t) enum_fc
->label_buf
->len
;
405 return BT_FIELD_CLASS_STATUS_OK
;
408 enum bt_field_class_status
409 bt_field_class_signed_enumeration_get_mapping_labels_by_value(
410 const struct bt_field_class
*fc
, int64_t value
,
411 bt_field_class_enumeration_mapping_label_array
*label_array
,
414 const struct bt_field_class_enumeration
*enum_fc
= (const void *) fc
;
417 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
418 BT_ASSERT_PRE_NON_NULL(label_array
, "Label array (output)");
419 BT_ASSERT_PRE_NON_NULL(count
, "Count (output)");
420 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
,
422 g_ptr_array_set_size(enum_fc
->label_buf
, 0);
424 for (i
= 0; i
< enum_fc
->mappings
->len
; i
++) {
426 const struct bt_field_class_enumeration_mapping
*mapping
=
427 BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(enum_fc
, i
);
429 for (j
= 0; j
< mapping
->ranges
->len
; j
++) {
430 const struct bt_field_class_enumeration_mapping_range
*range
=
431 BT_FIELD_CLASS_ENUM_MAPPING_RANGE_AT_INDEX(
434 if (value
>= range
->lower
.i
&&
435 value
<= range
->upper
.i
) {
436 g_ptr_array_add(enum_fc
->label_buf
,
437 mapping
->label
->str
);
443 *label_array
= (void *) enum_fc
->label_buf
->pdata
;
444 *count
= (uint64_t) enum_fc
->label_buf
->len
;
445 return BT_FIELD_CLASS_STATUS_OK
;
449 enum bt_field_class_status
add_mapping_to_enumeration_field_class(
450 struct bt_field_class
*fc
,
451 const char *label
, uint64_t lower
, uint64_t upper
)
453 int ret
= BT_FIELD_CLASS_STATUS_OK
;
455 struct bt_field_class_enumeration
*enum_fc
= (void *) fc
;
456 struct bt_field_class_enumeration_mapping
*mapping
= NULL
;
457 struct bt_field_class_enumeration_mapping_range
*range
;
460 BT_ASSERT_PRE_NON_NULL(label
, "Label");
462 /* Find existing mapping identified by this label */
463 for (i
= 0; i
< enum_fc
->mappings
->len
; i
++) {
464 struct bt_field_class_enumeration_mapping
*mapping_candidate
=
465 BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(enum_fc
, i
);
467 if (strcmp(mapping_candidate
->label
->str
, label
) == 0) {
468 mapping
= mapping_candidate
;
474 /* Create new mapping for this label */
475 g_array_set_size(enum_fc
->mappings
, enum_fc
->mappings
->len
+ 1);
476 mapping
= BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(enum_fc
,
477 enum_fc
->mappings
->len
- 1);
478 mapping
->ranges
= g_array_new(FALSE
, TRUE
,
479 sizeof(struct bt_field_class_enumeration_mapping_range
));
480 if (!mapping
->ranges
) {
481 finalize_enumeration_field_class_mapping(mapping
);
482 g_array_set_size(enum_fc
->mappings
,
483 enum_fc
->mappings
->len
- 1);
484 ret
= BT_FIELD_CLASS_STATUS_NOMEM
;
488 mapping
->label
= g_string_new(label
);
489 if (!mapping
->label
) {
490 finalize_enumeration_field_class_mapping(mapping
);
491 g_array_set_size(enum_fc
->mappings
,
492 enum_fc
->mappings
->len
- 1);
493 ret
= BT_FIELD_CLASS_STATUS_NOMEM
;
500 g_array_set_size(mapping
->ranges
, mapping
->ranges
->len
+ 1);
501 range
= BT_FIELD_CLASS_ENUM_MAPPING_RANGE_AT_INDEX(mapping
,
502 mapping
->ranges
->len
- 1);
503 range
->lower
.u
= lower
;
504 range
->upper
.u
= upper
;
505 BT_LIB_LOGV("Added mapping to enumeration field class: "
506 "%![fc-]+F, label=\"%s\", lower-unsigned=%" PRIu64
", "
507 "upper-unsigned=%" PRIu64
, fc
, label
, lower
, upper
);
513 enum bt_field_class_status
bt_field_class_unsigned_enumeration_map_range(
514 struct bt_field_class
*fc
, const char *label
,
515 uint64_t range_lower
, uint64_t range_upper
)
517 struct bt_field_class_enumeration
*enum_fc
= (void *) fc
;
519 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
520 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
,
522 BT_ASSERT_PRE(range_lower
<= range_upper
,
523 "Range's upper bound is less than lower bound: "
524 "upper=%" PRIu64
", lower=%" PRIu64
,
525 range_lower
, range_upper
);
526 BT_ASSERT_PRE(bt_util_value_is_in_range_unsigned(enum_fc
->common
.range
,
528 "Range's lower bound is outside the enumeration field class's value range: "
529 "%![fc-]+F, lower=%" PRIu64
, fc
, range_lower
);
530 BT_ASSERT_PRE(bt_util_value_is_in_range_unsigned(enum_fc
->common
.range
,
532 "Range's upper bound is outside the enumeration field class's value range: "
533 "%![fc-]+F, upper=%" PRIu64
, fc
, range_upper
);
534 return add_mapping_to_enumeration_field_class(fc
, label
, range_lower
,
538 enum bt_field_class_status
bt_field_class_signed_enumeration_map_range(
539 struct bt_field_class
*fc
, const char *label
,
540 int64_t range_lower
, int64_t range_upper
)
542 struct bt_field_class_enumeration
*enum_fc
= (void *) fc
;
544 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
545 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
,
547 BT_ASSERT_PRE(range_lower
<= range_upper
,
548 "Range's upper bound is less than lower bound: "
549 "upper=%" PRId64
", lower=%" PRId64
,
550 range_lower
, range_upper
);
551 BT_ASSERT_PRE(bt_util_value_is_in_range_signed(enum_fc
->common
.range
,
553 "Range's lower bound is outside the enumeration field class's value range: "
554 "%![fc-]+F, lower=%" PRId64
, fc
, range_lower
);
555 BT_ASSERT_PRE(bt_util_value_is_in_range_signed(enum_fc
->common
.range
,
557 "Range's upper bound is outside the enumeration field class's value range: "
558 "%![fc-]+F, upper=%" PRId64
, fc
, range_upper
);
559 return add_mapping_to_enumeration_field_class(fc
, label
, range_lower
,
564 void destroy_real_field_class(struct bt_object
*obj
)
567 BT_LIB_LOGD("Destroying real field class object: %!+F", obj
);
571 struct bt_field_class
*bt_field_class_real_create(bt_trace_class
*trace_class
)
573 struct bt_field_class_real
*real_fc
= NULL
;
575 BT_ASSERT_PRE_NON_NULL(trace_class
, "Trace class");
576 BT_LOGD_STR("Creating default real field class object.");
577 real_fc
= g_new0(struct bt_field_class_real
, 1);
579 BT_LOGE_STR("Failed to allocate one real field class.");
583 init_field_class((void *) real_fc
, BT_FIELD_CLASS_TYPE_REAL
,
584 destroy_real_field_class
);
585 BT_LIB_LOGD("Created real field class object: %!+F", real_fc
);
589 BT_OBJECT_PUT_REF_AND_RESET(real_fc
);
592 return (void *) real_fc
;
595 bt_bool
bt_field_class_real_is_single_precision(const struct bt_field_class
*fc
)
597 const struct bt_field_class_real
*real_fc
= (const void *) fc
;
599 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
600 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_REAL
, "Field class");
601 return real_fc
->is_single_precision
;
604 void bt_field_class_real_set_is_single_precision(struct bt_field_class
*fc
,
605 bt_bool is_single_precision
)
607 struct bt_field_class_real
*real_fc
= (void *) fc
;
609 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
610 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_REAL
, "Field class");
611 BT_ASSERT_PRE_FC_HOT(fc
, "Field class");
612 real_fc
->is_single_precision
= (bool) is_single_precision
;
613 BT_LIB_LOGV("Set real field class's \"is single precision\" property: "
618 int init_named_field_classes_container(
619 struct bt_field_class_named_field_class_container
*fc
,
620 enum bt_field_class_type type
,
621 bt_object_release_func release_func
)
625 init_field_class((void *) fc
, type
, release_func
);
626 fc
->named_fcs
= g_array_new(FALSE
, TRUE
,
627 sizeof(struct bt_named_field_class
));
628 if (!fc
->named_fcs
) {
629 BT_LOGE_STR("Failed to allocate a GArray.");
634 fc
->name_to_index
= g_hash_table_new(g_str_hash
, g_str_equal
);
635 if (!fc
->name_to_index
) {
636 BT_LOGE_STR("Failed to allocate a GHashTable.");
646 void finalize_named_field_class(struct bt_named_field_class
*named_fc
)
649 BT_LIB_LOGD("Finalizing named field class: "
650 "addr=%p, name=\"%s\", %![fc-]+F",
651 named_fc
, named_fc
->name
? named_fc
->name
->str
: NULL
,
654 if (named_fc
->name
) {
655 g_string_free(named_fc
->name
, TRUE
);
658 BT_LOGD_STR("Putting named field class's field class.");
659 BT_OBJECT_PUT_REF_AND_RESET(named_fc
->fc
);
663 void finalize_named_field_classes_container(
664 struct bt_field_class_named_field_class_container
*fc
)
671 for (i
= 0; i
< fc
->named_fcs
->len
; i
++) {
672 finalize_named_field_class(
673 &g_array_index(fc
->named_fcs
,
674 struct bt_named_field_class
, i
));
677 g_array_free(fc
->named_fcs
, TRUE
);
680 if (fc
->name_to_index
) {
681 g_hash_table_destroy(fc
->name_to_index
);
686 void destroy_structure_field_class(struct bt_object
*obj
)
689 BT_LIB_LOGD("Destroying structure field class object: %!+F", obj
);
690 finalize_named_field_classes_container((void *) obj
);
694 struct bt_field_class
*bt_field_class_structure_create(
695 bt_trace_class
*trace_class
)
698 struct bt_field_class_structure
*struct_fc
= NULL
;
700 BT_ASSERT_PRE_NON_NULL(trace_class
, "Trace class");
701 BT_LOGD_STR("Creating default structure field class object.");
702 struct_fc
= g_new0(struct bt_field_class_structure
, 1);
704 BT_LOGE_STR("Failed to allocate one structure field class.");
708 ret
= init_named_field_classes_container((void *) struct_fc
,
709 BT_FIELD_CLASS_TYPE_STRUCTURE
, destroy_structure_field_class
);
714 BT_LIB_LOGD("Created structure field class object: %!+F", struct_fc
);
718 BT_OBJECT_PUT_REF_AND_RESET(struct_fc
);
721 return (void *) struct_fc
;
725 enum bt_field_class_status
append_named_field_class_to_container_field_class(
726 struct bt_field_class_named_field_class_container
*container_fc
,
727 const char *name
, struct bt_field_class
*fc
)
729 int ret
= BT_FIELD_CLASS_STATUS_OK
;
730 struct bt_named_field_class
*named_fc
;
733 BT_ASSERT(container_fc
);
734 BT_ASSERT_PRE_FC_HOT(container_fc
, "Field class");
735 BT_ASSERT_PRE_NON_NULL(name
, "Name");
736 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
737 BT_ASSERT_PRE(!bt_g_hash_table_contains(container_fc
->name_to_index
,
739 "Duplicate member/option name in structure/variant field class: "
740 "%![container-fc-]+F, name=\"%s\"", container_fc
, name
);
741 name_str
= g_string_new(name
);
743 BT_LOGE_STR("Failed to allocate a GString.");
744 ret
= BT_FIELD_CLASS_STATUS_NOMEM
;
748 g_array_set_size(container_fc
->named_fcs
,
749 container_fc
->named_fcs
->len
+ 1);
750 named_fc
= &g_array_index(container_fc
->named_fcs
,
751 struct bt_named_field_class
, container_fc
->named_fcs
->len
- 1);
752 named_fc
->name
= name_str
;
754 bt_object_get_no_null_check(fc
);
755 g_hash_table_insert(container_fc
->name_to_index
, named_fc
->name
->str
,
756 GUINT_TO_POINTER(container_fc
->named_fcs
->len
- 1));
759 * Freeze the field class, but not the named field class (the
760 * user can still modify it, if possible, until the container
763 bt_field_class_freeze(fc
);
769 enum bt_field_class_status
bt_field_class_structure_append_member(
770 struct bt_field_class
*fc
, const char *name
,
771 struct bt_field_class
*member_fc
)
774 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
775 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_STRUCTURE
,
777 return append_named_field_class_to_container_field_class((void *) fc
,
781 uint64_t bt_field_class_structure_get_member_count(
782 const struct bt_field_class
*fc
)
784 struct bt_field_class_structure
*struct_fc
= (void *) fc
;
786 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
787 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_STRUCTURE
,
789 return (uint64_t) struct_fc
->common
.named_fcs
->len
;
793 struct bt_named_field_class
*
794 borrow_named_field_class_from_container_field_class_at_index(
795 struct bt_field_class_named_field_class_container
*fc
,
799 BT_ASSERT_PRE_VALID_INDEX(index
, fc
->named_fcs
->len
);
800 return BT_FIELD_CLASS_NAMED_FC_AT_INDEX(fc
, index
);
803 const struct bt_field_class_structure_member
*
804 bt_field_class_structure_borrow_member_by_index_const(
805 const struct bt_field_class
*fc
, uint64_t index
)
807 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
808 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_STRUCTURE
,
810 return (const void *)
811 borrow_named_field_class_from_container_field_class_at_index(
815 struct bt_field_class_structure_member
*
816 bt_field_class_structure_borrow_member_by_index(
817 struct bt_field_class
*fc
, uint64_t index
)
819 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
820 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_STRUCTURE
,
823 borrow_named_field_class_from_container_field_class_at_index(
828 struct bt_named_field_class
*
829 borrow_named_field_class_from_container_field_class_by_name(
830 struct bt_field_class_named_field_class_container
*fc
,
833 struct bt_named_field_class
*named_fc
= NULL
;
838 BT_ASSERT_PRE_NON_NULL(name
, "Name");
839 if (!g_hash_table_lookup_extended(fc
->name_to_index
, name
, &orig_key
,
844 named_fc
= BT_FIELD_CLASS_NAMED_FC_AT_INDEX(fc
,
845 GPOINTER_TO_UINT(value
));
851 const struct bt_field_class_structure_member
*
852 bt_field_class_structure_borrow_member_by_name_const(
853 const struct bt_field_class
*fc
, const char *name
)
855 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
856 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_STRUCTURE
,
858 return (const void *)
859 borrow_named_field_class_from_container_field_class_by_name(
863 struct bt_field_class_structure_member
*
864 bt_field_class_structure_borrow_member_by_name(
865 struct bt_field_class
*fc
, const char *name
)
867 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
868 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_STRUCTURE
,
871 borrow_named_field_class_from_container_field_class_by_name(
875 const char *bt_field_class_structure_member_get_name(
876 const struct bt_field_class_structure_member
*member
)
878 const struct bt_named_field_class
*named_fc
= (const void *) member
;
880 BT_ASSERT_PRE_NON_NULL(member
, "Structure field class member");
881 return named_fc
->name
->str
;
884 const struct bt_field_class
*
885 bt_field_class_structure_member_borrow_field_class_const(
886 const struct bt_field_class_structure_member
*member
)
888 const struct bt_named_field_class
*named_fc
= (const void *) member
;
890 BT_ASSERT_PRE_NON_NULL(member
, "Structure field class member");
894 struct bt_field_class
*
895 bt_field_class_structure_member_borrow_field_class(
896 struct bt_field_class_structure_member
*member
)
898 struct bt_named_field_class
*named_fc
= (void *) member
;
900 BT_ASSERT_PRE_NON_NULL(member
, "Structure field class member");
905 void destroy_variant_field_class(struct bt_object
*obj
)
907 struct bt_field_class_variant
*fc
= (void *) obj
;
910 BT_LIB_LOGD("Destroying variant field class object: %!+F", fc
);
911 finalize_named_field_classes_container((void *) fc
);
912 BT_LOGD_STR("Putting selector field path.");
913 BT_OBJECT_PUT_REF_AND_RESET(fc
->selector_field_path
);
914 BT_LOGD_STR("Putting selector field class.");
915 BT_OBJECT_PUT_REF_AND_RESET(fc
->selector_fc
);
919 struct bt_field_class
*bt_field_class_variant_create(
920 bt_trace_class
*trace_class
)
923 struct bt_field_class_variant
*var_fc
= NULL
;
925 BT_ASSERT_PRE_NON_NULL(trace_class
, "Trace class");
926 BT_LOGD_STR("Creating default variant field class object.");
927 var_fc
= g_new0(struct bt_field_class_variant
, 1);
929 BT_LOGE_STR("Failed to allocate one variant field class.");
933 ret
= init_named_field_classes_container((void *) var_fc
,
934 BT_FIELD_CLASS_TYPE_VARIANT
, destroy_variant_field_class
);
939 BT_LIB_LOGD("Created variant field class object: %!+F", var_fc
);
943 BT_OBJECT_PUT_REF_AND_RESET(var_fc
);
946 return (void *) var_fc
;
949 enum bt_field_class_status
bt_field_class_variant_set_selector_field_class(
950 struct bt_field_class
*fc
,
951 struct bt_field_class
*selector_fc
)
953 struct bt_field_class_variant
*var_fc
= (void *) fc
;
955 BT_ASSERT_PRE_NON_NULL(fc
, "Variant field class");
956 BT_ASSERT_PRE_NON_NULL(selector_fc
, "Selector field class");
957 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_VARIANT
, "Field class");
958 BT_ASSERT_PRE_FC_IS_ENUM(selector_fc
, "Selector field class");
959 BT_ASSERT_PRE_FC_HOT(fc
, "Variant field class");
960 var_fc
->selector_fc
= selector_fc
;
961 bt_object_get_no_null_check(selector_fc
);
962 bt_field_class_freeze(selector_fc
);
963 return BT_FIELD_CLASS_STATUS_OK
;
966 enum bt_field_class_status
bt_field_class_variant_append_option(
967 struct bt_field_class
*fc
,
968 const char *name
, struct bt_field_class
*option_fc
)
971 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
972 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_VARIANT
, "Field class");
973 return append_named_field_class_to_container_field_class((void *) fc
,
977 const struct bt_field_class_variant_option
*
978 bt_field_class_variant_borrow_option_by_name_const(
979 const struct bt_field_class
*fc
, const char *name
)
981 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
982 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_VARIANT
, "Field class");
983 return (const void *)
984 borrow_named_field_class_from_container_field_class_by_name(
988 struct bt_field_class_variant_option
*
989 bt_field_class_variant_borrow_option_by_name(
990 struct bt_field_class
*fc
, const char *name
)
992 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
993 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_VARIANT
, "Field class");
995 borrow_named_field_class_from_container_field_class_by_name(
999 uint64_t bt_field_class_variant_get_option_count(const struct bt_field_class
*fc
)
1001 const struct bt_field_class_variant
*var_fc
= (const void *) fc
;
1003 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
1004 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_VARIANT
, "Field class");
1005 return (uint64_t) var_fc
->common
.named_fcs
->len
;
1008 const struct bt_field_class_variant_option
*
1009 bt_field_class_variant_borrow_option_by_index_const(
1010 const struct bt_field_class
*fc
, uint64_t index
)
1012 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
1013 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_VARIANT
, "Field class");
1014 return (const void *)
1015 borrow_named_field_class_from_container_field_class_at_index(
1016 (void *) fc
, index
);
1019 struct bt_field_class_variant_option
*
1020 bt_field_class_variant_borrow_option_by_index(
1021 struct bt_field_class
*fc
, uint64_t index
)
1023 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
1024 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_VARIANT
, "Field class");
1026 borrow_named_field_class_from_container_field_class_at_index(
1027 (void *) fc
, index
);
1030 const char *bt_field_class_variant_option_get_name(
1031 const struct bt_field_class_variant_option
*option
)
1033 const struct bt_named_field_class
*named_fc
= (const void *) option
;
1035 BT_ASSERT_PRE_NON_NULL(option
, "Variant field class option");
1036 return named_fc
->name
->str
;
1039 const struct bt_field_class
*
1040 bt_field_class_variant_option_borrow_field_class_const(
1041 const struct bt_field_class_variant_option
*option
)
1043 const struct bt_named_field_class
*named_fc
= (const void *) option
;
1045 BT_ASSERT_PRE_NON_NULL(option
, "Variant field class option");
1046 return named_fc
->fc
;
1049 struct bt_field_class
*
1050 bt_field_class_variant_option_borrow_field_class(
1051 struct bt_field_class_variant_option
*option
)
1053 struct bt_named_field_class
*named_fc
= (void *) option
;
1055 BT_ASSERT_PRE_NON_NULL(option
, "Variant field class option");
1056 return named_fc
->fc
;
1059 const struct bt_field_path
*
1060 bt_field_class_variant_borrow_selector_field_path_const(
1061 const struct bt_field_class
*fc
)
1063 const struct bt_field_class_variant
*var_fc
= (const void *) fc
;
1065 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
1066 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_VARIANT
,
1068 return var_fc
->selector_field_path
;
1072 void init_array_field_class(struct bt_field_class_array
*fc
,
1073 enum bt_field_class_type type
, bt_object_release_func release_func
,
1074 struct bt_field_class
*element_fc
)
1076 BT_ASSERT(element_fc
);
1077 init_field_class((void *) fc
, type
, release_func
);
1078 fc
->element_fc
= element_fc
;
1079 bt_object_get_no_null_check(element_fc
);
1080 bt_field_class_freeze(element_fc
);
1084 void finalize_array_field_class(struct bt_field_class_array
*array_fc
)
1086 BT_ASSERT(array_fc
);
1087 BT_LOGD_STR("Putting element field class.");
1088 BT_OBJECT_PUT_REF_AND_RESET(array_fc
->element_fc
);
1092 void destroy_static_array_field_class(struct bt_object
*obj
)
1095 BT_LIB_LOGD("Destroying static array field class object: %!+F", obj
);
1096 finalize_array_field_class((void *) obj
);
1100 struct bt_field_class
*
1101 bt_field_class_static_array_create(bt_trace_class
*trace_class
,
1102 struct bt_field_class
*element_fc
, uint64_t length
)
1104 struct bt_field_class_static_array
*array_fc
= NULL
;
1106 BT_ASSERT_PRE_NON_NULL(trace_class
, "Trace class");
1107 BT_ASSERT_PRE_NON_NULL(element_fc
, "Element field class");
1108 BT_LOGD_STR("Creating default static array field class object.");
1109 array_fc
= g_new0(struct bt_field_class_static_array
, 1);
1111 BT_LOGE_STR("Failed to allocate one static array field class.");
1115 init_array_field_class((void *) array_fc
, BT_FIELD_CLASS_TYPE_STATIC_ARRAY
,
1116 destroy_static_array_field_class
, element_fc
);
1117 array_fc
->length
= length
;
1118 BT_LIB_LOGD("Created static array field class object: %!+F", array_fc
);
1122 BT_OBJECT_PUT_REF_AND_RESET(array_fc
);
1125 return (void *) array_fc
;
1128 const struct bt_field_class
*
1129 bt_field_class_array_borrow_element_field_class_const(
1130 const struct bt_field_class
*fc
)
1132 const struct bt_field_class_array
*array_fc
= (const void *) fc
;
1134 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
1135 BT_ASSERT_PRE_FC_IS_ARRAY(fc
, "Field class");
1136 return array_fc
->element_fc
;
1139 struct bt_field_class
*
1140 bt_field_class_array_borrow_element_field_class(struct bt_field_class
*fc
)
1142 struct bt_field_class_array
*array_fc
= (void *) fc
;
1144 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
1145 BT_ASSERT_PRE_FC_IS_ARRAY(fc
, "Field class");
1146 return array_fc
->element_fc
;
1149 uint64_t bt_field_class_static_array_get_length(const struct bt_field_class
*fc
)
1151 const struct bt_field_class_static_array
*array_fc
= (const void *) fc
;
1153 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
1154 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_STATIC_ARRAY
,
1156 return (uint64_t) array_fc
->length
;
1160 void destroy_dynamic_array_field_class(struct bt_object
*obj
)
1162 struct bt_field_class_dynamic_array
*fc
= (void *) obj
;
1165 BT_LIB_LOGD("Destroying dynamic array field class object: %!+F", fc
);
1166 finalize_array_field_class((void *) fc
);
1167 BT_LOGD_STR("Putting length field path.");
1168 BT_OBJECT_PUT_REF_AND_RESET(fc
->length_field_path
);
1169 BT_LOGD_STR("Putting length field class.");
1170 BT_OBJECT_PUT_REF_AND_RESET(fc
->length_fc
);
1174 struct bt_field_class
*bt_field_class_dynamic_array_create(
1175 bt_trace_class
*trace_class
,
1176 struct bt_field_class
*element_fc
)
1178 struct bt_field_class_dynamic_array
*array_fc
= NULL
;
1180 BT_ASSERT_PRE_NON_NULL(trace_class
, "Trace class");
1181 BT_ASSERT_PRE_NON_NULL(element_fc
, "Element field class");
1182 BT_LOGD_STR("Creating default dynamic array field class object.");
1183 array_fc
= g_new0(struct bt_field_class_dynamic_array
, 1);
1185 BT_LOGE_STR("Failed to allocate one dynamic array field class.");
1189 init_array_field_class((void *) array_fc
,
1190 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY
,
1191 destroy_dynamic_array_field_class
, element_fc
);
1192 BT_LIB_LOGD("Created dynamic array field class object: %!+F", array_fc
);
1196 BT_OBJECT_PUT_REF_AND_RESET(array_fc
);
1199 return (void *) array_fc
;
1202 enum bt_field_class_status
bt_field_class_dynamic_array_set_length_field_class(
1203 struct bt_field_class
*fc
,
1204 struct bt_field_class
*length_fc
)
1206 struct bt_field_class_dynamic_array
*array_fc
= (void *) fc
;
1208 BT_ASSERT_PRE_NON_NULL(fc
, "Dynamic array field class");
1209 BT_ASSERT_PRE_NON_NULL(length_fc
, "Length field class");
1210 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY
,
1212 BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(length_fc
, "Length field class");
1213 BT_ASSERT_PRE_FC_HOT(fc
, "Dynamic array field class");
1214 array_fc
->length_fc
= length_fc
;
1215 bt_object_get_no_null_check(length_fc
);
1216 bt_field_class_freeze(length_fc
);
1217 return BT_FIELD_CLASS_STATUS_OK
;
1220 const struct bt_field_path
*
1221 bt_field_class_dynamic_array_borrow_length_field_path_const(
1222 const struct bt_field_class
*fc
)
1224 const struct bt_field_class_dynamic_array
*seq_fc
= (const void *) fc
;
1226 BT_ASSERT_PRE_NON_NULL(fc
, "Field class");
1227 BT_ASSERT_PRE_FC_HAS_ID(fc
, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY
,
1229 return seq_fc
->length_field_path
;
1233 void destroy_string_field_class(struct bt_object
*obj
)
1236 BT_LIB_LOGD("Destroying string field class object: %!+F", obj
);
1240 struct bt_field_class
*bt_field_class_string_create(bt_trace_class
*trace_class
)
1242 struct bt_field_class_string
*string_fc
= NULL
;
1244 BT_ASSERT_PRE_NON_NULL(trace_class
, "Trace class");
1245 BT_LOGD_STR("Creating default string field class object.");
1246 string_fc
= g_new0(struct bt_field_class_string
, 1);
1248 BT_LOGE_STR("Failed to allocate one string field class.");
1252 init_field_class((void *) string_fc
, BT_FIELD_CLASS_TYPE_STRING
,
1253 destroy_string_field_class
);
1254 BT_LIB_LOGD("Created string field class object: %!+F", string_fc
);
1258 BT_OBJECT_PUT_REF_AND_RESET(string_fc
);
1261 return (void *) string_fc
;
1265 void _bt_field_class_freeze(const struct bt_field_class
*c_fc
)
1267 struct bt_field_class
*fc
= (void *) c_fc
;
1270 * Element/member/option field classes are frozen when added to
1277 case BT_FIELD_CLASS_TYPE_STRUCTURE
:
1278 case BT_FIELD_CLASS_TYPE_VARIANT
:
1280 struct bt_field_class_named_field_class_container
*container_fc
=
1284 for (i
= 0; i
< container_fc
->named_fcs
->len
; i
++) {
1285 struct bt_named_field_class
*named_fc
=
1286 BT_FIELD_CLASS_NAMED_FC_AT_INDEX(
1289 bt_named_field_class_freeze(named_fc
);
1300 void _bt_named_field_class_freeze(const struct bt_named_field_class
*named_fc
)
1302 BT_ASSERT(named_fc
);
1303 ((struct bt_named_field_class
*) named_fc
)->frozen
= true;
1304 bt_field_class_freeze(named_fc
->fc
);
1308 void _bt_field_class_make_part_of_trace_class(const struct bt_field_class
*c_fc
)
1310 struct bt_field_class
*fc
= (void *) c_fc
;
1313 BT_ASSERT_PRE(!fc
->part_of_trace_class
,
1314 "Field class is already part of a trace: %!+F", fc
);
1315 fc
->part_of_trace_class
= true;
1318 case BT_FIELD_CLASS_TYPE_STRUCTURE
:
1319 case BT_FIELD_CLASS_TYPE_VARIANT
:
1321 struct bt_field_class_named_field_class_container
*container_fc
=
1325 for (i
= 0; i
< container_fc
->named_fcs
->len
; i
++) {
1326 struct bt_named_field_class
*named_fc
=
1327 BT_FIELD_CLASS_NAMED_FC_AT_INDEX(
1330 bt_field_class_make_part_of_trace_class(named_fc
->fc
);
1335 case BT_FIELD_CLASS_TYPE_STATIC_ARRAY
:
1336 case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY
:
1338 struct bt_field_class_array
*array_fc
= (void *) fc
;
1340 bt_field_class_make_part_of_trace_class(array_fc
->element_fc
);
1348 void bt_field_class_get_ref(const struct bt_field_class
*field_class
)
1350 bt_object_get_ref(field_class
);
1353 void bt_field_class_put_ref(const struct bt_field_class
*field_class
)
1355 bt_object_put_ref(field_class
);