*/
#include <babeltrace/ctf-ir/field-types.h>
+#include <babeltrace/ctf-ir/visitor.h>
#include <babeltrace/values.h>
+#include <babeltrace/plugin/notification/notification.h>
#include <stdint.h>
#ifdef __cplusplus
struct bt_ctf_stream_class;
struct bt_ctf_clock;
+/**
+ * Trace modification handling function type.
+ *
+ * Callback invoked whenever an element is added to a trace's hierachy.
+ *
+ * @param element New element
+ * @param data Handler private data
+ */
+typedef void (*bt_ctf_listener_cb)(
+ struct bt_ctf_ir_element *element, void *data);
+
/*
* bt_ctf_trace_create: create a trace instance.
*
extern int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace,
struct bt_ctf_field_type *packet_header_type);
+/*
+ * bt_ctf_trace_visit: visit a trace's hierarchy.
+ *
+ * Recursively walk a trace's hierarchy and call visitor on each of its
+ * elements.
+ *
+ * @param trace Trace instance.
+ * @param visitor visitor function to invoke for each element.
+ * @param data user data passed to the visitor.
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_trace_visit(struct bt_ctf_trace *trace,
+ bt_ctf_ir_visitor visitor, void *data);
+
+/*
+ * bt_ctf_trace_add_listener: add a trace modification listener
+ * which will be invoked whenever a trace's schema is modified.
+ *
+ * Register a modification listener to a trace.
+ *
+ * @param trace Trace instance.
+ * @param listener Callback to invoke on trace modification.
+ * @param listener_data Private data passed to the listener.
+ *
+ * Returns 0 on success, a negative value on error.
+ *
+ * Note: the listener will be used to serialize the trace's current
+ * state on registration. It will then be invoked on any change occuring within
+ * the trace's hierarchy.
+ */
+extern int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace,
+ bt_ctf_listener_cb listener, void *listener_data);
+
#ifdef __cplusplus
}
#endif