Commit | Line | Data |
---|---|---|
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 |
34 | extern "C" { | |
35 | #endif | |
36 | ||
fb25b9e3 PP |
37 | typedef 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 | 43 | typedef 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 | 48 | typedef 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 | 53 | typedef 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 | 58 | typedef 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 | 63 | typedef 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 | 70 | typedef 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 | 77 | typedef 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 | 85 | typedef 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 |
92 | typedef void (* bt_graph_listener_removed_func)(void *data); |
93 | ||
8eee8ea2 | 94 | extern bt_graph *bt_graph_create(void); |
7b53201c | 95 | |
fb25b9e3 PP |
96 | typedef enum bt_graph_add_component_status { |
97 | BT_GRAPH_ADD_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK, | |
98 | BT_GRAPH_ADD_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
99 | BT_GRAPH_ADD_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
100 | } bt_graph_add_component_status; | |
101 | ||
102 | extern bt_graph_add_component_status | |
103 | bt_graph_add_source_component(bt_graph *graph, | |
8eee8ea2 PP |
104 | const bt_component_class_source *component_class, |
105 | const char *name, const bt_value *params, | |
cc81b5ab | 106 | bt_logging_level log_level, const bt_component_source **component); |
7b53201c | 107 | |
fb25b9e3 PP |
108 | extern bt_graph_add_component_status |
109 | bt_graph_add_source_component_with_init_method_data( | |
8eee8ea2 PP |
110 | bt_graph *graph, |
111 | const bt_component_class_source *component_class, | |
112 | const char *name, const bt_value *params, | |
cc81b5ab | 113 | void *init_method_data, bt_logging_level log_level, |
8eee8ea2 | 114 | const bt_component_source **component); |
7b53201c | 115 | |
fb25b9e3 PP |
116 | extern bt_graph_add_component_status |
117 | bt_graph_add_filter_component(bt_graph *graph, | |
8eee8ea2 PP |
118 | const bt_component_class_filter *component_class, |
119 | const char *name, const bt_value *params, | |
cc81b5ab | 120 | bt_logging_level log_level, |
8eee8ea2 | 121 | const bt_component_filter **component); |
7b53201c | 122 | |
fb25b9e3 PP |
123 | extern bt_graph_add_component_status |
124 | bt_graph_add_filter_component_with_init_method_data( | |
8eee8ea2 PP |
125 | bt_graph *graph, |
126 | const bt_component_class_filter *component_class, | |
127 | const char *name, const bt_value *params, | |
cc81b5ab | 128 | void *init_method_data, bt_logging_level log_level, |
8eee8ea2 | 129 | const bt_component_filter **component); |
7b53201c | 130 | |
fb25b9e3 PP |
131 | extern bt_graph_add_component_status |
132 | bt_graph_add_sink_component( | |
ee78f405 | 133 | bt_graph *graph, const bt_component_class_sink *component_class, |
8eee8ea2 | 134 | const char *name, const bt_value *params, |
cc81b5ab | 135 | bt_logging_level log_level, |
8eee8ea2 | 136 | const bt_component_sink **component); |
7b53201c | 137 | |
fb25b9e3 PP |
138 | extern bt_graph_add_component_status |
139 | bt_graph_add_sink_component_with_init_method_data( | |
ee78f405 | 140 | bt_graph *graph, const bt_component_class_sink *component_class, |
8eee8ea2 | 141 | const char *name, const bt_value *params, |
cc81b5ab | 142 | void *init_method_data, bt_logging_level log_level, |
8eee8ea2 | 143 | const bt_component_sink **component); |
7b53201c | 144 | |
fb25b9e3 PP |
145 | typedef enum bt_graph_connect_ports_status { |
146 | BT_GRAPH_CONNECT_PORTS_STATUS_OK = __BT_FUNC_STATUS_OK, | |
147 | BT_GRAPH_CONNECT_PORTS_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
fb25b9e3 PP |
148 | BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
149 | } bt_graph_connect_ports_status; | |
150 | ||
151 | extern bt_graph_connect_ports_status bt_graph_connect_ports(bt_graph *graph, | |
8eee8ea2 PP |
152 | const bt_port_output *upstream, |
153 | const bt_port_input *downstream, | |
154 | const bt_connection **connection); | |
7b53201c | 155 | |
fb25b9e3 PP |
156 | typedef enum bt_graph_run_status { |
157 | BT_GRAPH_RUN_STATUS_OK = __BT_FUNC_STATUS_OK, | |
158 | BT_GRAPH_RUN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
159 | BT_GRAPH_RUN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
160 | BT_GRAPH_RUN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, | |
161 | BT_GRAPH_RUN_STATUS_END = __BT_FUNC_STATUS_END, | |
fb25b9e3 PP |
162 | } bt_graph_run_status; |
163 | ||
164 | extern bt_graph_run_status bt_graph_run(bt_graph *graph); | |
165 | ||
166 | typedef enum bt_graph_consume_status { | |
167 | BT_GRAPH_CONSUME_STATUS_OK = __BT_FUNC_STATUS_OK, | |
168 | BT_GRAPH_CONSUME_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
169 | BT_GRAPH_CONSUME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
170 | BT_GRAPH_CONSUME_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, | |
171 | BT_GRAPH_CONSUME_STATUS_END = __BT_FUNC_STATUS_END, | |
fb25b9e3 PP |
172 | } bt_graph_consume_status; |
173 | ||
174 | extern bt_graph_consume_status bt_graph_consume(bt_graph *graph); | |
175 | ||
176 | typedef enum bt_graph_add_listener_status { | |
177 | BT_GRAPH_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK, | |
178 | BT_GRAPH_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
179 | } bt_graph_add_listener_status; | |
180 | ||
181 | extern bt_graph_add_listener_status | |
182 | bt_graph_add_filter_component_input_port_added_listener( | |
8eee8ea2 | 183 | bt_graph *graph, |
7b53201c PP |
184 | bt_graph_filter_component_input_port_added_listener_func listener, |
185 | bt_graph_listener_removed_func listener_removed, void *data, | |
eba7ea21 | 186 | bt_listener_id *listener_id); |
7b53201c | 187 | |
fb25b9e3 PP |
188 | extern bt_graph_add_listener_status |
189 | bt_graph_add_sink_component_input_port_added_listener( | |
8eee8ea2 | 190 | bt_graph *graph, |
7b53201c PP |
191 | bt_graph_sink_component_input_port_added_listener_func listener, |
192 | bt_graph_listener_removed_func listener_removed, void *data, | |
eba7ea21 | 193 | bt_listener_id *listener_id); |
7b53201c | 194 | |
fb25b9e3 PP |
195 | extern bt_graph_add_listener_status |
196 | bt_graph_add_source_component_output_port_added_listener( | |
8eee8ea2 | 197 | bt_graph *graph, |
7b53201c PP |
198 | bt_graph_source_component_output_port_added_listener_func listener, |
199 | bt_graph_listener_removed_func listener_removed, void *data, | |
eba7ea21 | 200 | bt_listener_id *listener_id); |
7b53201c | 201 | |
fb25b9e3 PP |
202 | extern bt_graph_add_listener_status |
203 | bt_graph_add_filter_component_output_port_added_listener( | |
8eee8ea2 | 204 | bt_graph *graph, |
7b53201c PP |
205 | bt_graph_filter_component_output_port_added_listener_func listener, |
206 | bt_graph_listener_removed_func listener_removed, void *data, | |
eba7ea21 | 207 | bt_listener_id *listener_id); |
7b53201c | 208 | |
fb25b9e3 | 209 | extern bt_graph_add_listener_status |
7b53201c | 210 | bt_graph_add_source_filter_component_ports_connected_listener( |
8eee8ea2 | 211 | bt_graph *graph, |
7b53201c PP |
212 | bt_graph_source_filter_component_ports_connected_listener_func listener, |
213 | bt_graph_listener_removed_func listener_removed, void *data, | |
eba7ea21 | 214 | bt_listener_id *listener_id); |
7b53201c | 215 | |
fb25b9e3 | 216 | extern bt_graph_add_listener_status |
ee976410 PP |
217 | bt_graph_add_filter_filter_component_ports_connected_listener( |
218 | bt_graph *graph, | |
219 | bt_graph_filter_filter_component_ports_connected_listener_func listener, | |
220 | bt_graph_listener_removed_func listener_removed, void *data, | |
eba7ea21 | 221 | bt_listener_id *listener_id); |
ee976410 | 222 | |
fb25b9e3 | 223 | extern bt_graph_add_listener_status |
7b53201c | 224 | bt_graph_add_source_sink_component_ports_connected_listener( |
8eee8ea2 | 225 | bt_graph *graph, |
7b53201c PP |
226 | bt_graph_source_sink_component_ports_connected_listener_func listener, |
227 | bt_graph_listener_removed_func listener_removed, void *data, | |
eba7ea21 | 228 | bt_listener_id *listener_id); |
7b53201c | 229 | |
fb25b9e3 | 230 | extern bt_graph_add_listener_status |
7b53201c | 231 | bt_graph_add_filter_sink_component_ports_connected_listener( |
8eee8ea2 | 232 | bt_graph *graph, |
7b53201c PP |
233 | bt_graph_filter_sink_component_ports_connected_listener_func listener, |
234 | bt_graph_listener_removed_func listener_removed, void *data, | |
eba7ea21 | 235 | bt_listener_id *listener_id); |
7b53201c | 236 | |
d73bb381 PP |
237 | typedef enum bt_graph_add_interrupter_status { |
238 | BT_GRAPH_ADD_INTERRUPTER_STATUS_OK = __BT_FUNC_STATUS_OK, | |
239 | BT_GRAPH_ADD_INTERRUPTER_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
240 | } bt_graph_add_interrupter_status; | |
fb25b9e3 | 241 | |
d73bb381 PP |
242 | extern bt_graph_add_interrupter_status bt_graph_add_interrupter(bt_graph *graph, |
243 | const bt_interrupter *interrupter); | |
244 | ||
245 | extern void bt_graph_interrupt(bt_graph *graph); | |
202a3a13 | 246 | |
c0418dd9 JG |
247 | #ifdef __cplusplus |
248 | } | |
249 | #endif | |
250 | ||
3fd40f46 | 251 | #endif /* BABELTRACE2_GRAPH_GRAPH_H */ |