* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <babeltrace/plugin/plugin-dev.h>
-#include <babeltrace/graph/component-class.h>
-#include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
-#include <babeltrace/object.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-internal.h>
+#include <babeltrace2/babeltrace.h>
+#include "common/assert.h"
-static enum bt_component_status sink_consume(
- struct bt_private_component *private_component)
+static bt_component_class_sink_consume_method_status sink_consume(
+ bt_self_component_sink *self_comp)
{
- return BT_COMPONENT_STATUS_OK;
+ return BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
}
-static enum bt_notification_iterator_status dummy_iterator_init_method(
- struct bt_private_connection_private_notification_iterator *private_iterator,
- struct bt_private_port *private_port)
+static bt_component_class_message_iterator_init_method_status
+src_dummy_iterator_init_method(
+ bt_self_message_iterator *self_msg_iter,
+ bt_self_component_source *self_comp,
+ bt_self_component_port_output *self_port)
{
- return BT_NOTIFICATION_ITERATOR_STATUS_OK;
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
+}
+
+static bt_component_class_message_iterator_init_method_status
+flt_dummy_iterator_init_method(
+ bt_self_message_iterator *self_msg_iter,
+ bt_self_component_filter *self_comp,
+ bt_self_component_port_output *self_port)
+{
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
}
static void dummy_iterator_finalize_method(
- struct bt_private_connection_private_notification_iterator *private_iterator)
+ bt_self_message_iterator *self_msg_iter)
{
}
-static enum bt_notification_iterator_status dummy_iterator_next_method(
- struct bt_private_connection_private_notification_iterator *private_iterator,
- bt_notification_array notifs, uint64_t capacity,
+static bt_component_class_message_iterator_next_method_status
+dummy_iterator_next_method(
+ bt_self_message_iterator *self_msg_iter,
+ bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- return BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+ return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
}
-static struct bt_component_class_query_method_return query_method(
- struct bt_component_class *component_class,
- struct bt_query_executor *query_exec,
- const char *object, struct bt_value *params)
+static bt_component_class_query_method_status flt_query_method(
+ bt_self_component_class_filter *component_class,
+ bt_private_query_executor *priv_query_exec,
+ const char *object, const bt_value *params,
+ __attribute__((unused)) void *method_data,
+ const bt_value **result)
{
- struct bt_private_value *results = bt_private_value_array_create();
- struct bt_component_class_query_method_return ret = {
- .status = BT_QUERY_STATUS_OK,
- .result = bt_value_borrow_from_private(results),
- };
+ bt_value *res = bt_value_array_create();
+ bt_value *val;
+ *result = res;
int iret;
- BT_ASSERT(ret.result);
- iret = bt_private_value_array_append_string_element(results, object);
+ BT_ASSERT(*result);
+ iret = bt_value_array_append_string_element(res, object);
+ BT_ASSERT(iret == 0);
+ iret = bt_value_copy(params, &val);
BT_ASSERT(iret == 0);
- iret = bt_private_value_array_append_element(results, params);
+ iret = bt_value_array_append_element(res, val);
BT_ASSERT(iret == 0);
- return ret;
+ bt_value_put_ref(val);
+ return BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
}
BT_PLUGIN_MODULE();
BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_iterator_next_method);
BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(source, "A source.");
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(source,
- dummy_iterator_init_method);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(source,
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(source,
+ src_dummy_iterator_init_method);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(source,
dummy_iterator_finalize_method);
BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume);
BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_iterator_next_method);
BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(filter, "A filter.");
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(filter,
- dummy_iterator_init_method);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(filter,
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(filter,
+ flt_dummy_iterator_init_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(filter,
dummy_iterator_finalize_method);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, query_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, flt_query_method);