2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
7 #ifndef BABELTRACE2_GRAPH_CONNECTION_H
8 #define BABELTRACE2_GRAPH_CONNECTION_H
10 #ifndef __BT_IN_BABELTRACE_H
11 # error "Please include <babeltrace2/babeltrace.h> instead."
14 #include <babeltrace2/types.h>
21 @defgroup api-conn Connection
25 \bt_c_comp \bt_port connection.
27 A <strong><em>connection</em></strong> is a link between an \bt_oport
30 @image html component-zoom.png
32 A connection is a \ref api-fund-shared-object "shared object": get a new
33 reference with bt_connection_get_ref() and put an existing reference with
34 bt_connection_put_ref().
36 The type of a connection is #bt_connection.
38 Borrow the upstream (output) port and downstream (input) port of a
39 connection with bt_connection_borrow_upstream_port_const() and
40 bt_connection_borrow_downstream_port_const().
49 @typedef struct bt_connection bt_connection;
64 Borrows the upstream \bt_iport of the connection \bt_p{connection}.
67 Connection of which to borrow the upstream port.
70 \em Borrowed reference of the upstream port of \bt_p{connection}.
72 @bt_pre_not_null{connection}
74 extern const bt_port_input
*bt_connection_borrow_downstream_port_const(
75 const bt_connection
*connection
);
79 Borrows the downstream \bt_oport of the connection
83 Connection of which to borrow the downstream port.
86 \em Borrowed reference of the downstream port of \bt_p{connection}.
88 @bt_pre_not_null{connection}
90 extern const bt_port_output
*bt_connection_borrow_upstream_port_const(
91 const bt_connection
*connection
);
102 Increments the \ref api-fund-shared-object "reference count" of
103 the connection \bt_p{connection}.
105 @param[in] connection
107 Connection of which to increment the reference count.
112 @sa bt_connection_put_ref() —
113 Decrements the reference count of a connection.
115 extern void bt_connection_get_ref(const bt_connection
*connection
);
119 Decrements the \ref api-fund-shared-object "reference count" of
120 the connection \bt_p{connection}.
122 @param[in] connection
124 Connection of which to decrement the reference count.
129 @sa bt_connection_get_ref() —
130 Increments the reference count of a connection.
132 extern void bt_connection_put_ref(const bt_connection
*connection
);
136 Decrements the reference count of the connection
137 \bt_p{_connection}, and then sets \bt_p{_connection} to \c NULL.
141 Connection of which to decrement the reference count.
146 @bt_pre_assign_expr{_connection}
148 #define BT_CONNECTION_PUT_REF_AND_RESET(_connection) \
150 bt_connection_put_ref(_connection); \
151 (_connection) = NULL; \
156 Decrements the reference count of the connection \bt_p{_dst}, sets
157 \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL.
159 This macro effectively moves a connection reference from the expression
160 \bt_p{_src} to the expression \bt_p{_dst}, putting the existing
161 \bt_p{_dst} reference.
165 Destination expression.
176 @bt_pre_assign_expr{_dst}
177 @bt_pre_assign_expr{_src}
179 #define BT_CONNECTION_MOVE_REF(_dst, _src) \
181 bt_connection_put_ref(_dst); \
194 #endif /* BABELTRACE2_GRAPH_CONNECTION_H */
This page took 0.034595 seconds and 4 git commands to generate.