X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fgraph%2Fcomponent.h;h=f2db9d723c1f254056937b90e1be920fe016429f;hb=5c5632787fc9cafa602c89a28966bcfd01ec0204;hp=f2faa36a0a6e8ebb203c17864bf8e438d9cc48f5;hpb=543147faa3c86ef04d00e7eed5ca115db3d0a733;p=babeltrace.git diff --git a/include/babeltrace/graph/component.h b/include/babeltrace/graph/component.h index f2faa36a..f2db9d72 100644 --- a/include/babeltrace/graph/component.h +++ b/include/babeltrace/graph/component.h @@ -1,5 +1,5 @@ -#ifndef BABELTRACE_COMPONENT_COMPONENT_H -#define BABELTRACE_COMPONENT_COMPONENT_H +#ifndef BABELTRACE_GRAPH_COMPONENT_H +#define BABELTRACE_GRAPH_COMPONENT_H /* * BabelTrace - Babeltrace Component Interface @@ -27,11 +27,14 @@ * SOFTWARE. */ -#include +/* For BT_COMPONENT_CLASS_TYPE_* */ #include -#include -#include -#include + +/* For bt_bool */ +#include + +/* For bt_get */ +#include #ifdef __cplusplus extern "C" { @@ -43,22 +46,6 @@ struct bt_component; struct bt_value; struct bt_port; -/** - * Create an instance of a component from a component class. - * - * @param component_class Component class of which to create an instance - * @param name Name of the new component instance, optional - * @param params A dictionary of component parameters - * @returns Returns a pointer to a new component instance - */ -extern struct bt_component *bt_component_create( - struct bt_component_class *component_class, const char *name, - struct bt_value *params); - -extern struct bt_component *bt_component_create_with_init_method_data( - struct bt_component_class *component_class, const char *name, - struct bt_value *params, void *init_method_data); - /** * Get component's name. * @@ -80,30 +67,36 @@ extern enum bt_component_class_type bt_component_get_class_type( struct bt_component *component); static inline -bool bt_component_is_source(struct bt_component *component) +bt_bool bt_component_is_source(struct bt_component *component) { return bt_component_get_class_type(component) == BT_COMPONENT_CLASS_TYPE_SOURCE; } static inline -bool bt_component_is_filter(struct bt_component *component) +bt_bool bt_component_is_filter(struct bt_component *component) { return bt_component_get_class_type(component) == BT_COMPONENT_CLASS_TYPE_FILTER; } static inline -bool bt_component_is_sink(struct bt_component *component) +bt_bool bt_component_is_sink(struct bt_component *component) { return bt_component_get_class_type(component) == BT_COMPONENT_CLASS_TYPE_SINK; } -extern struct bt_graph *bt_component_get_graph(struct bt_component *component); +extern struct bt_graph *bt_component_borrow_graph(struct bt_component *component); + +static inline +struct bt_graph *bt_component_get_graph(struct bt_component *component) +{ + return bt_get(bt_component_borrow_graph(component)); +} #ifdef __cplusplus } #endif -#endif /* BABELTRACE_COMPONENT_COMPONENT_H */ +#endif /* BABELTRACE_GRAPH_COMPONENT_H */