babeltrace/plugin/plugin.h \
babeltrace/plugin/component.h \
babeltrace/plugin/component-class.h \
+ babeltrace/plugin/component-connection.h \
babeltrace/plugin/component-factory.h \
+ babeltrace/plugin/component-graph.h \
babeltrace/plugin/source.h \
babeltrace/plugin/sink.h \
babeltrace/plugin/filter.h \
babeltrace/compat/mman.h \
babeltrace/endian.h \
babeltrace/mmap-align.h \
+ babeltrace/plugin/component-class-internal.h \
+ babeltrace/plugin/component-connection-internal.h \
babeltrace/plugin/component-factory-internal.h \
babeltrace/plugin/component-internal.h \
- babeltrace/plugin/component-class-internal.h \
+ babeltrace/plugin/component-graph-internal.h \
babeltrace/plugin/plugin-internal.h \
babeltrace/plugin/filter-internal.h \
babeltrace/plugin/sink-internal.h \
--- /dev/null
+#ifndef BABELTRACE_PLUGIN_COMPONENT_GRAPH_INTERNAL_H
+#define BABELTRACE_PLUGIN_COMPONENT_GRAPH_INTERNAL_H
+
+/*
+ * BabelTrace - Component Graph Internal
+ *
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/plugin/component-graph.h>
+#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/object-internal.h>
+#include <glib.h>
+
+struct bt_component_graph {
+ struct bt_object base;
+ /* Array of pointers to bt_component_connection. */
+ GPtrArray *connections;
+ /*
+ * Array of pointers to bt_component.
+ *
+ * Components which were added to the graph, but have not been connected
+ * yet.
+ */
+ GPtrArray *loose_components;
+ /*
+ * Array of pointers to sink bt_component.
+ *
+ * A reference is held to the Sink components in order to implement the
+ * "run" interface, which executes the sinks in a round-robin pattern.
+ */
+ GPtrArray *sinks;
+};
+
+#endif /* BABELTRACE_PLUGIN_COMPONENT_GRAPH_INTERNAL_H */
--- /dev/null
+#ifndef BABELTRACE_PLUGIN_COMPONENT_GRAPH_H
+#define BABELTRACE_PLUGIN_COMPONENT_GRAPH_H
+
+/*
+ * BabelTrace - Babeltrace Component Graph Interface
+ *
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/plugin/component-class.h>
+#include <babeltrace/plugin/component.h>
+#include <babeltrace/values.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum bt_component_graph_status {
+ BT_COMPONENT_GRAPH_STATUS_OK = 0,
+};
+
+/*
+Graph Ownership:
+
+ Graph
+ ^
+ |
+ Connection
+ ^ ^
+ / \
+ ComponentA ComponentB
+
+1) A graph only owns a set of connections.
+2) Components should _never_ own each other.
+3) A component can keep the complete graph "alive".
+
+*/
+extern struct bt_component_graph *bt_component_graph_create(void);
+
+/**
+ * Creates a connection object which owns both components, invokes the
+ * components' connection callback, and add the connection to the component
+ * graph's set of connection.
+ *
+ * Will add any component that is not already part of the graph.
+ */
+extern enum bt_component_graph_status bt_component_graph_connect(
+ struct bt_component_graph *graph, struct bt_component *upstream,
+ struct bt_component *downstream);
+
+/**
+ * Add component to the graph
+ */
+extern enum bt_component_graph_status bt_component_graph_add_component(
+ struct bt_component_graph *graph,
+ struct bt_component *component);
+
+/**
+ * Add a component as a "sibling" of the origin component. Sibling share
+ * connections equivalent to each other at the time of connection (same
+ * parents and children).
+ */
+extern enum bt_component_graph_status bt_component_graph_add_component_as_sibling(
+ struct bt_component_graph *graph, struct bt_component *origin,
+ struct bt_component *new_component);
+
+/**
+ * Runs "bt_component_sink_consume()" on all sinks in round-robin until they all
+ * indicate that the end is reached on that an error occured.
+ */
+extern enum bt_component_graph_status bt_component_graph_run(
+ struct bt_component_graph *graph);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_COMPONENT_GRAPH_H */
component.c \
component-class.c \
component-factory.c \
+ component-graph.c \
plugin.c \
source.c \
sink.c \
--- /dev/null
+/*
+ * component-graph.c
+ *
+ * Babeltrace Plugin Component Graph
+ *
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/plugin/component-graph-internal.h>
+#include <babeltrace/compiler.h>
+
+static void bt_component_graph_destroy(struct bt_object *obj)
+{
+ struct bt_component_graph *graph = container_of(obj,
+ struct bt_component_graph, base);
+
+ if (graph->connections) {
+ g_ptr_array_free(graph->connections, TRUE);
+ }
+ if (graph->sinks) {
+ g_ptr_array_free(graph->sinks, TRUE);
+ }
+ g_free(graph);
+}
+
+struct bt_component_graph *bt_component_graph_create(void)
+{
+ struct bt_component_graph *graph;
+
+ graph = g_new0(struct bt_component_graph, 1);
+ if (!graph) {
+ goto end;
+ }
+
+ bt_object_init(graph, bt_component_graph_destroy);
+
+ graph->connections = g_ptr_array_new_with_free_func(bt_put);
+ if (!graph->connections) {
+ goto error;
+ }
+ graph->sinks = g_ptr_array_new_with_free_func(bt_put);
+ if (!graph->sinks) {
+ goto error;
+ }
+end:
+ return graph;
+error:
+ BT_PUT(graph);
+ goto end;
+}
+
+enum bt_component_graph_status bt_component_graph_connect(
+ struct bt_component_graph *graph, struct bt_component *upstream,
+ struct bt_component *downstream)
+{
+ return BT_COMPONENT_GRAPH_STATUS_OK;
+}
+
+enum bt_component_graph_status bt_component_graph_add_component(
+ struct bt_component_graph *graph,
+ struct bt_component *component)
+{
+ return BT_COMPONENT_GRAPH_STATUS_OK;
+}
+
+enum bt_component_graph_status bt_component_graph_add_component_as_sibling(
+ struct bt_component_graph *graph, struct bt_component *origin,
+ struct bt_component *new_component)
+{
+ return BT_COMPONENT_GRAPH_STATUS_OK;
+}
+
+enum bt_component_graph_status bt_component_graph_run(
+ struct bt_component_graph *graph)
+{
+ return BT_COMPONENT_GRAPH_STATUS_OK;
+}
+