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"
28 #include "trace-class.h"
30 #define BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(_sc) \
31 BT_ASSERT_PRE_DEV_HOT("stream-class", (_sc), "Stream class", \
35 void destroy_stream_class(struct bt_object
*obj
)
37 struct bt_stream_class
*stream_class
= (void *) obj
;
39 BT_LIB_LOGD("Destroying stream class: %!+S", stream_class
);
40 BT_LOGD_STR("Putting default clock class.");
41 BT_OBJECT_PUT_REF_AND_RESET(stream_class
->user_attributes
);
42 BT_OBJECT_PUT_REF_AND_RESET(stream_class
->default_clock_class
);
44 if (stream_class
->event_classes
) {
45 BT_LOGD_STR("Destroying event classes.");
46 g_ptr_array_free(stream_class
->event_classes
, TRUE
);
47 stream_class
->event_classes
= NULL
;
50 if (stream_class
->name
.str
) {
51 g_string_free(stream_class
->name
.str
, TRUE
);
52 stream_class
->name
.str
= NULL
;
53 stream_class
->name
.value
= NULL
;
56 BT_LOGD_STR("Putting packet context field class.");
57 BT_OBJECT_PUT_REF_AND_RESET(stream_class
->packet_context_fc
);
58 BT_LOGD_STR("Putting event common context field class.");
59 BT_OBJECT_PUT_REF_AND_RESET(stream_class
->event_common_context_fc
);
60 bt_object_pool_finalize(&stream_class
->packet_context_field_pool
);
65 void free_field_wrapper(struct bt_field_wrapper
*field_wrapper
,
66 struct bt_stream_class
*stream_class
__attribute__((unused
)))
68 bt_field_wrapper_destroy((void *) field_wrapper
);
72 bool stream_class_id_is_unique(const struct bt_trace_class
*tc
, uint64_t id
)
75 bool is_unique
= true;
77 for (i
= 0; i
< tc
->stream_classes
->len
; i
++) {
78 const struct bt_stream_class
*sc
=
79 tc
->stream_classes
->pdata
[i
];
92 struct bt_stream_class
*create_stream_class_with_id(
93 struct bt_trace_class
*tc
, uint64_t id
)
95 struct bt_stream_class
*stream_class
= NULL
;
99 BT_ASSERT_PRE("stream-class-id-is-unique",
100 stream_class_id_is_unique(tc
, id
),
101 "Duplicate stream class ID: %![tc-]+T, id=%" PRIu64
, tc
, id
);
102 BT_LIB_LOGD("Creating stream class object: %![tc-]+T, id=%" PRIu64
,
104 stream_class
= g_new0(struct bt_stream_class
, 1);
106 BT_LIB_LOGE_APPEND_CAUSE(
107 "Failed to allocate one stream class.");
111 bt_object_init_shared_with_parent(&stream_class
->base
,
112 destroy_stream_class
);
113 stream_class
->user_attributes
= bt_value_map_create();
114 if (!stream_class
->user_attributes
) {
115 BT_LIB_LOGE_APPEND_CAUSE(
116 "Failed to create a map value object.");
120 stream_class
->name
.str
= g_string_new(NULL
);
121 if (!stream_class
->name
.str
) {
122 BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
126 stream_class
->id
= id
;
127 stream_class
->assigns_automatic_event_class_id
= true;
128 stream_class
->assigns_automatic_stream_id
= true;
129 stream_class
->event_classes
= g_ptr_array_new_with_free_func(
130 (GDestroyNotify
) bt_object_try_spec_release
);
131 if (!stream_class
->event_classes
) {
132 BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GPtrArray.");
136 ret
= bt_object_pool_initialize(&stream_class
->packet_context_field_pool
,
137 (bt_object_pool_new_object_func
) bt_field_wrapper_new
,
138 (bt_object_pool_destroy_object_func
) free_field_wrapper
,
141 BT_LIB_LOGE_APPEND_CAUSE(
142 "Failed to initialize packet context field pool: ret=%d",
147 bt_object_set_parent(&stream_class
->base
, &tc
->base
);
148 g_ptr_array_add(tc
->stream_classes
, stream_class
);
149 bt_trace_class_freeze(tc
);
150 BT_LIB_LOGD("Created stream class object: %!+S", stream_class
);
154 BT_OBJECT_PUT_REF_AND_RESET(stream_class
);
161 struct bt_stream_class
*bt_stream_class_create(struct bt_trace_class
*tc
)
163 BT_ASSERT_PRE_NO_ERROR();
164 BT_ASSERT_PRE_TC_NON_NULL(tc
);
165 BT_ASSERT_PRE("trace-class-automatically-assigns-stream-class-ids",
166 tc
->assigns_automatic_stream_class_id
,
167 "Trace class does not automatically assigns stream class IDs: "
169 return create_stream_class_with_id(tc
,
170 (uint64_t) tc
->stream_classes
->len
);
174 struct bt_stream_class
*bt_stream_class_create_with_id(
175 struct bt_trace_class
*tc
, uint64_t id
)
177 BT_ASSERT_PRE_NO_ERROR();
178 BT_ASSERT_PRE_TC_NON_NULL(tc
);
180 "trace-class-does-not-automatically-assigns-stream-class-ids",
181 !tc
->assigns_automatic_stream_class_id
,
182 "Trace class automatically assigns stream class IDs: "
184 return create_stream_class_with_id(tc
, id
);
188 struct bt_trace_class
*bt_stream_class_borrow_trace_class(
189 struct bt_stream_class
*stream_class
)
191 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
192 return bt_stream_class_borrow_trace_class_inline(stream_class
);
196 const struct bt_trace_class
*bt_stream_class_borrow_trace_class_const(
197 const struct bt_stream_class
*stream_class
)
199 return bt_stream_class_borrow_trace_class((void *) stream_class
);
203 const char *bt_stream_class_get_name(const struct bt_stream_class
*stream_class
)
205 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
206 return stream_class
->name
.value
;
210 enum bt_stream_class_set_name_status
bt_stream_class_set_name(
211 struct bt_stream_class
*stream_class
,
214 BT_ASSERT_PRE_NO_ERROR();
215 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
216 BT_ASSERT_PRE_NAME_NON_NULL(name
);
217 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
218 g_string_assign(stream_class
->name
.str
, name
);
219 stream_class
->name
.value
= stream_class
->name
.str
->str
;
220 BT_LIB_LOGD("Set stream class's name: %!+S", stream_class
);
221 return BT_FUNC_STATUS_OK
;
225 uint64_t bt_stream_class_get_id(const struct bt_stream_class
*stream_class
)
227 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
228 return stream_class
->id
;
232 uint64_t bt_stream_class_get_event_class_count(
233 const struct bt_stream_class
*stream_class
)
235 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
236 return (uint64_t) stream_class
->event_classes
->len
;
240 struct bt_event_class
*bt_stream_class_borrow_event_class_by_index(
241 struct bt_stream_class
*stream_class
, uint64_t index
)
243 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
244 BT_ASSERT_PRE_DEV_VALID_INDEX(index
, stream_class
->event_classes
->len
);
245 return g_ptr_array_index(stream_class
->event_classes
, index
);
249 const struct bt_event_class
*
250 bt_stream_class_borrow_event_class_by_index_const(
251 const struct bt_stream_class
*stream_class
, uint64_t index
)
253 return bt_stream_class_borrow_event_class_by_index(
254 (void *) stream_class
, index
);
258 struct bt_event_class
*bt_stream_class_borrow_event_class_by_id(
259 struct bt_stream_class
*stream_class
, uint64_t id
)
261 struct bt_event_class
*event_class
= NULL
;
264 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
266 for (i
= 0; i
< stream_class
->event_classes
->len
; i
++) {
267 struct bt_event_class
*event_class_candidate
=
268 g_ptr_array_index(stream_class
->event_classes
, i
);
270 if (event_class_candidate
->id
== id
) {
271 event_class
= event_class_candidate
;
281 const struct bt_event_class
*
282 bt_stream_class_borrow_event_class_by_id_const(
283 const struct bt_stream_class
*stream_class
, uint64_t id
)
285 return bt_stream_class_borrow_event_class_by_id(
286 (void *) stream_class
, id
);
290 const struct bt_field_class
*
291 bt_stream_class_borrow_packet_context_field_class_const(
292 const struct bt_stream_class
*stream_class
)
294 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
295 return stream_class
->packet_context_fc
;
299 struct bt_field_class
*
300 bt_stream_class_borrow_packet_context_field_class(
301 struct bt_stream_class
*stream_class
)
303 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
304 return stream_class
->packet_context_fc
;
308 enum bt_stream_class_set_field_class_status
309 bt_stream_class_set_packet_context_field_class(
310 struct bt_stream_class
*stream_class
,
311 struct bt_field_class
*field_class
)
314 struct bt_resolve_field_path_context resolve_ctx
= {
315 .packet_context
= field_class
,
316 .event_common_context
= NULL
,
317 .event_specific_context
= NULL
,
318 .event_payload
= NULL
,
321 BT_ASSERT_PRE_NO_ERROR();
322 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
323 BT_ASSERT_PRE("supports-packets",
324 stream_class
->supports_packets
,
325 "Stream class does not support packets: %![sc-]+S",
327 BT_ASSERT_PRE_FC_NON_NULL(field_class
);
328 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
329 BT_ASSERT_PRE_FC_IS_STRUCT("field-class", field_class
,
330 "Packet context field class");
331 ret
= bt_resolve_field_paths(field_class
, &resolve_ctx
, __func__
);
334 * This is the only reason for which
335 * bt_resolve_field_paths() can fail: anything else
336 * would be because a precondition is not satisfied.
338 ret
= BT_FUNC_STATUS_MEMORY_ERROR
;
342 bt_field_class_make_part_of_trace_class(field_class
);
343 bt_object_put_ref(stream_class
->packet_context_fc
);
344 stream_class
->packet_context_fc
= field_class
;
345 bt_object_get_ref_no_null_check(stream_class
->packet_context_fc
);
346 bt_field_class_freeze(field_class
);
347 BT_LIB_LOGD("Set stream class's packet context field class: %!+S",
355 const struct bt_field_class
*
356 bt_stream_class_borrow_event_common_context_field_class_const(
357 const struct bt_stream_class
*stream_class
)
359 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
360 return stream_class
->event_common_context_fc
;
364 struct bt_field_class
*
365 bt_stream_class_borrow_event_common_context_field_class(
366 struct bt_stream_class
*stream_class
)
368 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
369 return stream_class
->event_common_context_fc
;
373 enum bt_stream_class_set_field_class_status
374 bt_stream_class_set_event_common_context_field_class(
375 struct bt_stream_class
*stream_class
,
376 struct bt_field_class
*field_class
)
379 struct bt_resolve_field_path_context resolve_ctx
= {
380 .packet_context
= NULL
,
381 .event_common_context
= field_class
,
382 .event_specific_context
= NULL
,
383 .event_payload
= NULL
,
386 BT_ASSERT_PRE_NO_ERROR();
387 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
388 BT_ASSERT_PRE_FC_NON_NULL(field_class
);
389 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
390 BT_ASSERT_PRE_FC_IS_STRUCT("field-class", field_class
,
391 "Event common context field class");
392 resolve_ctx
.packet_context
= stream_class
->packet_context_fc
;
393 ret
= bt_resolve_field_paths(field_class
, &resolve_ctx
, __func__
);
396 * This is the only reason for which
397 * bt_resolve_field_paths() can fail: anything else
398 * would be because a precondition is not satisfied.
400 ret
= BT_FUNC_STATUS_MEMORY_ERROR
;
404 bt_field_class_make_part_of_trace_class(field_class
);
405 bt_object_put_ref(stream_class
->event_common_context_fc
);
406 stream_class
->event_common_context_fc
= field_class
;
407 bt_object_get_ref_no_null_check(stream_class
->event_common_context_fc
);
408 bt_field_class_freeze(field_class
);
409 BT_LIB_LOGD("Set stream class's event common context field class: %!+S",
416 void _bt_stream_class_freeze(const struct bt_stream_class
*stream_class
)
418 /* The field classes and default clock class are already frozen */
419 BT_ASSERT(stream_class
);
420 BT_LIB_LOGD("Freezing stream class's user attributes: %!+v",
421 stream_class
->user_attributes
);
422 bt_value_freeze(stream_class
->user_attributes
);
423 BT_LIB_LOGD("Freezing stream class: %!+S", stream_class
);
424 ((struct bt_stream_class
*) stream_class
)->frozen
= true;
428 enum bt_stream_class_set_default_clock_class_status
429 bt_stream_class_set_default_clock_class(
430 struct bt_stream_class
*stream_class
,
431 struct bt_clock_class
*clock_class
)
433 BT_ASSERT_PRE_NO_ERROR();
434 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
435 BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class
);
436 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
437 bt_object_put_ref(stream_class
->default_clock_class
);
438 stream_class
->default_clock_class
= clock_class
;
439 bt_object_get_ref_no_null_check(stream_class
->default_clock_class
);
440 bt_clock_class_freeze(clock_class
);
441 BT_LIB_LOGD("Set stream class's default clock class: %!+S",
443 return BT_FUNC_STATUS_OK
;
447 struct bt_clock_class
*bt_stream_class_borrow_default_clock_class(
448 struct bt_stream_class
*stream_class
)
450 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
451 return stream_class
->default_clock_class
;
455 const struct bt_clock_class
*bt_stream_class_borrow_default_clock_class_const(
456 const struct bt_stream_class
*stream_class
)
458 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
459 return stream_class
->default_clock_class
;
463 bt_bool
bt_stream_class_assigns_automatic_event_class_id(
464 const struct bt_stream_class
*stream_class
)
466 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
467 return (bt_bool
) stream_class
->assigns_automatic_event_class_id
;
471 void bt_stream_class_set_assigns_automatic_event_class_id(
472 struct bt_stream_class
*stream_class
,
475 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
476 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
477 stream_class
->assigns_automatic_event_class_id
= (bool) value
;
478 BT_LIB_LOGD("Set stream class's automatic event class ID "
479 "assignment property: %!+S", stream_class
);
483 bt_bool
bt_stream_class_assigns_automatic_stream_id(
484 const struct bt_stream_class
*stream_class
)
486 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
487 return (bt_bool
) stream_class
->assigns_automatic_stream_id
;
491 void bt_stream_class_set_supports_discarded_events(
492 struct bt_stream_class
*stream_class
,
493 bt_bool supports_discarded_events
,
494 bt_bool with_default_clock_snapshots
)
496 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
497 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
498 BT_ASSERT_PRE("supports-discarded-events-for-default-clock-snapshots",
499 supports_discarded_events
||
500 !with_default_clock_snapshots
,
501 "Discarded events cannot have default clock snapshots when "
502 "not supported: %!+S", stream_class
);
503 BT_ASSERT_PRE("has-default-clock-class-for-default-clock-snapshots",
504 !with_default_clock_snapshots
||
505 stream_class
->default_clock_class
,
506 "Stream class has no default clock class: %!+S", stream_class
);
507 stream_class
->supports_discarded_events
=
508 (bool) supports_discarded_events
;
509 stream_class
->discarded_events_have_default_clock_snapshots
=
510 (bool) with_default_clock_snapshots
;
511 BT_LIB_LOGD("Set stream class's discarded events support property: "
512 "%!+S", stream_class
);
516 bt_bool
bt_stream_class_supports_discarded_events(
517 const struct bt_stream_class
*stream_class
)
519 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
520 return (bt_bool
) stream_class
->supports_discarded_events
;
524 bt_bool
bt_stream_class_discarded_events_have_default_clock_snapshots(
525 const struct bt_stream_class
*stream_class
)
527 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
528 return (bt_bool
) stream_class
->discarded_events_have_default_clock_snapshots
;
532 void bt_stream_class_set_supports_discarded_packets(
533 struct bt_stream_class
*stream_class
,
534 bt_bool supports_discarded_packets
,
535 bt_bool with_default_clock_snapshots
)
537 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
538 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
539 BT_ASSERT_PRE("supports-packets-for-discarded-packets-support",
540 !supports_discarded_packets
||
541 stream_class
->supports_packets
,
542 "Stream class does not support packets: %!+S",
544 BT_ASSERT_PRE("supports-discarded-packets-for-default-clock-snapshots",
545 supports_discarded_packets
||
546 !with_default_clock_snapshots
,
547 "Discarded packets cannot have default clock snapshots when "
548 "not supported: %!+S", stream_class
);
549 BT_ASSERT_PRE("has-default-clock-class-for-default-clock-snapshots",
550 !with_default_clock_snapshots
||
551 stream_class
->default_clock_class
,
552 "Stream class has no default clock class: %!+S", stream_class
);
553 stream_class
->supports_discarded_packets
=
554 (bool) supports_discarded_packets
;
555 stream_class
->discarded_packets_have_default_clock_snapshots
=
556 (bool) with_default_clock_snapshots
;
557 BT_LIB_LOGD("Set stream class's discarded packets support property: "
558 "%!+S", stream_class
);
562 bt_bool
bt_stream_class_supports_discarded_packets(
563 const struct bt_stream_class
*stream_class
)
565 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
566 return (bt_bool
) stream_class
->supports_discarded_packets
;
570 bt_bool
bt_stream_class_discarded_packets_have_default_clock_snapshots(
571 const struct bt_stream_class
*stream_class
)
573 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
574 return (bt_bool
) stream_class
->discarded_packets_have_default_clock_snapshots
;
578 void bt_stream_class_set_supports_packets(
579 struct bt_stream_class
*stream_class
,
580 bt_bool supports_packets
,
581 bt_bool with_beginning_default_clock_snapshot
,
582 bt_bool with_end_default_clock_snapshot
)
584 bt_bool with_default_clock_snapshot
=
585 with_beginning_default_clock_snapshot
||
586 with_end_default_clock_snapshot
;
587 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
588 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
589 BT_ASSERT_PRE("supports-packets-for-default-clock-snapshot",
591 !with_default_clock_snapshot
,
592 "Packets cannot have default clock snapshots when "
593 "not supported: %!+S", stream_class
);
594 BT_ASSERT_PRE("has-default-clock-class-for-default-clock-snapshot",
595 !with_default_clock_snapshot
||
596 stream_class
->default_clock_class
,
597 "Stream class has no default clock class: %!+S", stream_class
);
598 BT_ASSERT_PRE("supports-packets-for-packet-context-field-class",
599 supports_packets
|| !stream_class
->packet_context_fc
,
600 "Stream class already has a packet context field class: %!+S",
602 BT_ASSERT_PRE("supports-packets-for-discarded-packets-support",
603 supports_packets
|| !stream_class
->supports_discarded_packets
,
604 "Stream class already supports discarded packets: %!+S",
606 stream_class
->supports_packets
= (bool) supports_packets
;
607 stream_class
->packets_have_beginning_default_clock_snapshot
=
608 (bool) with_beginning_default_clock_snapshot
;
609 stream_class
->packets_have_end_default_clock_snapshot
=
610 (bool) with_end_default_clock_snapshot
;
611 BT_LIB_LOGD("Set stream class's packets support property: %!+S",
616 bt_bool
bt_stream_class_supports_packets(
617 const struct bt_stream_class
*stream_class
)
619 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
620 return (bt_bool
) stream_class
->supports_packets
;
624 bt_bool
bt_stream_class_packets_have_beginning_default_clock_snapshot(
625 const struct bt_stream_class
*stream_class
)
627 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
628 return (bt_bool
) stream_class
->packets_have_beginning_default_clock_snapshot
;
632 bt_bool
bt_stream_class_packets_have_end_default_clock_snapshot(
633 const struct bt_stream_class
*stream_class
)
635 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
636 return (bt_bool
) stream_class
->packets_have_end_default_clock_snapshot
;
640 void bt_stream_class_set_assigns_automatic_stream_id(
641 struct bt_stream_class
*stream_class
,
644 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
645 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
646 stream_class
->assigns_automatic_stream_id
= (bool) value
;
647 BT_LIB_LOGD("Set stream class's automatic stream ID "
648 "assignment property: %!+S", stream_class
);
652 const struct bt_value
*bt_stream_class_borrow_user_attributes_const(
653 const struct bt_stream_class
*stream_class
)
655 BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class
);
656 return stream_class
->user_attributes
;
660 struct bt_value
*bt_stream_class_borrow_user_attributes(
661 struct bt_stream_class
*stream_class
)
663 return (void *) bt_stream_class_borrow_user_attributes_const(
664 (void *) stream_class
);
668 void bt_stream_class_set_user_attributes(
669 struct bt_stream_class
*stream_class
,
670 const struct bt_value
*user_attributes
)
672 BT_ASSERT_PRE_SC_NON_NULL(stream_class
);
673 BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes
);
674 BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes
);
675 BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class
);
676 bt_object_put_ref_no_null_check(stream_class
->user_attributes
);
677 stream_class
->user_attributes
= (void *) user_attributes
;
678 bt_object_get_ref_no_null_check(stream_class
->user_attributes
);
682 void bt_stream_class_get_ref(const struct bt_stream_class
*stream_class
)
684 bt_object_get_ref(stream_class
);
688 void bt_stream_class_put_ref(const struct bt_stream_class
*stream_class
)
690 bt_object_put_ref(stream_class
);