1 #ifndef BABELTRACE_COMPONENT_COMPONENT_GRAPH_H
2 #define BABELTRACE_COMPONENT_COMPONENT_GRAPH_H
5 * BabelTrace - Babeltrace Component Graph Interface
7 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 #include <babeltrace/component/component-class.h>
31 #include <babeltrace/component/component.h>
32 #include <babeltrace/values.h>
39 enum bt_component_graph_status
{
40 BT_COMPONENT_GRAPH_STATUS_OK
= 0,
54 1) A graph only owns a set of connections.
55 2) Components should _never_ own each other.
56 3) A component can keep the complete graph "alive".
59 extern struct bt_component_graph
*bt_component_graph_create(void);
62 * Creates a connection object which owns both components, invokes the
63 * components' connection callback, and add the connection to the component
64 * graph's set of connection.
66 * Will add any component that is not already part of the graph.
68 extern enum bt_component_graph_status
bt_component_graph_connect(
69 struct bt_component_graph
*graph
, struct bt_component
*upstream
,
70 struct bt_component
*downstream
);
73 * Add component to the graph
75 extern enum bt_component_graph_status
bt_component_graph_add_component(
76 struct bt_component_graph
*graph
,
77 struct bt_component
*component
);
80 * Add a component as a "sibling" of the origin component. Sibling share
81 * connections equivalent to each other at the time of connection (same
82 * parents and children).
84 extern enum bt_component_graph_status
bt_component_graph_add_component_as_sibling(
85 struct bt_component_graph
*graph
, struct bt_component
*origin
,
86 struct bt_component
*new_component
);
89 * Runs "bt_component_sink_consume()" on all sinks in round-robin until they all
90 * indicate that the end is reached on that an error occured.
92 extern enum bt_component_graph_status
bt_component_graph_run(
93 struct bt_component_graph
*graph
);
99 #endif /* BABELTRACE_COMPONENT_COMPONENT_GRAPH_H */