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 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
16 #include <babeltrace2/types.h>
23 @defgroup api-conn Connection
27 \bt_c_comp \bt_port connection.
29 A <strong><em>connection</em></strong> is a link between an \bt_oport
32 @image html component-zoom.png
34 A connection is a \ref api-fund-shared-object "shared object": get a new
35 reference with bt_connection_get_ref() and put an existing reference with
36 bt_connection_put_ref().
38 The type of a connection is #bt_connection.
40 Borrow the upstream (output) port and downstream (input) port of a
41 connection with bt_connection_borrow_upstream_port_const() and
42 bt_connection_borrow_downstream_port_const().
51 @typedef struct bt_connection bt_connection;
66 Borrows the upstream \bt_iport of the connection \bt_p{connection}.
69 Connection of which to borrow the upstream port.
72 \em Borrowed reference of the upstream port of \bt_p{connection}.
74 @bt_pre_not_null{connection}
76 extern const bt_port_input
*bt_connection_borrow_downstream_port_const(
77 const bt_connection
*connection
) __BT_NOEXCEPT
;
81 Borrows the downstream \bt_oport of the connection
85 Connection of which to borrow the downstream port.
88 \em Borrowed reference of the downstream port of \bt_p{connection}.
90 @bt_pre_not_null{connection}
92 extern const bt_port_output
*bt_connection_borrow_upstream_port_const(
93 const bt_connection
*connection
) __BT_NOEXCEPT
;
104 Increments the \ref api-fund-shared-object "reference count" of
105 the connection \bt_p{connection}.
107 @param[in] connection
109 Connection of which to increment the reference count.
114 @sa bt_connection_put_ref() —
115 Decrements the reference count of a connection.
117 extern void bt_connection_get_ref(const bt_connection
*connection
)
122 Decrements the \ref api-fund-shared-object "reference count" of
123 the connection \bt_p{connection}.
125 @param[in] connection
127 Connection of which to decrement the reference count.
132 @sa bt_connection_get_ref() —
133 Increments the reference count of a connection.
135 extern void bt_connection_put_ref(const bt_connection
*connection
)
140 Decrements the reference count of the connection
141 \bt_p{_connection}, and then sets \bt_p{_connection} to \c NULL.
145 Connection of which to decrement the reference count.
150 @bt_pre_assign_expr{_connection}
152 #define BT_CONNECTION_PUT_REF_AND_RESET(_connection) \
154 bt_connection_put_ref(_connection); \
155 (_connection) = NULL; \
160 Decrements the reference count of the connection \bt_p{_dst}, sets
161 \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL.
163 This macro effectively moves a connection reference from the expression
164 \bt_p{_src} to the expression \bt_p{_dst}, putting the existing
165 \bt_p{_dst} reference.
169 Destination expression.
180 @bt_pre_assign_expr{_dst}
181 @bt_pre_assign_expr{_src}
183 #define BT_CONNECTION_MOVE_REF(_dst, _src) \
185 bt_connection_put_ref(_dst); \
198 #endif /* BABELTRACE2_GRAPH_CONNECTION_H */
This page took 0.035645 seconds and 4 git commands to generate.