Set notification iterator methods to the component class
[babeltrace.git] / tests / lib / test-plugin-plugins / sfs.c
index 3928be23179ac8baaaf0cf3a050fd095c7ebe4aa..52d3bf9f2bba319658726e4819799e4f5dce1515 100644 (file)
 #include <babeltrace/plugin/plugin-dev.h>
 #include <babeltrace/component/component.h>
 
-static int sink_value = 42;
-
-static enum bt_component_status sink_run(struct bt_component *component)
+static enum bt_component_status sink_consume(struct bt_component *component)
 {
        return BT_COMPONENT_STATUS_OK;
 }
 
-static enum bt_component_status comp_class_sink_init(
-               struct bt_component *component, struct bt_value *params)
+static enum bt_notification_iterator_status dummy_iterator_init_method(
+               struct bt_component *component,
+               struct bt_notification_iterator *iterator)
 {
-       enum bt_component_status ret;
+       return BT_NOTIFICATION_ITERATOR_STATUS_OK;
+}
 
-       ret = bt_component_set_private_data(component, &sink_value);
-       if (ret != BT_COMPONENT_STATUS_OK) {
-               return BT_COMPONENT_STATUS_ERROR;
-       }
+static void dummy_iterator_destroy_method(
+               struct bt_notification_iterator *iterator)
+{
+}
 
-       ret = bt_component_sink_set_consume_cb(component, sink_run);
-       if (ret != BT_COMPONENT_STATUS_OK) {
-               return BT_COMPONENT_STATUS_ERROR;
-       }
+static struct bt_notification *dummy_iterator_get_method(
+               struct bt_notification_iterator *iterator)
+{
+       return NULL;
+}
 
-       return BT_COMPONENT_STATUS_OK;
+static enum bt_notification_iterator_status dummy_iterator_next_method(
+               struct bt_notification_iterator *iterator)
+{
+       return BT_NOTIFICATION_ITERATOR_STATUS_OK;
 }
 
-static enum bt_component_status comp_class_dummy_init(
-               struct bt_component *component, struct bt_value *params)
+static enum bt_notification_iterator_status dummy_iterator_seek_time_method(
+               struct bt_notification_iterator *iterator, int64_t time)
 {
-       return BT_COMPONENT_STATUS_OK;
+       return BT_NOTIFICATION_ITERATOR_STATUS_OK;
 }
 
-BT_PLUGIN_NAME("test-sfs");
+BT_PLUGIN(test_sfs);
 BT_PLUGIN_DESCRIPTION("Babeltrace plugin with source, sink, and filter component classes");
 BT_PLUGIN_AUTHOR("Janine Sutto");
 BT_PLUGIN_LICENSE("Beerware");
+BT_PLUGIN_VERSION(1, 2, 3, "yes");
+
+BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_iterator_get_method,
+       dummy_iterator_next_method);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(source, "A source.");
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(source,
+       dummy_iterator_init_method);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(source,
+       dummy_iterator_destroy_method);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(source,
+       dummy_iterator_seek_time_method);
+
+BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume);
+BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(sink, "A sink.");
 
-BT_PLUGIN_COMPONENT_CLASSES_BEGIN
-BT_PLUGIN_COMPONENT_CLASS_SOURCE_ENTRY("source", "A source", comp_class_dummy_init)
-BT_PLUGIN_COMPONENT_CLASS_SINK_ENTRY("sink", "A sink", comp_class_sink_init)
-BT_PLUGIN_COMPONENT_CLASS_FILTER_ENTRY("filter", "A filter", comp_class_dummy_init)
-BT_PLUGIN_COMPONENT_CLASSES_END
+BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_iterator_get_method,
+       dummy_iterator_next_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(filter, "A filter.");
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(filter,
+       dummy_iterator_init_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(filter,
+       dummy_iterator_destroy_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(filter,
+       dummy_iterator_seek_time_method);
This page took 0.032961 seconds and 4 git commands to generate.