| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com> |
| 5 | * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef BABELTRACE_LIB_TRACE_IR_STREAM_H |
| 9 | #define BABELTRACE_LIB_TRACE_IR_STREAM_H |
| 10 | |
| 11 | #include <babeltrace2/trace-ir/stream.h> |
| 12 | #include "lib/object.h" |
| 13 | #include "lib/object-pool.h" |
| 14 | #include <glib.h> |
| 15 | #include <stdbool.h> |
| 16 | |
| 17 | struct bt_stream_class; |
| 18 | struct bt_stream; |
| 19 | |
| 20 | struct bt_stream { |
| 21 | struct bt_object base; |
| 22 | |
| 23 | /* Owned by this */ |
| 24 | struct bt_value *user_attributes; |
| 25 | |
| 26 | /* Owned by this */ |
| 27 | struct bt_stream_class *class; |
| 28 | |
| 29 | gchar *name; |
| 30 | |
| 31 | uint64_t id; |
| 32 | |
| 33 | /* Pool of `struct bt_packet *` */ |
| 34 | struct bt_object_pool packet_pool; |
| 35 | |
| 36 | bool frozen; |
| 37 | }; |
| 38 | |
| 39 | void _bt_stream_freeze(const struct bt_stream *stream); |
| 40 | |
| 41 | #ifdef BT_DEV_MODE |
| 42 | # define bt_stream_freeze _bt_stream_freeze |
| 43 | #else |
| 44 | # define bt_stream_freeze(_stream) |
| 45 | #endif |
| 46 | |
| 47 | static inline |
| 48 | struct bt_trace *bt_stream_borrow_trace_inline(const struct bt_stream *stream) |
| 49 | { |
| 50 | BT_ASSERT_DBG(stream); |
| 51 | return (void *) bt_object_borrow_parent(&stream->base); |
| 52 | } |
| 53 | |
| 54 | #endif /* BABELTRACE_LIB_TRACE_IR_STREAM_H */ |