Add event header accessors and support for custom event headers
[babeltrace.git] / include / babeltrace / ctf-ir / stream-class.h
index ef6bc778d535c94724fe8a6e7949068fe970208a..b52dcb78c6a6004f0465784abf16b7e12952f10b 100644 (file)
@@ -44,6 +44,19 @@ struct bt_ctf_clock;
  * Allocate a new stream class of the given name. The creation of an event class
  * sets its reference count to 1.
  *
+ * A stream class' packet context is a structure initialized with the following
+ * fields:
+ *     - uint64_t timestamp_begin
+ *     - uint64_t timestamp_end
+ *     - uint64_t content_size
+ *     - uint64_t packet_size
+ *     - uint64_t events_discarded
+ *
+ * A stream class's event header is a structure initialized the following
+ * fields:
+ *  - uint32_t id
+ *  - uint64_t timestamp
+ *
  * @param name Stream name.
  *
  * Returns an allocated stream class on success, NULL on error.
@@ -119,6 +132,8 @@ extern int bt_ctf_stream_class_set_id(
  * The stream class will share the ownership of "event_class" by incrementing
  * its reference count.
  *
+ * Note that an event class may only be added to one stream class.
+ *
  * @param stream_class Stream class.
  * @param event_class Event class to add to the provided stream class.
  *
@@ -136,7 +151,7 @@ extern int bt_ctf_stream_class_add_event_class(
  *
  * Returns the stream class' event count, a negative value on error.
  */
-extern int64_t bt_ctf_stream_class_get_event_class_count(
+extern int bt_ctf_stream_class_get_event_class_count(
                struct bt_ctf_stream_class *stream_class);
 
 /*
@@ -148,7 +163,7 @@ extern int64_t bt_ctf_stream_class_get_event_class_count(
  * Returns event class, NULL on error.
  */
 extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class(
-               struct bt_ctf_stream_class *stream_class, size_t index);
+               struct bt_ctf_stream_class *stream_class, int index);
 
 /*
  * bt_ctf_stream_class_get_event_class_by_name: Get stream class event class by
@@ -162,6 +177,80 @@ extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class(
 extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_name(
                struct bt_ctf_stream_class *stream_class, const char *name);
 
+/*
+ * bt_ctf_stream_class_get_packet_context_type: get the stream class' packet
+ * context type.
+ *
+ * @param stream_class Stream class.
+ *
+ * Returns the packet context's type (a structure), NULL on error.
+ */
+extern struct bt_ctf_field_type *bt_ctf_stream_class_get_packet_context_type(
+               struct bt_ctf_stream_class *stream_class);
+
+/*
+ * bt_ctf_stream_class_set_packet_context_type: set the stream class' packet
+ * context type.
+ *
+ * @param stream_class Stream class.
+ * @param packet_context_type Packet context type (must be a structure).
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_stream_class_set_packet_context_type(
+               struct bt_ctf_stream_class *stream_class,
+               struct bt_ctf_field_type *packet_context_type);
+
+/*
+ * bt_ctf_stream_class_get_event_header_type: get the stream class'
+ * event header type.
+ *
+ * @param stream_class Stream class.
+ *
+ * Returns the stream event header's type (a structure), NULL on error.
+ */
+extern struct bt_ctf_field_type *
+bt_ctf_stream_class_get_event_header_type(
+               struct bt_ctf_stream_class *stream_class);
+
+/*
+ * bt_ctf_stream_class_set_event_header_type: set the stream class'
+ * event header type.
+ *
+ * @param stream_class Stream class.
+ * @param event_header_type Event header type (must be a structure).
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_stream_class_set_event_header_type(
+               struct bt_ctf_stream_class *stream_class,
+               struct bt_ctf_field_type *event_header_type);
+
+/*
+ * bt_ctf_stream_class_get_event_context_type: get the stream class'
+ * event context type.
+ *
+ * @param stream_class Stream class.
+ *
+ * Returns the stream event context's type (a structure), NULL on error.
+ */
+extern struct bt_ctf_field_type *
+bt_ctf_stream_class_get_event_context_type(
+               struct bt_ctf_stream_class *stream_class);
+
+/*
+ * bt_ctf_stream_class_set_event_context_type: set the stream class'
+ * event context type.
+ *
+ * @param stream_class Stream class.
+ * @param event_context_type Event context type (must be a structure).
+ *
+ * Returns 0 on success, a negative value on error.
+ */
+extern int bt_ctf_stream_class_set_event_context_type(
+               struct bt_ctf_stream_class *stream_class,
+               struct bt_ctf_field_type *event_context_type);
+
 /*
  * bt_ctf_stream_class_get and bt_ctf_stream_class_put: increment and
  * decrement the stream class' reference count.
This page took 0.023927 seconds and 4 git commands to generate.