X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fgraph%2Fcomponent-class-sink-colander.c;h=6a9d287e2a9983dac998dbfebe92a320e4d9e2a0;hb=3fadfbc0c91f82c46bd36e6e0657ea93570c9db1;hp=1b67b2f8be6613bc2a58de1511d03dc9b1a83532;hpb=d0fea13089e4ea4825826b1022ff0d8110ef2898;p=babeltrace.git diff --git a/lib/graph/component-class-sink-colander.c b/lib/graph/component-class-sink-colander.c index 1b67b2f8..6a9d287e 100644 --- a/lib/graph/component-class-sink-colander.c +++ b/lib/graph/component-class-sink-colander.c @@ -21,35 +21,29 @@ */ #define BT_LOG_TAG "COLANDER" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include static struct bt_component_class_sink *colander_comp_cls; -struct colander_data { - bt_message_array_const msgs; - uint64_t *count_addr; - struct bt_self_component_port_input_message_iterator *msg_iter; -}; - static enum bt_self_component_status colander_init( struct bt_self_component_sink *self_comp, const struct bt_value *params, void *init_method_data) { enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; - struct colander_data *colander_data = NULL; + struct bt_component_class_sink_colander_priv_data *colander_data = NULL; struct bt_component_class_sink_colander_data *user_provided_data = init_method_data; @@ -59,7 +53,8 @@ enum bt_self_component_status colander_init( goto end; } - colander_data = g_new0(struct colander_data, 1); + colander_data = g_new0( + struct bt_component_class_sink_colander_priv_data, 1); if (!colander_data) { BT_LOGE_STR("Failed to allocate colander data."); status = BT_SELF_COMPONENT_STATUS_NOMEM; @@ -86,7 +81,7 @@ end: static void colander_finalize(struct bt_self_component_sink *self_comp) { - struct colander_data *colander_data = + struct bt_component_class_sink_colander_priv_data *colander_data = bt_self_component_get_data( bt_self_component_sink_as_self_component(self_comp)); @@ -99,16 +94,18 @@ void colander_finalize(struct bt_self_component_sink *self_comp) } static -enum bt_self_component_status colander_input_port_connected( - struct bt_self_component_sink *self_comp, - struct bt_self_component_port_input *self_port, - const struct bt_port_output *other_port) +enum bt_self_component_status colander_graph_is_configured( + bt_self_component_sink *self_comp) { enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; - struct colander_data *colander_data = + struct bt_component_class_sink_colander_priv_data *colander_data = bt_self_component_get_data( bt_self_component_sink_as_self_component(self_comp)); + struct bt_self_component_port_input *self_port = + bt_self_component_sink_borrow_input_port_by_name(self_comp, "in"); + BT_ASSERT(self_port); + BT_ASSERT(colander_data); BT_OBJECT_PUT_REF_AND_RESET(colander_data->msg_iter); colander_data->msg_iter = @@ -132,7 +129,7 @@ enum bt_self_component_status colander_consume( { enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; enum bt_message_iterator_status msg_iter_status; - struct colander_data *colander_data = + struct bt_component_class_sink_colander_priv_data *colander_data = bt_self_component_get_data( bt_self_component_sink_as_self_component(self_comp)); bt_message_array_const msgs; @@ -188,8 +185,8 @@ struct bt_component_class_sink *bt_component_class_sink_colander_get(void) colander_comp_cls, colander_init); (void) bt_component_class_sink_set_finalize_method( colander_comp_cls, colander_finalize); - (void) bt_component_class_sink_set_input_port_connected_method( - colander_comp_cls, colander_input_port_connected); + (void) bt_component_class_sink_set_graph_is_configured_method( + colander_comp_cls, colander_graph_is_configured); end: bt_object_get_ref(colander_comp_cls);