lib: graph API: remove "listener removed" callback parameters
[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/*
bbb7b5f0 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
4fa90f32
PP
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
28#endif
29
3fadfbc0 30#include <babeltrace2/types.h>
e874da19
PP
31#include <babeltrace2/logging.h>
32
c0418dd9
JG
33#ifdef __cplusplus
34extern "C" {
35#endif
36
d24d5663
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;
8cc56726 42
d24d5663 43typedef bt_graph_listener_func_status
8cc56726 44(*bt_graph_filter_component_input_port_added_listener_func)(
b19ff26f
PP
45 const bt_component_filter *component,
46 const bt_port_input *port, void *data);
0d72b8c3 47
d24d5663 48typedef bt_graph_listener_func_status
8cc56726 49(*bt_graph_sink_component_input_port_added_listener_func)(
b19ff26f
PP
50 const bt_component_sink *component,
51 const bt_port_input *port, void *data);
0d72b8c3 52
d24d5663 53typedef bt_graph_listener_func_status
8cc56726 54(*bt_graph_source_component_output_port_added_listener_func)(
b19ff26f
PP
55 const bt_component_source *component,
56 const bt_port_output *port, void *data);
0d72b8c3 57
d24d5663 58typedef bt_graph_listener_func_status
8cc56726 59(*bt_graph_filter_component_output_port_added_listener_func)(
b19ff26f
PP
60 const bt_component_filter *component,
61 const bt_port_output *port, void *data);
0d72b8c3 62
d24d5663 63typedef bt_graph_listener_func_status
8cc56726 64(*bt_graph_source_filter_component_ports_connected_listener_func)(
b19ff26f
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);
0d72b8c3 69
d24d5663 70typedef bt_graph_listener_func_status
8cc56726 71(*bt_graph_source_sink_component_ports_connected_listener_func)(
b19ff26f
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);
0d72b8c3 76
d24d5663 77typedef bt_graph_listener_func_status
8cc56726 78(*bt_graph_filter_filter_component_ports_connected_listener_func)(
9c0a126a
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
d24d5663 85typedef bt_graph_listener_func_status
8cc56726 86(*bt_graph_filter_sink_component_ports_connected_listener_func)(
b19ff26f
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);
0d72b8c3 91
21a9f056
FD
92typedef enum bt_graph_simple_sink_component_initialize_func_status {
93 BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK,
94 BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
95 BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
96} bt_graph_simple_sink_component_initialize_func_status;
97
98typedef bt_graph_simple_sink_component_initialize_func_status
99(*bt_graph_simple_sink_component_initialize_func)(
078033ed
PP
100 bt_self_component_port_input_message_iterator *iterator,
101 void *data);
102
103typedef enum bt_graph_simple_sink_component_consume_func_status {
104 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK,
105 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
bf15009b 106 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
078033ed
PP
107 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
108 BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_END = __BT_FUNC_STATUS_END,
109} bt_graph_simple_sink_component_consume_func_status;
110
111typedef bt_graph_simple_sink_component_consume_func_status
112(*bt_graph_simple_sink_component_consume_func)(
113 bt_self_component_port_input_message_iterator *iterator,
114 void *data);
115
116typedef void (*bt_graph_simple_sink_component_finalize_func)(void *data);
117
056deb59 118extern bt_graph *bt_graph_create(uint64_t mip_version);
0d72b8c3 119
d24d5663
PP
120typedef enum bt_graph_add_component_status {
121 BT_GRAPH_ADD_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK,
122 BT_GRAPH_ADD_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
123 BT_GRAPH_ADD_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
124} bt_graph_add_component_status;
125
126extern bt_graph_add_component_status
127bt_graph_add_source_component(bt_graph *graph,
b19ff26f
PP
128 const bt_component_class_source *component_class,
129 const char *name, const bt_value *params,
e874da19 130 bt_logging_level log_level, const bt_component_source **component);
0d72b8c3 131
d24d5663 132extern bt_graph_add_component_status
21a9f056 133bt_graph_add_source_component_with_initialize_method_data(
b19ff26f
PP
134 bt_graph *graph,
135 const bt_component_class_source *component_class,
136 const char *name, const bt_value *params,
e874da19 137 void *init_method_data, bt_logging_level log_level,
b19ff26f 138 const bt_component_source **component);
0d72b8c3 139
d24d5663
PP
140extern bt_graph_add_component_status
141bt_graph_add_filter_component(bt_graph *graph,
b19ff26f
PP
142 const bt_component_class_filter *component_class,
143 const char *name, const bt_value *params,
e874da19 144 bt_logging_level log_level,
b19ff26f 145 const bt_component_filter **component);
0d72b8c3 146
d24d5663 147extern bt_graph_add_component_status
21a9f056 148bt_graph_add_filter_component_with_initialize_method_data(
b19ff26f
PP
149 bt_graph *graph,
150 const bt_component_class_filter *component_class,
151 const char *name, const bt_value *params,
e874da19 152 void *init_method_data, bt_logging_level log_level,
b19ff26f 153 const bt_component_filter **component);
0d72b8c3 154
d24d5663
PP
155extern bt_graph_add_component_status
156bt_graph_add_sink_component(
4cdfc5e8 157 bt_graph *graph, const bt_component_class_sink *component_class,
b19ff26f 158 const char *name, const bt_value *params,
e874da19 159 bt_logging_level log_level,
b19ff26f 160 const bt_component_sink **component);
0d72b8c3 161
d24d5663 162extern bt_graph_add_component_status
21a9f056 163bt_graph_add_sink_component_with_initialize_method_data(
4cdfc5e8 164 bt_graph *graph, const bt_component_class_sink *component_class,
b19ff26f 165 const char *name, const bt_value *params,
e874da19 166 void *init_method_data, bt_logging_level log_level,
b19ff26f 167 const bt_component_sink **component);
0d72b8c3 168
078033ed
PP
169extern bt_graph_add_component_status
170bt_graph_add_simple_sink_component(bt_graph *graph, const char *name,
21a9f056 171 bt_graph_simple_sink_component_initialize_func init_func,
078033ed
PP
172 bt_graph_simple_sink_component_consume_func consume_func,
173 bt_graph_simple_sink_component_finalize_func finalize_func,
174 void *user_data, const bt_component_sink **component);
175
d24d5663
PP
176typedef enum bt_graph_connect_ports_status {
177 BT_GRAPH_CONNECT_PORTS_STATUS_OK = __BT_FUNC_STATUS_OK,
178 BT_GRAPH_CONNECT_PORTS_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
d24d5663
PP
179 BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
180} bt_graph_connect_ports_status;
181
182extern bt_graph_connect_ports_status bt_graph_connect_ports(bt_graph *graph,
b19ff26f
PP
183 const bt_port_output *upstream,
184 const bt_port_input *downstream,
185 const bt_connection **connection);
0d72b8c3 186
d24d5663
PP
187typedef enum bt_graph_run_status {
188 BT_GRAPH_RUN_STATUS_OK = __BT_FUNC_STATUS_OK,
189 BT_GRAPH_RUN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
190 BT_GRAPH_RUN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
191 BT_GRAPH_RUN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
d24d5663
PP
192} bt_graph_run_status;
193
194extern bt_graph_run_status bt_graph_run(bt_graph *graph);
195
648dab91
PP
196typedef enum bt_graph_run_once_status {
197 BT_GRAPH_RUN_ONCE_STATUS_OK = __BT_FUNC_STATUS_OK,
198 BT_GRAPH_RUN_ONCE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
199 BT_GRAPH_RUN_ONCE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
200 BT_GRAPH_RUN_ONCE_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
201 BT_GRAPH_RUN_ONCE_STATUS_END = __BT_FUNC_STATUS_END,
202} bt_graph_run_once_status;
203
204extern bt_graph_run_once_status bt_graph_run_once(bt_graph *graph);
d24d5663
PP
205
206typedef enum bt_graph_add_listener_status {
207 BT_GRAPH_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
208 BT_GRAPH_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
209} bt_graph_add_listener_status;
210
211extern bt_graph_add_listener_status
212bt_graph_add_filter_component_input_port_added_listener(
b19ff26f 213 bt_graph *graph,
0d72b8c3 214 bt_graph_filter_component_input_port_added_listener_func listener,
f3d6b4c2 215 void *data, bt_listener_id *listener_id);
0d72b8c3 216
d24d5663
PP
217extern bt_graph_add_listener_status
218bt_graph_add_sink_component_input_port_added_listener(
b19ff26f 219 bt_graph *graph,
0d72b8c3 220 bt_graph_sink_component_input_port_added_listener_func listener,
f3d6b4c2 221 void *data, bt_listener_id *listener_id);
0d72b8c3 222
d24d5663
PP
223extern bt_graph_add_listener_status
224bt_graph_add_source_component_output_port_added_listener(
b19ff26f 225 bt_graph *graph,
0d72b8c3 226 bt_graph_source_component_output_port_added_listener_func listener,
f3d6b4c2 227 void *data, bt_listener_id *listener_id);
0d72b8c3 228
d24d5663
PP
229extern bt_graph_add_listener_status
230bt_graph_add_filter_component_output_port_added_listener(
b19ff26f 231 bt_graph *graph,
0d72b8c3 232 bt_graph_filter_component_output_port_added_listener_func listener,
f3d6b4c2 233 void *data, bt_listener_id *listener_id);
0d72b8c3 234
9b4f9b42 235typedef enum bt_graph_add_interrupter_status {
2c938e2f
PP
236 BT_GRAPH_ADD_INTERRUPTER_STATUS_OK = __BT_FUNC_STATUS_OK,
237 BT_GRAPH_ADD_INTERRUPTER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
9b4f9b42 238} bt_graph_add_interrupter_status;
d24d5663 239
9b4f9b42
PP
240extern bt_graph_add_interrupter_status bt_graph_add_interrupter(bt_graph *graph,
241 const bt_interrupter *interrupter);
242
243extern void bt_graph_interrupt(bt_graph *graph);
202a3a13 244
c0418dd9
JG
245#ifdef __cplusplus
246}
247#endif
248
924dc299 249#endif /* BABELTRACE2_GRAPH_GRAPH_H */
This page took 0.069063 seconds and 4 git commands to generate.