From 543147faa3c86ef04d00e7eed5ca115db3d0a733 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 6 Apr 2017 03:27:19 -0400 Subject: [PATCH] Add bt_component_is_source(), bt_component_is_filter(), bt_component_is_sink() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- include/babeltrace/graph/component.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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 -- 2.34.1