include: add IWYU pragmas in private header files
[babeltrace.git] / include / babeltrace2 / graph / self-component-port.h
CommitLineData
890882ef 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
890882ef 3 *
0235b0db 4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
890882ef
PP
5 */
6
0235b0db
MJ
7#ifndef BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_H
8#define BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_H
9
f38da6ca
SM
10/* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11
4fa90f32
PP
12#ifndef __BT_IN_BABELTRACE_H
13# error "Please include <babeltrace2/babeltrace.h> instead."
14#endif
15
3fadfbc0 16#include <babeltrace2/types.h>
b19ff26f 17
890882ef
PP
18#ifdef __cplusplus
19extern "C" {
20#endif
21
43c59509
PP
22/*!
23@defgroup api-self-comp-port Self component ports
24@ingroup api-self-comp
25
26@brief
27 Private views of \bt_p_port for \bt_comp_cls instance methods.
28
29The #bt_self_component_port, #bt_self_component_port_input, and
30#bt_self_component_port_output types are private views of a \bt_port
31from within a component class
32\ref api-comp-cls-dev-instance-meth "instance method".
33
34Borrow the \bt_self_comp of a port with
35bt_self_component_port_borrow_component().
36
37Get the user data attached to a port with
38bt_self_component_port_get_data().
39
40\ref api-fund-c-typing "Upcast" the "self" (private) types to the
41public and common self component port types with the
42<code>bt_self_component_port*_as_port*()</code> and
43<code>bt_self_component_port_*_as_self_component_port()</code>
44functions.
45*/
46
47/*! @{ */
48
49/*!
50@name Types
51@{
52
53@typedef struct bt_self_component_port bt_self_component_port;
54
55@brief
56 Self component \bt_comp.
57
58@typedef struct bt_self_component_port_input bt_self_component_port_input;
59
60@brief
61 Self component \bt_iport.
62
63@typedef struct bt_self_component_port_output bt_self_component_port_output;
64
65@brief
66 Self component \bt_oport.
67
68@}
69*/
70
71/*!
72@name Component access
73@{
74*/
75
76/*!
77@brief
78 Borrows the \bt_comp of the \bt_port \bt_p{self_component_port}.
79
80@param[in] self_component_port
81 Port from which to borrow the component which owns it.
82
83@returns
84 Component which owns \bt_p{self_component_port}.
85
86@bt_pre_not_null{self_component_port}
87*/
88extern bt_self_component *bt_self_component_port_borrow_component(
89 bt_self_component_port *self_component_port);
90
91/*! @} */
92
93/*!
94@name User data access
95@{
96*/
97
98/*!
99@brief
100 Returns the user data of the \bt_port \bt_p{self_component_port}.
101
102You can attach user data to a port when you add it to a component with
103bt_self_component_source_add_output_port(),
104bt_self_component_filter_add_input_port(),
105bt_self_component_filter_add_output_port(), and
106bt_self_component_sink_add_input_port().
107
108@param[in] self_component_port
109 Port of which to get the user data.
110
111@returns
112 User data of \bt_p{self_component_port}.
113
114@bt_pre_not_null{self_component_port}
115*/
116extern void *bt_self_component_port_get_data(
117 const bt_self_component_port *self_component_port);
118
43c59509
PP
119/*! @} */
120
121/*!
122@name Self to public upcast
123@{
124*/
125
126/*!
127@brief
128 \ref api-fund-c-typing "Upcasts" the self component port
129 \bt_p{self_component_port} to the public #bt_port type.
130
131@param[in] self_component_port
132 @parblock
133 Port to upcast.
134
135 Can be \c NULL.
136 @endparblock
137
138@returns
139 \bt_p{self_component_port} as a public port.
140*/
d94d92ac 141static inline
b19ff26f 142const bt_port *bt_self_component_port_as_port(
43c59509 143 bt_self_component_port *self_component_port)
d94d92ac 144{
43c59509 145 return __BT_UPCAST_CONST(bt_port, self_component_port);
d94d92ac
PP
146}
147
43c59509
PP
148/*!
149@brief
150 \ref api-fund-c-typing "Upcasts" the self component \bt_iport
151 \bt_p{self_component_port} to the public #bt_port_input type.
d94d92ac 152
43c59509
PP
153@param[in] self_component_port
154 @parblock
155 Input port to upcast.
156
157 Can be \c NULL.
158 @endparblock
159
160@returns
161 \bt_p{self_component_port} as a public input port.
162*/
163static inline
164const bt_port_input *bt_self_component_port_input_as_port_input(
165 const bt_self_component_port_input *self_component_port)
166{
167 return __BT_UPCAST_CONST(bt_port_input, self_component_port);
168}
169
170/*!
171@brief
172 \ref api-fund-c-typing "Upcasts" the self component \bt_oport
173 \bt_p{self_component_port} to the public #bt_port_output type.
174
175@param[in] self_component_port
176 @parblock
177 Output port to upcast.
178
179 Can be \c NULL.
180 @endparblock
181
182@returns
183 \bt_p{self_component_port} as a public output port.
184*/
185static inline
186const bt_port_output *bt_self_component_port_output_as_port_output(
187 bt_self_component_port_output *self_component_port)
188{
189 return __BT_UPCAST_CONST(bt_port_output, self_component_port);
190}
191
192/*! @} */
193
194/*!
195@name Self to common self upcast
196@{
197*/
198
199/*!
200@brief
201 \ref api-fund-c-typing "Upcasts" the self \bt_iport
202 \bt_p{self_component_port} to the common #bt_self_component_port
203 type.
204
205@param[in] self_component_port
206 @parblock
207 Input port to upcast.
208
209 Can be \c NULL.
210 @endparblock
211
212@returns
213 \bt_p{self_component_port} as a common self component port.
214*/
215static inline
216bt_self_component_port *
217bt_self_component_port_input_as_self_component_port(
218 bt_self_component_port_input *self_component_port)
219{
220 return __BT_UPCAST(bt_self_component_port, self_component_port);
221}
222
223/*!
224@brief
225 \ref api-fund-c-typing "Upcasts" the self \bt_oport
226 \bt_p{self_component_port} to the common #bt_self_component_port
227 type.
228
229@param[in] self_component_port
230 @parblock
231 Output port to upcast.
232
233 Can be \c NULL.
234 @endparblock
235
236@returns
237 \bt_p{self_component_port} as a common self component port.
238*/
239static inline
240bt_self_component_port *
241bt_self_component_port_output_as_self_component_port(
242 bt_self_component_port_output *self_component_port)
243{
244 return __BT_UPCAST(bt_self_component_port, self_component_port);
245}
246
247/*! @} */
248
249/*! @} */
890882ef
PP
250
251#ifdef __cplusplus
252}
253#endif
254
924dc299 255#endif /* BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_H */
This page took 0.083215 seconds and 4 git commands to generate.