Commit | Line | Data |
---|---|---|
1ca80abd PP |
1 | #ifndef BABELTRACE_GRAPH_GRAPH_H |
2 | #define BABELTRACE_GRAPH_GRAPH_H | |
c0418dd9 JG |
3 | |
4 | /* | |
0554db57 | 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 | ||
b9879703 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 | */ | |
202a3a13 | 34 | #include <babeltrace/types.h> |
c0418dd9 | 35 | |
96ffdc46 PP |
36 | /* For enum bt_graph_status */ |
37 | #include <babeltrace/graph/graph-const.h> | |
38 | ||
c0418dd9 JG |
39 | #ifdef __cplusplus |
40 | extern "C" { | |
41 | #endif | |
42 | ||
96ffdc46 | 43 | typedef void (*bt_graph_filter_component_input_port_added_listener_func)( |
b9879703 PP |
44 | const bt_component_filter *component, |
45 | const bt_port_input *port, void *data); | |
96ffdc46 PP |
46 | |
47 | typedef void (*bt_graph_sink_component_input_port_added_listener_func)( | |
b9879703 PP |
48 | const bt_component_sink *component, |
49 | const bt_port_input *port, void *data); | |
96ffdc46 PP |
50 | |
51 | typedef void (*bt_graph_source_component_output_port_added_listener_func)( | |
b9879703 PP |
52 | const bt_component_source *component, |
53 | const bt_port_output *port, void *data); | |
96ffdc46 PP |
54 | |
55 | typedef void (*bt_graph_filter_component_output_port_added_listener_func)( | |
b9879703 PP |
56 | const bt_component_filter *component, |
57 | const bt_port_output *port, void *data); | |
96ffdc46 PP |
58 | |
59 | typedef void (*bt_graph_filter_component_input_port_removed_listener_func)( | |
b9879703 PP |
60 | const bt_component_filter *component, |
61 | const bt_port_input *port, void *data); | |
96ffdc46 PP |
62 | |
63 | typedef void (*bt_graph_sink_component_input_port_removed_listener_func)( | |
b9879703 PP |
64 | const bt_component_sink *component, |
65 | const bt_port_input *port, void *data); | |
96ffdc46 PP |
66 | |
67 | typedef void (*bt_graph_source_component_output_port_removed_listener_func)( | |
b9879703 PP |
68 | const bt_component_source *component, |
69 | const bt_port_output *port, void *data); | |
96ffdc46 PP |
70 | |
71 | typedef void (*bt_graph_filter_component_output_port_removed_listener_func)( | |
b9879703 PP |
72 | const bt_component_filter *component, |
73 | const bt_port_output *port, void *data); | |
96ffdc46 PP |
74 | |
75 | typedef void (*bt_graph_source_filter_component_ports_connected_listener_func)( | |
b9879703 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); | |
96ffdc46 PP |
80 | |
81 | typedef void (*bt_graph_source_sink_component_ports_connected_listener_func)( | |
b9879703 PP |
82 | const bt_component_source *source_component, |
83 | const bt_component_sink *sink_component, | |
84 | const bt_port_output *upstream_port, | |
85 | const bt_port_input *downstream_port, void *data); | |
96ffdc46 PP |
86 | |
87 | typedef void (*bt_graph_filter_sink_component_ports_connected_listener_func)( | |
b9879703 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); | |
96ffdc46 PP |
92 | |
93 | typedef void (*bt_graph_source_filter_component_ports_disconnected_listener_func)( | |
b9879703 PP |
94 | const bt_component_source *source_component, |
95 | const bt_component_filter *filter_component, | |
96 | const bt_port_output *upstream_port, | |
97 | const bt_port_input *downstream_port, | |
96ffdc46 PP |
98 | void *data); |
99 | ||
100 | typedef void (*bt_graph_source_sink_component_ports_disconnected_listener_func)( | |
b9879703 PP |
101 | const bt_component_source *source_component, |
102 | const bt_component_sink *sink_component, | |
103 | const bt_port_output *upstream_port, | |
104 | const bt_port_input *downstream_port, | |
96ffdc46 PP |
105 | void *data); |
106 | ||
107 | typedef void (*bt_graph_filter_sink_component_ports_disconnected_listener_func)( | |
b9879703 PP |
108 | const bt_component_filter *filter_component, |
109 | const bt_component_sink *sink_component, | |
110 | const bt_port_output *upstream_port, | |
111 | const bt_port_input *downstream_port, | |
96ffdc46 PP |
112 | void *data); |
113 | ||
114 | typedef void (* bt_graph_listener_removed_func)(void *data); | |
115 | ||
b9879703 | 116 | extern bt_graph *bt_graph_create(void); |
96ffdc46 PP |
117 | |
118 | extern enum bt_graph_status bt_graph_add_source_component( | |
b9879703 PP |
119 | bt_graph *graph, |
120 | const bt_component_class_source *component_class, | |
121 | const char *name, const bt_value *params, | |
122 | const bt_component_source **component); | |
96ffdc46 PP |
123 | |
124 | extern enum bt_graph_status | |
125 | bt_graph_add_source_component_with_init_method_data( | |
b9879703 PP |
126 | bt_graph *graph, |
127 | const bt_component_class_source *component_class, | |
128 | const char *name, const bt_value *params, | |
96ffdc46 | 129 | void *init_method_data, |
b9879703 | 130 | const bt_component_source **component); |
96ffdc46 PP |
131 | |
132 | extern enum bt_graph_status bt_graph_add_filter_component( | |
b9879703 PP |
133 | bt_graph *graph, |
134 | const bt_component_class_filter *component_class, | |
135 | const char *name, const bt_value *params, | |
136 | const bt_component_filter **component); | |
96ffdc46 PP |
137 | |
138 | extern enum bt_graph_status | |
139 | bt_graph_add_filter_component_with_init_method_data( | |
b9879703 PP |
140 | bt_graph *graph, |
141 | const bt_component_class_filter *component_class, | |
142 | const char *name, const bt_value *params, | |
96ffdc46 | 143 | void *init_method_data, |
b9879703 | 144 | const bt_component_filter **component); |
96ffdc46 PP |
145 | |
146 | extern enum bt_graph_status bt_graph_add_sink_component( | |
b9879703 PP |
147 | bt_graph *graph, |
148 | const bt_component_class_sink *component_class, | |
149 | const char *name, const bt_value *params, | |
150 | const bt_component_sink **component); | |
96ffdc46 PP |
151 | |
152 | extern enum bt_graph_status | |
153 | bt_graph_add_sink_component_with_init_method_data( | |
b9879703 PP |
154 | bt_graph *graph, |
155 | const bt_component_class_sink *component_class, | |
156 | const char *name, const bt_value *params, | |
96ffdc46 | 157 | void *init_method_data, |
b9879703 | 158 | const bt_component_sink **component); |
96ffdc46 PP |
159 | |
160 | extern enum bt_graph_status bt_graph_connect_ports( | |
b9879703 PP |
161 | bt_graph *graph, |
162 | const bt_port_output *upstream, | |
163 | const bt_port_input *downstream, | |
164 | const bt_connection **connection); | |
96ffdc46 | 165 | |
b9879703 | 166 | extern enum bt_graph_status bt_graph_run(bt_graph *graph); |
96ffdc46 PP |
167 | |
168 | extern enum bt_graph_status bt_graph_consume( | |
b9879703 | 169 | bt_graph *graph); |
96ffdc46 PP |
170 | |
171 | extern enum bt_graph_status | |
172 | bt_graph_add_filter_component_input_port_added_listener( | |
b9879703 | 173 | bt_graph *graph, |
96ffdc46 PP |
174 | bt_graph_filter_component_input_port_added_listener_func listener, |
175 | bt_graph_listener_removed_func listener_removed, void *data, | |
176 | int *listener_id); | |
177 | ||
178 | extern enum bt_graph_status | |
179 | bt_graph_add_sink_component_input_port_added_listener( | |
b9879703 | 180 | bt_graph *graph, |
96ffdc46 PP |
181 | bt_graph_sink_component_input_port_added_listener_func listener, |
182 | bt_graph_listener_removed_func listener_removed, void *data, | |
183 | int *listener_id); | |
184 | ||
185 | extern enum bt_graph_status | |
186 | bt_graph_add_source_component_output_port_added_listener( | |
b9879703 | 187 | bt_graph *graph, |
96ffdc46 PP |
188 | bt_graph_source_component_output_port_added_listener_func listener, |
189 | bt_graph_listener_removed_func listener_removed, void *data, | |
190 | int *listener_id); | |
191 | ||
192 | extern enum bt_graph_status | |
193 | bt_graph_add_filter_component_output_port_added_listener( | |
b9879703 | 194 | bt_graph *graph, |
96ffdc46 PP |
195 | bt_graph_filter_component_output_port_added_listener_func listener, |
196 | bt_graph_listener_removed_func listener_removed, void *data, | |
197 | int *listener_id); | |
198 | ||
199 | extern enum bt_graph_status | |
200 | bt_graph_add_filter_component_input_port_removed_listener( | |
b9879703 | 201 | bt_graph *graph, |
96ffdc46 PP |
202 | bt_graph_filter_component_input_port_removed_listener_func listener, |
203 | bt_graph_listener_removed_func listener_removed, void *data, | |
204 | int *listener_id); | |
205 | ||
206 | extern enum bt_graph_status | |
207 | bt_graph_add_sink_component_input_port_removed_listener( | |
b9879703 | 208 | bt_graph *graph, |
96ffdc46 PP |
209 | bt_graph_sink_component_input_port_removed_listener_func listener, |
210 | bt_graph_listener_removed_func listener_removed, void *data, | |
211 | int *listener_id); | |
212 | ||
213 | extern enum bt_graph_status | |
214 | bt_graph_add_source_component_output_port_removed_listener( | |
b9879703 | 215 | bt_graph *graph, |
96ffdc46 PP |
216 | bt_graph_source_component_output_port_removed_listener_func listener, |
217 | bt_graph_listener_removed_func listener_removed, void *data, | |
218 | int *listener_id); | |
219 | ||
220 | extern enum bt_graph_status | |
221 | bt_graph_add_filter_component_output_port_removed_listener( | |
b9879703 | 222 | bt_graph *graph, |
96ffdc46 PP |
223 | bt_graph_filter_component_output_port_removed_listener_func listener, |
224 | bt_graph_listener_removed_func listener_removed, void *data, | |
225 | int *listener_id); | |
226 | ||
227 | extern enum bt_graph_status | |
228 | bt_graph_add_source_filter_component_ports_connected_listener( | |
b9879703 | 229 | bt_graph *graph, |
96ffdc46 PP |
230 | bt_graph_source_filter_component_ports_connected_listener_func listener, |
231 | bt_graph_listener_removed_func listener_removed, void *data, | |
232 | int *listener_id); | |
233 | ||
234 | extern enum bt_graph_status | |
235 | bt_graph_add_source_sink_component_ports_connected_listener( | |
b9879703 | 236 | bt_graph *graph, |
96ffdc46 PP |
237 | bt_graph_source_sink_component_ports_connected_listener_func listener, |
238 | bt_graph_listener_removed_func listener_removed, void *data, | |
239 | int *listener_id); | |
240 | ||
241 | extern enum bt_graph_status | |
242 | bt_graph_add_filter_sink_component_ports_connected_listener( | |
b9879703 | 243 | bt_graph *graph, |
96ffdc46 PP |
244 | bt_graph_filter_sink_component_ports_connected_listener_func listener, |
245 | bt_graph_listener_removed_func listener_removed, void *data, | |
246 | int *listener_id); | |
247 | ||
248 | extern enum bt_graph_status | |
249 | bt_graph_add_source_filter_component_ports_disconnected_listener( | |
b9879703 | 250 | bt_graph *graph, |
96ffdc46 PP |
251 | bt_graph_source_filter_component_ports_disconnected_listener_func listener, |
252 | bt_graph_listener_removed_func listener_removed, void *data, | |
253 | int *listener_id); | |
254 | ||
255 | extern enum bt_graph_status | |
256 | bt_graph_add_source_sink_component_ports_disconnected_listener( | |
b9879703 | 257 | bt_graph *graph, |
96ffdc46 PP |
258 | bt_graph_source_sink_component_ports_disconnected_listener_func listener, |
259 | bt_graph_listener_removed_func listener_removed, void *data, | |
260 | int *listener_id); | |
261 | ||
262 | extern enum bt_graph_status | |
263 | bt_graph_add_filter_sink_component_ports_disconnected_listener( | |
b9879703 | 264 | bt_graph *graph, |
96ffdc46 PP |
265 | bt_graph_filter_sink_component_ports_disconnected_listener_func listener, |
266 | bt_graph_listener_removed_func listener_removed, void *data, | |
267 | int *listener_id); | |
c0418dd9 | 268 | |
b9879703 | 269 | extern enum bt_graph_status bt_graph_cancel(bt_graph *graph); |
202a3a13 | 270 | |
c0418dd9 JG |
271 | #ifdef __cplusplus |
272 | } | |
273 | #endif | |
274 | ||
1ca80abd | 275 | #endif /* BABELTRACE_GRAPH_GRAPH_H */ |