#define BT_LOG_TAG "COLANDER"
#include <babeltrace/lib-logging-internal.h>
+#include <babeltrace/ref.h>
+#include <babeltrace/graph/connection.h>
#include <babeltrace/graph/component-class-sink.h>
#include <babeltrace/graph/private-component-sink.h>
#include <babeltrace/graph/private-port.h>
#include <babeltrace/graph/private-connection.h>
+#include <babeltrace/graph/private-connection-notification-iterator.h>
+#include <babeltrace/graph/private-component.h>
+#include <babeltrace/graph/component-class-sink-colander-internal.h>
+#include <babeltrace/assert-internal.h>
#include <glib.h>
-#include <assert.h>
static
struct bt_component_class *colander_comp_cls;
struct colander_data {
struct bt_notification **user_notif;
+ enum bt_notification_type *notif_types;
struct bt_notification_iterator *notif_iter;
};
{
enum bt_component_status status = BT_COMPONENT_STATUS_OK;
struct colander_data *colander_data = NULL;
+ struct bt_component_class_sink_colander_data *user_provided_data =
+ init_method_data;
if (!init_method_data) {
BT_LOGW_STR("Component initialization method data is NULL.");
goto end;
}
- colander_data->user_notif = init_method_data;
+ colander_data->user_notif = user_provided_data->notification;
status = bt_private_component_sink_add_input_private_port(
priv_comp, "in", NULL, NULL);
if (status != BT_COMPONENT_STATUS_OK) {
bt_put(colander_data->notif_iter);
}
+ g_free(colander_data->notif_types);
g_free(colander_data);
}
struct colander_data *colander_data =
bt_private_component_get_user_data(priv_comp);
- assert(priv_conn);
- assert(colander_data);
+ BT_ASSERT(priv_conn);
+ BT_ASSERT(colander_data);
BT_PUT(colander_data->notif_iter);
conn_status = bt_private_connection_create_notification_iterator(
- priv_conn, NULL, &colander_data->notif_iter);
+ priv_conn, &colander_data->notif_iter);
if (conn_status) {
BT_LOGE("Cannot create notification iterator from connection: "
"comp-addr=%p, conn-addr=%p", priv_comp, priv_conn);
struct colander_data *colander_data =
bt_private_component_get_user_data(priv_comp);
- assert(colander_data);
+ BT_ASSERT(colander_data);
if (!colander_data->notif_iter) {
BT_LOGW("Trying to consume without an upstream notification iterator: "
goto end;
}
- notif_iter_status = bt_notification_iterator_next(
- colander_data->notif_iter);
+ notif_iter_status = bt_private_connection_notification_iterator_next(
+ colander_data->notif_iter, ¬if);
switch (notif_iter_status) {
case BT_NOTIFICATION_ITERATOR_STATUS_CANCELED:
status = BT_COMPONENT_STATUS_OK;
goto end;
}
- notif = bt_notification_iterator_get_notification(
- colander_data->notif_iter);
- assert(notif);
+ BT_ASSERT(notif);
end:
/* Move notification to user's pointer, even if NULL. */