From e365508426b71db9bdc15274058a473ad7b55477 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 6 Apr 2017 03:29:48 -0400 Subject: [PATCH] Add bt_port_is_input(), bt_port_is_output() 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/port.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/babeltrace/graph/port.h b/include/babeltrace/graph/port.h index 9d802440..af406341 100644 --- a/include/babeltrace/graph/port.h +++ b/include/babeltrace/graph/port.h @@ -28,6 +28,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { @@ -58,6 +59,18 @@ extern int bt_port_remove_from_component(struct bt_port *port); extern int bt_port_disconnect(struct bt_port *port); extern int bt_port_is_connected(struct bt_port *port); +static inline +bool bt_port_is_input(struct bt_port *port) +{ + return bt_port_get_type(port) == BT_PORT_TYPE_INPUT; +} + +static inline +bool bt_port_is_output(struct bt_port *port) +{ + return bt_port_get_type(port) == BT_PORT_TYPE_OUTPUT; +} + #ifdef __cplusplus } #endif -- 2.34.1