tests/lib: remove `test_bt_values` and `test_graph_topo`
[babeltrace.git] / include / babeltrace2 / graph / graph.h
CommitLineData
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 */
3fadfbc0 34#include <babeltrace2/types.h>
c0418dd9 35
4cdfc5e8 36/* For bt_graph_status */
3fadfbc0 37#include <babeltrace2/graph/graph-const.h>
0d72b8c3 38
e874da19
PP
39/* For bt_logging_level */
40#include <babeltrace2/logging.h>
41
c0418dd9
JG
42#ifdef __cplusplus
43extern "C" {
44#endif
45
8cc56726
SM
46typedef enum bt_graph_listener_status {
47 BT_GRAPH_LISTENER_STATUS_OK = 0,
48 BT_GRAPH_LISTENER_STATUS_ERROR = -1,
49 BT_GRAPH_LISTENER_STATUS_NOMEM = -12,
50} bt_graph_listener_status;
51
52typedef bt_graph_listener_status
53(*bt_graph_filter_component_input_port_added_listener_func)(
b19ff26f
PP
54 const bt_component_filter *component,
55 const bt_port_input *port, void *data);
0d72b8c3 56
8cc56726
SM
57typedef bt_graph_listener_status
58(*bt_graph_sink_component_input_port_added_listener_func)(
b19ff26f
PP
59 const bt_component_sink *component,
60 const bt_port_input *port, void *data);
0d72b8c3 61
8cc56726
SM
62typedef bt_graph_listener_status
63(*bt_graph_source_component_output_port_added_listener_func)(
b19ff26f
PP
64 const bt_component_source *component,
65 const bt_port_output *port, void *data);
0d72b8c3 66
8cc56726
SM
67typedef bt_graph_listener_status
68(*bt_graph_filter_component_output_port_added_listener_func)(
b19ff26f
PP
69 const bt_component_filter *component,
70 const bt_port_output *port, void *data);
0d72b8c3 71
8cc56726
SM
72typedef bt_graph_listener_status
73(*bt_graph_source_filter_component_ports_connected_listener_func)(
b19ff26f
PP
74 const bt_component_source *source_component,
75 const bt_component_filter *filter_component,
76 const bt_port_output *upstream_port,
77 const bt_port_input *downstream_port, void *data);
0d72b8c3 78
8cc56726
SM
79typedef bt_graph_listener_status
80(*bt_graph_source_sink_component_ports_connected_listener_func)(
b19ff26f
PP
81 const bt_component_source *source_component,
82 const bt_component_sink *sink_component,
83 const bt_port_output *upstream_port,
84 const bt_port_input *downstream_port, void *data);
0d72b8c3 85
8cc56726
SM
86typedef bt_graph_listener_status
87(*bt_graph_filter_filter_component_ports_connected_listener_func)(
9c0a126a
PP
88 const bt_component_filter *filter_component_upstream,
89 const bt_component_filter *filter_component_downstream,
90 const bt_port_output *upstream_port,
91 const bt_port_input *downstream_port,
92 void *data);
93
8cc56726
SM
94typedef bt_graph_listener_status
95(*bt_graph_filter_sink_component_ports_connected_listener_func)(
b19ff26f
PP
96 const bt_component_filter *filter_component,
97 const bt_component_sink *sink_component,
98 const bt_port_output *upstream_port,
99 const bt_port_input *downstream_port, void *data);
0d72b8c3 100
0d72b8c3
PP
101typedef void (* bt_graph_listener_removed_func)(void *data);
102
b19ff26f 103extern bt_graph *bt_graph_create(void);
0d72b8c3 104
4cdfc5e8 105extern bt_graph_status bt_graph_add_source_component(bt_graph *graph,
b19ff26f
PP
106 const bt_component_class_source *component_class,
107 const char *name, const bt_value *params,
e874da19 108 bt_logging_level log_level, const bt_component_source **component);
0d72b8c3 109
4cdfc5e8 110extern bt_graph_status bt_graph_add_source_component_with_init_method_data(
b19ff26f
PP
111 bt_graph *graph,
112 const bt_component_class_source *component_class,
113 const char *name, const bt_value *params,
e874da19 114 void *init_method_data, bt_logging_level log_level,
b19ff26f 115 const bt_component_source **component);
0d72b8c3 116
4cdfc5e8 117extern bt_graph_status 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
4cdfc5e8 123extern bt_graph_status bt_graph_add_filter_component_with_init_method_data(
b19ff26f
PP
124 bt_graph *graph,
125 const bt_component_class_filter *component_class,
126 const char *name, const bt_value *params,
e874da19 127 void *init_method_data, bt_logging_level log_level,
b19ff26f 128 const bt_component_filter **component);
0d72b8c3 129
4cdfc5e8
PP
130extern bt_graph_status bt_graph_add_sink_component(
131 bt_graph *graph, const bt_component_class_sink *component_class,
b19ff26f 132 const char *name, const bt_value *params,
e874da19 133 bt_logging_level log_level,
b19ff26f 134 const bt_component_sink **component);
0d72b8c3 135
4cdfc5e8
PP
136extern bt_graph_status bt_graph_add_sink_component_with_init_method_data(
137 bt_graph *graph, const bt_component_class_sink *component_class,
b19ff26f 138 const char *name, const bt_value *params,
e874da19 139 void *init_method_data, bt_logging_level log_level,
b19ff26f 140 const bt_component_sink **component);
0d72b8c3 141
4cdfc5e8 142extern bt_graph_status bt_graph_connect_ports(bt_graph *graph,
b19ff26f
PP
143 const bt_port_output *upstream,
144 const bt_port_input *downstream,
145 const bt_connection **connection);
0d72b8c3 146
4cdfc5e8 147extern bt_graph_status bt_graph_run(bt_graph *graph);
0d72b8c3 148
4725a201 149extern bt_graph_status bt_graph_consume(bt_graph *graph);
0d72b8c3 150
4725a201 151extern bt_graph_status bt_graph_add_filter_component_input_port_added_listener(
b19ff26f 152 bt_graph *graph,
0d72b8c3
PP
153 bt_graph_filter_component_input_port_added_listener_func listener,
154 bt_graph_listener_removed_func listener_removed, void *data,
155 int *listener_id);
156
4725a201 157extern bt_graph_status bt_graph_add_sink_component_input_port_added_listener(
b19ff26f 158 bt_graph *graph,
0d72b8c3
PP
159 bt_graph_sink_component_input_port_added_listener_func listener,
160 bt_graph_listener_removed_func listener_removed, void *data,
161 int *listener_id);
162
4725a201 163extern bt_graph_status bt_graph_add_source_component_output_port_added_listener(
b19ff26f 164 bt_graph *graph,
0d72b8c3
PP
165 bt_graph_source_component_output_port_added_listener_func listener,
166 bt_graph_listener_removed_func listener_removed, void *data,
167 int *listener_id);
168
4725a201 169extern bt_graph_status bt_graph_add_filter_component_output_port_added_listener(
b19ff26f 170 bt_graph *graph,
0d72b8c3
PP
171 bt_graph_filter_component_output_port_added_listener_func listener,
172 bt_graph_listener_removed_func listener_removed, void *data,
173 int *listener_id);
174
4cdfc5e8 175extern bt_graph_status
0d72b8c3 176bt_graph_add_source_filter_component_ports_connected_listener(
b19ff26f 177 bt_graph *graph,
0d72b8c3
PP
178 bt_graph_source_filter_component_ports_connected_listener_func listener,
179 bt_graph_listener_removed_func listener_removed, void *data,
180 int *listener_id);
181
9c0a126a
PP
182extern bt_graph_status
183bt_graph_add_filter_filter_component_ports_connected_listener(
184 bt_graph *graph,
185 bt_graph_filter_filter_component_ports_connected_listener_func listener,
186 bt_graph_listener_removed_func listener_removed, void *data,
187 int *listener_id);
188
4cdfc5e8 189extern bt_graph_status
0d72b8c3 190bt_graph_add_source_sink_component_ports_connected_listener(
b19ff26f 191 bt_graph *graph,
0d72b8c3
PP
192 bt_graph_source_sink_component_ports_connected_listener_func listener,
193 bt_graph_listener_removed_func listener_removed, void *data,
194 int *listener_id);
195
4cdfc5e8 196extern bt_graph_status
0d72b8c3 197bt_graph_add_filter_sink_component_ports_connected_listener(
b19ff26f 198 bt_graph *graph,
0d72b8c3
PP
199 bt_graph_filter_sink_component_ports_connected_listener_func listener,
200 bt_graph_listener_removed_func listener_removed, void *data,
201 int *listener_id);
202
4cdfc5e8 203extern bt_graph_status bt_graph_cancel(bt_graph *graph);
202a3a13 204
c0418dd9
JG
205#ifdef __cplusplus
206}
207#endif
208
1ca80abd 209#endif /* BABELTRACE_GRAPH_GRAPH_H */
This page took 0.051829 seconds and 4 git commands to generate.