1 #ifndef BABELTRACE2_GRAPH_CONNECTION_H
2 #define BABELTRACE2_GRAPH_CONNECTION_H
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #ifndef __BT_IN_BABELTRACE_H
27 # error "Please include <babeltrace2/babeltrace.h> instead."
30 #include <babeltrace2/types.h>
37 @defgroup api-conn Connection
41 \bt_c_comp \bt_port connection.
43 A <strong><em>connection</em></strong> is a link between an \bt_oport
46 @image html component-zoom.png
48 A connection is a \ref api-fund-shared-object "shared object": get a new
49 reference with bt_connection_get_ref() and put an existing reference with
50 bt_connection_put_ref().
52 The type of a connection is #bt_connection.
54 Borrow the upstream (output) port and downstream (input) port of a
55 connection with bt_connection_borrow_upstream_port_const() and
56 bt_connection_borrow_downstream_port_const().
65 @typedef struct bt_connection bt_connection;
80 Borrows the upstream \bt_iport of the connection \bt_p{connection}.
83 Connection of which to borrow the upstream port.
86 \em Borrowed reference of the upstream port of \bt_p{connection}.
88 @bt_pre_not_null{connection}
90 extern const bt_port_input
*bt_connection_borrow_downstream_port_const(
91 const bt_connection
*connection
);
95 Borrows the downstream \bt_oport of the connection
99 Connection of which to borrow the downstream port.
102 \em Borrowed reference of the downstream port of \bt_p{connection}.
104 @bt_pre_not_null{connection}
106 extern const bt_port_output
*bt_connection_borrow_upstream_port_const(
107 const bt_connection
*connection
);
112 @name Reference count
118 Increments the \ref api-fund-shared-object "reference count" of
119 the connection \bt_p{connection}.
121 @param[in] connection
123 Connection of which to increment the reference count.
128 @sa bt_connection_put_ref() —
129 Decrements the reference count of a connection.
131 extern void bt_connection_get_ref(const bt_connection
*connection
);
135 Decrements the \ref api-fund-shared-object "reference count" of
136 the connection \bt_p{connection}.
138 @param[in] connection
140 Connection of which to decrement the reference count.
145 @sa bt_connection_get_ref() —
146 Increments the reference count of a connection.
148 extern void bt_connection_put_ref(const bt_connection
*connection
);
152 Decrements the reference count of the connection
153 \bt_p{_connection}, and then sets \bt_p{_connection} to \c NULL.
157 Connection of which to decrement the reference count.
162 @bt_pre_assign_expr{_connection}
164 #define BT_CONNECTION_PUT_REF_AND_RESET(_connection) \
166 bt_connection_put_ref(_connection); \
167 (_connection) = NULL; \
172 Decrements the reference count of the connection \bt_p{_dst}, sets
173 \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL.
175 This macro effectively moves a connection reference from the expression
176 \bt_p{_src} to the expression \bt_p{_dst}, putting the existing
177 \bt_p{_dst} reference.
181 Destination expression.
192 @bt_pre_assign_expr{_dst}
193 @bt_pre_assign_expr{_src}
195 #define BT_CONNECTION_MOVE_REF(_dst, _src) \
197 bt_connection_put_ref(_dst); \
210 #endif /* BABELTRACE2_GRAPH_CONNECTION_H */
This page took 0.058411 seconds and 4 git commands to generate.