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