Commit | Line | Data |
---|---|---|
924dc299 PP |
1 | #ifndef BABELTRACE2_GRAPH_GRAPH_H |
2 | #define BABELTRACE2_GRAPH_GRAPH_H | |
c0418dd9 JG |
3 | |
4 | /* | |
e2f7325d | 5 | * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com> |
f60c8b34 | 6 | * Copyright 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
c0418dd9 | 7 | * |
c0418dd9 JG |
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 | ||
b19ff26f PP |
27 | /* |
28 | * For bt_bool, bt_component, bt_component_class, | |
29 | * bt_component_class_filter, bt_component_class_sink, | |
30 | * bt_component_class_source, bt_component_filter, bt_component_sink, | |
31 | * bt_component_source, bt_connection, bt_graph, bt_port_input, | |
32 | * bt_port_output, bt_value | |
33 | */ | |
3fadfbc0 | 34 | #include <babeltrace2/types.h> |
c0418dd9 | 35 | |
e874da19 PP |
36 | /* For bt_logging_level */ |
37 | #include <babeltrace2/logging.h> | |
38 | ||
d24d5663 PP |
39 | /* For __BT_FUNC_STATUS_* */ |
40 | #define __BT_FUNC_STATUS_ENABLE | |
41 | #include <babeltrace2/func-status.h> | |
42 | #undef __BT_FUNC_STATUS_ENABLE | |
43 | ||
c0418dd9 JG |
44 | #ifdef __cplusplus |
45 | extern "C" { | |
46 | #endif | |
47 | ||
d24d5663 PP |
48 | typedef enum bt_graph_listener_func_status { |
49 | BT_GRAPH_LISTENER_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK, | |
50 | BT_GRAPH_LISTENER_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
51 | BT_GRAPH_LISTENER_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
52 | } bt_graph_listener_func_status; | |
8cc56726 | 53 | |
d24d5663 | 54 | typedef bt_graph_listener_func_status |
8cc56726 | 55 | (*bt_graph_filter_component_input_port_added_listener_func)( |
b19ff26f PP |
56 | const bt_component_filter *component, |
57 | const bt_port_input *port, void *data); | |
0d72b8c3 | 58 | |
d24d5663 | 59 | typedef bt_graph_listener_func_status |
8cc56726 | 60 | (*bt_graph_sink_component_input_port_added_listener_func)( |
b19ff26f PP |
61 | const bt_component_sink *component, |
62 | const bt_port_input *port, void *data); | |
0d72b8c3 | 63 | |
d24d5663 | 64 | typedef bt_graph_listener_func_status |
8cc56726 | 65 | (*bt_graph_source_component_output_port_added_listener_func)( |
b19ff26f PP |
66 | const bt_component_source *component, |
67 | const bt_port_output *port, void *data); | |
0d72b8c3 | 68 | |
d24d5663 | 69 | typedef bt_graph_listener_func_status |
8cc56726 | 70 | (*bt_graph_filter_component_output_port_added_listener_func)( |
b19ff26f PP |
71 | const bt_component_filter *component, |
72 | const bt_port_output *port, void *data); | |
0d72b8c3 | 73 | |
d24d5663 | 74 | typedef bt_graph_listener_func_status |
8cc56726 | 75 | (*bt_graph_source_filter_component_ports_connected_listener_func)( |
b19ff26f PP |
76 | const bt_component_source *source_component, |
77 | const bt_component_filter *filter_component, | |
78 | const bt_port_output *upstream_port, | |
79 | const bt_port_input *downstream_port, void *data); | |
0d72b8c3 | 80 | |
d24d5663 | 81 | typedef bt_graph_listener_func_status |
8cc56726 | 82 | (*bt_graph_source_sink_component_ports_connected_listener_func)( |
b19ff26f PP |
83 | const bt_component_source *source_component, |
84 | const bt_component_sink *sink_component, | |
85 | const bt_port_output *upstream_port, | |
86 | const bt_port_input *downstream_port, void *data); | |
0d72b8c3 | 87 | |
d24d5663 | 88 | typedef bt_graph_listener_func_status |
8cc56726 | 89 | (*bt_graph_filter_filter_component_ports_connected_listener_func)( |
9c0a126a PP |
90 | const bt_component_filter *filter_component_upstream, |
91 | const bt_component_filter *filter_component_downstream, | |
92 | const bt_port_output *upstream_port, | |
93 | const bt_port_input *downstream_port, | |
94 | void *data); | |
95 | ||
d24d5663 | 96 | typedef bt_graph_listener_func_status |
8cc56726 | 97 | (*bt_graph_filter_sink_component_ports_connected_listener_func)( |
b19ff26f PP |
98 | const bt_component_filter *filter_component, |
99 | const bt_component_sink *sink_component, | |
100 | const bt_port_output *upstream_port, | |
101 | const bt_port_input *downstream_port, void *data); | |
0d72b8c3 | 102 | |
0d72b8c3 PP |
103 | typedef void (* bt_graph_listener_removed_func)(void *data); |
104 | ||
b19ff26f | 105 | extern bt_graph *bt_graph_create(void); |
0d72b8c3 | 106 | |
d24d5663 PP |
107 | typedef enum bt_graph_add_component_status { |
108 | BT_GRAPH_ADD_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK, | |
109 | BT_GRAPH_ADD_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
110 | BT_GRAPH_ADD_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
111 | } bt_graph_add_component_status; | |
112 | ||
113 | extern bt_graph_add_component_status | |
114 | bt_graph_add_source_component(bt_graph *graph, | |
b19ff26f PP |
115 | const bt_component_class_source *component_class, |
116 | const char *name, const bt_value *params, | |
e874da19 | 117 | bt_logging_level log_level, const bt_component_source **component); |
0d72b8c3 | 118 | |
d24d5663 PP |
119 | extern bt_graph_add_component_status |
120 | bt_graph_add_source_component_with_init_method_data( | |
b19ff26f PP |
121 | bt_graph *graph, |
122 | const bt_component_class_source *component_class, | |
123 | const char *name, const bt_value *params, | |
e874da19 | 124 | void *init_method_data, bt_logging_level log_level, |
b19ff26f | 125 | const bt_component_source **component); |
0d72b8c3 | 126 | |
d24d5663 PP |
127 | extern bt_graph_add_component_status |
128 | bt_graph_add_filter_component(bt_graph *graph, | |
b19ff26f PP |
129 | const bt_component_class_filter *component_class, |
130 | const char *name, const bt_value *params, | |
e874da19 | 131 | bt_logging_level log_level, |
b19ff26f | 132 | const bt_component_filter **component); |
0d72b8c3 | 133 | |
d24d5663 PP |
134 | extern bt_graph_add_component_status |
135 | bt_graph_add_filter_component_with_init_method_data( | |
b19ff26f PP |
136 | bt_graph *graph, |
137 | const bt_component_class_filter *component_class, | |
138 | const char *name, const bt_value *params, | |
e874da19 | 139 | void *init_method_data, bt_logging_level log_level, |
b19ff26f | 140 | const bt_component_filter **component); |
0d72b8c3 | 141 | |
d24d5663 PP |
142 | extern bt_graph_add_component_status |
143 | bt_graph_add_sink_component( | |
4cdfc5e8 | 144 | bt_graph *graph, const bt_component_class_sink *component_class, |
b19ff26f | 145 | const char *name, const bt_value *params, |
e874da19 | 146 | bt_logging_level log_level, |
b19ff26f | 147 | const bt_component_sink **component); |
0d72b8c3 | 148 | |
d24d5663 PP |
149 | extern bt_graph_add_component_status |
150 | bt_graph_add_sink_component_with_init_method_data( | |
4cdfc5e8 | 151 | bt_graph *graph, const bt_component_class_sink *component_class, |
b19ff26f | 152 | const char *name, const bt_value *params, |
e874da19 | 153 | void *init_method_data, bt_logging_level log_level, |
b19ff26f | 154 | const bt_component_sink **component); |
0d72b8c3 | 155 | |
d24d5663 PP |
156 | typedef enum bt_graph_connect_ports_status { |
157 | BT_GRAPH_CONNECT_PORTS_STATUS_OK = __BT_FUNC_STATUS_OK, | |
158 | BT_GRAPH_CONNECT_PORTS_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
159 | BT_GRAPH_CONNECT_PORTS_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED, | |
160 | BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
161 | } bt_graph_connect_ports_status; | |
162 | ||
163 | extern bt_graph_connect_ports_status bt_graph_connect_ports(bt_graph *graph, | |
b19ff26f PP |
164 | const bt_port_output *upstream, |
165 | const bt_port_input *downstream, | |
166 | const bt_connection **connection); | |
0d72b8c3 | 167 | |
d24d5663 PP |
168 | typedef enum bt_graph_run_status { |
169 | BT_GRAPH_RUN_STATUS_OK = __BT_FUNC_STATUS_OK, | |
170 | BT_GRAPH_RUN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
171 | BT_GRAPH_RUN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
172 | BT_GRAPH_RUN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, | |
173 | BT_GRAPH_RUN_STATUS_END = __BT_FUNC_STATUS_END, | |
174 | BT_GRAPH_RUN_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED, | |
175 | } bt_graph_run_status; | |
176 | ||
177 | extern bt_graph_run_status bt_graph_run(bt_graph *graph); | |
178 | ||
179 | typedef enum bt_graph_consume_status { | |
180 | BT_GRAPH_CONSUME_STATUS_OK = __BT_FUNC_STATUS_OK, | |
181 | BT_GRAPH_CONSUME_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
182 | BT_GRAPH_CONSUME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
183 | BT_GRAPH_CONSUME_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, | |
184 | BT_GRAPH_CONSUME_STATUS_END = __BT_FUNC_STATUS_END, | |
185 | BT_GRAPH_CONSUME_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED, | |
186 | } bt_graph_consume_status; | |
187 | ||
188 | extern bt_graph_consume_status bt_graph_consume(bt_graph *graph); | |
189 | ||
190 | typedef enum bt_graph_add_listener_status { | |
191 | BT_GRAPH_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK, | |
192 | BT_GRAPH_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
193 | } bt_graph_add_listener_status; | |
194 | ||
195 | extern bt_graph_add_listener_status | |
196 | bt_graph_add_filter_component_input_port_added_listener( | |
b19ff26f | 197 | bt_graph *graph, |
0d72b8c3 PP |
198 | bt_graph_filter_component_input_port_added_listener_func listener, |
199 | bt_graph_listener_removed_func listener_removed, void *data, | |
200 | int *listener_id); | |
201 | ||
d24d5663 PP |
202 | extern bt_graph_add_listener_status |
203 | bt_graph_add_sink_component_input_port_added_listener( | |
b19ff26f | 204 | bt_graph *graph, |
0d72b8c3 PP |
205 | bt_graph_sink_component_input_port_added_listener_func listener, |
206 | bt_graph_listener_removed_func listener_removed, void *data, | |
207 | int *listener_id); | |
208 | ||
d24d5663 PP |
209 | extern bt_graph_add_listener_status |
210 | bt_graph_add_source_component_output_port_added_listener( | |
b19ff26f | 211 | bt_graph *graph, |
0d72b8c3 PP |
212 | bt_graph_source_component_output_port_added_listener_func listener, |
213 | bt_graph_listener_removed_func listener_removed, void *data, | |
214 | int *listener_id); | |
215 | ||
d24d5663 PP |
216 | extern bt_graph_add_listener_status |
217 | bt_graph_add_filter_component_output_port_added_listener( | |
b19ff26f | 218 | bt_graph *graph, |
0d72b8c3 PP |
219 | bt_graph_filter_component_output_port_added_listener_func listener, |
220 | bt_graph_listener_removed_func listener_removed, void *data, | |
221 | int *listener_id); | |
222 | ||
d24d5663 | 223 | extern bt_graph_add_listener_status |
0d72b8c3 | 224 | bt_graph_add_source_filter_component_ports_connected_listener( |
b19ff26f | 225 | bt_graph *graph, |
0d72b8c3 PP |
226 | bt_graph_source_filter_component_ports_connected_listener_func listener, |
227 | bt_graph_listener_removed_func listener_removed, void *data, | |
228 | int *listener_id); | |
229 | ||
d24d5663 | 230 | extern bt_graph_add_listener_status |
9c0a126a PP |
231 | bt_graph_add_filter_filter_component_ports_connected_listener( |
232 | bt_graph *graph, | |
233 | bt_graph_filter_filter_component_ports_connected_listener_func listener, | |
234 | bt_graph_listener_removed_func listener_removed, void *data, | |
235 | int *listener_id); | |
236 | ||
d24d5663 | 237 | extern bt_graph_add_listener_status |
0d72b8c3 | 238 | bt_graph_add_source_sink_component_ports_connected_listener( |
b19ff26f | 239 | bt_graph *graph, |
0d72b8c3 PP |
240 | bt_graph_source_sink_component_ports_connected_listener_func listener, |
241 | bt_graph_listener_removed_func listener_removed, void *data, | |
242 | int *listener_id); | |
243 | ||
d24d5663 | 244 | extern bt_graph_add_listener_status |
0d72b8c3 | 245 | bt_graph_add_filter_sink_component_ports_connected_listener( |
b19ff26f | 246 | bt_graph *graph, |
0d72b8c3 PP |
247 | bt_graph_filter_sink_component_ports_connected_listener_func listener, |
248 | bt_graph_listener_removed_func listener_removed, void *data, | |
249 | int *listener_id); | |
250 | ||
d24d5663 PP |
251 | typedef enum bt_graph_cancel_status { |
252 | BT_GRAPH_CANCEL_STATUS_OK = __BT_FUNC_STATUS_OK, | |
253 | } bt_graph_cancel_status; | |
254 | ||
255 | extern bt_graph_cancel_status bt_graph_cancel(bt_graph *graph); | |
202a3a13 | 256 | |
c0418dd9 JG |
257 | #ifdef __cplusplus |
258 | } | |
259 | #endif | |
260 | ||
d24d5663 PP |
261 | #include <babeltrace2/undef-func-status.h> |
262 | ||
924dc299 | 263 | #endif /* BABELTRACE2_GRAPH_GRAPH_H */ |