lib: return `void` when setting a simple value with no side effects
[babeltrace.git] / lib / trace-ir / stream-class.c
... / ...
CommitLineData
1/*
2 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25#define BT_LOG_TAG "STREAM-CLASS"
26#include <babeltrace/lib-logging-internal.h>
27
28#include <babeltrace/assert-pre-internal.h>
29#include <babeltrace/trace-ir/clock-class-internal.h>
30#include <babeltrace/trace-ir/event-class-internal.h>
31#include <babeltrace/trace-ir/field-classes-internal.h>
32#include <babeltrace/trace-ir/fields-internal.h>
33#include <babeltrace/trace-ir/stream-class-internal.h>
34#include <babeltrace/trace-ir/private-trace.h>
35#include <babeltrace/trace-ir/trace-internal.h>
36#include <babeltrace/trace-ir/utils-internal.h>
37#include <babeltrace/trace-ir/field-wrapper-internal.h>
38#include <babeltrace/trace-ir/resolve-field-path-internal.h>
39#include <babeltrace/object.h>
40#include <babeltrace/compiler-internal.h>
41#include <babeltrace/align-internal.h>
42#include <babeltrace/endian-internal.h>
43#include <babeltrace/assert-internal.h>
44#include <babeltrace/property-internal.h>
45#include <inttypes.h>
46#include <stdint.h>
47#include <stdbool.h>
48
49#define BT_ASSERT_PRE_STREAM_CLASS_HOT(_sc) \
50 BT_ASSERT_PRE_HOT((_sc), "Stream class", ": %!+S", (_sc))
51
52static
53void destroy_stream_class(struct bt_object *obj)
54{
55 struct bt_stream_class *stream_class = (void *) obj;
56
57 BT_LIB_LOGD("Destroying stream class: %!+S", stream_class);
58 BT_LOGD_STR("Putting default clock class.");
59 bt_object_put_ref(stream_class->default_clock_class);
60
61 if (stream_class->event_classes) {
62 BT_LOGD_STR("Destroying event classes.");
63 g_ptr_array_free(stream_class->event_classes, TRUE);
64 }
65
66 if (stream_class->name.str) {
67 g_string_free(stream_class->name.str, TRUE);
68 }
69
70 BT_LOGD_STR("Putting event header field classe.");
71 bt_object_put_ref(stream_class->event_header_fc);
72 BT_LOGD_STR("Putting packet context field classe.");
73 bt_object_put_ref(stream_class->packet_context_fc);
74 BT_LOGD_STR("Putting event common context field classe.");
75 bt_object_put_ref(stream_class->event_common_context_fc);
76 bt_object_pool_finalize(&stream_class->event_header_field_pool);
77 bt_object_pool_finalize(&stream_class->packet_context_field_pool);
78 g_free(stream_class);
79}
80
81static
82void free_field_wrapper(struct bt_field_wrapper *field_wrapper,
83 struct bt_stream_class *stream_class)
84{
85 bt_field_wrapper_destroy((void *) field_wrapper);
86}
87
88BT_ASSERT_PRE_FUNC
89static
90bool stream_class_id_is_unique(struct bt_trace *trace, uint64_t id)
91{
92 uint64_t i;
93 bool is_unique = true;
94
95 for (i = 0; i < trace->stream_classes->len; i++) {
96 struct bt_stream_class *sc =
97 trace->stream_classes->pdata[i];
98
99 if (sc->id == id) {
100 is_unique = false;
101 goto end;
102 }
103 }
104
105end:
106 return is_unique;
107}
108
109static
110struct bt_stream_class *create_stream_class_with_id(struct bt_trace *trace,
111 uint64_t id)
112{
113 struct bt_stream_class *stream_class = NULL;
114 int ret;
115
116 BT_ASSERT(trace);
117 BT_ASSERT_PRE(stream_class_id_is_unique(trace, id),
118 "Duplicate stream class ID: %![trace-]+t, id=%" PRIu64,
119 trace, id);
120 BT_LIB_LOGD("Creating stream class object: %![trace-]+t, id=%" PRIu64,
121 trace, id);
122 stream_class = g_new0(struct bt_stream_class, 1);
123 if (!stream_class) {
124 BT_LOGE_STR("Failed to allocate one stream class.");
125 goto error;
126 }
127
128 bt_object_init_shared_with_parent(&stream_class->base,
129 destroy_stream_class);
130
131 stream_class->name.str = g_string_new(NULL);
132 if (!stream_class->name.str) {
133 BT_LOGE_STR("Failed to allocate a GString.");
134 ret = -1;
135 goto end;
136 }
137
138 stream_class->id = id;
139 stream_class->assigns_automatic_event_class_id = true;
140 stream_class->assigns_automatic_stream_id = true;
141 stream_class->event_classes = g_ptr_array_new_with_free_func(
142 (GDestroyNotify) bt_object_try_spec_release);
143 if (!stream_class->event_classes) {
144 BT_LOGE_STR("Failed to allocate a GPtrArray.");
145 goto error;
146 }
147
148 ret = bt_object_pool_initialize(&stream_class->event_header_field_pool,
149 (bt_object_pool_new_object_func) bt_field_wrapper_new,
150 (bt_object_pool_destroy_object_func) free_field_wrapper,
151 stream_class);
152 if (ret) {
153 BT_LOGE("Failed to initialize event header field pool: ret=%d",
154 ret);
155 goto error;
156 }
157
158 ret = bt_object_pool_initialize(&stream_class->packet_context_field_pool,
159 (bt_object_pool_new_object_func) bt_field_wrapper_new,
160 (bt_object_pool_destroy_object_func) free_field_wrapper,
161 stream_class);
162 if (ret) {
163 BT_LOGE("Failed to initialize packet context field pool: ret=%d",
164 ret);
165 goto error;
166 }
167
168 bt_object_set_parent(&stream_class->base, &trace->base);
169 g_ptr_array_add(trace->stream_classes, stream_class);
170 bt_trace_freeze(trace);
171 BT_LIB_LOGD("Created stream class object: %!+S", stream_class);
172 goto end;
173
174error:
175 BT_OBJECT_PUT_REF_AND_RESET(stream_class);
176
177end:
178 return stream_class;
179}
180
181struct bt_private_stream_class *bt_private_stream_class_create(
182 struct bt_private_trace *priv_trace)
183{
184 struct bt_trace *trace = (void *) priv_trace;
185
186 BT_ASSERT_PRE_NON_NULL(trace, "Trace");
187 BT_ASSERT_PRE(trace->assigns_automatic_stream_class_id,
188 "Trace does not automatically assigns stream class IDs: "
189 "%![sc-]+t", trace);
190 return (void *) create_stream_class_with_id(trace,
191 (uint64_t) trace->stream_classes->len);
192}
193
194struct bt_private_stream_class *bt_private_stream_class_create_with_id(
195 struct bt_private_trace *priv_trace, uint64_t id)
196{
197 struct bt_trace *trace = (void *) priv_trace;
198
199 BT_ASSERT_PRE_NON_NULL(trace, "Trace");
200 BT_ASSERT_PRE(!trace->assigns_automatic_stream_class_id,
201 "Trace automatically assigns stream class IDs: "
202 "%![sc-]+t", trace);
203 return (void *) create_stream_class_with_id(trace, id);
204}
205
206struct bt_trace *bt_stream_class_borrow_trace(struct bt_stream_class *stream_class)
207{
208 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
209 return bt_stream_class_borrow_trace_inline(stream_class);
210}
211
212struct bt_private_trace *bt_private_stream_class_borrow_trace(
213 struct bt_private_stream_class *stream_class)
214{
215 return (void *) bt_stream_class_borrow_trace((void *) stream_class);
216}
217
218const char *bt_stream_class_get_name(struct bt_stream_class *stream_class)
219{
220 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
221 return stream_class->name.value;
222}
223
224int bt_private_stream_class_set_name(
225 struct bt_private_stream_class *priv_stream_class,
226 const char *name)
227{
228 struct bt_stream_class *stream_class = (void *) priv_stream_class;
229
230 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
231 BT_ASSERT_PRE_NON_NULL(name, "Name");
232 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
233 g_string_assign(stream_class->name.str, name);
234 stream_class->name.value = stream_class->name.str->str;
235 BT_LIB_LOGV("Set stream class's name: %!+S", stream_class);
236 return 0;
237}
238
239uint64_t bt_stream_class_get_id(struct bt_stream_class *stream_class)
240{
241 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
242 return stream_class->id;
243}
244
245uint64_t bt_stream_class_get_event_class_count(
246 struct bt_stream_class *stream_class)
247{
248 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
249 return (uint64_t) stream_class->event_classes->len;
250}
251
252struct bt_event_class *bt_stream_class_borrow_event_class_by_index(
253 struct bt_stream_class *stream_class, uint64_t index)
254{
255 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
256 BT_ASSERT_PRE_VALID_INDEX(index, stream_class->event_classes->len);
257 return g_ptr_array_index(stream_class->event_classes, index);
258}
259
260struct bt_private_event_class *
261bt_private_stream_class_borrow_event_class_by_index(
262 struct bt_private_stream_class *stream_class, uint64_t index)
263{
264 return (void *) bt_stream_class_borrow_event_class_by_index(
265 (void *) stream_class, index);
266}
267
268struct bt_event_class *bt_stream_class_borrow_event_class_by_id(
269 struct bt_stream_class *stream_class, uint64_t id)
270{
271 struct bt_event_class *event_class = NULL;
272 uint64_t i;
273
274 BT_ASSERT_PRE_NON_NULL(stream_class, "Trace");
275
276 for (i = 0; i < stream_class->event_classes->len; i++) {
277 struct bt_event_class *event_class_candidate =
278 g_ptr_array_index(stream_class->event_classes, i);
279
280 if (event_class_candidate->id == id) {
281 event_class = event_class_candidate;
282 goto end;
283 }
284 }
285
286end:
287 return event_class;
288}
289
290struct bt_private_event_class *
291bt_private_stream_class_borrow_event_class_by_id(
292 struct bt_private_stream_class *stream_class, uint64_t id)
293{
294 return (void *) bt_stream_class_borrow_event_class_by_id(
295 (void *) stream_class, id);
296}
297
298struct bt_field_class *bt_stream_class_borrow_packet_context_field_class(
299 struct bt_stream_class *stream_class)
300{
301 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
302 return stream_class->packet_context_fc;
303}
304
305struct bt_private_field_class *
306bt_private_stream_class_borrow_packet_context_field_class(
307 struct bt_private_stream_class *stream_class)
308{
309 return (void *) bt_stream_class_borrow_packet_context_field_class(
310 (void *) stream_class);
311}
312
313int bt_private_stream_class_set_packet_context_field_class(
314 struct bt_private_stream_class *priv_stream_class,
315 struct bt_private_field_class *priv_field_class)
316{
317 int ret;
318 struct bt_stream_class *stream_class = (void *) priv_stream_class;
319 struct bt_field_class *field_class = (void *) priv_field_class;
320 struct bt_resolve_field_path_context resolve_ctx = {
321 .packet_header = NULL,
322 .packet_context = field_class,
323 .event_header = NULL,
324 .event_common_context = NULL,
325 .event_specific_context = NULL,
326 .event_payload = NULL,
327 };
328
329 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
330 BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
331 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
332 BT_ASSERT_PRE(bt_field_class_get_type(field_class) ==
333 BT_FIELD_CLASS_TYPE_STRUCTURE,
334 "Packet context field classe is not a structure field classe: %!+F",
335 field_class);
336 resolve_ctx.packet_header =
337 bt_stream_class_borrow_trace_inline(stream_class)->packet_header_fc;
338 ret = bt_resolve_field_paths(field_class, &resolve_ctx);
339 if (ret) {
340 goto end;
341 }
342
343 bt_field_class_make_part_of_trace(field_class);
344 bt_object_put_ref(stream_class->packet_context_fc);
345 stream_class->packet_context_fc = bt_object_get_ref(field_class);
346 bt_field_class_freeze(field_class);
347 BT_LIB_LOGV("Set stream class's packet context field classe: %!+S",
348 stream_class);
349
350end:
351 return ret;
352}
353
354struct bt_field_class *bt_stream_class_borrow_event_header_field_class(
355 struct bt_stream_class *stream_class)
356{
357 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
358 return stream_class->event_header_fc;
359}
360
361struct bt_private_field_class *
362bt_private_stream_class_borrow_event_header_field_class(
363 struct bt_private_stream_class *stream_class)
364{
365 return (void *) bt_stream_class_borrow_event_header_field_class(
366 (void *) stream_class);
367}
368
369int bt_private_stream_class_set_event_header_field_class(
370 struct bt_private_stream_class *priv_stream_class,
371 struct bt_private_field_class *priv_field_class)
372{
373 int ret;
374 struct bt_stream_class *stream_class = (void *) priv_stream_class;
375 struct bt_field_class *field_class = (void *) priv_field_class;
376 struct bt_resolve_field_path_context resolve_ctx = {
377 .packet_header = NULL,
378 .packet_context = NULL,
379 .event_header = field_class,
380 .event_common_context = NULL,
381 .event_specific_context = NULL,
382 .event_payload = NULL,
383 };
384
385 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
386 BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
387 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
388 BT_ASSERT_PRE(bt_field_class_get_type(field_class) ==
389 BT_FIELD_CLASS_TYPE_STRUCTURE,
390 "Event header field classe is not a structure field classe: %!+F",
391 field_class);
392 resolve_ctx.packet_header =
393 bt_stream_class_borrow_trace_inline(stream_class)->packet_header_fc;
394 resolve_ctx.packet_context = stream_class->packet_context_fc;
395 ret = bt_resolve_field_paths(field_class, &resolve_ctx);
396 if (ret) {
397 goto end;
398 }
399
400 bt_field_class_make_part_of_trace(field_class);
401 bt_object_put_ref(stream_class->event_header_fc);
402 stream_class->event_header_fc = bt_object_get_ref(field_class);
403 bt_field_class_freeze(field_class);
404 BT_LIB_LOGV("Set stream class's event header field classe: %!+S",
405 stream_class);
406
407end:
408 return ret;
409}
410
411struct bt_field_class *bt_stream_class_borrow_event_common_context_field_class(
412 struct bt_stream_class *stream_class)
413{
414 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
415 return stream_class->event_common_context_fc;
416}
417
418struct bt_private_field_class *
419bt_private_stream_class_borrow_event_common_context_field_class(
420 struct bt_private_stream_class *stream_class)
421{
422 return (void *) bt_stream_class_borrow_event_common_context_field_class(
423 (void *) stream_class);
424}
425
426int bt_private_stream_class_set_event_common_context_field_class(
427 struct bt_private_stream_class *priv_stream_class,
428 struct bt_private_field_class *priv_field_class)
429{
430 int ret;
431 struct bt_stream_class *stream_class = (void *) priv_stream_class;
432 struct bt_field_class *field_class = (void *) priv_field_class;
433 struct bt_resolve_field_path_context resolve_ctx = {
434 .packet_header = NULL,
435 .packet_context = NULL,
436 .event_header = NULL,
437 .event_common_context = field_class,
438 .event_specific_context = NULL,
439 .event_payload = NULL,
440 };
441
442 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
443 BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
444 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
445 BT_ASSERT_PRE(bt_field_class_get_type(field_class) ==
446 BT_FIELD_CLASS_TYPE_STRUCTURE,
447 "Event common context field classe is not a structure field classe: %!+F",
448 field_class);
449 resolve_ctx.packet_header =
450 bt_stream_class_borrow_trace_inline(stream_class)->packet_header_fc;
451 resolve_ctx.packet_context = stream_class->packet_context_fc;
452 resolve_ctx.event_header = stream_class->event_header_fc;
453 ret = bt_resolve_field_paths(field_class, &resolve_ctx);
454 if (ret) {
455 goto end;
456 }
457
458 bt_field_class_make_part_of_trace(field_class);
459 bt_object_put_ref(stream_class->event_common_context_fc);
460 stream_class->event_common_context_fc = bt_object_get_ref(field_class);
461 bt_field_class_freeze(field_class);
462 BT_LIB_LOGV("Set stream class's event common context field classe: %!+S",
463 stream_class);
464
465end:
466 return ret;
467}
468
469BT_HIDDEN
470void _bt_stream_class_freeze(struct bt_stream_class *stream_class)
471{
472 /* The field classes and default clock class are already frozen */
473 BT_ASSERT(stream_class);
474 BT_LIB_LOGD("Freezing stream class: %!+S", stream_class);
475 stream_class->frozen = true;
476}
477
478int bt_private_stream_class_set_default_clock_class(
479 struct bt_private_stream_class *priv_stream_class,
480 struct bt_clock_class *clock_class)
481{
482 struct bt_stream_class *stream_class = (void *) priv_stream_class;
483
484 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
485 BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
486 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
487 bt_object_put_ref(stream_class->default_clock_class);
488 stream_class->default_clock_class = bt_object_get_ref(clock_class);
489 bt_clock_class_freeze(clock_class);
490 BT_LIB_LOGV("Set stream class's default clock class: %!+S",
491 stream_class);
492 return 0;
493}
494
495struct bt_clock_class *bt_stream_class_borrow_default_clock_class(
496 struct bt_stream_class *stream_class)
497{
498 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
499 return stream_class->default_clock_class;
500}
501
502bt_bool bt_stream_class_assigns_automatic_event_class_id(
503 struct bt_stream_class *stream_class)
504{
505 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
506 return (bt_bool) stream_class->assigns_automatic_event_class_id;
507}
508
509void bt_private_stream_class_set_assigns_automatic_event_class_id(
510 struct bt_private_stream_class *priv_stream_class,
511 bt_bool value)
512{
513 struct bt_stream_class *stream_class = (void *) priv_stream_class;
514
515 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
516 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
517 stream_class->assigns_automatic_event_class_id = (bool) value;
518 BT_LIB_LOGV("Set stream class's automatic event class ID "
519 "assignment property: %!+S", stream_class);
520}
521
522bt_bool bt_stream_class_assigns_automatic_stream_id(
523 struct bt_stream_class *stream_class)
524{
525 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
526 return (bt_bool) stream_class->assigns_automatic_stream_id;
527}
528
529void bt_private_stream_class_set_assigns_automatic_stream_id(
530 struct bt_private_stream_class *priv_stream_class,
531 bt_bool value)
532{
533 struct bt_stream_class *stream_class = (void *) priv_stream_class;
534
535 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
536 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
537 stream_class->assigns_automatic_stream_id = (bool) value;
538 BT_LIB_LOGV("Set stream class's automatic stream ID "
539 "assignment property: %!+S", stream_class);
540}
541
542bt_bool bt_stream_class_packets_have_discarded_event_counter_snapshot(
543 struct bt_stream_class *stream_class)
544{
545 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
546 return (bt_bool) stream_class->packets_have_discarded_event_counter_snapshot;
547}
548
549void bt_private_stream_class_set_packets_have_discarded_event_counter_snapshot(
550 struct bt_private_stream_class *priv_stream_class,
551 bt_bool value)
552{
553 struct bt_stream_class *stream_class = (void *) priv_stream_class;
554
555 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
556 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
557 stream_class->packets_have_discarded_event_counter_snapshot =
558 (bool) value;
559 BT_LIB_LOGV("Set stream class's "
560 "\"packets have discarded event counter snapshot\" property: "
561 "%!+S", stream_class);
562}
563
564bt_bool bt_stream_class_packets_have_packet_counter_snapshot(
565 struct bt_stream_class *stream_class)
566{
567 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
568 return (bt_bool) stream_class->packets_have_packet_counter_snapshot;
569}
570
571void bt_private_stream_class_set_packets_have_packet_counter_snapshot(
572 struct bt_private_stream_class *priv_stream_class,
573 bt_bool value)
574{
575 struct bt_stream_class *stream_class = (void *) priv_stream_class;
576
577 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
578 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
579 stream_class->packets_have_packet_counter_snapshot =
580 (bool) value;
581 BT_LIB_LOGV("Set stream class's "
582 "\"packets have packet counter snapshot\" property: "
583 "%!+S", stream_class);
584}
585
586bt_bool bt_stream_class_packets_have_default_beginning_clock_value(
587 struct bt_stream_class *stream_class)
588{
589 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
590 return (bt_bool) stream_class->packets_have_default_beginning_cv;
591}
592
593void bt_private_stream_class_set_packets_have_default_beginning_clock_value(
594 struct bt_private_stream_class *priv_stream_class,
595 bt_bool value)
596{
597 struct bt_stream_class *stream_class = (void *) priv_stream_class;
598
599 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
600 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
601 BT_ASSERT_PRE(!value || stream_class->default_clock_class,
602 "Stream class does not have a default clock class: %!+S",
603 stream_class);
604 stream_class->packets_have_default_beginning_cv = (bool) value;
605 BT_LIB_LOGV("Set stream class's "
606 "\"packets have default beginning clock value\" property: "
607 "%!+S", stream_class);
608}
609
610bt_bool bt_stream_class_packets_have_default_end_clock_value(
611 struct bt_stream_class *stream_class)
612{
613 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
614 return (bt_bool) stream_class->packets_have_default_end_cv;
615}
616
617void bt_private_stream_class_set_packets_have_default_end_clock_value(
618 struct bt_private_stream_class *priv_stream_class,
619 bt_bool value)
620{
621 struct bt_stream_class *stream_class = (void *) priv_stream_class;
622
623 BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
624 BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
625 BT_ASSERT_PRE(!value || stream_class->default_clock_class,
626 "Stream class does not have a default clock class: %!+S",
627 stream_class);
628 stream_class->packets_have_default_end_cv = (bool) value;
629 BT_LIB_LOGV("Set stream class's "
630 "\"packets have default end clock value\" property: "
631 "%!+S", stream_class);
632}
633
634bt_bool bt_stream_class_default_clock_is_always_known(
635 struct bt_stream_class *stream_class)
636{
637 /* BT_CLOCK_VALUE_STATUS_UNKNOWN is not supported as of 2.0 */
638 return BT_TRUE;
639}
This page took 0.034487 seconds and 4 git commands to generate.