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