Add bt_component_*_create_iterator_with_init_method_data()
[babeltrace.git] / tests / lib / test-plugin-plugins / sfs.c
1 /*
2 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; under version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #include <babeltrace/plugin/plugin-dev.h>
19 #include <babeltrace/component/component.h>
20
21 static enum bt_component_status sink_consume(struct bt_component *component)
22 {
23 return BT_COMPONENT_STATUS_OK;
24 }
25
26 static enum bt_notification_iterator_status dummy_iterator_init_method(
27 struct bt_component *component,
28 struct bt_notification_iterator *iterator,
29 void *init_method_data)
30 {
31 return BT_NOTIFICATION_ITERATOR_STATUS_OK;
32 }
33
34 static void dummy_iterator_destroy_method(
35 struct bt_notification_iterator *iterator)
36 {
37 }
38
39 static struct bt_notification *dummy_iterator_get_method(
40 struct bt_notification_iterator *iterator)
41 {
42 return NULL;
43 }
44
45 static enum bt_notification_iterator_status dummy_iterator_next_method(
46 struct bt_notification_iterator *iterator)
47 {
48 return BT_NOTIFICATION_ITERATOR_STATUS_OK;
49 }
50
51 static enum bt_notification_iterator_status dummy_iterator_seek_time_method(
52 struct bt_notification_iterator *iterator, int64_t time)
53 {
54 return BT_NOTIFICATION_ITERATOR_STATUS_OK;
55 }
56
57 BT_PLUGIN(test_sfs);
58 BT_PLUGIN_DESCRIPTION("Babeltrace plugin with source, sink, and filter component classes");
59 BT_PLUGIN_AUTHOR("Janine Sutto");
60 BT_PLUGIN_LICENSE("Beerware");
61 BT_PLUGIN_VERSION(1, 2, 3, "yes");
62
63 BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_iterator_get_method,
64 dummy_iterator_next_method);
65 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(source, "A source.");
66 BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(source,
67 dummy_iterator_init_method);
68 BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(source,
69 dummy_iterator_destroy_method);
70 BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(source,
71 dummy_iterator_seek_time_method);
72
73 BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume);
74 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(sink, "A sink.");
75
76 BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_iterator_get_method,
77 dummy_iterator_next_method);
78 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(filter, "A filter.");
79 BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(filter,
80 dummy_iterator_init_method);
81 BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(filter,
82 dummy_iterator_destroy_method);
83 BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(filter,
84 dummy_iterator_seek_time_method);
This page took 0.032379 seconds and 5 git commands to generate.