Hide bt_component_sink_consume
[babeltrace.git] / include / babeltrace / component / component-graph.h
CommitLineData
33b34c43
PP
1#ifndef BABELTRACE_COMPONENT_COMPONENT_GRAPH_H
2#define BABELTRACE_COMPONENT_COMPONENT_GRAPH_H
c0418dd9
JG
3
4/*
5 * BabelTrace - Babeltrace Component Graph Interface
6 *
7 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 *
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
10 *
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:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
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
27 * SOFTWARE.
28 */
29
33b34c43
PP
30#include <babeltrace/component/component-class.h>
31#include <babeltrace/component/component.h>
c0418dd9
JG
32#include <babeltrace/values.h>
33#include <stdio.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39enum bt_component_graph_status {
40 BT_COMPONENT_GRAPH_STATUS_OK = 0,
41};
42
43/*
44Graph Ownership:
45
46 Graph
47 ^
48 |
49 Connection
50 ^ ^
51 / \
52 ComponentA ComponentB
53
541) A graph only owns a set of connections.
552) Components should _never_ own each other.
563) A component can keep the complete graph "alive".
57
58*/
59extern struct bt_component_graph *bt_component_graph_create(void);
60
61/**
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.
65 *
66 * Will add any component that is not already part of the graph.
67 */
68extern enum bt_component_graph_status bt_component_graph_connect(
69 struct bt_component_graph *graph, struct bt_component *upstream,
70 struct bt_component *downstream);
71
72/**
73 * Add component to the graph
74 */
75extern enum bt_component_graph_status bt_component_graph_add_component(
76 struct bt_component_graph *graph,
77 struct bt_component *component);
78
79/**
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).
83 */
84extern 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);
87
88/**
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.
91 */
92extern enum bt_component_graph_status bt_component_graph_run(
93 struct bt_component_graph *graph);
94
95#ifdef __cplusplus
96}
97#endif
98
33b34c43 99#endif /* BABELTRACE_COMPONENT_COMPONENT_GRAPH_H */
This page took 0.027087 seconds and 4 git commands to generate.