Commit | Line | Data |
---|---|---|
cbb9e0b1 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: GPL-2.0-only |
cbb9e0b1 | 3 | * |
0235b0db | 4 | * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com> |
cbb9e0b1 PP |
5 | */ |
6 | ||
3fadfbc0 | 7 | #include <babeltrace2/babeltrace.h> |
578e048b | 8 | #include "common/assert.h" |
cbb9e0b1 | 9 | |
d24d5663 | 10 | static bt_component_class_sink_consume_method_status sink_consume( |
b19ff26f | 11 | bt_self_component_sink *self_comp) |
cbb9e0b1 | 12 | { |
d24d5663 | 13 | return BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK; |
cbb9e0b1 PP |
14 | } |
15 | ||
a3f0c7db | 16 | static bt_message_iterator_class_initialize_method_status |
d24d5663 | 17 | src_dummy_iterator_init_method( |
d6e69534 | 18 | bt_self_message_iterator *self_msg_iter, |
8d8b141d | 19 | bt_self_message_iterator_configuration *config, |
b19ff26f | 20 | bt_self_component_port_output *self_port) |
cbb9e0b1 | 21 | { |
a3f0c7db | 22 | return BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK; |
d94d92ac PP |
23 | } |
24 | ||
a3f0c7db | 25 | static bt_message_iterator_class_initialize_method_status |
d24d5663 | 26 | flt_dummy_iterator_init_method( |
d6e69534 | 27 | bt_self_message_iterator *self_msg_iter, |
8d8b141d | 28 | bt_self_message_iterator_configuration *config, |
b19ff26f | 29 | bt_self_component_port_output *self_port) |
d94d92ac | 30 | { |
a3f0c7db | 31 | return BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK; |
d3eb6e8f PP |
32 | } |
33 | ||
64cadc66 | 34 | static void dummy_iterator_finalize_method( |
d6e69534 | 35 | bt_self_message_iterator *self_msg_iter) |
d3eb6e8f PP |
36 | { |
37 | } | |
38 | ||
a3f0c7db | 39 | static bt_message_iterator_class_next_method_status |
d24d5663 | 40 | dummy_iterator_next_method( |
d6e69534 PP |
41 | bt_self_message_iterator *self_msg_iter, |
42 | bt_message_array_const msgs, uint64_t capacity, | |
d4393e08 | 43 | uint64_t *count) |
d3eb6e8f | 44 | { |
a3f0c7db | 45 | return BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK; |
d3eb6e8f PP |
46 | } |
47 | ||
d24d5663 | 48 | static bt_component_class_query_method_status flt_query_method( |
b19ff26f | 49 | bt_self_component_class_filter *component_class, |
3c729b9a | 50 | bt_private_query_executor *priv_query_exec, |
b19ff26f | 51 | const char *object, const bt_value *params, |
7c14d641 | 52 | __attribute__((unused)) void *method_data, |
b19ff26f | 53 | const bt_value **result) |
5933c0f2 | 54 | { |
b19ff26f PP |
55 | bt_value *res = bt_value_array_create(); |
56 | bt_value *val; | |
05e21286 | 57 | *result = res; |
c7eee084 | 58 | int iret; |
5933c0f2 | 59 | |
d94d92ac | 60 | BT_ASSERT(*result); |
05e21286 PP |
61 | iret = bt_value_array_append_string_element(res, object); |
62 | BT_ASSERT(iret == 0); | |
6be5a99e | 63 | iret = bt_value_copy(params, &val); |
25583cd0 | 64 | BT_ASSERT(iret == 0); |
05e21286 | 65 | iret = bt_value_array_append_element(res, val); |
25583cd0 | 66 | BT_ASSERT(iret == 0); |
c5b9b441 | 67 | bt_value_put_ref(val); |
d24d5663 | 68 | return BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK; |
5933c0f2 PP |
69 | } |
70 | ||
df5b5d01 | 71 | BT_PLUGIN_MODULE(); |
6ba0b073 | 72 | BT_PLUGIN(test_sfs); |
cbb9e0b1 PP |
73 | BT_PLUGIN_DESCRIPTION("Babeltrace plugin with source, sink, and filter component classes"); |
74 | BT_PLUGIN_AUTHOR("Janine Sutto"); | |
75 | BT_PLUGIN_LICENSE("Beerware"); | |
458e8e1d | 76 | BT_PLUGIN_VERSION(1, 2, 3, "yes"); |
cbb9e0b1 | 77 | |
41a2b7ae | 78 | BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_iterator_next_method); |
d3e4dcd8 | 79 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(source, "A source."); |
8e1fe2a4 | 80 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD(source, |
d94d92ac | 81 | src_dummy_iterator_init_method); |
8e1fe2a4 | 82 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD(source, |
64cadc66 | 83 | dummy_iterator_finalize_method); |
6ba0b073 | 84 | |
d3e4dcd8 PP |
85 | BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume); |
86 | BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(sink, "A sink."); | |
a889b89f PP |
87 | BT_PLUGIN_SINK_COMPONENT_CLASS_HELP(sink, |
88 | "Bacon ipsum dolor amet strip steak cupim pastrami venison shoulder.\n" | |
89 | "Prosciutto beef ribs flank meatloaf pancetta brisket kielbasa drumstick\n" | |
90 | "venison tenderloin cow tail. Beef short loin shoulder meatball, sirloin\n" | |
91 | "ground round brisket salami cupim pork bresaola turkey bacon boudin.\n" | |
92 | ); | |
6ba0b073 | 93 | |
41a2b7ae | 94 | BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_iterator_next_method); |
d3e4dcd8 | 95 | BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(filter, "A filter."); |
8e1fe2a4 | 96 | BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD(filter, |
d94d92ac | 97 | flt_dummy_iterator_init_method); |
8e1fe2a4 | 98 | BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD(filter, |
64cadc66 | 99 | dummy_iterator_finalize_method); |
d94d92ac | 100 | BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, flt_query_method); |