Add bt_graph_add_component(), make bt_component_create() internal
[babeltrace.git] / include / babeltrace / graph / graph.h
index 06f2af1b122407a46b07e29465a1fec1969f0d15..a5077c4901991bcc9e343f6aaf4f3a048d375fb3 100644 (file)
@@ -38,6 +38,7 @@ struct bt_port;
 struct bt_connection;
 
 enum bt_graph_status {
+       BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION = 111,
        /** Canceled. */
        BT_GRAPH_STATUS_CANCELED = 125,
        /** No sink can consume at the moment. */
@@ -45,14 +46,13 @@ enum bt_graph_status {
        /** Downstream component does not support multiple inputs. */
        BT_GRAPH_STATUS_END = 1,
        BT_GRAPH_STATUS_OK = 0,
-       /** Component is already part of another graph. */
-       BT_GRAPH_STATUS_ALREADY_IN_A_GRAPH = -2,
        /** Invalid arguments. */
        BT_GRAPH_STATUS_INVALID = -22,
        /** No sink in graph. */
        BT_GRAPH_STATUS_NO_SINK = -6,
        /** General error. */
        BT_GRAPH_STATUS_ERROR = -1,
+       BT_GRAPH_STATUS_NOMEM = -12,
 };
 
 typedef void (*bt_graph_port_added_listener)(struct bt_port *port,
@@ -69,13 +69,26 @@ typedef void (*bt_graph_ports_disconnected_listener)(
 
 extern struct bt_graph *bt_graph_create(void);
 
+extern enum bt_graph_status bt_graph_add_component(
+               struct bt_graph *graph,
+               struct bt_component_class *component_class,
+               const char *name, struct bt_value *params,
+               struct bt_component **component);
+
+extern enum bt_graph_status bt_graph_add_component_with_init_method_data(
+               struct bt_graph *graph,
+               struct bt_component_class *component_class,
+               const char *name, struct bt_value *params,
+               void *init_method_data,
+               struct bt_component **component);
+
 /**
  * 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);
+extern enum bt_graph_status bt_graph_connect_ports(struct bt_graph *graph,
+               struct bt_port *upstream, struct bt_port *downstream,
+               struct bt_connection **connection);
 
 /**
  * Run graph to completion or until a single sink is left and "AGAIN" is received.
This page took 0.023522 seconds and 4 git commands to generate.