From 2154eb7df06eb48c6db3a1447e657feccf47fa86 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 6 Apr 2017 03:31:55 -0400 Subject: [PATCH] Add bt_component_class_is_source/filter/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-class.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/babeltrace/graph/component-class.h b/include/babeltrace/graph/component-class.h index fcb171fc4..a3ca7ccc6 100644 --- a/include/babeltrace/graph/component-class.h +++ b/include/babeltrace/graph/component-class.h @@ -26,6 +26,7 @@ */ #include +#include #include #include @@ -170,6 +171,27 @@ extern struct bt_value *bt_component_class_query( extern enum bt_component_class_type bt_component_class_get_type( struct bt_component_class *component_class); +static inline +bool bt_component_class_is_source(struct bt_component_class *component_class) +{ + return bt_component_class_get_type(component_class) == + BT_COMPONENT_CLASS_TYPE_SOURCE; +} + +static inline +bool bt_component_class_is_filter(struct bt_component_class *component_class) +{ + return bt_component_class_get_type(component_class) == + BT_COMPONENT_CLASS_TYPE_FILTER; +} + +static inline +bool bt_component_class_is_sink(struct bt_component_class *component_class) +{ + return bt_component_class_get_type(component_class) == + BT_COMPONENT_CLASS_TYPE_SINK; +} + #ifdef __cplusplus } #endif -- 2.34.1