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