lib: add aliases for Babeltrace structure types
[babeltrace.git] / tests / lib / test_bt_notification_iterator.c
index f121df0593785492b4b806852ad962693619b542..387eaa81f22b2135f1c280bc410a8aad41b3ecd4 100644 (file)
@@ -47,22 +47,22 @@ enum test_event_type {
 
 struct test_event {
        enum test_event_type type;
-       const struct bt_stream *stream;
-       const struct bt_packet *packet;
+       const bt_stream *stream;
+       const bt_packet *packet;
 };
 
 static bool debug = false;
 static enum test current_test;
 static GArray *test_events;
-static struct bt_graph *graph;
-static struct bt_stream_class *src_stream_class;
-static struct bt_event_class *src_event_class;
-static struct bt_stream *src_stream1;
-static struct bt_stream *src_stream2;
-static struct bt_packet *src_stream1_packet1;
-static struct bt_packet *src_stream1_packet2;
-static struct bt_packet *src_stream2_packet1;
-static struct bt_packet *src_stream2_packet2;
+static bt_graph *graph;
+static bt_stream_class *src_stream_class;
+static bt_event_class *src_event_class;
+static bt_stream *src_stream1;
+static bt_stream *src_stream2;
+static bt_packet *src_stream1_packet1;
+static bt_packet *src_stream1_packet2;
+static bt_packet *src_stream2_packet1;
+static bt_packet *src_stream2_packet2;
 
 enum {
        SEQ_END = -1,
@@ -90,7 +90,7 @@ struct src_iter_user_data {
 };
 
 struct sink_user_data {
-       void *notif_iter;
+       bt_self_component_port_input_notification_iterator *notif_iter;
 };
 
 /*
@@ -241,8 +241,8 @@ bool compare_test_events(const struct test_event *expected_events)
 static
 void init_static_data(void)
 {
-       struct bt_trace_class *trace_class;
-       struct bt_trace *trace;
+       bt_trace_class *trace_class;
+       bt_trace *trace;
 
        /* Test events */
        test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event));
@@ -279,8 +279,8 @@ void init_static_data(void)
                fprintf(stderr, ":: stream 2, packet 2: %p\n", src_stream2_packet2);
        }
 
-       bt_object_put_ref(trace);
-       bt_object_put_ref(trace_class);
+       bt_trace_put_ref(trace);
+       bt_trace_class_put_ref(trace_class);
 }
 
 static
@@ -290,18 +290,18 @@ void fini_static_data(void)
        g_array_free(test_events, TRUE);
 
        /* Metadata */
-       bt_object_put_ref(src_stream_class);
-       bt_object_put_ref(src_event_class);
-       bt_object_put_ref(src_stream1);
-       bt_object_put_ref(src_stream2);
-       bt_object_put_ref(src_stream1_packet1);
-       bt_object_put_ref(src_stream1_packet2);
-       bt_object_put_ref(src_stream2_packet1);
-       bt_object_put_ref(src_stream2_packet2);
+       bt_stream_class_put_ref(src_stream_class);
+       bt_event_class_put_ref(src_event_class);
+       bt_stream_put_ref(src_stream1);
+       bt_stream_put_ref(src_stream2);
+       bt_packet_put_ref(src_stream1_packet1);
+       bt_packet_put_ref(src_stream1_packet2);
+       bt_packet_put_ref(src_stream2_packet1);
+       bt_packet_put_ref(src_stream2_packet2);
 }
 
 static
