lib: remove `BT_GRAPH_RUN_STATUS_END`
[babeltrace.git] / include / babeltrace2 / graph / graph.h
CommitLineData
3fd40f46
PP
1#ifndef BABELTRACE2_GRAPH_GRAPH_H
2#define BABELTRACE2_GRAPH_GRAPH_H
c0418dd9
JG
3
4/*
0dcb770f 5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
c0418dd9 6 *
c0418dd9
JG
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
9df34b44
PP
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
28#endif
29
71c5da58 30#include <babeltrace2/types.h>
cc81b5ab
PP
31#include <babeltrace2/logging.h>
32
c0418dd9
JG
33#ifdef __cplusplus
34extern "C" {
35#endif
36
fb25b9e3
PP
37typedef 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;
e18f3e2b 42
fb25b9e3 43typedef bt_graph_listener_func_status
e18f3e2b 44(*bt_graph_filter_component_input_port_added_listener_func)(
8eee8ea2
PP
45 const bt_component_filter *component,
46 const bt_port_input *port, void *data);
7b53201c 47
fb25b9e3 48typedef bt_graph_listener_func_status
e18f3e2b 49(*bt_graph_sink_component_input_port_added_listener_func)(
8eee8ea2
PP
50 const bt_component_sink *component,
51 const bt_port_input *port, void *data);
7b53201c 52
fb25b9e3 53typedef bt_graph_listener_func_status
e18f3e2b 54(*bt_graph_source_component_output_port_added_listener_func)(
8eee8ea2
PP
55 const bt_component_source *component,
56 const bt_port_output *port, void *data);
7b53201c 57
fb25b9e3 58typedef bt_graph_listener_func_status
e18f3e2b 59(*bt_graph_filter_component_output_port_added_listener_func)(
8eee8ea2
PP
60 const bt_component_filter *component,
61 const bt_port_output *port, void *data);
7b53201c 62
fb25b9e3 63typedef bt_graph_listener_func_status
e18f3e2b 64(*bt_graph_source_filter_component_ports_connected_listener_func)(
8eee8ea2
PP
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);
7b53201c 69
fb25b9e3 70typedef bt_graph_listener_func_status
e18f3e2b 71(*bt_graph_source_sink_component_ports_connected_listener_func)(
8eee8ea2
PP
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);
7b53201c 76
fb25b9e3 77typedef bt_graph_listener_func_status
e18f3e2b 78(*bt_graph_filter_filter_component_ports_connected_listener_func)(
ee976410
PP
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
fb25b9e3 85typedef bt_graph_listener_func_status
e18f3e2b 86(*bt_graph_filter_sink_component_ports_connected_listener_func)(
8eee8ea2
PP
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);
7b53201c 91
7b53201c
PP
92typedef void (* bt_graph_listener_removed_func)(void *data);
93
4175c1d5
FD
94typedef enum bt_graph_simple_sink_component_initialize_func_status {
95 BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK,
96 BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
97 BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
98} bt_graph_simple_sink_component_initialize_func_status;
99
100typedef bt_graph_simple_sink_component_initialize_func_status
101(*bt_graph_simple_sink_component_initialize_func)(
5efafa1a
PP
102 bt_self_component_port_input_message_iterator *iterator,
103 void *data);
104
105typedef 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,
1ca37c62 108 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
5efafa1a
PP
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
113typedef 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
118typedef void (*bt_graph_simple_sink_component_finalize_func)(void *data);
119
253a9ecc 120extern bt_graph *bt_graph_create(uint64_t mip_version);
7b53201c 121
fb25b9e3
PP
122typedef 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
128extern bt_graph_add_component_status
129bt_graph_add_source_component(bt_graph *graph,
8eee8ea2
PP
130 const bt_component_class_source *component_class,
131 const char *name, const bt_value *params,
cc81b5ab 132 bt_logging_level log_level, const bt_component_source **component);
7b53201c 133
fb25b9e3 134extern bt_graph_add_component_status
4175c1d5 135bt_graph_add_source_component_with_initialize_method_data(
8eee8ea2
PP
136 bt_graph *graph,
137 const bt_component_class_source *component_class,
138 const char *name, const bt_value *params,
cc81b5ab 139 void *init_method_data, bt_logging_level log_level,
8eee8ea2 140 const bt_component_source **component);
7b53201c 141
fb25b9e3
PP
142extern bt_graph_add_component_status
143bt_graph_add_filter_component(bt_graph *graph,
8eee8ea2
PP
144 const bt_component_class_filter *component_class,
145 const char *name, const bt_value *params,
cc81b5ab 146 bt_logging_level log_level,
8eee8ea2 147 const bt_component_filter **component);
7b53201c 148
fb25b9e3 149extern bt_graph_add_component_status
4175c1d5 150bt_graph_add_filter_component_with_initialize_method_data(
8eee8ea2
PP
151 bt_graph *graph,
152 const bt_component_class_filter *component_class,
153 const char *name, const bt_value *params,
cc81b5ab 154 void *init_method_data, bt_logging_level log_level,
8eee8ea2 155 const bt_component_filter **component);
7b53201c 156
fb25b9e3
PP
157extern bt_graph_add_component_status
158bt_graph_add_sink_component(
ee78f405 159 bt_graph *graph, const bt_component_class_sink *component_class,
8eee8ea2 160 const char *name, const bt_value *params,
cc81b5ab 161 bt_logging_level log_level,
8eee8ea2 162 const bt_component_sink **component);
7b53201c 163
fb25b9e3 164extern bt_graph_add_component_status
4175c1d5 165bt_graph_add_sink_component_with_initialize_method_data(
ee78f405 166 bt_graph *graph, const bt_component_class_sink *component_class,
8eee8ea2 167 const char *name, const bt_value *params,
cc81b5ab 168 void *init_method_data, bt_logging_level log_level,
8eee8ea2 169 const bt_component_sink **component);
7b53201c 170
5efafa1a
PP
171extern bt_graph_add_component_status
172bt_graph_add_simple_sink_component(bt_graph *graph, const char *name,
4175c1d5 173 bt_graph_simple_sink_component_initialize_func init_func,
5efafa1a
PP
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
fb25b9e3
PP
178typedef 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,
fb25b9e3
PP
181 BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
182} bt_graph_connect_ports_status;
183
184extern bt_graph_connect_ports_status bt_graph_connect_ports(bt_graph *graph,
8eee8ea2
PP
185 const bt_port_output *upstream,
186 const bt_port_input *downstream,
187 const bt_connection **connection);
7b53201c 188
fb25b9e3
PP
189typedef 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,
fb25b9e3
PP
194} bt_graph_run_status;
195
196extern bt_graph_run_status bt_graph_run(bt_graph *graph);
197
e023d253
PP
198typedef enum bt_graph_run_once_status {
199 BT_GRAPH_RUN_ONCE_STATUS_OK = __BT_FUNC_STATUS_OK,
200 BT_GRAPH_RUN_ONCE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
201 BT_GRAPH_RUN_ONCE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
202 BT_GRAPH_RUN_ONCE_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
203 BT_GRAPH_RUN_ONCE_STATUS_END = __BT_FUNC_STATUS_END,
204} bt_graph_run_once_status;
205
206extern bt_graph_run_once_status bt_graph_run_once(bt_graph *graph);
fb25b9e3
PP
207
208typedef enum bt_graph_add_listener_status {
209 BT_GRAPH_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
210 BT_GRAPH_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
211} bt_graph_add_listener_status;
212
213extern bt_graph_add_listener_status
214bt_graph_add_filter_component_input_port_added_listener(
8eee8ea2 215 bt_graph *graph,
7b53201c
PP
216 bt_graph_filter_component_input_port_added_listener_func listener,
217 bt_graph_listener_removed_func listener_removed, void *data,
eba7ea21 218 bt_listener_id *listener_id);
7b53201c 219
fb25b9e3
PP
220extern bt_graph_add_listener_status
221bt_graph_add_sink_component_input_port_added_listener(
8eee8ea2 222 bt_graph *graph,
7b53201c
PP
223 bt_graph_sink_component_input_port_added_listener_func listener,
224 bt_graph_listener_removed_func listener_removed, void *data,
eba7ea21 225 bt_listener_id *listener_id);
7b53201c 226
fb25b9e3
PP
227extern bt_graph_add_listener_status
228bt_graph_add_source_component_output_port_added_listener(
8eee8ea2 229 bt_graph *graph,
7b53201c
PP
230 bt_graph_source_component_output_port_added_listener_func listener,
231 bt_graph_listener_removed_func listener_removed, void *data,
eba7ea21 232 bt_listener_id *listener_id);
7b53201c 233
fb25b9e3
PP
234extern bt_graph_add_listener_status
235bt_graph_add_filter_component_output_port_added_listener(
8eee8ea2 236 bt_graph *graph,
7b53201c
PP
237 bt_graph_filter_component_output_port_added_listener_func listener,
238 bt_graph_listener_removed_func listener_removed, void *data,
eba7ea21 239 bt_listener_id *listener_id);
7b53201c 240
fb25b9e3 241extern bt_graph_add_listener_status
7b53201c 242bt_graph_add_source_filter_component_ports_connected_listener(
8eee8ea2 243 bt_graph *graph,
7b53201c
PP
244 bt_graph_source_filter_component_ports_connected_listener_func listener,
245 bt_graph_listener_removed_func listener_removed, void *data,
eba7ea21 246 bt_listener_id *listener_id);
7b53201c 247
fb25b9e3 248extern bt_graph_add_listener_status
ee976410
PP
249bt_graph_add_filter_filter_component_ports_connected_listener(
250 bt_graph *graph,
251 bt_graph_filter_filter_component_ports_connected_listener_func listener,
252 bt_graph_listener_removed_func listener_removed, void *data,
eba7ea21 253 bt_listener_id *listener_id);
ee976410 254
fb25b9e3 255extern bt_graph_add_listener_status
7b53201c 256bt_graph_add_source_sink_component_ports_connected_listener(
8eee8ea2 257 bt_graph *graph,
7b53201c
PP
258 bt_graph_source_sink_component_ports_connected_listener_func listener,
259 bt_graph_listener_removed_func listener_removed, void *data,
eba7ea21 260 bt_listener_id *listener_id);
7b53201c 261
fb25b9e3 262extern bt_graph_add_listener_status
7b53201c 263bt_graph_add_filter_sink_component_ports_connected_listener(
8eee8ea2 264 bt_graph *graph,
7b53201c
PP
265 bt_graph_filter_sink_component_ports_connected_listener_func listener,
266 bt_graph_listener_removed_func listener_removed, void *data,
eba7ea21 267 bt_listener_id *listener_id);
7b53201c 268
d73bb381 269typedef enum bt_graph_add_interrupter_status {
ce95c60b
PP
270 BT_GRAPH_ADD_INTERRUPTER_STATUS_OK = __BT_FUNC_STATUS_OK,
271 BT_GRAPH_ADD_INTERRUPTER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
d73bb381 272} bt_graph_add_interrupter_status;
fb25b9e3 273
d73bb381
PP
274extern bt_graph_add_interrupter_status bt_graph_add_interrupter(bt_graph *graph,
275 const bt_interrupter *interrupter);
276
277extern void bt_graph_interrupt(bt_graph *graph);
202a3a13 278
c0418dd9
JG
279#ifdef __cplusplus
280}
281#endif
282
3fd40f46 283#endif /* BABELTRACE2_GRAPH_GRAPH_H */
This page took 0.065226 seconds and 4 git commands to generate.