284eb0e8abc79b30efdeefdd5a08aa07d7ce7264
[babeltrace.git] / include / babeltrace2 / graph / graph.h
1 #ifndef BABELTRACE2_GRAPH_GRAPH_H
2 #define BABELTRACE2_GRAPH_GRAPH_H
3
4 /*
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
26 #ifndef __BT_IN_BABELTRACE_H
27 # error "Please include <babeltrace2/babeltrace.h> instead."
28 #endif
29
30 #include <babeltrace2/types.h>
31 #include <babeltrace2/logging.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 typedef enum bt_graph_listener_func_status {
38 BT_GRAPH_LISTENER_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK,
39 BT_GRAPH_LISTENER_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
40 BT_GRAPH_LISTENER_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
41 } bt_graph_listener_func_status;
42
43 typedef bt_graph_listener_func_status
44 (*bt_graph_filter_component_input_port_added_listener_func)(
45 const bt_component_filter *component,
46 const bt_port_input *port, void *data);
47
48 typedef bt_graph_listener_func_status
49 (*bt_graph_sink_component_input_port_added_listener_func)(
50 const bt_component_sink *component,
51 const bt_port_input *port, void *data);
52
53 typedef bt_graph_listener_func_status
54 (*bt_graph_source_component_output_port_added_listener_func)(
55 const bt_component_source *component,
56 const bt_port_output *port, void *data);
57
58 typedef bt_graph_listener_func_status
59 (*bt_graph_filter_component_output_port_added_listener_func)(
60 const bt_component_filter *component,
61 const bt_port_output *port, void *data);
62
63 typedef bt_graph_listener_func_status
64 (*bt_graph_source_filter_component_ports_connected_listener_func)(
65 const bt_component_source *source_component,
66 const bt_component_filter *filter_component,
67 const bt_port_output *upstream_port,
68 const bt_port_input *downstream_port, void *data);
69
70 typedef bt_graph_listener_func_status
71 (*bt_graph_source_sink_component_ports_connected_listener_func)(
72 const bt_component_source *source_component,
73 const bt_component_sink *sink_component,
74 const bt_port_output *upstream_port,
75 const bt_port_input *downstream_port, void *data);
76
77 typedef bt_graph_listener_func_status
78 (*bt_graph_filter_filter_component_ports_connected_listener_func)(
79 const bt_component_filter *filter_component_upstream,
80 const bt_component_filter *filter_component_downstream,
81 const bt_port_output *upstream_port,
82 const bt_port_input *downstream_port,
83 void *data);
84
85 typedef bt_graph_listener_func_status
86 (*bt_graph_filter_sink_component_ports_connected_listener_func)(
87 const bt_component_filter *filter_component,
88 const bt_component_sink *sink_component,
89 const bt_port_output *upstream_port,
90 const bt_port_input *downstream_port, void *data);
91
92 typedef void (* bt_graph_listener_removed_func)(void *data);
93
94 typedef enum bt_graph_simple_sink_component_init_func_status {
95 BT_GRAPH_SIMPLE_SINK_COMPONENT_INIT_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK,
96 BT_GRAPH_SIMPLE_SINK_COMPONENT_INIT_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
97 BT_GRAPH_SIMPLE_SINK_COMPONENT_INIT_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
98 } bt_graph_simple_sink_component_init_func_status;
99
100 typedef bt_graph_simple_sink_component_init_func_status
101 (*bt_graph_simple_sink_component_init_func)(
102 bt_self_component_port_input_message_iterator *iterator,
103 void *data);
104
105 typedef enum bt_graph_simple_sink_component_consume_func_status {
106 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK,
107 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
108 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
109 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
110 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_END = __BT_FUNC_STATUS_END,
111 } bt_graph_simple_sink_component_consume_func_status;
112
113 typedef bt_graph_simple_sink_component_consume_func_status
114 (*bt_graph_simple_sink_component_consume_func)(
115 bt_self_component_port_input_message_iterator *iterator,
116 void *data);
117
118 typedef void (*bt_graph_simple_sink_component_finalize_func)(void *data);
119
120 extern bt_graph *bt_graph_create(void);
121
122 typedef enum bt_graph_add_component_status {
123 BT_GRAPH_ADD_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK,
124 BT_GRAPH_ADD_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
125 BT_GRAPH_ADD_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
126 } bt_graph_add_component_status;
127
128 extern bt_graph_add_component_status
129 bt_graph_add_source_component(bt_graph *graph,
130 const bt_component_class_source *component_class,
131 const char *name, const bt_value *params,
132 bt_logging_level log_level, const bt_component_source **component);
133
134 extern bt_graph_add_component_status
135 bt_graph_add_source_component_with_init_method_data(
136 bt_graph *graph,
137 const bt_component_class_source *component_class,
138 const char *name, const bt_value *params,
139 void *init_method_data, bt_logging_level log_level,
140 const bt_component_source **component);
141
142 extern bt_graph_add_component_status
143 bt_graph_add_filter_component(bt_graph *graph,
144 const bt_component_class_filter *component_class,
145 const char *name, const bt_value *params,
146 bt_logging_level log_level,
147 const bt_component_filter **component);
148
149 extern bt_graph_add_component_status
150 bt_graph_add_filter_component_with_init_method_data(
151 bt_graph *graph,
152 const bt_component_class_filter *component_class,
153 const char *name, const bt_value *params,
154 void *init_method_data, bt_logging_level log_level,
155 const bt_component_filter **component);
156
157 extern bt_graph_add_component_status
158 bt_graph_add_sink_component(
159 bt_graph *graph, const bt_component_class_sink *component_class,
160 const char *name, const bt_value *params,
161 bt_logging_level log_level,
162 const bt_component_sink **component);
163
164 extern bt_graph_add_component_status
165 bt_graph_add_sink_component_with_init_method_data(
166 bt_graph *graph, const bt_component_class_sink *component_class,
167 const char *name, const bt_value *params,
168 void *init_method_data, bt_logging_level log_level,
169 const bt_component_sink **component);
170
171 extern bt_graph_add_component_status
172 bt_graph_add_simple_sink_component(bt_graph *graph, const char *name,
173 bt_graph_simple_sink_component_init_func init_func,
174 bt_graph_simple_sink_component_consume_func consume_func,
175 bt_graph_simple_sink_component_finalize_func finalize_func,
176 void *user_data, const bt_component_sink **component);
177
178 typedef enum bt_graph_connect_ports_status {
179 BT_GRAPH_CONNECT_PORTS_STATUS_OK = __BT_FUNC_STATUS_OK,
180 BT_GRAPH_CONNECT_PORTS_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
181 BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
182 } bt_graph_connect_ports_status;
183
184 extern bt_graph_connect_ports_status bt_graph_connect_ports(bt_graph *graph,
185 const bt_port_output *upstream,
186 const bt_port_input *downstream,
187 const bt_connection **connection);
188
189 typedef enum bt_graph_run_status {
190 BT_GRAPH_RUN_STATUS_OK = __BT_FUNC_STATUS_OK,
191 BT_GRAPH_RUN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
192 BT_GRAPH_RUN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
193 BT_GRAPH_RUN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
194 BT_GRAPH_RUN_STATUS_END = __BT_FUNC_STATUS_END,
195 } bt_graph_run_status;
196
197 extern bt_graph_run_status bt_graph_run(bt_graph *graph);
198
199 typedef enum bt_graph_run_once_status {
200 BT_GRAPH_RUN_ONCE_STATUS_OK = __BT_FUNC_STATUS_OK,
201 BT_GRAPH_RUN_ONCE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
202 BT_GRAPH_RUN_ONCE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
203 BT_GRAPH_RUN_ONCE_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
204 BT_GRAPH_RUN_ONCE_STATUS_END = __BT_FUNC_STATUS_END,
205 } bt_graph_run_once_status;
206
207 extern bt_graph_run_once_status bt_graph_run_once(bt_graph *graph);
208
209 typedef enum bt_graph_add_listener_status {
210 BT_GRAPH_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
211 BT_GRAPH_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
212 } bt_graph_add_listener_status;
213
214 extern bt_graph_add_listener_status
215 bt_graph_add_filter_component_input_port_added_listener(
216 bt_graph *graph,
217 bt_graph_filter_component_input_port_added_listener_func listener,
218 bt_graph_listener_removed_func listener_removed, void *data,
219 bt_listener_id *listener_id);
220
221 extern bt_graph_add_listener_status
222 bt_graph_add_sink_component_input_port_added_listener(
223 bt_graph *graph,
224 bt_graph_sink_component_input_port_added_listener_func listener,
225 bt_graph_listener_removed_func listener_removed, void *data,
226 bt_listener_id *listener_id);
227
228 extern bt_graph_add_listener_status
229 bt_graph_add_source_component_output_port_added_listener(
230 bt_graph *graph,
231 bt_graph_source_component_output_port_added_listener_func listener,
232 bt_graph_listener_removed_func listener_removed, void *data,
233 bt_listener_id *listener_id);
234
235 extern bt_graph_add_listener_status
236 bt_graph_add_filter_component_output_port_added_listener(
237 bt_graph *graph,
238 bt_graph_filter_component_output_port_added_listener_func listener,
239 bt_graph_listener_removed_func listener_removed, void *data,
240 bt_listener_id *listener_id);
241
242 extern bt_graph_add_listener_status
243 bt_graph_add_source_filter_component_ports_connected_listener(
244 bt_graph *graph,
245 bt_graph_source_filter_component_ports_connected_listener_func listener,
246 bt_graph_listener_removed_func listener_removed, void *data,
247 bt_listener_id *listener_id);
248
249 extern bt_graph_add_listener_status
250 bt_graph_add_filter_filter_component_ports_connected_listener(
251 bt_graph *graph,
252 bt_graph_filter_filter_component_ports_connected_listener_func listener,
253 bt_graph_listener_removed_func listener_removed, void *data,
254 bt_listener_id *listener_id);
255
256 extern bt_graph_add_listener_status
257 bt_graph_add_source_sink_component_ports_connected_listener(
258 bt_graph *graph,
259 bt_graph_source_sink_component_ports_connected_listener_func listener,
260 bt_graph_listener_removed_func listener_removed, void *data,
261 bt_listener_id *listener_id);
262
263 extern bt_graph_add_listener_status
264 bt_graph_add_filter_sink_component_ports_connected_listener(
265 bt_graph *graph,
266 bt_graph_filter_sink_component_ports_connected_listener_func listener,
267 bt_graph_listener_removed_func listener_removed, void *data,
268 bt_listener_id *listener_id);
269
270 typedef enum bt_graph_add_interrupter_status {
271 BT_GRAPH_ADD_INTERRUPTER_STATUS_OK = __BT_FUNC_STATUS_OK,
272 BT_GRAPH_ADD_INTERRUPTER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
273 } bt_graph_add_interrupter_status;
274
275 extern bt_graph_add_interrupter_status bt_graph_add_interrupter(bt_graph *graph,
276 const bt_interrupter *interrupter);
277
278 extern void bt_graph_interrupt(bt_graph *graph);
279
280 #ifdef __cplusplus
281 }
282 #endif
283
284 #endif /* BABELTRACE2_GRAPH_GRAPH_H */
This page took 0.034841 seconds and 3 git commands to generate.