Commit | Line | Data |
---|---|---|
1ca80abd PP |
1 | #ifndef BABELTRACE_GRAPH_COMPONENT_CLASS_FILTER_H |
2 | #define BABELTRACE_GRAPH_COMPONENT_CLASS_FILTER_H | |
d3e4dcd8 PP |
3 | |
4 | /* | |
e2f7325d | 5 | * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com> |
d3e4dcd8 PP |
6 | * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
7 | * | |
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
9 | * of this software and associated documentation files (the "Software"), to deal | |
10 | * in the Software without restriction, including without limitation the rights | |
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
12 | * copies of the Software, and to permit persons to whom the Software is | |
13 | * furnished to do so, subject to the following conditions: | |
14 | * | |
15 | * The above copyright notice and this permission notice shall be included in | |
16 | * all copies or substantial portions of the Software. | |
17 | * | |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
24 | * SOFTWARE. | |
25 | */ | |
26 | ||
0d72b8c3 PP |
27 | #include <stdint.h> |
28 | ||
d24d5663 | 29 | /* For bt_component_class_*_status */ |
3fadfbc0 | 30 | #include <babeltrace2/graph/component-class.h> |
0d72b8c3 | 31 | |
b19ff26f PP |
32 | /* |
33 | * For bt_component_class, bt_component_class_filter, bt_port_input, | |
34 | * bt_port_output, bt_query_executor, bt_self_component_class_filter, | |
35 | * bt_self_component_filter, bt_self_component_port_input, | |
7474e7d3 | 36 | * bt_self_component_port_output, bt_value, bt_message_array_const, |
005f1204 | 37 | * bt_bool, bt_self_message_iterator, __BT_UPCAST |
b19ff26f | 38 | */ |
3fadfbc0 | 39 | #include <babeltrace2/types.h> |
b19ff26f | 40 | |
f4e38e70 PP |
41 | /* For bt_logging_level */ |
42 | #include <babeltrace2/logging.h> | |
43 | ||
d3e4dcd8 PP |
44 | #ifdef __cplusplus |
45 | extern "C" { | |
46 | #endif | |
47 | ||
d24d5663 | 48 | typedef bt_component_class_init_method_status |
0d72b8c3 | 49 | (*bt_component_class_filter_init_method)( |
b19ff26f PP |
50 | bt_self_component_filter *self_component, |
51 | const bt_value *params, void *init_method_data); | |
0d72b8c3 PP |
52 | |
53 | typedef void (*bt_component_class_filter_finalize_method)( | |
b19ff26f | 54 | bt_self_component_filter *self_component); |
0d72b8c3 | 55 | |
d24d5663 | 56 | typedef bt_component_class_message_iterator_init_method_status |
d6e69534 PP |
57 | (*bt_component_class_filter_message_iterator_init_method)( |
58 | bt_self_message_iterator *message_iterator, | |
b19ff26f PP |
59 | bt_self_component_filter *self_component, |
60 | bt_self_component_port_output *port); | |
0d72b8c3 PP |
61 | |
62 | typedef void | |
d6e69534 PP |
63 | (*bt_component_class_filter_message_iterator_finalize_method)( |
64 | bt_self_message_iterator *message_iterator); | |
0d72b8c3 | 65 | |
d24d5663 | 66 | typedef bt_component_class_message_iterator_next_method_status |
d6e69534 PP |
67 | (*bt_component_class_filter_message_iterator_next_method)( |
68 | bt_self_message_iterator *message_iterator, | |
69 | bt_message_array_const msgs, uint64_t capacity, | |
0d72b8c3 PP |
70 | uint64_t *count); |
71 | ||
d24d5663 | 72 | typedef bt_component_class_message_iterator_seek_ns_from_origin_method_status |
7474e7d3 PP |
73 | (*bt_component_class_filter_message_iterator_seek_ns_from_origin_method)( |
74 | bt_self_message_iterator *message_iterator, | |
75 | int64_t ns_from_origin); | |
76 | ||
d24d5663 | 77 | typedef bt_component_class_message_iterator_seek_beginning_method_status |
7474e7d3 PP |
78 | (*bt_component_class_filter_message_iterator_seek_beginning_method)( |
79 | bt_self_message_iterator *message_iterator); | |
80 | ||
81 | typedef bt_bool | |
82 | (*bt_component_class_filter_message_iterator_can_seek_ns_from_origin_method)( | |
83 | bt_self_message_iterator *message_iterator, | |
84 | int64_t ns_from_origin); | |
85 | ||
86 | typedef bt_bool | |
87 | (*bt_component_class_filter_message_iterator_can_seek_beginning_method)( | |
88 | bt_self_message_iterator *message_iterator); | |
89 | ||
d24d5663 | 90 | typedef bt_component_class_query_method_status |
0d72b8c3 | 91 | (*bt_component_class_filter_query_method)( |
b19ff26f PP |
92 | bt_self_component_class_filter *comp_class, |
93 | const bt_query_executor *query_executor, | |
94 | const char *object, const bt_value *params, | |
f4e38e70 | 95 | bt_logging_level logging_level, const bt_value **result); |
0d72b8c3 | 96 | |
d24d5663 | 97 | typedef bt_component_class_port_connected_method_status |
0d72b8c3 | 98 | (*bt_component_class_filter_input_port_connected_method)( |
b19ff26f PP |
99 | bt_self_component_filter *self_component, |
100 | bt_self_component_port_input *self_port, | |
101 | const bt_port_output *other_port); | |
0d72b8c3 | 102 | |
d24d5663 | 103 | typedef bt_component_class_port_connected_method_status |
0d72b8c3 | 104 | (*bt_component_class_filter_output_port_connected_method)( |
b19ff26f PP |
105 | bt_self_component_filter *self_component, |
106 | bt_self_component_port_output *self_port, | |
107 | const bt_port_input *other_port); | |
0d72b8c3 | 108 | |
d94d92ac | 109 | static inline |
b19ff26f PP |
110 | bt_component_class *bt_component_class_filter_as_component_class( |
111 | bt_component_class_filter *comp_cls_filter) | |
d94d92ac | 112 | { |
005f1204 | 113 | return __BT_UPCAST(bt_component_class, comp_cls_filter); |
d94d92ac | 114 | } |
d3eb6e8f | 115 | |
0d72b8c3 | 116 | extern |
b19ff26f | 117 | bt_component_class_filter *bt_component_class_filter_create( |
0d72b8c3 | 118 | const char *name, |
d6e69534 | 119 | bt_component_class_filter_message_iterator_next_method method); |
0d72b8c3 | 120 | |
d24d5663 | 121 | extern bt_component_class_set_method_status |
d0cf29ee | 122 | bt_component_class_filter_set_init_method( |
b19ff26f | 123 | bt_component_class_filter *comp_class, |
0d72b8c3 PP |
124 | bt_component_class_filter_init_method method); |
125 | ||
d24d5663 | 126 | extern bt_component_class_set_method_status |
d0cf29ee | 127 | bt_component_class_filter_set_finalize_method( |
b19ff26f | 128 | bt_component_class_filter *comp_class, |
0d72b8c3 PP |
129 | bt_component_class_filter_finalize_method method); |
130 | ||
d24d5663 | 131 | extern bt_component_class_set_method_status |
d0cf29ee | 132 | bt_component_class_filter_set_input_port_connected_method( |
b19ff26f | 133 | bt_component_class_filter *comp_class, |
0d72b8c3 PP |
134 | bt_component_class_filter_input_port_connected_method method); |
135 | ||
d24d5663 | 136 | extern bt_component_class_set_method_status |
d0cf29ee | 137 | bt_component_class_filter_set_output_port_connected_method( |
b19ff26f | 138 | bt_component_class_filter *comp_class, |
0d72b8c3 PP |
139 | bt_component_class_filter_output_port_connected_method method); |
140 | ||
d24d5663 | 141 | extern bt_component_class_set_method_status |
d0cf29ee | 142 | bt_component_class_filter_set_query_method( |
b19ff26f | 143 | bt_component_class_filter *comp_class, |
0d72b8c3 PP |
144 | bt_component_class_filter_query_method method); |
145 | ||
d24d5663 | 146 | extern bt_component_class_set_method_status |
d0cf29ee | 147 | bt_component_class_filter_set_message_iterator_init_method( |
b19ff26f | 148 | bt_component_class_filter *comp_class, |
d6e69534 | 149 | bt_component_class_filter_message_iterator_init_method method); |
0d72b8c3 | 150 | |
d24d5663 | 151 | extern bt_component_class_set_method_status |
d0cf29ee | 152 | bt_component_class_filter_set_message_iterator_finalize_method( |
b19ff26f | 153 | bt_component_class_filter *comp_class, |
d6e69534 | 154 | bt_component_class_filter_message_iterator_finalize_method method); |
0d72b8c3 | 155 | |
d24d5663 | 156 | extern bt_component_class_set_method_status |
7474e7d3 PP |
157 | bt_component_class_filter_set_message_iterator_seek_ns_from_origin_method( |
158 | bt_component_class_filter *comp_class, | |
159 | bt_component_class_filter_message_iterator_seek_ns_from_origin_method method); | |
160 | ||
d24d5663 | 161 | extern bt_component_class_set_method_status |
7474e7d3 PP |
162 | bt_component_class_filter_set_message_iterator_seek_beginning_method( |
163 | bt_component_class_filter *comp_class, | |
164 | bt_component_class_filter_message_iterator_seek_beginning_method method); | |
165 | ||
d24d5663 | 166 | extern bt_component_class_set_method_status |
7474e7d3 PP |
167 | bt_component_class_filter_set_message_iterator_can_seek_ns_from_origin_method( |
168 | bt_component_class_filter *comp_class, | |
169 | bt_component_class_filter_message_iterator_can_seek_ns_from_origin_method method); | |
170 | ||
d24d5663 | 171 | extern bt_component_class_set_method_status |
7474e7d3 PP |
172 | bt_component_class_filter_set_message_iterator_can_seek_beginning_method( |
173 | bt_component_class_filter *comp_class, | |
174 | bt_component_class_filter_message_iterator_can_seek_beginning_method method); | |
175 | ||
d3eb6e8f PP |
176 | #ifdef __cplusplus |
177 | } | |
178 | #endif | |
179 | ||
90157d89 | 180 | #endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_FILTER_H */ |