#include <babeltrace/compiler-internal.h>
#include <babeltrace/values.h>
+#include <babeltrace/graph/private-component.h>
#include <babeltrace/graph/component-sink-internal.h>
#include <babeltrace/graph/component-internal.h>
#include <babeltrace/graph/notification.h>
#include <babeltrace/graph/graph.h>
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-internal.h>
BT_HIDDEN
void bt_component_sink_destroy(struct bt_component *component)
return sink ? &sink->parent : NULL;
}
-BT_HIDDEN
-enum bt_component_status bt_component_sink_consume(
- struct bt_component *component)
-{
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
- struct bt_component_class_sink *sink_class = NULL;
-
- if (!component) {
- BT_LOGW_STR("Invalid parameter: component is NULL.");
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_SINK) {
- BT_LOGW("Invalid parameter: component's class is not a sink component class: "
- "comp-addr=%p, comp-name=\"%s\", comp-class-type=%s",
- component, bt_component_get_name(component),
- bt_component_class_type_string(component->class->type));
- ret = BT_COMPONENT_STATUS_UNSUPPORTED;
- goto end;
- }
-
- sink_class = container_of(component->class, struct bt_component_class_sink, parent);
- assert(sink_class->methods.consume);
- BT_LOGD("Calling user's consume method: "
- "comp-addr=%p, comp-name=\"%s\"",
- component, bt_component_get_name(component));
- ret = sink_class->methods.consume(bt_private_component_from_component(component));
- BT_LOGD("User method returned: status=%s",
- bt_component_status_string(ret));
- if (ret < 0) {
- BT_LOGW_STR("Consume method failed.");
- }
-
-end:
- return ret;
-}
-
int64_t bt_component_sink_get_input_port_count(struct bt_component *component)
{
int64_t ret;
}
end:
- bt_put(port);
+ bt_object_put_ref(port);
return status;
}