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