2 * SPDX-License-Identifier: MIT
4 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
5 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 #define BT_LOG_TAG "LIB/STREAM-CLASS"
9 #include "lib/logging.h"
11 #include "lib/assert-cond.h"
12 #include <babeltrace2/trace-ir/trace.h>
13 #include "compat/compiler.h"
14 #include "compat/endian.h"
15 #include "common/assert.h"
20 #include "clock-class.h"
21 #include "event-class.h"
22 #include "field-class.h"
23 #include "field-wrapper.h"
24 #include "resolve-field-path.h"
25 #include "stream-class.h"
26 #include "lib/value.h"
27 #include "lib/func-status.h"
29 #define BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(_sc) \
30 BT_ASSERT_PRE_DEV_HOT("stream-class", (_sc), "Stream class", \
34 void destroy_stream_class(struct bt_object
*obj
)
36 struct bt_stream_class
*stream_class
= (void *) obj
;
38 BT_LIB_LOGD("Destroying stream class: %!+S", stream_class
);
39 BT_LOGD_STR("Putting default clock class.");
40 BT_OBJECT_PUT_REF_AND_RESET(stream_class
->user_attributes
);
41 BT_OBJECT_PUT_REF_AND_RESET(stream_class
->default_clock_class
);
43 if (stream_class
->event_classes
) {
44 BT_LOGD_STR("Destroying event classes.");
45 g_ptr_array_free(stream_class
->event_classes
, TRUE
);
46 stream_class
->event_classes
= NULL
;
49 if (stream_class
->name
.str
) {
50 g_string_free(stream_class
->name
.str
, TRUE
);
51 stream_class
->name
.str
= NULL
;
52 stream_class
->name
.value
= NULL
;
55 BT_LOGD_STR("Putting packet context field class.");
56 BT_OBJECT_PUT_REF_AND_RESET(stream_class
->packet_context_fc
);
57 BT_LOGD_STR("Putting event common context field class.");
58 BT_OBJECT_PUT_REF_AND_RESET(stream_class
->event_common_context_fc
);
59 bt_object_pool_finalize(&stream_class
->packet_context_field_pool
);
64 void free_field_wrapper(struct bt_field_wrapper
*field_wrapper
,
65 struct bt_stream_class
*stream_class
__attribute__((unused
)))
67 bt_field_wrapper_destroy((void *) field_wrapper
);
71 bool stream_class_id_is_unique(const struct bt_trace_class
*tc
, uint64_t id
)
74 bool is_unique
= true;
76 for (i
= 0; i
< tc
->stream_classes
->len
; i
++) {
77 const struct bt_stream_class
*sc
=
78 tc
->stream_classes
->pdata
[i
];
91 struct bt_stream_class
*create_stream_class_with_id(
92 struct bt_trace_class
*tc
, uint64_t id
)
94 struct bt_stream_class
*stream_class
= NULL
;
98 BT_ASSERT_PRE("stream-class-id-is-unique",
99 stream_class_id_is_unique(tc
, id
),
100 "Duplicate stream class ID: %![tc-]+T, id=%" PRIu64
, tc
, id
);
101 BT_LIB_LOGD("Creating stream class object: %![tc-]+T, id=%" PRIu64
,
103 stream_class
= g_new0(struct bt_stream_class
, 1);
105 BT_LIB_LOGE_APPEND_CAUSE(
106 "Failed to allocate one stream class.");
110 bt_object_init_shared_with_parent(&stream_class
->base
,
111 destroy_stream_class
);
112 stream_class
->user_attributes
= bt_value_map_create();
113 if (!stream_class
->user_attributes
) {
114 BT_LIB_LOGE_APPEND_CAUSE(
115 "Failed to create a map value object.");
119 stream_class
->name
.str
= g_string_new(NULL
);
120 if (!stream_class
->name
.str
) {
121 BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
125 stream_class
->id
= id
;
126 stream_class
->assigns_automatic_event_class_id
= true;
127 stream_class
->assigns_automatic_stream_id
= true;
128 stream_class
->event_classes
= g_ptr_array_new_with_free_func(
129 (GDestroyNotify
) bt_object_try_spec_release
);
130 if (!stream_class
->event_classes
) {
131 BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GPtrArray.");
135 ret
= bt_object_pool_initialize(&stream_class
->packet_context_field_pool
,
136 (bt_object_pool_new_object_func
) bt_field_wrapper_new
,
137 (bt_object_pool_destroy_object_func
) free_field_wrapper
,
140 BT_LIB_LOGE_APPEND_CAUSE(
141 "Failed to initialize packet context field pool: ret=%d",
146 bt_object_set_parent(&stream_class
->base
, &tc
->base
);
147 g_ptr_array_add(tc
->stream_classes
, stream_class
);
148 bt_trace_class_freeze(tc
);
149 BT_LIB_LOGD("Created stream class object: %!+S", stream_class
);
153 BT_OBJECT_PUT_REF_AND_RESET(stream_class
);
160 struct bt_stream_class
*bt_stream_class_create(struct bt_trace_class
*tc
)
162 BT_ASSERT_PRE_NO_ERROR();
163 BT_ASSERT_PRE_TC_NON_NULL(tc
);
164 BT_ASSERT_PRE("trace-class-automatically-assigns-stream-class-ids",
165 tc
->assigns_automatic_stream_class_id
,
166 "Trace class does not automatically assigns stream class IDs: "
168 return create_stream_class_with_id(tc
,
169 (uint64_t) tc
->stream_classes
->len
);
173 struct bt_stream_class
*bt_stream_class_create_with_id(
174 struct bt_trace_class
*tc
, uint64_t id
)
176 BT_ASSERT_PRE_NO_ERROR();
177 BT_ASSERT_PRE_TC_NON_NULL(tc
);
179 "trace-class-does-not-automatically-assigns-stream-class-ids",
180 !tc
->assigns_automatic_stream_class_id
,
181 "Trace class automatically assigns stream class IDs: "
183 return create_stream_class_with_id(tc
, id
);
187 struct bt_trace_class
*bt_stream_class_borrow_trace_class(
188 struct bt_stream_class
*stream_class
)
190 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
191 return bt_stream_class_borrow_trace_class_inline(stream_class
);
195 const struct bt_trace_class
*bt_stream_class_borrow_trace_class_const(
196 const struct bt_stream_class
*stream_class
)
198 return bt_stream_class_borrow_trace_class((void *) stream_class
);
202 const char *bt_stream_class_get_name(const struct bt_stream_class
*stream_class
)
204 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
205 return stream_class
->name
.value
;
209 enum bt_stream_class_set_name_status
bt_stream_class_set_name(
210 struct bt_stream_class
*stream_class
,
213 BT_ASSERT_PRE_NO_ERROR();
214 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
215 BT_ASSERT_PRE_NAME_NON_NULL(name
);
216 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
217 g_string_assign(stream_class
->name
.str
, name
);
218 stream_class
->name
.value
= stream_class
->name
.str
->str
;
219 BT_LIB_LOGD("Set stream class's name: %!+S", stream_class
);
220 return BT_FUNC_STATUS_OK
;
224 uint64_t bt_stream_class_get_id(const struct bt_stream_class
*stream_class
)
226 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
227 return stream_class
->id
;
231 uint64_t bt_stream_class_get_event_class_count(
232 const struct bt_stream_class
*stream_class
)
234 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
235 return (uint64_t) stream_class
->event_classes
->len
;
239 struct bt_event_class
*bt_stream_class_borrow_event_class_by_index(
240 struct bt_stream_class
*stream_class
, uint64_t index
)
242 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
243 BT_ASSERT_PRE_DEV_VALID_INDEX(index
, stream_class
->event_classes
->len
);
244 return g_ptr_array_index(stream_class
->event_classes
, index
);
248 const struct bt_event_class
*
249 bt_stream_class_borrow_event_class_by_index_const(
250 const struct bt_stream_class
*stream_class
, uint64_t index
)
252 return bt_stream_class_borrow_event_class_by_index(
253 (void *) stream_class
, index
);
257 struct bt_event_class
*bt_stream_class_borrow_event_class_by_id(
258 struct bt_stream_class
*stream_class
, uint64_t id
)
260 struct bt_event_class
*event_class
= NULL
;
263 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
265 for (i
= 0; i
< stream_class
->event_classes
->len
; i
++) {
266 struct bt_event_class
*event_class_candidate
=
267 g_ptr_array_index(stream_class
->event_classes
, i
);
269 if (event_class_candidate
->id
== id
) {
270 event_class
= event_class_candidate
;
280 const struct bt_event_class
*
281 bt_stream_class_borrow_event_class_by_id_const(
282 const struct bt_stream_class
*stream_class
, uint64_t id
)
284 return bt_stream_class_borrow_event_class_by_id(
285 (void *) stream_class
, id
);
289 const struct bt_field_class
*
290 bt_stream_class_borrow_packet_context_field_class_const(
291 const struct bt_stream_class
*stream_class
)
293 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
294 return stream_class
->packet_context_fc
;
298 struct bt_field_class
*
299 bt_stream_class_borrow_packet_context_field_class(
300 struct bt_stream_class
*stream_class
)
302 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
303 return stream_class
->packet_context_fc
;
307 enum bt_stream_class_set_field_class_status
308 bt_stream_class_set_packet_context_field_class(
309 struct bt_stream_class
*stream_class
,
310 struct bt_field_class
*field_class
)
313 struct bt_resolve_field_path_context resolve_ctx
= {
314 .packet_context
= field_class
,
315 .event_common_context
= NULL
,
316 .event_specific_context
= NULL
,
317 .event_payload
= NULL
,
320 BT_ASSERT_PRE_NO_ERROR();
321 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
322 BT_ASSERT_PRE("supports-packets",
323 stream_class
->supports_packets
,
324 "Stream class does not support packets: %![sc-]+S",
326 BT_ASSERT_PRE_FC_NON_NULL(field_class
);
327 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
328 BT_ASSERT_PRE_FC_IS_STRUCT("field-class", field_class
,
329 "Packet context field class");
330 ret
= bt_resolve_field_paths(field_class
, &resolve_ctx
, __func__
);
333 * This is the only reason for which
334 * bt_resolve_field_paths() can fail: anything else
335 * would be because a precondition is not satisfied.
337 ret
= BT_FUNC_STATUS_MEMORY_ERROR
;
341 bt_field_class_make_part_of_trace_class(field_class
);
342 bt_object_put_ref(stream_class
->packet_context_fc
);
343 stream_class
->packet_context_fc
= field_class
;
344 bt_object_get_ref_no_null_check(stream_class
->packet_context_fc
);
345 bt_field_class_freeze(field_class
);
346 BT_LIB_LOGD("Set stream class's packet context field class: %!+S",
354 const struct bt_field_class
*
355 bt_stream_class_borrow_event_common_context_field_class_const(
356 const struct bt_stream_class
*stream_class
)
358 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
359 return stream_class
->event_common_context_fc
;
363 struct bt_field_class
*
364 bt_stream_class_borrow_event_common_context_field_class(
365 struct bt_stream_class
*stream_class
)
367 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
368 return stream_class
->event_common_context_fc
;
372 enum bt_stream_class_set_field_class_status
373 bt_stream_class_set_event_common_context_field_class(
374 struct bt_stream_class
*stream_class
,
375 struct bt_field_class
*field_class
)
378 struct bt_resolve_field_path_context resolve_ctx
= {
379 .packet_context
= NULL
,
380 .event_common_context
= field_class
,
381 .event_specific_context
= NULL
,
382 .event_payload
= NULL
,
385 BT_ASSERT_PRE_NO_ERROR();
386 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
387 BT_ASSERT_PRE_FC_NON_NULL(field_class
);
388 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
389 BT_ASSERT_PRE_FC_IS_STRUCT("field-class", field_class
,
390 "Event common context field class");
391 resolve_ctx
.packet_context
= stream_class
->packet_context_fc
;
392 ret
= bt_resolve_field_paths(field_class
, &resolve_ctx
, __func__
);
395 * This is the only reason for which
396 * bt_resolve_field_paths() can fail: anything else
397 * would be because a precondition is not satisfied.
399 ret
= BT_FUNC_STATUS_MEMORY_ERROR
;
403 bt_field_class_make_part_of_trace_class(field_class
);
404 bt_object_put_ref(stream_class
->event_common_context_fc
);
405 stream_class
->event_common_context_fc
= field_class
;
406 bt_object_get_ref_no_null_check(stream_class
->event_common_context_fc
);
407 bt_field_class_freeze(field_class
);
408 BT_LIB_LOGD("Set stream class's event common context field class: %!+S",
415 void _bt_stream_class_freeze(const struct bt_stream_class
*stream_class
)
417 /* The field classes and default clock class are already frozen */
418 BT_ASSERT(stream_class
);
419 BT_LIB_LOGD("Freezing stream class's user attributes: %!+v",
420 stream_class
->user_attributes
);
421 bt_value_freeze(stream_class
->user_attributes
);
422 BT_LIB_LOGD("Freezing stream class: %!+S", stream_class
);
423 ((struct bt_stream_class
*) stream_class
)->frozen
= true;
427 enum bt_stream_class_set_default_clock_class_status
428 bt_stream_class_set_default_clock_class(
429 struct bt_stream_class
*stream_class
,
430 struct bt_clock_class
*clock_class
)
432 BT_ASSERT_PRE_NO_ERROR();
433 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
434 BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class
);
435 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
436 bt_object_put_ref(stream_class
->default_clock_class
);
437 stream_class
->default_clock_class
= clock_class
;
438 bt_object_get_ref_no_null_check(stream_class
->default_clock_class
);
439 bt_clock_class_freeze(clock_class
);
440 BT_LIB_LOGD("Set stream class's default clock class: %!+S",
442 return BT_FUNC_STATUS_OK
;
446 struct bt_clock_class
*bt_stream_class_borrow_default_clock_class(
447 struct bt_stream_class
*stream_class
)
449 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
450 return stream_class
->default_clock_class
;
454 const struct bt_clock_class
*bt_stream_class_borrow_default_clock_class_const(
455 const struct bt_stream_class
*stream_class
)
457 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
458 return stream_class
->default_clock_class
;
462 bt_bool
bt_stream_class_assigns_automatic_event_class_id(
463 const struct bt_stream_class
*stream_class
)
465 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
466 return (bt_bool
) stream_class
->assigns_automatic_event_class_id
;
470 void bt_stream_class_set_assigns_automatic_event_class_id(
471 struct bt_stream_class
*stream_class
,
474 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
475 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
476 stream_class
->assigns_automatic_event_class_id
= (bool) value
;
477 BT_LIB_LOGD("Set stream class's automatic event class ID "
478 "assignment property: %!+S", stream_class
);
482 bt_bool
bt_stream_class_assigns_automatic_stream_id(
483 const struct bt_stream_class
*stream_class
)
485 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
486 return (bt_bool
) stream_class
->assigns_automatic_stream_id
;
490 void bt_stream_class_set_supports_discarded_events(
491 struct bt_stream_class
*stream_class
,
492 bt_bool supports_discarded_events
,
493 bt_bool with_default_clock_snapshots
)
495 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
496 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
497 BT_ASSERT_PRE("supports-discarded-events-for-default-clock-snapshots",
498 supports_discarded_events
||
499 !with_default_clock_snapshots
,
500 "Discarded events cannot have default clock snapshots when "
501 "not supported: %!+S", stream_class
);
502 BT_ASSERT_PRE("has-default-clock-class-for-default-clock-snapshots",
503 !with_default_clock_snapshots
||
504 stream_class
->default_clock_class
,
505 "Stream class has no default clock class: %!+S", stream_class
);
506 stream_class
->supports_discarded_events
=
507 (bool) supports_discarded_events
;
508 stream_class
->discarded_events_have_default_clock_snapshots
=
509 (bool) with_default_clock_snapshots
;
510 BT_LIB_LOGD("Set stream class's discarded events support property: "
511 "%!+S", stream_class
);
515 bt_bool
bt_stream_class_supports_discarded_events(
516 const struct bt_stream_class
*stream_class
)
518 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
519 return (bt_bool
) stream_class
->supports_discarded_events
;
523 bt_bool
bt_stream_class_discarded_events_have_default_clock_snapshots(
524 const struct bt_stream_class
*stream_class
)
526 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
527 return (bt_bool
) stream_class
->discarded_events_have_default_clock_snapshots
;
531 void bt_stream_class_set_supports_discarded_packets(
532 struct bt_stream_class
*stream_class
,
533 bt_bool supports_discarded_packets
,
534 bt_bool with_default_clock_snapshots
)
536 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
537 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
538 BT_ASSERT_PRE("supports-packets-for-discarded-packets-support",
539 !supports_discarded_packets
||
540 stream_class
->supports_packets
,
541 "Stream class does not support packets: %!+S",
543 BT_ASSERT_PRE("supports-discarded-packets-for-default-clock-snapshots",
544 supports_discarded_packets
||
545 !with_default_clock_snapshots
,
546 "Discarded packets cannot have default clock snapshots when "
547 "not supported: %!+S", stream_class
);
548 BT_ASSERT_PRE("has-default-clock-class-for-default-clock-snapshots",
549 !with_default_clock_snapshots
||
550 stream_class
->default_clock_class
,
551 "Stream class has no default clock class: %!+S", stream_class
);
552 stream_class
->supports_discarded_packets
=
553 (bool) supports_discarded_packets
;
554 stream_class
->discarded_packets_have_default_clock_snapshots
=
555 (bool) with_default_clock_snapshots
;
556 BT_LIB_LOGD("Set stream class's discarded packets support property: "
557 "%!+S", stream_class
);
561 bt_bool
bt_stream_class_supports_discarded_packets(
562 const struct bt_stream_class
*stream_class
)
564 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
565 return (bt_bool
) stream_class
->supports_discarded_packets
;
569 bt_bool
bt_stream_class_discarded_packets_have_default_clock_snapshots(
570 const struct bt_stream_class
*stream_class
)
572 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
573 return (bt_bool
) stream_class
->discarded_packets_have_default_clock_snapshots
;
577 void bt_stream_class_set_supports_packets(
578 struct bt_stream_class
*stream_class
,
579 bt_bool supports_packets
,
580 bt_bool with_beginning_default_clock_snapshot
,
581 bt_bool with_end_default_clock_snapshot
)
583 bt_bool with_default_clock_snapshot
=
584 with_beginning_default_clock_snapshot
||
585 with_end_default_clock_snapshot
;
586 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
587 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
588 BT_ASSERT_PRE("supports-packets-for-default-clock-snapshot",
590 !with_default_clock_snapshot
,
591 "Packets cannot have default clock snapshots when "
592 "not supported: %!+S", stream_class
);
593 BT_ASSERT_PRE("has-default-clock-class-for-default-clock-snapshot",
594 !with_default_clock_snapshot
||
595 stream_class
->default_clock_class
,
596 "Stream class has no default clock class: %!+S", stream_class
);
597 BT_ASSERT_PRE("supports-packets-for-packet-context-field-class",
598 supports_packets
|| !stream_class
->packet_context_fc
,
599 "Stream class already has a packet context field class: %!+S",
601 BT_ASSERT_PRE("supports-packets-for-discarded-packets-support",
602 supports_packets
|| !stream_class
->supports_discarded_packets
,
603 "Stream class already supports discarded packets: %!+S",
605 stream_class
->supports_packets
= (bool) supports_packets
;
606 stream_class
->packets_have_beginning_default_clock_snapshot
=
607 (bool) with_beginning_default_clock_snapshot
;
608 stream_class
->packets_have_end_default_clock_snapshot
=
609 (bool) with_end_default_clock_snapshot
;
610 BT_LIB_LOGD("Set stream class's packets support property: %!+S",
615 bt_bool
bt_stream_class_supports_packets(
616 const struct bt_stream_class
*stream_class
)
618 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
619 return (bt_bool
) stream_class
->supports_packets
;
623 bt_bool
bt_stream_class_packets_have_beginning_default_clock_snapshot(
624 const struct bt_stream_class
*stream_class
)
626 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
627 return (bt_bool
) stream_class
->packets_have_beginning_default_clock_snapshot
;
631 bt_bool
bt_stream_class_packets_have_end_default_clock_snapshot(
632 const struct bt_stream_class
*stream_class
)
634 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
635 return (bt_bool
) stream_class
->packets_have_end_default_clock_snapshot
;
639 void bt_stream_class_set_assigns_automatic_stream_id(
640 struct bt_stream_class
*stream_class
,
643 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
644 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
645 stream_class
->assigns_automatic_stream_id
= (bool) value
;
646 BT_LIB_LOGD("Set stream class's automatic stream ID "
647 "assignment property: %!+S", stream_class
);
651 const struct bt_value
*bt_stream_class_borrow_user_attributes_const(
652 const struct bt_stream_class
*stream_class
)
654 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
655 return stream_class
->user_attributes
;
659 struct bt_value
*bt_stream_class_borrow_user_attributes(
660 struct bt_stream_class
*stream_class
)
662 return (void *) bt_stream_class_borrow_user_attributes_const(
663 (void *) stream_class
);
667 void bt_stream_class_set_user_attributes(
668 struct bt_stream_class
*stream_class
,
669 const struct bt_value
*user_attributes
)
671 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
672 BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes
);
673 BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes
);
674 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
675 bt_object_put_ref_no_null_check(stream_class
->user_attributes
);
676 stream_class
->user_attributes
= (void *) user_attributes
;
677 bt_object_get_ref_no_null_check(stream_class
->user_attributes
);
681 void bt_stream_class_get_ref(const struct bt_stream_class
*stream_class
)
683 bt_object_get_ref(stream_class
);
687 void bt_stream_class_put_ref(const struct bt_stream_class
*stream_class
)
689 bt_object_put_ref(stream_class
);