From: Philippe Proulx Date: Thu, 6 Apr 2017 07:27:19 +0000 (-0400) Subject: Add bt_component_is_source(), bt_component_is_filter(), bt_component_is_sink() X-Git-Tag: v2.0.0-pre1~373 X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=543147faa3c86ef04d00e7eed5ca115db3d0a733;p=babeltrace.git Add bt_component_is_source(), bt_component_is_filter(), bt_component_is_sink() Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/include/babeltrace/graph/component.h b/include/babeltrace/graph/component.h index 9dac6dec..f2faa36a 100644 --- a/include/babeltrace/graph/component.h +++ b/include/babeltrace/graph/component.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { @@ -79,6 +79,27 @@ extern struct bt_component_class *bt_component_get_class( 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) +{ + return bt_component_get_class_type(component) == + BT_COMPONENT_CLASS_TYPE_SOURCE; +} + +static inline +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) +{ + return bt_component_get_class_type(component) == + BT_COMPONENT_CLASS_TYPE_SINK; +} + extern struct bt_graph *bt_component_get_graph(struct bt_component *component); #ifdef __cplusplus