Visibility hidden by default
[babeltrace.git] / src / lib / graph / port.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
5 * Copyright 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 */
7
8 #ifndef BABELTRACE_GRAPH_PORT_INTERNAL_H
9 #define BABELTRACE_GRAPH_PORT_INTERNAL_H
10
11 #include <babeltrace2/graph/port.h>
12 #include "common/macros.h"
13
14 struct bt_port {
15 struct bt_object base;
16 enum bt_port_type type;
17 GString *name;
18 struct bt_connection *connection;
19 void *user_data;
20 };
21
22 struct bt_component;
23
24 struct bt_port *bt_port_create(struct bt_component *parent_component,
25 enum bt_port_type type, const char *name, void *user_data);
26
27 void bt_port_set_connection(struct bt_port *port,
28 struct bt_connection *connection);
29
30 static inline
31 struct bt_component *bt_port_borrow_component_inline(const struct bt_port *port)
32 {
33 BT_ASSERT_DBG(port);
34 return (void *) bt_object_borrow_parent(&port->base);
35 }
36
37 static inline
38 const char *bt_port_type_string(enum bt_port_type port_type)
39 {
40 switch (port_type) {
41 case BT_PORT_TYPE_INPUT:
42 return "INPUT";
43 case BT_PORT_TYPE_OUTPUT:
44 return "OUTPUT";
45 default:
46 return "(unknown)";
47 }
48 }
49
50 #endif /* BABELTRACE_GRAPH_PORT_INTERNAL_H */
This page took 0.029543 seconds and 4 git commands to generate.