Commit | Line | Data |
---|---|---|
1ca80abd PP |
1 | #ifndef BABELTRACE_GRAPH_GRAPH_H |
2 | #define BABELTRACE_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 | ||
b19ff26f PP |
27 | /* |
28 | * For bt_bool, bt_component, bt_component_class, | |
29 | * bt_component_class_filter, bt_component_class_sink, | |
30 | * bt_component_class_source, bt_component_filter, bt_component_sink, | |
31 | * bt_component_source, bt_connection, bt_graph, bt_port_input, | |
32 | * bt_port_output, bt_value | |
33 | */ | |
202a3a13 | 34 | #include <babeltrace/types.h> |
c0418dd9 | 35 | |
4cdfc5e8 | 36 | /* For bt_graph_status */ |
0d72b8c3 PP |
37 | #include <babeltrace/graph/graph-const.h> |
38 | ||
c0418dd9 JG |
39 | #ifdef __cplusplus |
40 | extern "C" { | |
41 | #endif | |
42 | ||
0d72b8c3 | 43 | typedef void (*bt_graph_filter_component_input_port_added_listener_func)( |
b19ff26f PP |
44 | const bt_component_filter *component, |
45 | const bt_port_input *port, void *data); | |
0d72b8c3 PP |
46 | |
47 | typedef void (*bt_graph_sink_component_input_port_added_listener_func)( | |
b19ff26f PP |
48 | const bt_component_sink *component, |
49 | const bt_port_input *port, void *data); | |
0d72b8c3 PP |
50 | |
51 | typedef void (*bt_graph_source_component_output_port_added_listener_func)( | |
b19ff26f PP |
52 | const bt_component_source *component, |
53 | const bt_port_output *port, void *data); | |
0d72b8c3 PP |
54 | |
55 | typedef void (*bt_graph_filter_component_output_port_added_listener_func)( | |
b19ff26f PP |
56 | const bt_component_filter *component, |
57 | const bt_port_output *port, void *data); | |
0d72b8c3 | 58 | |
0d72b8c3 | 59 | typedef void (*bt_graph_source_filter_component_ports_connected_listener_func)( |
b19ff26f PP |
60 | const bt_component_source *source_component, |
61 | const bt_component_filter *filter_component, | |
62 | const bt_port_output *upstream_port, | |
63 | const bt_port_input *downstream_port, void *data); | |
0d72b8c3 PP |
64 | |
65 | typedef void (*bt_graph_source_sink_component_ports_connected_listener_func)( | |
b19ff26f PP |
66 | const bt_component_source *source_component, |
67 | const bt_component_sink *sink_component, | |
68 | const bt_port_output *upstream_port, | |
69 | const bt_port_input *downstream_port, void *data); | |
0d72b8c3 | 70 | |
9c0a126a PP |
71 | typedef void (*bt_graph_filter_filter_component_ports_connected_listener_func)( |
72 | const bt_component_filter *filter_component_upstream, | |
73 | const bt_component_filter *filter_component_downstream, | |
74 | const bt_port_output *upstream_port, | |
75 | const bt_port_input *downstream_port, | |
76 | void *data); | |
77 | ||
0d72b8c3 | 78 | typedef void (*bt_graph_filter_sink_component_ports_connected_listener_func)( |
b19ff26f PP |
79 | const bt_component_filter *filter_component, |
80 | const bt_component_sink *sink_component, | |
81 | const bt_port_output *upstream_port, | |
82 | const bt_port_input *downstream_port, void *data); | |
0d72b8c3 | 83 | |
0d72b8c3 PP |
84 | typedef void (* bt_graph_listener_removed_func)(void *data); |
85 | ||
b19ff26f | 86 | extern bt_graph *bt_graph_create(void); |
0d72b8c3 | 87 | |
4cdfc5e8 | 88 | extern bt_graph_status bt_graph_add_source_component(bt_graph *graph, |
b19ff26f PP |
89 | const bt_component_class_source *component_class, |
90 | const char *name, const bt_value *params, | |
91 | const bt_component_source **component); | |
0d72b8c3 | 92 | |
4cdfc5e8 | 93 | extern bt_graph_status bt_graph_add_source_component_with_init_method_data( |
b19ff26f PP |
94 | bt_graph *graph, |
95 | const bt_component_class_source *component_class, | |
96 | const char *name, const bt_value *params, | |
0d72b8c3 | 97 | void *init_method_data, |
b19ff26f | 98 | const bt_component_source **component); |
0d72b8c3 | 99 | |
4cdfc5e8 | 100 | extern bt_graph_status bt_graph_add_filter_component(bt_graph *graph, |
b19ff26f PP |
101 | const bt_component_class_filter *component_class, |
102 | const char *name, const bt_value *params, | |
103 | const bt_component_filter **component); | |
0d72b8c3 | 104 | |
4cdfc5e8 | 105 | extern bt_graph_status bt_graph_add_filter_component_with_init_method_data( |
b19ff26f PP |
106 | bt_graph *graph, |
107 | const bt_component_class_filter *component_class, | |
108 | const char *name, const bt_value *params, | |
0d72b8c3 | 109 | void *init_method_data, |
b19ff26f | 110 | const bt_component_filter **component); |
0d72b8c3 | 111 | |
4cdfc5e8 PP |
112 | extern bt_graph_status bt_graph_add_sink_component( |
113 | bt_graph *graph, const bt_component_class_sink *component_class, | |
b19ff26f PP |
114 | const char *name, const bt_value *params, |
115 | const bt_component_sink **component); | |
0d72b8c3 | 116 | |
4cdfc5e8 PP |
117 | extern bt_graph_status bt_graph_add_sink_component_with_init_method_data( |
118 | bt_graph *graph, const bt_component_class_sink *component_class, | |
b19ff26f | 119 | const char *name, const bt_value *params, |
0d72b8c3 | 120 | void *init_method_data, |
b19ff26f | 121 | const bt_component_sink **component); |
0d72b8c3 | 122 | |
4cdfc5e8 | 123 | extern bt_graph_status bt_graph_connect_ports(bt_graph *graph, |
b19ff26f PP |
124 | const bt_port_output *upstream, |
125 | const bt_port_input *downstream, | |
126 | const bt_connection **connection); | |
0d72b8c3 | 127 | |
4cdfc5e8 | 128 | extern bt_graph_status bt_graph_run(bt_graph *graph); |
0d72b8c3 | 129 | |
4725a201 | 130 | extern bt_graph_status bt_graph_consume(bt_graph *graph); |
0d72b8c3 | 131 | |
4725a201 | 132 | extern bt_graph_status bt_graph_add_filter_component_input_port_added_listener( |
b19ff26f | 133 | bt_graph *graph, |
0d72b8c3 PP |
134 | bt_graph_filter_component_input_port_added_listener_func listener, |
135 | bt_graph_listener_removed_func listener_removed, void *data, | |
136 | int *listener_id); | |
137 | ||
4725a201 | 138 | extern bt_graph_status bt_graph_add_sink_component_input_port_added_listener( |
b19ff26f | 139 | bt_graph *graph, |
0d72b8c3 PP |
140 | bt_graph_sink_component_input_port_added_listener_func listener, |
141 | bt_graph_listener_removed_func listener_removed, void *data, | |
142 | int *listener_id); | |
143 | ||
4725a201 | 144 | extern bt_graph_status bt_graph_add_source_component_output_port_added_listener( |
b19ff26f | 145 | bt_graph *graph, |
0d72b8c3 PP |
146 | bt_graph_source_component_output_port_added_listener_func listener, |
147 | bt_graph_listener_removed_func listener_removed, void *data, | |
148 | int *listener_id); | |
149 | ||
4725a201 | 150 | extern bt_graph_status bt_graph_add_filter_component_output_port_added_listener( |
b19ff26f | 151 | bt_graph *graph, |
0d72b8c3 PP |
152 | bt_graph_filter_component_output_port_added_listener_func listener, |
153 | bt_graph_listener_removed_func listener_removed, void *data, | |
154 | int *listener_id); | |
155 | ||
4cdfc5e8 | 156 | extern bt_graph_status |
0d72b8c3 | 157 | bt_graph_add_source_filter_component_ports_connected_listener( |
b19ff26f | 158 | bt_graph *graph, |
0d72b8c3 PP |
159 | bt_graph_source_filter_component_ports_connected_listener_func listener, |
160 | bt_graph_listener_removed_func listener_removed, void *data, | |
161 | int *listener_id); | |
162 | ||
9c0a126a PP |
163 | extern bt_graph_status |
164 | bt_graph_add_filter_filter_component_ports_connected_listener( | |
165 | bt_graph *graph, | |
166 | bt_graph_filter_filter_component_ports_connected_listener_func listener, | |
167 | bt_graph_listener_removed_func listener_removed, void *data, | |
168 | int *listener_id); | |
169 | ||
4cdfc5e8 | 170 | extern bt_graph_status |
0d72b8c3 | 171 | bt_graph_add_source_sink_component_ports_connected_listener( |
b19ff26f | 172 | bt_graph *graph, |
0d72b8c3 PP |
173 | bt_graph_source_sink_component_ports_connected_listener_func listener, |
174 | bt_graph_listener_removed_func listener_removed, void *data, | |
175 | int *listener_id); | |
176 | ||
4cdfc5e8 | 177 | extern bt_graph_status |
0d72b8c3 | 178 | bt_graph_add_filter_sink_component_ports_connected_listener( |
b19ff26f | 179 | bt_graph *graph, |
0d72b8c3 PP |
180 | bt_graph_filter_sink_component_ports_connected_listener_func listener, |
181 | bt_graph_listener_removed_func listener_removed, void *data, | |
182 | int *listener_id); | |
183 | ||
4cdfc5e8 | 184 | extern bt_graph_status bt_graph_cancel(bt_graph *graph); |
202a3a13 | 185 | |
c0418dd9 JG |
186 | #ifdef __cplusplus |
187 | } | |
188 | #endif | |
189 | ||
1ca80abd | 190 | #endif /* BABELTRACE_GRAPH_GRAPH_H */ |