ir: trace: pass remove listeners when adding listeners
[babeltrace.git] / include / babeltrace / ctf-ir / trace-internal.h
index 03a7ebf1c3f6c8155561cd48b7c511df7a30995e..f2275fb7e7a7d4d9ef730c58104fbe799f1d61cc 100644 (file)
 #include <babeltrace/object-internal.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/values.h>
+#include <babeltrace/types.h>
 #include <glib.h>
 #include <sys/types.h>
-#include <uuid/uuid.h>
+#include <babeltrace/compat/uuid-internal.h>
 
 enum field_type_alias {
        FIELD_TYPE_ALIAS_UINT5_T = 0,
@@ -51,14 +52,15 @@ struct bt_ctf_trace {
        struct bt_object base;
        GString *name;
        int frozen;
-       uuid_t uuid;
-       int byte_order; /* A value defined in Babeltrace's "endian.h" */
+       unsigned char uuid[BABELTRACE_UUID_LEN];
+       bt_bool uuid_set;
+       enum bt_ctf_byte_order native_byte_order;
        struct bt_value *environment;
-       GPtrArray *clocks; /* Array of pointers to bt_ctf_clock */
+       GPtrArray *clocks; /* Array of pointers to bt_ctf_clock_class */
        GPtrArray *stream_classes; /* Array of ptrs to bt_ctf_stream_class */
        GPtrArray *streams; /* Array of ptrs to bt_ctf_stream */
        struct bt_ctf_field_type *packet_header_type;
-       uint64_t next_stream_id;
+       int64_t next_stream_id;
        int is_created_by_writer;
 
        /*
@@ -67,6 +69,9 @@ struct bt_ctf_trace {
         */
        int valid;
        GPtrArray *listeners; /* Array of struct listener_wrapper */
+       GArray *is_static_listeners;
+       bt_bool is_static;
+       bt_bool in_remove_listener;
 };
 
 struct metadata_context {
@@ -85,4 +90,53 @@ BT_HIDDEN
 int bt_ctf_trace_object_modification(struct bt_ctf_object *object,
                void *trace_ptr);
 
+BT_HIDDEN
+bt_bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace,
+               struct bt_ctf_clock_class *clock_class);
+
+/**
+@brief User function type to use with bt_ctf_trace_add_listener().
+
+@param[in] obj New CTF IR object which is part of the trace
+               class hierarchy.
+@param[in] data        User data.
+
+@prenotnull{obj}
+*/
+typedef void (*bt_ctf_listener_cb)(struct bt_ctf_object *obj, void *data);
+
+/**
+@brief Adds the trace class modification listener \p listener to
+       the CTF IR trace class \p trace_class.
+
+Once you add \p listener to \p trace_class, whenever \p trace_class
+is modified, \p listener is called with the new element and with
+\p data (user data).
+
+@param[in] trace_class Trace class to which to add \p listener.
+@param[in] listener    Modification listener function.
+@param[in] data                User data.
+@returns               0 on success, or a negative value on error.
+
+@prenotnull{trace_class}
+@prenotnull{listener}
+@postrefcountsame{trace_class}
+*/
+BT_HIDDEN
+int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace_class,
+               bt_ctf_listener_cb listener, void *data);
+
+/*
+ * bt_ctf_trace_get_metadata_string: get metadata string.
+ *
+ * Get the trace's TSDL metadata. The caller assumes the ownership of the
+ * returned string.
+ *
+ * @param trace Trace instance.
+ *
+ * Returns the metadata string on success, NULL on error.
+ */
+BT_HIDDEN
+char *bt_ctf_trace_get_metadata_string(struct bt_ctf_trace *trace);
+
 #endif /* BABELTRACE_CTF_IR_TRACE_INTERNAL_H */
This page took 0.034876 seconds and 4 git commands to generate.