Add bt_component_is_source(), bt_component_is_filter(), bt_component_is_sink()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 6 Apr 2017 07:27:19 +0000 (03:27 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:40 +0000 (12:57 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/graph/component.h

index 9dac6dec66a117db841d56d97002e718726349bf..f2faa36a0a6e8ebb203c17864bf8e438d9cc48f5 100644 (file)
@@ -31,7 +31,7 @@
 #include <babeltrace/graph/component-class.h>
 #include <babeltrace/graph/notification-iterator.h>
 #include <babeltrace/values.h>
-#include <stdio.h>
+#include <stdbool.h>
 
 #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
This page took 0.026987 seconds and 4 git commands to generate.