X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fgraph.h;h=01dfaec6a8df300cccde917a897560cb2fd31d4e;hb=HEAD;hp=66654939417029f9a010c7181ce780dcde369004;hpb=d98421f2abfc5adab28ab7ee9b63537a6c7261cc;p=babeltrace.git diff --git a/src/lib/graph/graph.h b/src/lib/graph/graph.h index 66654939..efc96991 100644 --- a/src/lib/graph/graph.h +++ b/src/lib/graph/graph.h @@ -5,8 +5,8 @@ * Copyright 2017 Jérémie Galarneau */ -#ifndef BABELTRACE_GRAPH_GRAPH_INTERNAL_H -#define BABELTRACE_GRAPH_GRAPH_INTERNAL_H +#ifndef BABELTRACE_LIB_GRAPH_GRAPH_H +#define BABELTRACE_LIB_GRAPH_GRAPH_H /* Protection: this file uses BT_LIB_LOG*() macros directly */ #ifndef BT_LIB_LOG_SUPPORTED @@ -15,33 +15,21 @@ #include #include -#include "common/macros.h" #include "lib/object.h" #include "lib/object-pool.h" #include "common/assert.h" -#include "common/common.h" #include -#include #include #include "component.h" #include "component-sink.h" #include "connection.h" -#include "lib/func-status.h" /* Protection: this file uses BT_LIB_LOG*() macros directly */ #ifndef BT_LIB_LOG_SUPPORTED # error Please include "lib/logging.h" before including this file. #endif -/* - * Protection: this file uses precondition and postcondition assertion - * macros directly. - */ -#ifndef BT_ASSERT_COND_SUPPORTED -# error Please include "lib/assert-cond.h" before including this file. -#endif - struct bt_component; struct bt_port; @@ -60,7 +48,7 @@ struct bt_graph { * * In terms of ownership: * 1) The graph is the components' parent, - * 2) The graph is the connnections' parent, + * 2) The graph is the connections' parent, * 3) Components share the ownership of their connections, * 4) A connection holds weak references to its two component endpoints. */ @@ -143,23 +131,18 @@ void bt_graph_set_can_consume(struct bt_graph *graph, bool can_consume) graph->can_consume = can_consume; } -BT_HIDDEN int bt_graph_consume_sink_no_check(struct bt_graph *graph, struct bt_component_sink *sink); -BT_HIDDEN enum bt_graph_listener_func_status bt_graph_notify_port_added(struct bt_graph *graph, struct bt_port *port); -BT_HIDDEN void bt_graph_remove_connection(struct bt_graph *graph, struct bt_connection *connection); -BT_HIDDEN void bt_graph_add_message(struct bt_graph *graph, struct bt_message *msg); -BT_HIDDEN bool bt_graph_is_interrupted(const struct bt_graph *graph); static inline @@ -182,77 +165,6 @@ const char *bt_graph_configuration_state_string( } } -static inline -int bt_graph_configure(struct bt_graph *graph) -{ - int status = BT_FUNC_STATUS_OK; - uint64_t i; - - BT_ASSERT_DBG(graph->config_state != - BT_GRAPH_CONFIGURATION_STATE_FAULTY); - - if (G_LIKELY(graph->config_state == - BT_GRAPH_CONFIGURATION_STATE_CONFIGURED)) { - goto end; - } - - BT_ASSERT_PRE(graph->has_sink, "Graph has no sink component: %!+g", graph); - graph->config_state = BT_GRAPH_CONFIGURATION_STATE_PARTIALLY_CONFIGURED; - - for (i = 0; i < graph->components->len; i++) { - struct bt_component *comp = graph->components->pdata[i]; - struct bt_component_sink *comp_sink = (void *) comp; - struct bt_component_class_sink *comp_cls_sink = - (void *) comp->class; - - if (comp->class->type != BT_COMPONENT_CLASS_TYPE_SINK) { - continue; - } - - if (comp_sink->graph_is_configured_method_called) { - continue; - } - - if (comp_cls_sink->methods.graph_is_configured) { - enum bt_component_class_sink_graph_is_configured_method_status comp_status; - - BT_LIB_LOGD("Calling user's \"graph is configured\" method: " - "%![graph-]+g, %![comp-]+c", - graph, comp); - comp_status = comp_cls_sink->methods.graph_is_configured( - (void *) comp_sink); - BT_LIB_LOGD("User method returned: status=%s", - bt_common_func_status_string(comp_status)); - BT_ASSERT_POST(comp_status == BT_FUNC_STATUS_OK || - comp_status == BT_FUNC_STATUS_ERROR || - comp_status == BT_FUNC_STATUS_MEMORY_ERROR, - "Unexpected returned status: status=%s", - bt_common_func_status_string(comp_status)); - BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(comp_status); - if (comp_status != BT_FUNC_STATUS_OK) { - if (comp_status < 0) { - BT_LIB_LOGW_APPEND_CAUSE( - "Component's \"graph is configured\" method failed: " - "%![comp-]+c, status=%s", - comp, - bt_common_func_status_string( - comp_status)); - } - - status = comp_status; - goto end; - } - } - - comp_sink->graph_is_configured_method_called = true; - } - - graph->config_state = BT_GRAPH_CONFIGURATION_STATE_CONFIGURED; - -end: - return status; -} - static inline void bt_graph_make_faulty(struct bt_graph *graph) { @@ -260,4 +172,4 @@ void bt_graph_make_faulty(struct bt_graph *graph) BT_LIB_LOGI("Set graph's state to faulty: %![graph-]+g", graph); } -#endif /* BABELTRACE_GRAPH_GRAPH_INTERNAL_H */ +#endif /* BABELTRACE_LIB_GRAPH_GRAPH_H */