lib: add output port notification iterator
[babeltrace.git] / tests / lib / test_bt_notification_iterator.c
index cbce6b4c965a00acef12aa469933640ae6307e5f..d4bb01da49973e7eb292b002f159313bfc744a68 100644 (file)
@@ -50,7 +50,7 @@
 #include <babeltrace/graph/private-component-sink.h>
 #include <babeltrace/graph/private-component.h>
 #include <babeltrace/graph/private-connection.h>
-#include <babeltrace/graph/private-notification-iterator.h>
+#include <babeltrace/graph/private-connection-private-notification-iterator.h>
 #include <babeltrace/graph/private-port.h>
 #include <babeltrace/plugin/plugin.h>
 #include <babeltrace/ref.h>
@@ -483,10 +483,10 @@ void fini_static_data(void)
 
 static
 void src_iter_finalize(
-               struct bt_private_notification_iterator *private_notification_iterator)
+               struct bt_private_connection_private_notification_iterator *private_notification_iterator)
 {
        struct src_iter_user_data *user_data =
-               bt_private_notification_iterator_get_user_data(
+               bt_private_connection_private_notification_iterator_get_user_data(
                        private_notification_iterator);
 
        if (user_data) {
@@ -496,7 +496,7 @@ void src_iter_finalize(
 
 static
 enum bt_notification_iterator_status src_iter_init(
-               struct bt_private_notification_iterator *priv_notif_iter,
+               struct bt_private_connection_private_notification_iterator *priv_notif_iter,
                struct bt_private_port *private_port)
 {
        struct src_iter_user_data *user_data =
@@ -504,7 +504,7 @@ enum bt_notification_iterator_status src_iter_init(
        int ret;
 
        assert(user_data);
-       ret = bt_private_notification_iterator_set_user_data(priv_notif_iter,
+       ret = bt_private_connection_private_notification_iterator_set_user_data(priv_notif_iter,
                user_data);
        assert(ret == 0);
 
@@ -565,10 +565,10 @@ struct bt_ctf_event *src_create_event(struct bt_ctf_packet *packet)
 }
 
 static
-struct bt_notification_iterator_next_return src_iter_next_seq(
+struct bt_notification_iterator_next_method_return src_iter_next_seq(
                struct src_iter_user_data *user_data)
 {
-       struct bt_notification_iterator_next_return next_return = {
+       struct bt_notification_iterator_next_method_return next_return = {
                .status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
        };
        int64_t cur_ts_ns;
@@ -681,15 +681,15 @@ struct bt_notification_iterator_next_return src_iter_next_seq(
 }
 
 static
-struct bt_notification_iterator_next_return src_iter_next(
-               struct bt_private_notification_iterator *priv_iterator)
+struct bt_notification_iterator_next_method_return src_iter_next(
+               struct bt_private_connection_private_notification_iterator *priv_iterator)
 {
-       struct bt_notification_iterator_next_return next_return = {
+       struct bt_notification_iterator_next_method_return next_return = {
                .status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
                .notification = NULL,
        };
        struct src_iter_user_data *user_data =
-               bt_private_notification_iterator_get_user_data(priv_iterator);
+               bt_private_connection_private_notification_iterator_get_user_data(priv_iterator);
 
        assert(user_data);
        next_return = src_iter_next_seq(user_data);
@@ -866,7 +866,7 @@ void sink_finalize(struct bt_private_component *private_component)
 }
 
 static
-void create_source_sink(struct bt_component **source,
+void create_source_sink(struct bt_graph *graph, struct bt_component **source,
                struct bt_component **sink)
 {
        struct bt_component_class *src_comp_class;
@@ -887,8 +887,9 @@ void create_source_sink(struct bt_component **source,
        ret = bt_component_class_source_set_notification_iterator_finalize_method(
                src_comp_class, src_iter_finalize);
        assert(ret == 0);
-       *source = bt_component_create(src_comp_class, "source", NULL);
-       assert(*source);
+       ret = bt_graph_add_component(graph, src_comp_class, "source", NULL,
+               source);
+       assert(ret == 0);
 
        /* Create sink component */
        sink_comp_class = bt_component_class_sink_create("sink", sink_consume);
@@ -900,7 +901,9 @@ void create_source_sink(struct bt_component **source,
        ret = bt_component_class_set_port_connected_method(sink_comp_class,
                sink_port_connected);
        assert(ret == 0);
-       *sink = bt_component_create(sink_comp_class, "sink", NULL);
+       ret = bt_graph_add_component(graph, sink_comp_class, "sink", NULL,
+               sink);
+       assert(ret == 0);
 
        bt_put(src_comp_class);
        bt_put(sink_comp_class);
@@ -920,9 +923,9 @@ void do_std_test(enum test test, const char *name,
        clear_test_events();
        current_test = test;
        diag("test: %s", name);
-       create_source_sink(&src_comp, &sink_comp);
        graph = bt_graph_create();
        assert(graph);
+       create_source_sink(graph, &src_comp, &sink_comp);
 
        /* Connect source to sink */
        upstream_port = bt_component_source_get_output_port_by_name(src_comp, "out");
This page took 0.039613 seconds and 4 git commands to generate.