lib: add sink component class's "graph is configured" method
[babeltrace.git] / plugins / utils / counter / counter.c
index e667e2529f134ad7c137b7e482fabdf3407dd83e..ec0a8dba8633a83641254f9b555ae6a2930fba65 100644 (file)
@@ -39,6 +39,9 @@
                }                                                       \
        } while (0)
 
+static
+const char * const in_port_name = "in";
+
 static
 uint64_t get_total_count(struct counter *counter)
 {
@@ -122,12 +125,12 @@ void counter_finalize(bt_self_component_sink *comp)
 }
 
 BT_HIDDEN
-enum bt_self_component_status counter_init(
+bt_self_component_status counter_init(
                bt_self_component_sink *component,
                const bt_value *params,
                UNUSED_VAR void *init_method_data)
 {
-       enum bt_self_component_status ret;
+       bt_self_component_status ret;
        struct counter *counter = g_new0(struct counter, 1);
        const bt_value *step = NULL;
        const bt_value *hide_zero = NULL;
@@ -176,12 +179,10 @@ end:
 }
 
 BT_HIDDEN
-enum bt_self_component_status counter_port_connected(
-               bt_self_component_sink *comp,
-               bt_self_component_port_input *self_port,
-               const bt_port_output *other_port)
+bt_self_component_status counter_graph_is_configured(
+               bt_self_component_sink *comp)
 {
-       enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+       bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
        struct counter *counter;
        bt_self_component_port_input_message_iterator *iterator;
 
@@ -189,7 +190,8 @@ enum bt_self_component_status counter_port_connected(
                bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
        iterator = bt_self_component_port_input_message_iterator_create(
-               self_port);
+               bt_self_component_sink_borrow_input_port_by_name(comp,
+                       in_port_name));
        if (!iterator) {
                status = BT_SELF_COMPONENT_STATUS_NOMEM;
                goto end;
@@ -203,12 +205,12 @@ end:
 }
 
 BT_HIDDEN
-enum bt_self_component_status counter_consume(
+bt_self_component_status counter_consume(
                bt_self_component_sink *comp)
 {
-       enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+       bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
        struct counter *counter;
-       enum bt_message_iterator_status it_ret;
+       bt_message_iterator_status it_ret;
        uint64_t msg_count;
        bt_message_array_const msgs;
 
This page took 0.028053 seconds and 4 git commands to generate.