Sinks own their input iterators
[babeltrace.git] / include / babeltrace / plugin / plugin-system.h
index 0c3618c219b46b79dc1957ad750400cede5db1cd..ec84b872926bdc369c2d16ed43e504bf16774024 100644 (file)
@@ -31,6 +31,7 @@
  */
 
 #include <babeltrace/plugin/notification/notification.h>
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -121,45 +122,68 @@ bt_component_source_set_iterator_init_cb(struct bt_component *source,
 
 /** bt_component_sink */
 /**
- * Notification handling function type.
+ * Notification consumption function type.
  *
- * A reference must be taken on the notification if the component has 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_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.
  *
  * @param sink         Sink component instance
- * @param notification Notification to handle
  * @returns            One of #bt_component_status values
  */
-typedef enum bt_component_status (*bt_component_sink_handle_notification_cb)(
-               struct bt_component *, struct bt_notification *);
+typedef enum bt_component_status (*bt_component_sink_add_iterator_cb)(
+               struct bt_component *, struct bt_notification_iterator *);
 
 /**
- * Set a sink component's notification handling callback.
+ * Set a sink component's consumption 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 consume      Consumption 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_consume_cb(struct bt_component *sink,
+               bt_component_sink_consume_cb consume);
 
 /**
- * Register a sink to a given notification 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).
+ * Set a sink component's iterator addition callback.
  *
- * @param sink         Sink component instance.
- * @param type         One of #bt_notification_type
- * @returns            One of #bt_component_status
+ * @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_register_notification_type(struct bt_component *sink,
-               enum bt_notification_type type);
+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_notification_iterator */
+/** bt_notification_iterator */
 /**
  * Function returning an iterator's current notification.
  *
This page took 0.023959 seconds and 4 git commands to generate.