X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Flib%2Ftest-plugin-plugins%2Fsfs.c;h=6e0e0a4b0ba1b65433db6bab93977ffe708e0b85;hb=d24d56638469189904fb6ddbb3c725817b3e9417;hp=a3b7f84b3e16966939b66c8f440b66fd7a941b5c;hpb=a67681c1f02f54bc1f708d449bceb35476024083;p=babeltrace.git diff --git a/tests/lib/test-plugin-plugins/sfs.c b/tests/lib/test-plugin-plugins/sfs.c index a3b7f84b..6e0e0a4b 100644 --- a/tests/lib/test-plugin-plugins/sfs.c +++ b/tests/lib/test-plugin-plugins/sfs.c @@ -15,78 +15,83 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include -#include -#include -#include -#include +#include +#include "common/assert.h" -static enum bt_component_status sink_consume(struct bt_component *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_component *component, - struct bt_notification_iterator *iterator, - void *init_method_data) +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 void dummy_iterator_destroy_method( - struct bt_notification_iterator *iterator) +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 struct bt_notification *dummy_iterator_get_method( - struct bt_notification_iterator *iterator) +static void dummy_iterator_finalize_method( + bt_self_message_iterator *self_msg_iter) { - return NULL; } -static enum bt_notification_iterator_status dummy_iterator_next_method( - struct bt_notification_iterator *iterator) +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_OK; + return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; } -static enum bt_notification_iterator_status dummy_iterator_seek_time_method( - struct bt_notification_iterator *iterator, int64_t time) +static bt_component_class_query_method_status flt_query_method( + bt_self_component_class_filter *component_class, + const bt_query_executor *query_exec, + const char *object, const bt_value *params, + __attribute__((unused)) bt_logging_level log_level, + const bt_value **result) { - return BT_NOTIFICATION_ITERATOR_STATUS_OK; -} - -static struct bt_value *query_method( - struct bt_component_class *component_class, - const char *object, struct bt_value *params) -{ - int ret; - struct bt_value *results = bt_value_array_create(); + bt_value *res = bt_value_array_create(); + bt_value *val; + *result = res; + int iret; - assert(results); - ret = bt_value_array_append_string(results, object); - assert(ret == 0); - ret = bt_value_array_append(results, params); - assert(ret == 0); - return results; + 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_value_array_append_element(res, val); + BT_ASSERT(iret == 0); + bt_value_put_ref(val); + return BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK; } +BT_PLUGIN_MODULE(); BT_PLUGIN(test_sfs); BT_PLUGIN_DESCRIPTION("Babeltrace plugin with source, sink, and filter component classes"); BT_PLUGIN_AUTHOR("Janine Sutto"); BT_PLUGIN_LICENSE("Beerware"); BT_PLUGIN_VERSION(1, 2, 3, "yes"); -BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_iterator_get_method, - dummy_iterator_next_method); +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_DESTROY_METHOD(source, - dummy_iterator_destroy_method); -BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(source, - dummy_iterator_seek_time_method); +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_SINK_COMPONENT_CLASS_DESCRIPTION(sink, "A sink."); @@ -97,13 +102,10 @@ BT_PLUGIN_SINK_COMPONENT_CLASS_HELP(sink, "ground round brisket salami cupim pork bresaola turkey bacon boudin.\n" ); -BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_iterator_get_method, - dummy_iterator_next_method); +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_DESTROY_METHOD(filter, - dummy_iterator_destroy_method); -BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(filter, - dummy_iterator_seek_time_method); -BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, query_method); +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, flt_query_method);