| 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_TRACE_IR_STREAM_CLASS_INTERNAL_H |
| 9 | #define BABELTRACE_TRACE_IR_STREAM_CLASS_INTERNAL_H |
| 10 | |
| 11 | #include "common/assert.h" |
| 12 | #include "common/common.h" |
| 13 | #include <babeltrace2/trace-ir/stream-class.h> |
| 14 | #include "lib/object.h" |
| 15 | #include "lib/object-pool.h" |
| 16 | #include "common/macros.h" |
| 17 | #include <glib.h> |
| 18 | #include <inttypes.h> |
| 19 | #include <stdbool.h> |
| 20 | |
| 21 | #include "field-class.h" |
| 22 | #include "utils.h" |
| 23 | |
| 24 | struct bt_stream_class { |
| 25 | struct bt_object base; |
| 26 | |
| 27 | /* Owned by this */ |
| 28 | struct bt_value *user_attributes; |
| 29 | |
| 30 | struct { |
| 31 | GString *str; |
| 32 | |
| 33 | /* NULL or `str->str` above */ |
| 34 | const char *value; |
| 35 | } name; |
| 36 | |
| 37 | uint64_t id; |
| 38 | bool assigns_automatic_event_class_id; |
| 39 | bool assigns_automatic_stream_id; |
| 40 | bool supports_packets; |
| 41 | bool packets_have_beginning_default_clock_snapshot; |
| 42 | bool packets_have_end_default_clock_snapshot; |
| 43 | bool supports_discarded_events; |
| 44 | bool supports_discarded_packets; |
| 45 | bool discarded_events_have_default_clock_snapshots; |
| 46 | bool discarded_packets_have_default_clock_snapshots; |
| 47 | struct bt_field_class *packet_context_fc; |
| 48 | struct bt_field_class *event_common_context_fc; |
| 49 | struct bt_clock_class *default_clock_class; |
| 50 | |
| 51 | /* Array of `struct bt_event_class *` */ |
| 52 | GPtrArray *event_classes; |
| 53 | |
| 54 | /* Pool of `struct bt_field_wrapper *` */ |
| 55 | struct bt_object_pool packet_context_field_pool; |
| 56 | |
| 57 | bool frozen; |
| 58 | }; |
| 59 | |
| 60 | BT_HIDDEN |
| 61 | void _bt_stream_class_freeze(const struct bt_stream_class *stream_class); |
| 62 | |
| 63 | #ifdef BT_DEV_MODE |
| 64 | # define bt_stream_class_freeze _bt_stream_class_freeze |
| 65 | #else |
| 66 | # define bt_stream_class_freeze(_sc) |
| 67 | #endif |
| 68 | |
| 69 | static inline |
| 70 | struct bt_trace_class *bt_stream_class_borrow_trace_class_inline( |
| 71 | const struct bt_stream_class *stream_class) |
| 72 | { |
| 73 | BT_ASSERT_DBG(stream_class); |
| 74 | return (void *) bt_object_borrow_parent(&stream_class->base); |
| 75 | } |
| 76 | |
| 77 | #endif /* BABELTRACE_TRACE_IR_STREAM_CLASS_INTERNAL_H */ |