1 #ifndef BABELTRACE_GRAPH_GRAPH_H
2 #define BABELTRACE_GRAPH_GRAPH_H
5 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
6 * Copyright 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
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:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
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
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
34 #include <babeltrace/types.h>
36 /* For bt_graph_status */
37 #include <babeltrace/graph/graph-const.h>
43 typedef void (*bt_graph_filter_component_input_port_added_listener_func
)(
44 const bt_component_filter
*component
,
45 const bt_port_input
*port
, void *data
);
47 typedef void (*bt_graph_sink_component_input_port_added_listener_func
)(
48 const bt_component_sink
*component
,
49 const bt_port_input
*port
, void *data
);
51 typedef void (*bt_graph_source_component_output_port_added_listener_func
)(
52 const bt_component_source
*component
,
53 const bt_port_output
*port
, void *data
);
55 typedef void (*bt_graph_filter_component_output_port_added_listener_func
)(
56 const bt_component_filter
*component
,
57 const bt_port_output
*port
, void *data
);
59 typedef void (*bt_graph_filter_component_input_port_removed_listener_func
)(
60 const bt_component_filter
*component
,
61 const bt_port_input
*port
, void *data
);
63 typedef void (*bt_graph_sink_component_input_port_removed_listener_func
)(
64 const bt_component_sink
*component
,
65 const bt_port_input
*port
, void *data
);
67 typedef void (*bt_graph_source_component_output_port_removed_listener_func
)(
68 const bt_component_source
*component
,
69 const bt_port_output
*port
, void *data
);
71 typedef void (*bt_graph_filter_component_output_port_removed_listener_func
)(
72 const bt_component_filter
*component
,
73 const bt_port_output
*port
, void *data
);
75 typedef void (*bt_graph_source_filter_component_ports_connected_listener_func
)(
76 const bt_component_source
*source_component
,
77 const bt_component_filter
*filter_component
,
78 const bt_port_output
*upstream_port
,
79 const bt_port_input
*downstream_port
, void *data
);
81 typedef void (*bt_graph_source_sink_component_ports_connected_listener_func
)(
82 const bt_component_source
*source_component
,
83 const bt_component_sink
*sink_component
,
84 const bt_port_output
*upstream_port
,
85 const bt_port_input
*downstream_port
, void *data
);
87 typedef void (*bt_graph_filter_sink_component_ports_connected_listener_func
)(
88 const bt_component_filter
*filter_component
,
89 const bt_component_sink
*sink_component
,
90 const bt_port_output
*upstream_port
,
91 const bt_port_input
*downstream_port
, void *data
);
93 typedef void (*bt_graph_source_filter_component_ports_disconnected_listener_func
)(
94 const bt_component_source
*source_component
,
95 const bt_component_filter
*filter_component
,
96 const bt_port_output
*upstream_port
,
97 const bt_port_input
*downstream_port
,
100 typedef void (*bt_graph_source_sink_component_ports_disconnected_listener_func
)(
101 const bt_component_source
*source_component
,
102 const bt_component_sink
*sink_component
,
103 const bt_port_output
*upstream_port
,
104 const bt_port_input
*downstream_port
,
107 typedef void (*bt_graph_filter_sink_component_ports_disconnected_listener_func
)(
108 const bt_component_filter
*filter_component
,
109 const bt_component_sink
*sink_component
,
110 const bt_port_output
*upstream_port
,
111 const bt_port_input
*downstream_port
,
114 typedef void (* bt_graph_listener_removed_func
)(void *data
);
116 extern bt_graph
*bt_graph_create(void);
118 extern bt_graph_status
bt_graph_add_source_component(bt_graph
*graph
,
119 const bt_component_class_source
*component_class
,
120 const char *name
, const bt_value
*params
,
121 const bt_component_source
**component
);
123 extern bt_graph_status
bt_graph_add_source_component_with_init_method_data(
125 const bt_component_class_source
*component_class
,
126 const char *name
, const bt_value
*params
,
127 void *init_method_data
,
128 const bt_component_source
**component
);
130 extern bt_graph_status
bt_graph_add_filter_component(bt_graph
*graph
,
131 const bt_component_class_filter
*component_class
,
132 const char *name
, const bt_value
*params
,
133 const bt_component_filter
**component
);
135 extern bt_graph_status
bt_graph_add_filter_component_with_init_method_data(
137 const bt_component_class_filter
*component_class
,
138 const char *name
, const bt_value
*params
,
139 void *init_method_data
,
140 const bt_component_filter
**component
);
142 extern bt_graph_status
bt_graph_add_sink_component(
143 bt_graph
*graph
, const bt_component_class_sink
*component_class
,
144 const char *name
, const bt_value
*params
,
145 const bt_component_sink
**component
);
147 extern bt_graph_status
bt_graph_add_sink_component_with_init_method_data(
148 bt_graph
*graph
, const bt_component_class_sink
*component_class
,
149 const char *name
, const bt_value
*params
,
150 void *init_method_data
,
151 const bt_component_sink
**component
);
153 extern bt_graph_status
bt_graph_connect_ports(bt_graph
*graph
,
154 const bt_port_output
*upstream
,
155 const bt_port_input
*downstream
,
156 const bt_connection
**connection
);
158 extern bt_graph_status
bt_graph_run(bt_graph
*graph
);
160 extern bt_graph_status
bt_graph_consume(
163 extern bt_graph_status
164 bt_graph_add_filter_component_input_port_added_listener(
166 bt_graph_filter_component_input_port_added_listener_func listener
,
167 bt_graph_listener_removed_func listener_removed
, void *data
,
170 extern bt_graph_status
171 bt_graph_add_sink_component_input_port_added_listener(
173 bt_graph_sink_component_input_port_added_listener_func listener
,
174 bt_graph_listener_removed_func listener_removed
, void *data
,
177 extern bt_graph_status
178 bt_graph_add_source_component_output_port_added_listener(
180 bt_graph_source_component_output_port_added_listener_func listener
,
181 bt_graph_listener_removed_func listener_removed
, void *data
,
184 extern bt_graph_status
185 bt_graph_add_filter_component_output_port_added_listener(
187 bt_graph_filter_component_output_port_added_listener_func listener
,
188 bt_graph_listener_removed_func listener_removed
, void *data
,
191 extern bt_graph_status
192 bt_graph_add_filter_component_input_port_removed_listener(
194 bt_graph_filter_component_input_port_removed_listener_func listener
,
195 bt_graph_listener_removed_func listener_removed
, void *data
,
198 extern bt_graph_status
199 bt_graph_add_sink_component_input_port_removed_listener(
201 bt_graph_sink_component_input_port_removed_listener_func listener
,
202 bt_graph_listener_removed_func listener_removed
, void *data
,
205 extern bt_graph_status
206 bt_graph_add_source_component_output_port_removed_listener(
208 bt_graph_source_component_output_port_removed_listener_func listener
,
209 bt_graph_listener_removed_func listener_removed
, void *data
,
212 extern bt_graph_status
213 bt_graph_add_filter_component_output_port_removed_listener(
215 bt_graph_filter_component_output_port_removed_listener_func listener
,
216 bt_graph_listener_removed_func listener_removed
, void *data
,
219 extern bt_graph_status
220 bt_graph_add_source_filter_component_ports_connected_listener(
222 bt_graph_source_filter_component_ports_connected_listener_func listener
,
223 bt_graph_listener_removed_func listener_removed
, void *data
,
226 extern bt_graph_status
227 bt_graph_add_source_sink_component_ports_connected_listener(
229 bt_graph_source_sink_component_ports_connected_listener_func listener
,
230 bt_graph_listener_removed_func listener_removed
, void *data
,
233 extern bt_graph_status
234 bt_graph_add_filter_sink_component_ports_connected_listener(
236 bt_graph_filter_sink_component_ports_connected_listener_func listener
,
237 bt_graph_listener_removed_func listener_removed
, void *data
,
240 extern bt_graph_status
241 bt_graph_add_source_filter_component_ports_disconnected_listener(
243 bt_graph_source_filter_component_ports_disconnected_listener_func listener
,
244 bt_graph_listener_removed_func listener_removed
, void *data
,
247 extern bt_graph_status
248 bt_graph_add_source_sink_component_ports_disconnected_listener(
250 bt_graph_source_sink_component_ports_disconnected_listener_func listener
,
251 bt_graph_listener_removed_func listener_removed
, void *data
,
254 extern bt_graph_status
255 bt_graph_add_filter_sink_component_ports_disconnected_listener(
257 bt_graph_filter_sink_component_ports_disconnected_listener_func listener
,
258 bt_graph_listener_removed_func listener_removed
, void *data
,
261 extern bt_graph_status
bt_graph_cancel(bt_graph
*graph
);
267 #endif /* BABELTRACE_GRAPH_GRAPH_H */