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