-void src_iter_finalize(struct bt_self_notification_iterator *self_notif_iter)
+void src_iter_finalize(bt_self_notification_iterator *self_notif_iter)
 {
        struct src_iter_user_data *user_data =
                bt_self_notification_iterator_get_data(
@@ -314,9 +314,9 @@ void src_iter_finalize(struct bt_self_notification_iterator *self_notif_iter)
 
 static
 enum bt_self_notification_iterator_status src_iter_init(
-               struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_self_component_source *self_comp,
-               struct bt_self_component_port_output *self_port)
+               bt_self_notification_iterator *self_notif_iter,
+               bt_self_component_source *self_comp,
+               bt_self_component_port_output *self_port)
 {
        struct src_iter_user_data *user_data =
                g_new0(struct src_iter_user_data, 1);
@@ -337,11 +337,11 @@ enum bt_self_notification_iterator_status src_iter_init(
 }
 
 static
-void src_iter_next_seq_one(struct bt_self_notification_iterator* notif_iter,
+void src_iter_next_seq_one(bt_self_notification_iterator* notif_iter,
                struct src_iter_user_data *user_data,
-               const struct bt_notification **notif)
+               const bt_notification **notif)
 {
-       struct bt_packet *event_packet = NULL;
+       bt_packet *event_packet = NULL;
 
        switch (user_data->seq[user_data->at]) {
        case SEQ_STREAM1_BEGIN:
@@ -420,7 +420,7 @@ void src_iter_next_seq_one(struct bt_self_notification_iterator* notif_iter,
 
 static
 enum bt_self_notification_iterator_status src_iter_next_seq(
-               struct bt_self_notification_iterator *notif_iter,
+               bt_self_notification_iterator *notif_iter,
                struct src_iter_user_data *user_data,
                bt_notification_array_const notifs, uint64_t capacity,
                uint64_t *count)
@@ -450,7 +450,7 @@ end:
 
 static
 enum bt_self_notification_iterator_status src_iter_next(
-               struct bt_self_notification_iterator *self_notif_iter,
+               bt_self_notification_iterator *self_notif_iter,
                bt_notification_array_const notifs, uint64_t capacity,
                uint64_t *count)
 {
@@ -464,8 +464,8 @@ enum bt_self_notification_iterator_status src_iter_next(
 
 static
 enum bt_self_component_status src_init(
-               struct bt_self_component_source *self_comp,
-               const struct bt_value *params, void *init_method_data)
+               bt_self_component_source *self_comp,
+               const bt_value *params, void *init_method_data)
 {
        int ret;
 
@@ -476,19 +476,19 @@ enum bt_self_component_status src_init(
 }
 
 static
-void src_finalize(struct bt_self_component_source *self_comp)
+void src_finalize(bt_self_component_source *self_comp)
 {
 }
 
 static
-void append_test_events_from_notification(const struct bt_notification *notification)
+void append_test_events_from_notification(const bt_notification *notification)
 {
        struct test_event test_event = { 0 };
 
        switch (bt_notification_get_type(notification)) {
        case BT_NOTIFICATION_TYPE_EVENT:
        {
-               const struct bt_event *event;
+               const bt_event *event;
 
                test_event.type = TEST_EV_TYPE_NOTIF_EVENT;
                event = bt_notification_event_borrow_event_const(notification);
@@ -575,7 +575,7 @@ enum bt_notification_iterator_status common_consume(
 
        for (i = 0; i < count; i++) {
                append_test_events_from_notification(notifications[i]);
-               bt_object_put_ref(notifications[i]);
+               bt_notification_put_ref(notifications[i]);
        }
 
 end:
@@ -584,7 +584,7 @@ end:
 
 static
 enum bt_self_component_status sink_consume(
-               struct bt_self_component_sink *self_comp)
+               bt_self_component_sink *self_comp)
 {
        enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
        struct sink_user_data *user_data =
@@ -604,7 +604,8 @@ enum bt_self_component_status sink_consume(
        switch (it_ret) {
        case BT_NOTIFICATION_ITERATOR_STATUS_END:
                ret = BT_SELF_COMPONENT_STATUS_END;
-               BT_OBJECT_PUT_REF_AND_RESET(user_data->notif_iter);
+               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+                       user_data->notif_iter);
                goto end;
        case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
                abort();
@@ -618,9 +619,9 @@ end:
 
 static
 enum bt_self_component_status sink_port_connected(
-               struct bt_self_component_sink *self_comp,
-               struct bt_self_component_port_input *self_port,
-               const struct bt_port_output *other_port)
+               bt_self_component_sink *self_comp,
+               bt_self_component_port_input *self_port,
+               const bt_port_output *other_port)
 {
        struct sink_user_data *user_data =
                bt_self_component_get_data(
@@ -636,8 +637,8 @@ enum bt_self_component_status sink_port_connected(
 
 static
 enum bt_self_component_status sink_init(
-               struct bt_self_component_sink *self_comp,
-               const struct bt_value *params, void *init_method_data)
+               bt_self_component_sink *self_comp,
+               const bt_value *params, void *init_method_data)
 {
        struct sink_user_data *user_data = g_new0(struct sink_user_data, 1);
        int ret;
@@ -653,7 +654,7 @@ enum bt_self_component_status sink_init(
 }
 
 static
-void sink_finalize(struct bt_self_component_sink *self_comp)
+void sink_finalize(bt_self_component_sink *self_comp)
 {
        struct sink_user_data *user_data =
                bt_self_component_get_data(
@@ -661,18 +662,19 @@ void sink_finalize(struct bt_self_component_sink *self_comp)
                                self_comp));
 
        if (user_data) {
-               bt_object_put_ref(user_data->notif_iter);
+               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+                       user_data->notif_iter);
                g_free(user_data);
        }
 }
 
 static
-void create_source_sink(struct bt_graph *graph,
-               const struct bt_component_source **source,
-               const struct bt_component_sink **sink)
+void create_source_sink(bt_graph *graph,
+               const bt_component_source **source,
+               const bt_component_sink **sink)
 {
-       struct bt_component_class_source *src_comp_class;
-       struct bt_component_class_sink *sink_comp_class;
+       bt_component_class_source *src_comp_class;
+       bt_component_class_sink *sink_comp_class;
        int ret;
 
        /* Create source component */
@@ -695,7 +697,7 @@ void create_source_sink(struct bt_graph *graph,
                ret = bt_graph_add_source_component(graph,
                        src_comp_class, "source", NULL, source);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(src_comp_class);
+               bt_component_class_source_put_ref(src_comp_class);
        }
 
        /* Create sink component */
@@ -715,7 +717,7 @@ void create_source_sink(struct bt_graph *graph,
                        sink_comp_class,
                        "sink", NULL, sink);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(sink_comp_class);
+               bt_component_class_sink_put_ref(sink_comp_class);
        }
 }
 
@@ -723,10 +725,10 @@ static
 void do_std_test(enum test test, const char *name,
                const struct test_event *expected_test_events)
 {
-       const struct bt_component_source *src_comp;
-       const struct bt_component_sink *sink_comp;
-       const struct bt_port_output *upstream_port;
-       const struct bt_port_input *downstream_port;
+       const bt_component_source *src_comp;
+       const bt_component_sink *sink_comp;
+       const bt_port_output *upstream_port;
+       const bt_port_input *downstream_port;
        enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK;
 
        clear_test_events();
@@ -763,9 +765,9 @@ void do_std_test(enum test test, const char *name,
                        "the produced sequence of test events is the expected one");
        }
 
-       bt_object_put_ref(src_comp);
-       bt_object_put_ref(sink_comp);
-       BT_OBJECT_PUT_REF_AND_RESET(graph);
+       bt_component_source_put_ref(src_comp);
+       bt_component_sink_put_ref(sink_comp);
+       BT_GRAPH_PUT_REF_AND_RESET(graph);
 }
 
 static
@@ -819,11 +821,11 @@ void test_output_port_notification_iterator(void)
                { .type = TEST_EV_TYPE_END, },
                { .type = TEST_EV_TYPE_SENTINEL, },
        };
-       const struct bt_component_source *src_comp;
-       struct bt_port_output_notification_iterator *notif_iter;
+       const bt_component_source *src_comp;
+       bt_port_output_notification_iterator *notif_iter;
        enum bt_notification_iterator_status iter_status =
                BT_NOTIFICATION_ITERATOR_STATUS_OK;
-       const struct bt_port_output *upstream_port;
+       const bt_port_output *upstream_port;
 
        clear_test_events();
        current_test = TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR;
@@ -852,9 +854,9 @@ void test_output_port_notification_iterator(void)
        ok(compare_test_events(expected_test_events),
                "the produced sequence of test events is the expected one");
 
-       bt_object_put_ref(src_comp);
-       BT_OBJECT_PUT_REF_AND_RESET(graph);
-       bt_object_put_ref(notif_iter);
+       bt_component_source_put_ref(src_comp);
+       BT_GRAPH_PUT_REF_AND_RESET(graph);
+       bt_port_output_notification_iterator_put_ref(notif_iter);
 }
 
 #define DEBUG_ENV_VAR  "TEST_BT_NOTIFICATION_ITERATOR_DEBUG"
This page took 0.030238 seconds and 4 git commands to generate.