lib: graph: add "self" and some "private" APIs
[babeltrace.git] / tests / lib / test-plugin-plugins / sfs.c
index f9d521300818638ed4a633659efadb163ce00e44..d58b8ea8919ead2e76dbb01dd70385a338b559b3 100644 (file)
 #include <babeltrace/plugin/plugin-dev.h>
 #include <babeltrace/graph/component-class.h>
 #include <babeltrace/values.h>
-#include <babeltrace/ref.h>
+#include <babeltrace/private-values.h>
+#include <babeltrace/object.h>
 #include <babeltrace/assert-internal.h>
 #include <babeltrace/assert-internal.h>
 
-static enum bt_component_status sink_consume(
-               struct bt_private_component *private_component)
+static enum bt_self_component_status sink_consume(
+               struct bt_self_component_sink *self_comp)
 {
-       return BT_COMPONENT_STATUS_OK;
+       return BT_SELF_COMPONENT_STATUS_OK;
 }
 
-static enum bt_notification_iterator_status dummy_iterator_init_method(
-               struct bt_private_connection_private_notification_iterator *private_iterator,
-               struct bt_private_port *private_port)
+static enum bt_self_notification_iterator_status src_dummy_iterator_init_method(
+               struct bt_self_notification_iterator *self_notif_iter,
+               struct bt_self_component_source *self_comp,
+               struct bt_self_component_port_output *self_port)
 {
-       return BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       return BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
 }
 
-static void dummy_iterator_finalize_method(
-               struct bt_private_connection_private_notification_iterator *private_iterator)
+static enum bt_self_notification_iterator_status flt_dummy_iterator_init_method(
+               struct bt_self_notification_iterator *self_notif_iter,
+               struct bt_self_component_filter *self_comp,
+               struct bt_self_component_port_output *self_port)
 {
+       return BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
 }
 
-static struct bt_notification_iterator_next_method_return dummy_iterator_next_method(
-               struct bt_private_connection_private_notification_iterator *private_iterator)
+static void dummy_iterator_finalize_method(
+               struct bt_self_notification_iterator *self_notif_iter)
 {
-       struct bt_notification_iterator_next_method_return next_return = {
-               .notification = NULL,
-               .status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
-       };
+}
 
-       return next_return;
+static enum bt_self_notification_iterator_status dummy_iterator_next_method(
+               struct bt_self_notification_iterator *self_notif_iter,
+               bt_notification_array notifs, uint64_t capacity,
+               uint64_t *count)
+{
+       return BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR;
 }
 
-static struct bt_component_class_query_method_return query_method(
-               struct bt_component_class *component_class,
+static enum bt_query_status flt_query_method(
+               struct bt_self_component_class_filter *component_class,
                struct bt_query_executor *query_exec,
-               const char *object, struct bt_value *params)
+               const char *object, struct bt_value *params,
+               struct bt_value **result)
 {
-       struct bt_component_class_query_method_return ret = {
-               .status = BT_QUERY_STATUS_OK,
-               .result = bt_value_array_create(),
-       };
+       struct bt_private_value *res = bt_private_value_array_create();
+       *result = bt_private_value_borrow_value(res);
        int iret;
 
-       BT_ASSERT(ret.result);
-       iret = bt_value_array_append_string(ret.result, object);
+       BT_ASSERT(*result);
+       iret = bt_private_value_array_append_string_element(res, object);
        BT_ASSERT(iret == 0);
-       iret = bt_value_array_append(ret.result, params);
+       iret = bt_private_value_array_append_element(res, params);
        BT_ASSERT(iret == 0);
-       return ret;
+       return BT_QUERY_STATUS_OK;
 }
 
 BT_PLUGIN_MODULE();
@@ -80,7 +86,7 @@ BT_PLUGIN_VERSION(1, 2, 3, "yes");
 BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, 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);
+       src_dummy_iterator_init_method);
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(source,
        dummy_iterator_finalize_method);
 
@@ -96,7 +102,7 @@ BT_PLUGIN_SINK_COMPONENT_CLASS_HELP(sink,
 BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, 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);
+       flt_dummy_iterator_init_method);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(filter,
        dummy_iterator_finalize_method);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, query_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, flt_query_method);
This page took 0.024546 seconds and 4 git commands to generate.