Make API CTF-agnostic
[babeltrace.git] / include / babeltrace / ctf-ir / stream-class-internal.h
index 6a167c9371267cf2302844cf46ca6de1f5b7ad3a..844a0c713de80550330b06ad6358e0d0cfa5b1fb 100644 (file)
 
 #include <babeltrace/assert-internal.h>
 #include <babeltrace/common-internal.h>
-#include <babeltrace/ctf-ir/validation-internal.h>
 #include <babeltrace/ctf-ir/field-types-internal.h>
 #include <babeltrace/ctf-ir/utils-internal.h>
-#include <babeltrace/ctf-ir/visitor.h>
 #include <babeltrace/ctf-ir/stream-class.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/object-pool-internal.h>
 
 struct bt_stream_class {
        struct bt_object base;
-       GString *name;
 
-       /* Array of pointers to event class addresses */
+       struct {
+               GString *str;
+
+               /* NULL or `str->str` above */
+               const char *value;
+       } name;
+
+       uint64_t id;
+       bool assigns_automatic_event_class_id;
+       bool assigns_automatic_stream_id;
+       bool packets_have_discarded_event_counter_snapshot;
+       bool packets_have_packet_counter_snapshot;
+       bool packets_have_default_beginning_cv;
+       bool packets_have_default_end_cv;
+       struct bt_field_type *packet_context_ft;
+       struct bt_field_type *event_header_ft;
+       struct bt_field_type *event_common_context_ft;
+       struct bt_clock_class *default_clock_class;
+
+       /* Array of `struct bt_event_class *` */
        GPtrArray *event_classes;
 
-       /* event class id (int64_t) to event class address */
-       GHashTable *event_classes_ht;
-       int id_set;
-       int64_t id;
-       int64_t next_event_id;
-       struct bt_field_type *packet_context_field_type;
-       struct bt_field_type *event_header_field_type;
-       struct bt_field_type *event_context_field_type;
-       int frozen;
-       int byte_order;
-
-       /*
-        * This flag indicates if the stream class is valid. A valid
-        * stream class is _always_ frozen.
-        */
-       int valid;
-
-       /*
-        * Unique clock class mapped to any field type within this
-        * stream class, including all the stream class's event class
-        * field types. This is only set if the stream class is frozen.
-        *
-        * If the stream class is frozen and this is still NULL, it is
-        * still possible that it becomes non-NULL because
-        * bt_stream_class_add_event_class() can add an event class
-        * containing a field type mapped to some clock class. In this
-        * case, this is the mapped clock class, and at this point, both
-        * the new event class and the stream class are frozen, so the
-        * next added event classes are expected to contain field types
-        * which only map to this specific clock class.
-        *
-        * If this is a CTF writer stream class, then this is the
-        * backing clock class of the `clock` member above.
-        */
-       struct bt_clock_class *clock_class;
-
        /* Pool of `struct bt_field_wrapper *` */
        struct bt_object_pool event_header_field_pool;
 
        /* Pool of `struct bt_field_wrapper *` */
        struct bt_object_pool packet_context_field_pool;
-};
-
-struct bt_event_class;
 
-BT_HIDDEN
-void bt_stream_class_freeze(struct bt_stream_class *stream_class);
+       bool frozen;
+};
 
 BT_HIDDEN
-int bt_stream_class_validate_single_clock_class(
-               struct bt_stream_class *stream_class,
-               struct bt_clock_class **expected_clock_class);
+void _bt_stream_class_freeze(struct bt_stream_class *stream_class);
 
-BT_HIDDEN
-int bt_stream_class_visit(struct bt_stream_class *stream_class,
-               bt_visitor visitor, void *data);
+#ifdef BT_DEV_MODE
+# define bt_stream_class_freeze                _bt_stream_class_freeze
+#else
+# define bt_stream_class_freeze(_sc)
+#endif
 
 static inline
-void _bt_stream_class_set_id(
-               struct bt_stream_class *stream_class, int64_t id)
+struct bt_trace *bt_stream_class_borrow_trace_inline(
+               struct bt_stream_class *stream_class)
 {
        BT_ASSERT(stream_class);
-       stream_class->id = id;
-       stream_class->id_set = 1;
-       BT_LOGV("Set stream class's ID (internal): "
-               "addr=%p, name=\"%s\", id=%" PRId64,
-               stream_class, bt_stream_class_get_name(stream_class),
-               bt_stream_class_get_id(stream_class));
-}
-
-static inline
-int bt_stream_class_set_id_no_check(
-               struct bt_stream_class *stream_class, int64_t id)
-{
-       _bt_stream_class_set_id(stream_class, id);
-       return 0;
+       return (void *) bt_object_borrow_parent(&stream_class->base);
 }
 
 #endif /* BABELTRACE_CTF_IR_STREAM_CLASS_INTERNAL_H */
This page took 0.026289 seconds and 4 git commands to generate.