ref.h: doc: fix typo
[babeltrace.git] / include / babeltrace / plugin / plugin-system.h
index 59fc54cc79f3e2eb889c8bbedfe3e9489677a4c2..1ec7a08c40f269a513e2950408d5f1db086b9c46 100644 (file)
@@ -31,6 +31,7 @@
  */
 
 #include <babeltrace/plugin/notification/notification.h>
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -42,16 +43,15 @@ struct bt_component;
 struct bt_component_factory;
 struct bt_value;
 
-typedef enum bt_component_status (*bt_plugin_init_func)(
+typedef enum bt_component_status (*bt_plugin_register_func)(
                struct bt_component_factory *factory);
-typedef void (*bt_plugin_exit_func)(void);
 
 /**
  * Component private data deallocation function type.
  *
- * @param data         Component private data
+ * @param component    Component instance
  */
-typedef void (*bt_component_destroy_cb)(void *data);
+typedef void (*bt_component_destroy_cb)(struct bt_component *component);
 
 /**
  * Component initialization function type.
@@ -121,45 +121,133 @@ bt_component_source_set_iterator_init_cb(struct bt_component *source,
 
 /** bt_component_sink */
 /**
- * Notification handling function type.
+ * Notification consumption function type.
+ *
+ * @param sink         Sink component instance
+ * @returns            One of #bt_component_status values
+ */
+typedef enum bt_component_status (*bt_component_sink_consume_cb)(
+               struct bt_component *);
+
+/**
+ * Iterator addition function type.
+ *
+ * A sink component may choose to refuse the addition of an iterator
+ * by not returning BT_COMPONENT_STATUS_OK.
  *
- * A reference must be taken on the notification if the component wishes to
- * keep ownership of the notification beyond the invocation of the callback.
+ * @param sink         Sink component instance
+ * @returns            One of #bt_component_status values
+ */
+typedef enum bt_component_status (*bt_component_sink_add_iterator_cb)(
+               struct bt_component *, struct bt_notification_iterator *);
+
+/**
+ * Set a sink component's consumption callback.
  *
  * @param sink         Sink component instance
- * @param notification Notification to handle
+ * @param consume      Consumption callback
  * @returns            One of #bt_component_status values
  */
-typedef enum bt_component_status (*bt_component_sink_handle_notification_cb)(
-               struct bt_component *, struct bt_notification *);
+extern enum bt_component_status
+bt_component_sink_set_consume_cb(struct bt_component *sink,
+               bt_component_sink_consume_cb consume);
 
 /**
- * Set a sink component's notification handling callback.
+ * Set a sink component's iterator addition callback.
  *
- * @param sink                 Sink component instance
- * @param handle_notification  Notification handling callback
- * @returns                    One of #bt_component_status values
+ * @param sink         Sink component instance
+ * @param add_iterator Iterator addition callback
+ * @returns            One of #bt_component_status values
  */
 extern enum bt_component_status
-bt_component_sink_set_handle_notification_cb(struct bt_component *sink,
-               bt_component_sink_handle_notification_cb handle_notification);
+bt_component_sink_set_add_iterator_cb(struct bt_component *sink,
+               bt_component_sink_add_iterator_cb add_iterator);
+
+/* Defaults to 1. */
+extern enum bt_component_status
+bt_component_sink_set_minimum_input_count(struct bt_component *sink,
+               unsigned int minimum);
+
+/* Defaults to 1. */
+extern enum bt_component_status
+bt_component_sink_set_maximum_input_count(struct bt_component *sink,
+               unsigned int maximum);
+
+extern enum bt_component_status
+bt_component_sink_get_input_count(struct bt_component *sink,
+               unsigned int *count);
+
+/* May return NULL after an interator has reached its end. */
+extern enum bt_component_status
+bt_component_sink_get_input_iterator(struct bt_component *sink,
+               unsigned int input, struct bt_notification_iterator **iterator);
+
+/** bt_component_filter */
+/**
+ * Iterator initialization function type.
+ *
+ * A notification iterator's private data, deinitialization, next, and get
+ * callbacks must be set by this function.
+ *
+ * @param filter       Filter component instance
+ * @param iterator     Notification iterator instance
+ */
+typedef enum bt_component_status (*bt_component_filter_init_iterator_cb)(
+               struct bt_component *, struct bt_notification_iterator *);
 
 /**
- * Register a sink to a given notification type.
+ * Iterator addition function type.
  *
- * A sink is always registered to notifications of type
- * BT_NOTIFICATION_TYPE_EVENT. However, it may opt to receive any (or all)
- * other notification type(s).
+ * A filter component may choose to refuse the addition of an iterator
+ * by not returning BT_COMPONENT_STATUS_OK.
  *
- * @param sink         Sink component instance.
- * @param type         One of #bt_notification_type
- * @returns            One of #bt_component_status
+ * @param filter       Filter component instance
+ * @returns            One of #bt_component_status values
+ */
+typedef enum bt_component_status (*bt_component_filter_add_iterator_cb)(
+               struct bt_component *, struct bt_notification_iterator *);
+
+/**
+ * Set a filter component's iterator initialization function.
+ *
+ * @param filter       Filter component instance
+ * @param init_iterator        Notification iterator initialization callback
  */
 extern enum bt_component_status
-bt_component_sink_register_notification_type(struct bt_component *sink,
-               enum bt_notification_type type);
+bt_component_filter_set_iterator_init_cb(struct bt_component *filter,
+               bt_component_filter_init_iterator_cb init_iterator);
 
-/** bt_component_notification_iterator */
+/**
+ * Set a filter component's iterator addition callback.
+ *
+ * @param filter       Filter component instance
+ * @param add_iterator Iterator addition callback
+ * @returns            One of #bt_component_status values
+ */
+extern enum bt_component_status
+bt_component_filter_set_add_iterator_cb(struct bt_component *filter,
+               bt_component_filter_add_iterator_cb add_iterator);
+
+/* Defaults to 1. */
+extern enum bt_component_status
+bt_component_filter_set_minimum_input_count(struct bt_component *filter,
+               unsigned int minimum);
+
+/* Defaults to 1. */
+extern enum bt_component_status
+bt_component_filter_set_maximum_input_count(struct bt_component *filter,
+               unsigned int maximum);
+
+extern enum bt_component_status
+bt_component_filter_get_input_count(struct bt_component *filter,
+               unsigned int *count);
+
+/* May return NULL after an interator has reached its end. */
+extern enum bt_component_status
+bt_component_filter_get_input_iterator(struct bt_component *filter,
+               unsigned int input, struct bt_notification_iterator **iterator);
+
+/** bt_notification_iterator */
 /**
  * Function returning an iterator's current notification.
  *
@@ -178,6 +266,17 @@ typedef struct bt_notification *(*bt_notification_iterator_get_cb)(
 typedef enum bt_notification_iterator_status (*bt_notification_iterator_next_cb)(
                struct bt_notification_iterator *iterator);
 
+/**
+ * Function advancing an iterator's position to a given time (relative to Epoch).
+ *
+ * @param iterator     Notification iterator instance
+ * @param time         Time at which to seek, expressed in ns since Epoch
+ * @returns            One of #bt_notification_iterator_status values
+ */
+typedef enum bt_notification_iterator_status
+               (*bt_notification_iterator_seek_time_cb)(
+               struct bt_notification_iterator *iterator, int64_t time);
+
 /**
  * Function cleaning-up an iterator's private data on destruction.
  *
@@ -208,6 +307,18 @@ extern enum bt_notification_iterator_status
 bt_notification_iterator_set_next_cb(struct bt_notification_iterator *iterator,
                bt_notification_iterator_next_cb next);
 
+/**
+ * Set an iterator's "seek_time" callback which sets the iterator's position to
+ *     provided time (in ns since Epoch).
+ *
+ * @param iterator     Notification iterator instance
+ * @param seek_timetime        Iterator "seek_time" callback
+ * @returns            One of #bt_notification_iterator_status values
+ */
+extern enum bt_notification_iterator_status
+bt_notification_iterator_set_seek_time_cb(struct bt_notification_iterator *iterator,
+               bt_notification_iterator_seek_time_cb seek_time);
+
 /**
  * Set an iterator's "destroy" callback.
  *
This page took 0.029058 seconds and 4 git commands to generate.