Add iterator and source implementations
[babeltrace.git] / include / babeltrace / plugin / plugin-system.h
index fea024fdd87f33d04ccc865ed0da7f991305f662..9a9332006a477b0e2345fb2ad9b44e71c59351d8 100644 (file)
  */
 
 #include <babeltrace/objects.h>
-#include <babeltrace/plugin/notification/iterator.h>
+#include <babeltrace/objects.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct bt_notification;
+struct bt_notification_iterator;
+struct bt_component;
 
 /**
- * Plug-in private data deallocation function type.
+ * Component private data deallocation function type.
  *
- * @param plugin       Plug-in instance
+ * @param component    Component instance
  */
-typedef void (*bt_plugin_destroy_cb)(struct bt_plugin *plugin);
+typedef void (*bt_component_destroy_cb)(struct bt_component *component);
 
 /**
  * Iterator creation function type.
  *
- * @param plugin       Plug-in instance
+ * @param component    Component instance
  */
-typedef struct bt_notification_iterator *(
-               *bt_plugin_source_iterator_create_cb)(
-               struct bt_plugin *plugin);
+typedef enum bt_component_status (*bt_component_source_iterator_init_cb)(
+               struct bt_component *component,
+               struct bt_notification_iterator *iterator);
+
+typedef struct bt_component *(*bt_component_init_cb)(
+               struct bt_component *component);
+
+typedef struct bt_component *(*bt_component_fini_cb)(
+               struct bt_component *component);
 
 /**
  * Notification handling function type.
  *
- * @param plugin       Plug-in instance
+ * @param component    Component instance
  * @param notificattion        Notification to handle
+ * @returns            One of #bt_component_status values
  */
-typedef int (*bt_plugin_sink_handle_notification_cb)(struct bt_plugin *,
-               struct bt_notification *);
+typedef enum bt_component_status (*bt_component_sink_handle_notification_cb)(
+               struct bt_component *, struct bt_notification *);
 
-typedef struct bt_notification *(bt_notification_iterator_get_notification_cb)(
+typedef struct bt_notification *(*bt_notification_iterator_get_cb)(
                struct bt_notification_iterator *);
 
-typedef struct bt_notification *(bt_notification_iterator_get_notification_cb)(
-               struct bt_notification_iterator *);
-
-typedef enum bt_notification_iterator_status (bt_notification_iterator_next_cb)(
+typedef enum bt_notification_iterator_status (*bt_notification_iterator_next_cb)(
                struct bt_notification_iterator *);
 
 /**
- * Get a plug-in's private (implementation) data.
+ * Get a component's private (implementation) data.
  *
- * @param plugin       Plug-in of which to get the private data
- * @returns            Plug-in private data
+ * @param component    Component of which to get the private data
+ * @returns            Component's private data
  */
-extern void *bt_plugin_get_private_data(struct bt_plugin *plugin);
+extern void *bt_component_get_private_data(struct bt_component *component);
 
+extern enum bt_notification_iterator_status
+bt_notification_iterator_set_get_cb(struct bt_notification_iterator *iterator,
+               bt_notification_iterator_get_cb get);
 
-/** Plug-in initialization functions */
-/**
- * Allocate a source plug-in.
- *
- * @param name                 Plug-in instance name (will be copied)
- * @param private_data         Private plug-in implementation data
- * @param destroy_cb           Plug-in private data clean-up callback
- * @param iterator_create_cb   Iterator creation callback
- * @returns                    A source plug-in instance
- */
-extern struct bt_plugin *bt_plugin_source_create(const char *name,
-               void *private_data, bt_plugin_destroy_cb destroy_func,
-               bt_plugin_source_iterator_create_cb iterator_create_cb);
+extern enum bt_notification_iterator_status
+bt_notification_iterator_set_next_cb(struct bt_notification_iterator *iterator,
+               bt_notification_iterator_next_cb next);
 
-/**
- * Allocate a sink plug-in.
- *
- * @param name                 Plug-in instance name (will be copied)
- * @param private_data         Private plug-in implementation data
- * @param destroy_cb           Plug-in private data clean-up callback
- * @param notification_cb      Notification handling callback
- * @returns                    A sink plug-in instance
- */
-extern struct bt_plugin *bt_plugin_sink_create(const char *name,
-               void *private_data, bt_plugin_destroy_cb destroy_func,
-               bt_plugin_sink_handle_notification_cb notification_cb);
+extern enum bt_notification_iterator_status
+bt_notification_iterator_set_private_data(
+               struct bt_notification_iterator *iterator, void *data);
 
+extern void *bt_notification_iterator_get_private_data(
+               struct bt_notification_iterator *iterator);
 
-/** Notification iterator functions */
 /**
- * Allocate a notification iterator.
+ * Set a component's private (implementation) data.
  *
- * @param plugin               Plug-in instance
- * @param next_cb              Callback advancing to the next notification
- * @param notification_cb      Callback providing the current notification
- * @returns                    A notification iterator instance
+ * @param component    Component of which to set the private data
+ * @param data         Component private data
+ * @returns            One of #bt_component_status values
  */
-extern struct bt_notification_iterator *bt_notification_iterator_create(
-               struct bt_plugin *plugin,
-               bt_notification_iterator_next_cb next_cb,
-               bt_notification_iterator_get_notification_cb notification_cb);
+extern enum bt_component_status bt_component_set_private_data(
+               struct bt_component *component, void *data);
 
 #ifdef __cplusplus
 }
This page took 0.025424 seconds and 4 git commands to generate.