Graph API: split into private and public APIs
[babeltrace.git] / include / babeltrace / graph / graph.h
index c42802491647dd4d705966c9fb9fffe219496bf5..f44bee7f3c12328ae0f3557781daeeacdc1c3ab8 100644 (file)
@@ -1,9 +1,7 @@
-#ifndef BABELTRACE_COMPONENT_GRAPH_H
-#define BABELTRACE_COMPONENT_GRAPH_H
+#ifndef BABELTRACE_GRAPH_GRAPH_H
+#define BABELTRACE_GRAPH_GRAPH_H
 
 /*
- * BabelTrace - Babeltrace Graph Interface
- *
  * Copyright 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  * SOFTWARE.
  */
 
-#include <babeltrace/graph/component.h>
+/* For bt_bool */
+#include <babeltrace/types.h>
+
+/* For enum bt_component_status */
+#include <babeltrace/graph/component-status.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-struct bt_port;
-struct bt_connection;
+struct bt_graph;
 
 enum bt_graph_status {
+       BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION = 111,
+       /** Canceled. */
+       BT_GRAPH_STATUS_CANCELED = BT_COMPONENT_STATUS_GRAPH_IS_CANCELED,
        /** No sink can consume at the moment. */
-       BT_GRAPH_STATUS_AGAIN = 2,
-       /** Downstream component does not support multiple inputs. */
-       BT_GRAPH_STATUS_END = 1,
-       BT_GRAPH_STATUS_OK = 0,
+       BT_GRAPH_STATUS_AGAIN = BT_COMPONENT_STATUS_AGAIN,
        /** Downstream component does not support multiple inputs. */
-       BT_GRAPH_STATUS_MULTIPLE_INPUTS_UNSUPPORTED = -1,
-       /** Component is already part of another graph. */
-       BT_GRAPH_STATUS_ALREADY_IN_A_GRAPH = -2,
+       BT_GRAPH_STATUS_END = BT_COMPONENT_STATUS_END,
+       BT_GRAPH_STATUS_OK = BT_COMPONENT_STATUS_OK,
        /** Invalid arguments. */
-       BT_GRAPH_STATUS_INVALID = -3,
+       BT_GRAPH_STATUS_INVALID = BT_COMPONENT_STATUS_INVALID,
        /** No sink in graph. */
-       BT_GRAPH_STATUS_NO_SINK = -4,
+       BT_GRAPH_STATUS_NO_SINK = -6,
        /** General error. */
-       BT_GRAPH_STATUS_ERROR = -5,
+       BT_GRAPH_STATUS_ERROR = BT_COMPONENT_STATUS_ERROR,
+       BT_GRAPH_STATUS_NOMEM = BT_COMPONENT_STATUS_NOMEM,
 };
 
-typedef void (*bt_graph_port_added_listener)(struct bt_port *port,
-               void *data);
-typedef void (*bt_graph_port_removed_listener)(struct bt_component *component,
-               struct bt_port *port, void *data);
-typedef void (*bt_graph_port_connected_listener)(struct bt_port *port,
-               void *data);
-typedef void (*bt_graph_port_disconnected_listener)(
-               struct bt_component *component, struct bt_port *port,
-               void *data);
-
-extern struct bt_graph *bt_graph_create(void);
-
-/**
- * Creates a connection between two components using the two ports specified
- * and adds the connection and components (if not already added) to the graph.
- */
-extern struct bt_connection *bt_graph_connect_ports(struct bt_graph *graph,
-               struct bt_port *upstream,
-               struct bt_port *downstream);
-
-/**
- * Add a component as a "sibling" of the origin component. Sibling share
- * connections equivalent to each other at the time of connection (same
- * upstream and downstream ports).
- */
-extern enum bt_graph_status bt_graph_add_component_as_sibling(
-               struct bt_graph *graph, struct bt_component *origin,
-               struct bt_component *new_component);
-
-/**
- * Run graph to completion or until a single sink is left and "AGAIN" is received.
- *
- * Runs "bt_component_sink_consume()" on all sinks in round-robin until they all
- * indicate that the end is reached or that an error occured.
- */
-extern enum bt_graph_status bt_graph_run(struct bt_graph *graph);
-
-/**
- * Runs "bt_component_sink_consume()" on the graph's sinks. Each invokation will
- * invoke "bt_component_sink_consume()" on the next sink, in round-robin, until
- * they all indicated that the end is reached.
- */
-extern enum bt_graph_status bt_graph_consume(struct bt_graph *graph);
-
-extern enum bt_graph_status bt_graph_add_port_added_listener(
-               struct bt_graph *graph,
-               bt_graph_port_added_listener listener, void *data);
-
-extern enum bt_graph_status bt_graph_add_port_removed_listener(
-               struct bt_graph *graph,
-               bt_graph_port_removed_listener listener, void *data);
-
-extern enum bt_graph_status bt_graph_add_port_connected_listener(
-               struct bt_graph *graph,
-               bt_graph_port_connected_listener listener, void *data);
-
-extern enum bt_graph_status bt_graph_add_port_disconnected_listener(
-               struct bt_graph *graph,
-               bt_graph_port_disconnected_listener listener, void *data);
+extern bt_bool bt_graph_is_canceled(struct bt_graph *graph);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* BABELTRACE_COMPONENT_GRAPH_H */
+#endif /* BABELTRACE_GRAPH_GRAPH_H */
This page took 0.071419 seconds and 4 git commands to generate.