Commit | Line | Data |
---|---|---|
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_H |
8 | #define BABELTRACE2_GRAPH_SELF_COMPONENT_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 |
19 | extern "C" { | |
20 | #endif | |
21 | ||
43c59509 PP |
22 | /*! |
23 | @defgroup api-self-comp Self components | |
24 | @ingroup api-comp-cls-dev | |
25 | ||
26 | @brief | |
27 | Private views of \bt_p_comp for instance methods. | |
28 | ||
29 | The #bt_self_component, #bt_self_component_source, | |
30 | #bt_self_component_filter, #bt_self_component_sink types are | |
31 | private views of a \bt_comp from within a component class | |
32 | \ref api-comp-cls-dev-instance-meth "instance method". | |
33 | ||
34 | Add a \bt_port to a component with | |
35 | bt_self_component_source_add_output_port(), | |
36 | bt_self_component_filter_add_input_port(), | |
37 | bt_self_component_filter_add_output_port(), and | |
38 | bt_self_component_sink_add_input_port(). | |
39 | ||
40 | When you add a port to a component, you can attach custom user data | |
41 | to it (\bt_voidp). You can retrieve this user data | |
42 | afterwards with bt_self_component_port_get_data(). | |
43 | ||
44 | Borrow a \bt_self_comp_port from a component by index with | |
45 | bt_self_component_source_borrow_output_port_by_index(), | |
46 | bt_self_component_filter_borrow_input_port_by_index(), | |
47 | bt_self_component_filter_borrow_output_port_by_index(), and | |
48 | bt_self_component_sink_borrow_input_port_by_index(). | |
49 | ||
50 | Borrow a \bt_self_comp_port from a component by name with | |
51 | bt_self_component_source_borrow_output_port_by_name(), | |
52 | bt_self_component_filter_borrow_input_port_by_name(), | |
53 | bt_self_component_filter_borrow_output_port_by_name(), and | |
54 | bt_self_component_sink_borrow_input_port_by_name(). | |
55 | ||
56 | Set and get user data attached to a component with | |
57 | bt_self_component_set_data() and bt_self_component_get_data(). | |
58 | ||
59 | Get a component's owning trace processing \bt_graph's effective | |
60 | \bt_mip version with bt_self_component_get_graph_mip_version(). | |
61 | ||
62 | Check whether or not a \bt_sink_comp is interrupted with | |
63 | bt_self_component_sink_is_interrupted(). | |
64 | ||
65 | \ref api-fund-c-typing "Upcast" the "self" (private) types to the | |
66 | public and common self component types with the | |
67 | <code>bt_self_component*_as_component*()</code> and | |
68 | <code>bt_self_component_*_as_self_component()</code> functions. | |
69 | */ | |
70 | ||
71 | /*! @{ */ | |
72 | ||
73 | /*! | |
74 | @name Types | |
75 | @{ | |
76 | ||
77 | @typedef struct bt_self_component bt_self_component; | |
78 | ||
79 | @brief | |
80 | Self \bt_comp. | |
81 | ||
82 | @typedef struct bt_self_component_source bt_self_component_source; | |
83 | ||
84 | @brief | |
85 | Self \bt_src_comp. | |
86 | ||
87 | @typedef struct bt_self_component_filter bt_self_component_filter; | |
88 | ||
89 | @brief | |
90 | Self \bt_flt_comp. | |
91 | ||
92 | @typedef struct bt_self_component_sink bt_self_component_sink; | |
93 | ||
94 | @brief | |
95 | Self \bt_sink_comp. | |
96 | ||
97 | @typedef struct bt_self_component_source_configuration bt_self_component_source_configuration; | |
98 | ||
99 | @brief | |
100 | Self \bt_src_comp configuration. | |
101 | ||
102 | @typedef struct bt_self_component_filter_configuration bt_self_component_filter_configuration; | |
103 | ||
104 | @brief | |
105 | Self \bt_flt_comp configuration. | |
106 | ||
107 | @typedef struct bt_self_component_sink_configuration bt_self_component_sink_configuration; | |
108 | ||
109 | @brief | |
110 | Self \bt_sink_comp configuration. | |
111 | ||
112 | @} | |
113 | */ | |
114 | ||
115 | /*! | |
116 | @name Port adding | |
117 | @{ | |
118 | */ | |
119 | ||
120 | /*! | |
121 | @brief | |
122 | Status codes for bt_self_component_source_add_output_port(), | |
123 | bt_self_component_filter_add_input_port(), | |
124 | bt_self_component_filter_add_output_port(), and | |
125 | bt_self_component_sink_add_input_port(). | |
126 | */ | |
d24d5663 | 127 | typedef enum bt_self_component_add_port_status { |
43c59509 PP |
128 | /*! |
129 | @brief | |
130 | Success. | |
131 | */ | |
d24d5663 | 132 | BT_SELF_COMPONENT_ADD_PORT_STATUS_OK = __BT_FUNC_STATUS_OK, |
43c59509 PP |
133 | |
134 | /*! | |
135 | @brief | |
136 | Out of memory. | |
137 | */ | |
d24d5663 | 138 | BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
43c59509 PP |
139 | |
140 | /*! | |
141 | @brief | |
142 | Other error. | |
143 | */ | |
144 | BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
d24d5663 | 145 | } bt_self_component_add_port_status; |
d94d92ac | 146 | |
43c59509 PP |
147 | /*! |
148 | @brief | |
149 | Adds an \bt_oport named \bt_p{name} and having the user data | |
150 | \bt_p{user_data} to the \bt_src_comp \bt_p{self_component}, | |
151 | and sets \bt_p{*self_component_port} to the resulting port. | |
152 | ||
153 | @attention | |
154 | You can only call this function from within the | |
155 | \ref api-comp-cls-dev-meth-init "initialization", | |
156 | \link api-comp-cls-dev-meth-iport-connected "input port connected"\endlink, | |
157 | and | |
158 | \link api-comp-cls-dev-meth-oport-connected "output port connected"\endlink | |
159 | methods. | |
160 | ||
161 | @param[in] self_component | |
162 | Source component instance. | |
163 | @param[in] name | |
164 | Name of the output port to add to \bt_p{self_component} (copied). | |
165 | @param[in] user_data | |
166 | User data of the output port to add to \bt_p{self_component}. | |
167 | @param[out] self_component_port | |
168 | <strong>On success, if not \c NULL</strong>, | |
169 | \bt_p{*self_component_port} is a \em borrowed reference of the | |
170 | created port. | |
171 | ||
172 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_OK | |
173 | Success. | |
174 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR | |
175 | Out of memory. | |
176 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR | |
177 | Other error. | |
178 | ||
179 | @bt_pre_not_null{self_component} | |
180 | @bt_pre_not_null{name} | |
181 | @pre | |
182 | No other output port within \bt_p{self_component} has the name | |
183 | \bt_p{name}. | |
184 | */ | |
185 | extern bt_self_component_add_port_status | |
186 | bt_self_component_source_add_output_port( | |
187 | bt_self_component_source *self_component, | |
188 | const char *name, void *user_data, | |
189 | bt_self_component_port_output **self_component_port); | |
190 | ||
191 | /*! | |
192 | @brief | |
193 | Adds an \bt_iport named \bt_p{name} and having the user data | |
194 | \bt_p{user_data} to the \bt_flt_comp \bt_p{self_component}, | |
195 | and sets \bt_p{*self_component_port} to the resulting port. | |
196 | ||
197 | @attention | |
198 | You can only call this function from within the | |
199 | \ref api-comp-cls-dev-meth-init "initialization", | |
200 | \link api-comp-cls-dev-meth-iport-connected "input port connected"\endlink, | |
201 | and | |
202 | \link api-comp-cls-dev-meth-oport-connected "output port connected"\endlink | |
203 | methods. | |
204 | ||
205 | @param[in] self_component | |
206 | Filter component instance. | |
207 | @param[in] name | |
208 | Name of the input port to add to \bt_p{self_component} (copied). | |
209 | @param[in] user_data | |
210 | User data of the input port to add to \bt_p{self_component}. | |
211 | @param[out] self_component_port | |
212 | <strong>On success, if not \c NULL</strong>, | |
213 | \bt_p{*self_component_port} is a \em borrowed reference of the | |
214 | created port. | |
215 | ||
216 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_OK | |
217 | Success. | |
218 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR | |
219 | Out of memory. | |
220 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR | |
221 | Other error. | |
222 | ||
223 | @bt_pre_not_null{self_component} | |
224 | @bt_pre_not_null{name} | |
225 | @pre | |
226 | No other input port within \bt_p{self_component} has the name | |
227 | \bt_p{name}. | |
228 | */ | |
229 | extern bt_self_component_add_port_status | |
230 | bt_self_component_filter_add_input_port( | |
231 | bt_self_component_filter *self_component, | |
232 | const char *name, void *user_data, | |
233 | bt_self_component_port_input **self_component_port); | |
234 | ||
235 | /*! | |
236 | @brief | |
237 | Adds an \bt_oport named \bt_p{name} and having the user data | |
238 | \bt_p{user_data} to the \bt_flt_comp \bt_p{self_component}, | |
239 | and sets \bt_p{*self_component_port} to the resulting port. | |
240 | ||
241 | @attention | |
242 | You can only call this function from within the | |
243 | \ref api-comp-cls-dev-meth-init "initialization", | |
244 | \link api-comp-cls-dev-meth-iport-connected "input port connected"\endlink, | |
245 | and | |
246 | \link api-comp-cls-dev-meth-oport-connected "output port connected"\endlink | |
247 | methods. | |
248 | ||
249 | @param[in] self_component | |
250 | Filter component instance. | |
251 | @param[in] name | |
252 | Name of the output port to add to \bt_p{self_component} (copied). | |
253 | @param[in] user_data | |
254 | User data of the output port to add to \bt_p{self_component}. | |
255 | @param[out] self_component_port | |
256 | <strong>On success, if not \c NULL</strong>, | |
257 | \bt_p{*self_component_port} is a \em borrowed reference of the | |
258 | created port. | |
259 | ||
260 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_OK | |
261 | Success. | |
262 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR | |
263 | Out of memory. | |
264 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR | |
265 | Other error. | |
266 | ||
267 | @bt_pre_not_null{self_component} | |
268 | @bt_pre_not_null{name} | |
269 | @pre | |
270 | No other output port within \bt_p{self_component} has the name | |
271 | \bt_p{name}. | |
272 | */ | |
273 | extern bt_self_component_add_port_status | |
274 | bt_self_component_filter_add_output_port( | |
275 | bt_self_component_filter *self_component, | |
276 | const char *name, void *user_data, | |
277 | bt_self_component_port_output **self_component_port); | |
278 | ||
279 | /*! | |
280 | @brief | |
281 | Adds an \bt_iport named \bt_p{name} and having the user data | |
282 | \bt_p{user_data} to the \bt_sink_comp \bt_p{self_component}, | |
283 | and sets \bt_p{*self_component_port} to the resulting port. | |
284 | ||
285 | @attention | |
286 | You can only call this function from within the | |
287 | \ref api-comp-cls-dev-meth-init "initialization", | |
288 | \link api-comp-cls-dev-meth-iport-connected "input port connected"\endlink, | |
289 | and | |
290 | \link api-comp-cls-dev-meth-oport-connected "output port connected"\endlink | |
291 | methods. | |
292 | ||
293 | @param[in] self_component | |
294 | Sink component instance. | |
295 | @param[in] name | |
296 | Name of the input port to add to \bt_p{self_component} (copied). | |
297 | @param[in] user_data | |
298 | User data of the input port to add to \bt_p{self_component}. | |
299 | @param[out] self_component_port | |
300 | <strong>On success, if not \c NULL</strong>, | |
301 | \bt_p{*self_component_port} is a \em borrowed reference of the | |
302 | created port. | |
303 | ||
304 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_OK | |
305 | Success. | |
306 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR | |
307 | Out of memory. | |
308 | @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR | |
309 | Other error. | |
310 | ||
311 | @bt_pre_not_null{self_component} | |
312 | @bt_pre_not_null{name} | |
313 | @pre | |
314 | No other input port within \bt_p{self_component} has the name | |
315 | \bt_p{name}. | |
316 | */ | |
317 | ||
318 | extern bt_self_component_add_port_status | |
319 | bt_self_component_sink_add_input_port( | |
320 | bt_self_component_sink *self_component, | |
321 | const char *name, void *user_data, | |
322 | bt_self_component_port_input **self_component_port); | |
323 | ||
324 | /*! @} */ | |
325 | ||
326 | /*! | |
327 | @name Port access | |
328 | @{ | |
329 | */ | |
330 | ||
331 | /*! | |
332 | @brief | |
333 | Borrows the \bt_self_comp_oport at index \bt_p{index} from the | |
334 | \bt_src_comp \bt_p{self_component}. | |
335 | ||
336 | @param[in] self_component | |
337 | Source component instance. | |
338 | @param[in] index | |
339 | Index of the output port to borrow from \bt_p{self_component}. | |
340 | ||
341 | @returns | |
342 | @parblock | |
343 | \em Borrowed reference of the output port of | |
344 | \bt_p{self_component} at index \bt_p{index}. | |
345 | ||
346 | The returned pointer remains valid as long as \bt_p{self_component} | |
347 | exists. | |
348 | @endparblock | |
349 | ||
350 | @bt_pre_not_null{self_component} | |
351 | @pre | |
352 | \bt_p{index} is less than the number of output ports | |
353 | \bt_p{self_component} has (as returned by | |
354 | bt_component_source_get_output_port_count()). | |
355 | ||
356 | @sa bt_component_source_get_output_port_count() — | |
357 | Returns the number of output ports that a source component has. | |
358 | */ | |
359 | extern bt_self_component_port_output * | |
360 | bt_self_component_source_borrow_output_port_by_index( | |
361 | bt_self_component_source *self_component, | |
362 | uint64_t index); | |
363 | ||
364 | /*! | |
365 | @brief | |
366 | Borrows the \bt_self_comp_iport at index \bt_p{index} from the | |
367 | \bt_flt_comp \bt_p{self_component}. | |
368 | ||
369 | @param[in] self_component | |
370 | Filter component instance. | |
371 | @param[in] index | |
372 | Index of the input port to borrow from \bt_p{self_component}. | |
373 | ||
374 | @returns | |
375 | @parblock | |
376 | \em Borrowed reference of the input port of | |
377 | \bt_p{self_component} at index \bt_p{index}. | |
378 | ||
379 | The returned pointer remains valid as long as \bt_p{self_component} | |
380 | exists. | |
381 | @endparblock | |
382 | ||
383 | @bt_pre_not_null{self_component} | |
384 | @pre | |
385 | \bt_p{index} is less than the number of input ports | |
386 | \bt_p{self_component} has (as returned by | |
387 | bt_component_filter_get_input_port_count()). | |
388 | ||
389 | @sa bt_component_filter_get_input_port_count() — | |
390 | Returns the number of input ports that a filter component has. | |
391 | */ | |
392 | extern bt_self_component_port_input * | |
393 | bt_self_component_filter_borrow_input_port_by_index( | |
394 | bt_self_component_filter *self_component, | |
395 | uint64_t index); | |
396 | ||
397 | /*! | |
398 | @brief | |
399 | Borrows the \bt_self_comp_oport at index \bt_p{index} from the | |
400 | \bt_flt_comp \bt_p{self_component}. | |
401 | ||
402 | @param[in] self_component | |
403 | Filter component instance. | |
404 | @param[in] index | |
405 | Index of the output port to borrow from \bt_p{self_component}. | |
406 | ||
407 | @returns | |
408 | @parblock | |
409 | \em Borrowed reference of the output port of | |
410 | \bt_p{self_component} at index \bt_p{index}. | |
411 | ||
412 | The returned pointer remains valid as long as \bt_p{self_component} | |
413 | exists. | |
414 | @endparblock | |
415 | ||
416 | @bt_pre_not_null{self_component} | |
417 | @pre | |
418 | \bt_p{index} is less than the number of output ports | |
419 | \bt_p{self_component} has (as returned by | |
420 | bt_component_filter_get_output_port_count()). | |
421 | ||
422 | @sa bt_component_filter_get_output_port_count() — | |
423 | Returns the number of output ports that a filter component has. | |
424 | */ | |
425 | extern bt_self_component_port_output * | |
426 | bt_self_component_filter_borrow_output_port_by_index( | |
427 | bt_self_component_filter *self_component, | |
428 | uint64_t index); | |
429 | ||
430 | /*! | |
431 | @brief | |
432 | Borrows the \bt_self_comp_iport at index \bt_p{index} from the | |
433 | \bt_sink_comp \bt_p{self_component}. | |
434 | ||
435 | @param[in] self_component | |
436 | Sink component instance. | |
437 | @param[in] index | |
438 | Index of the input port to borrow from \bt_p{self_component}. | |
439 | ||
440 | @returns | |
441 | @parblock | |
442 | \em Borrowed reference of the input port of | |
443 | \bt_p{self_component} at index \bt_p{index}. | |
444 | ||
445 | The returned pointer remains valid as long as \bt_p{self_component} | |
446 | exists. | |
447 | @endparblock | |
448 | ||
449 | @bt_pre_not_null{self_component} | |
450 | @pre | |
451 | \bt_p{index} is less than the number of input ports | |
452 | \bt_p{self_component} has (as returned by | |
453 | bt_component_sink_get_input_port_count()). | |
454 | ||
455 | @sa bt_component_sink_get_input_port_count() — | |
456 | Returns the number of input ports that a sink component has. | |
457 | */ | |
458 | extern bt_self_component_port_input * | |
459 | bt_self_component_sink_borrow_input_port_by_index( | |
460 | bt_self_component_sink *self_component, uint64_t index); | |
461 | ||
462 | /*! | |
463 | @brief | |
464 | Borrows the \bt_self_comp_oport named \bt_p{name} from the | |
465 | \bt_src_comp \bt_p{self_component}. | |
466 | ||
467 | If \bt_p{self_component} has no output port named \bt_p{name}, this | |
468 | function returns \c NULL. | |
469 | ||
470 | @param[in] self_component | |
471 | Source component instance. | |
472 | @param[in] name | |
473 | Name of the output port to borrow from \bt_p{self_component}. | |
474 | ||
475 | @returns | |
476 | @parblock | |
477 | \em Borrowed reference of the output port of | |
478 | \bt_p{self_component} named \bt_p{name}, or \c NULL if none. | |
479 | ||
480 | The returned pointer remains valid as long as \bt_p{self_component} | |
481 | exists. | |
482 | @endparblock | |
483 | ||
484 | @bt_pre_not_null{self_component} | |
485 | @bt_pre_not_null{name} | |
486 | */ | |
487 | extern bt_self_component_port_output * | |
488 | bt_self_component_source_borrow_output_port_by_name( | |
489 | bt_self_component_source *self_component, | |
490 | const char *name); | |
491 | ||
492 | /*! | |
493 | @brief | |
494 | Borrows the \bt_self_comp_iport named \bt_p{name} from the | |
495 | \bt_flt_comp \bt_p{self_component}. | |
496 | ||
497 | If \bt_p{self_component} has no input port named \bt_p{name}, this | |
498 | function returns \c NULL. | |
499 | ||
500 | @param[in] self_component | |
501 | Filter component instance. | |
502 | @param[in] name | |
503 | Name of the input port to borrow from \bt_p{self_component}. | |
504 | ||
505 | @returns | |
506 | @parblock | |
507 | \em Borrowed reference of the input port of | |
508 | \bt_p{self_component} named \bt_p{name}, or \c NULL if none. | |
509 | ||
510 | The returned pointer remains valid as long as \bt_p{self_component} | |
511 | exists. | |
512 | @endparblock | |
513 | ||
514 | @bt_pre_not_null{self_component} | |
515 | @bt_pre_not_null{name} | |
516 | */ | |
517 | extern bt_self_component_port_input * | |
518 | bt_self_component_filter_borrow_input_port_by_name( | |
519 | bt_self_component_filter *self_component, | |
520 | const char *name); | |
521 | ||
522 | /*! | |
523 | @brief | |
524 | Borrows the \bt_self_comp_oport named \bt_p{name} from the | |
525 | \bt_flt_comp \bt_p{self_component}. | |
526 | ||
527 | If \bt_p{self_component} has no output port named \bt_p{name}, this | |
528 | function returns \c NULL. | |
529 | ||
530 | @param[in] self_component | |
531 | Filter component instance. | |
532 | @param[in] name | |
533 | Name of the output port to borrow from \bt_p{self_component}. | |
534 | ||
535 | @returns | |
536 | @parblock | |
537 | \em Borrowed reference of the output port of | |
538 | \bt_p{self_component} named \bt_p{name}, or \c NULL if none. | |
539 | ||
540 | The returned pointer remains valid as long as \bt_p{self_component} | |
541 | exists. | |
542 | @endparblock | |
543 | ||
544 | @bt_pre_not_null{self_component} | |
545 | @bt_pre_not_null{name} | |
546 | */ | |
547 | extern bt_self_component_port_output * | |
548 | bt_self_component_filter_borrow_output_port_by_name( | |
549 | bt_self_component_filter *self_component, | |
550 | const char *name); | |
551 | ||
552 | /*! | |
553 | @brief | |
554 | Borrows the \bt_self_comp_iport named \bt_p{name} from the | |
555 | \bt_sink_comp \bt_p{self_component}. | |
556 | ||
557 | If \bt_p{self_component} has no input port named \bt_p{name}, this | |
558 | function returns \c NULL. | |
559 | ||
560 | @param[in] self_component | |
561 | Sink component instance. | |
562 | @param[in] name | |
563 | Name of the input port to borrow from \bt_p{self_component}. | |
564 | ||
565 | @returns | |
566 | @parblock | |
567 | \em Borrowed reference of the input port of | |
568 | \bt_p{self_component} named \bt_p{name}, or \c NULL if none. | |
569 | ||
570 | The returned pointer remains valid as long as \bt_p{self_component} | |
571 | exists. | |
572 | @endparblock | |
573 | ||
574 | @bt_pre_not_null{self_component} | |
575 | @bt_pre_not_null{name} | |
576 | */ | |
577 | extern bt_self_component_port_input * | |
578 | bt_self_component_sink_borrow_input_port_by_name( | |
579 | bt_self_component_sink *self_component, | |
580 | const char *name); | |
581 | ||
582 | /*! @} */ | |
583 | ||
584 | /*! | |
585 | @name User data | |
586 | @{ | |
587 | */ | |
588 | ||
589 | /*! | |
590 | @brief | |
591 | Sets the user data of the \bt_comp \bt_p{self_component} to | |
592 | \bt_p{data}. | |
593 | ||
594 | @param[in] self_component | |
595 | Component instance. | |
596 | @param[in] user_data | |
597 | New user data of \bt_p{self_component}. | |
598 | ||
599 | @bt_pre_not_null{self_component} | |
600 | ||
601 | @sa bt_self_component_get_data() — | |
602 | Returns the user data of a component. | |
603 | */ | |
604 | extern void bt_self_component_set_data( | |
605 | bt_self_component *self_component, void *user_data); | |
606 | ||
607 | /*! | |
608 | @brief | |
609 | Returns the user data of the \bt_comp \bt_p{self_component}. | |
610 | ||
611 | @param[in] self_component | |
612 | Component instance. | |
613 | ||
614 | @returns | |
615 | User data of \bt_p{self_component}. | |
616 | ||
617 | @bt_pre_not_null{self_component} | |
618 | ||
619 | @sa bt_self_component_set_data() — | |
620 | Sets the user data of a component. | |
621 | */ | |
622 | extern void *bt_self_component_get_data( | |
623 | const bt_self_component *self_component); | |
624 | ||
625 | /*! @} */ | |
626 | ||
627 | /*! | |
628 | @name Trace processing graph's effective MIP version access | |
629 | @{ | |
630 | */ | |
631 | ||
632 | /*! | |
633 | @brief | |
634 | Returns the effective \bt_mip (MIP) version of the trace processing | |
635 | \bt_graph which contains the \bt_comp \bt_p{self_component}. | |
636 | ||
637 | @note | |
638 | As of \bt_name_version_min_maj, because bt_get_maximal_mip_version() | |
639 | returns 0, this function always returns 0. | |
640 | ||
641 | @param[in] self_component | |
642 | Component instance. | |
643 | ||
644 | @returns | |
645 | Effective MIP version of the trace processing graph which | |
646 | contains \bt_p{self_component}. | |
647 | ||
648 | @bt_pre_not_null{self_component} | |
649 | */ | |
650 | extern | |
651 | uint64_t bt_self_component_get_graph_mip_version( | |
652 | bt_self_component *self_component); | |
653 | ||
654 | /*! @} */ | |
655 | ||
656 | /*! | |
657 | @name Sink component's interruption query | |
658 | @{ | |
659 | */ | |
660 | ||
661 | /*! | |
662 | @brief | |
663 | Returns whether or not the \bt_sink_comp \bt_p{self_component} | |
664 | is interrupted, that is, whether or not any of its \bt_p_intr | |
665 | is set. | |
666 | ||
667 | @param[in] self_component | |
668 | Component instance. | |
669 | ||
670 | @returns | |
671 | #BT_TRUE if \bt_p{self_component} is interrupted (any of its | |
672 | interrupters is set). | |
673 | ||
674 | @bt_pre_not_null{self_component} | |
675 | ||
676 | @sa bt_graph_borrow_default_interrupter() — | |
677 | Borrows a trace processing graph's default interrupter. | |
678 | @sa bt_graph_add_interrupter() — | |
679 | Adds an interrupter to a graph. | |
680 | */ | |
681 | extern bt_bool bt_self_component_sink_is_interrupted( | |
682 | const bt_self_component_sink *self_component); | |
683 | ||
684 | /*! @} */ | |
685 | ||
686 | /*! | |
687 | @name Self to public upcast | |
688 | @{ | |
689 | */ | |
690 | ||
691 | /*! | |
692 | @brief | |
693 | \ref api-fund-c-typing "Upcasts" the self \bt_comp | |
694 | \bt_p{self_component} to the public #bt_component type. | |
695 | ||
696 | @param[in] self_component | |
697 | @parblock | |
698 | Component to upcast. | |
699 | ||
700 | Can be \c NULL. | |
701 | @endparblock | |
702 | ||
703 | @returns | |
704 | \bt_p{self_component} as a public component. | |
705 | */ | |
d94d92ac | 706 | static inline |
b19ff26f PP |
707 | const bt_component *bt_self_component_as_component( |
708 | bt_self_component *self_component) | |
d94d92ac | 709 | { |
005f1204 | 710 | return __BT_UPCAST(bt_component, self_component); |
d94d92ac | 711 | } |
890882ef | 712 | |
43c59509 PP |
713 | /*! |
714 | @brief | |
715 | \ref api-fund-c-typing "Upcasts" the self \bt_src_comp | |
716 | \bt_p{self_component} to the public #bt_component_source | |
717 | type. | |
056deb59 | 718 | |
43c59509 PP |
719 | @param[in] self_component |
720 | @parblock | |
721 | Source component to upcast. | |
890882ef | 722 | |
43c59509 PP |
723 | Can be \c NULL. |
724 | @endparblock | |
725 | ||
726 | @returns | |
727 | \bt_p{self_component} as a public source component. | |
728 | */ | |
729 | static inline | |
730 | const bt_component_source * | |
731 | bt_self_component_source_as_component_source( | |
732 | bt_self_component_source *self_component) | |
733 | { | |
734 | return __BT_UPCAST_CONST(bt_component_source, self_component); | |
735 | } | |
736 | ||
737 | /*! | |
738 | @brief | |
739 | \ref api-fund-c-typing "Upcasts" the self \bt_flt_comp | |
740 | \bt_p{self_component} to the public #bt_component_filter | |
741 | type. | |
742 | ||
743 | @param[in] self_component | |
744 | @parblock | |
745 | Filter component to upcast. | |
746 | ||
747 | Can be \c NULL. | |
748 | @endparblock | |
749 | ||
750 | @returns | |
751 | \bt_p{self_component} as a public filter component. | |
752 | */ | |
753 | static inline | |
754 | const bt_component_filter * | |
755 | bt_self_component_filter_as_component_filter( | |
756 | bt_self_component_filter *self_component) | |
757 | { | |
758 | return __BT_UPCAST_CONST(bt_component_filter, self_component); | |
759 | } | |
760 | ||
761 | /*! | |
762 | @brief | |
763 | \ref api-fund-c-typing "Upcasts" the self \bt_sink_comp | |
764 | \bt_p{self_component} to the public #bt_component_sink | |
765 | type. | |
766 | ||
767 | @param[in] self_component | |
768 | @parblock | |
769 | Sink component to upcast. | |
770 | ||
771 | Can be \c NULL. | |
772 | @endparblock | |
773 | ||
774 | @returns | |
775 | \bt_p{self_component} as a public sink component. | |
776 | */ | |
777 | static inline | |
778 | const bt_component_sink * | |
779 | bt_self_component_sink_as_component_sink( | |
780 | bt_self_component_sink *self_component) | |
781 | { | |
782 | return __BT_UPCAST_CONST(bt_component_sink, self_component); | |
783 | } | |
784 | ||
785 | /*! @} */ | |
786 | ||
787 | /*! | |
788 | @name Self to common self upcast | |
789 | @{ | |
790 | */ | |
791 | ||
792 | /*! | |
793 | @brief | |
794 | \ref api-fund-c-typing "Upcasts" the self \bt_src_comp | |
795 | \bt_p{self_component} to the common #bt_self_component | |
796 | type. | |
797 | ||
798 | @param[in] self_component | |
799 | @parblock | |
800 | Source component to upcast. | |
801 | ||
802 | Can be \c NULL. | |
803 | @endparblock | |
804 | ||
805 | @returns | |
806 | \bt_p{self_component} as a common self component. | |
807 | */ | |
808 | static inline | |
809 | bt_self_component *bt_self_component_source_as_self_component( | |
810 | bt_self_component_source *self_component) | |
811 | { | |
812 | return __BT_UPCAST(bt_self_component, self_component); | |
813 | } | |
814 | ||
815 | /*! | |
816 | @brief | |
817 | \ref api-fund-c-typing "Upcasts" the self \bt_flt_comp | |
818 | \bt_p{self_component} to the common #bt_self_component | |
819 | type. | |
820 | ||
821 | @param[in] self_component | |
822 | @parblock | |
823 | Filter component to upcast. | |
824 | ||
825 | Can be \c NULL. | |
826 | @endparblock | |
827 | ||
828 | @returns | |
829 | \bt_p{self_component} as a common self component. | |
830 | */ | |
831 | static inline | |
832 | bt_self_component *bt_self_component_filter_as_self_component( | |
833 | bt_self_component_filter *self_component) | |
834 | { | |
835 | return __BT_UPCAST(bt_self_component, self_component); | |
836 | } | |
837 | ||
838 | /*! | |
839 | @brief | |
840 | \ref api-fund-c-typing "Upcasts" the self \bt_sink_comp | |
841 | \bt_p{self_component} to the common #bt_self_component | |
842 | type. | |
843 | ||
844 | @param[in] self_component | |
845 | @parblock | |
846 | Sink component to upcast. | |
847 | ||
848 | Can be \c NULL. | |
849 | @endparblock | |
850 | ||
851 | @returns | |
852 | \bt_p{self_component} as a common self component. | |
853 | */ | |
854 | static inline | |
855 | bt_self_component *bt_self_component_sink_as_self_component( | |
856 | bt_self_component_sink *self_component) | |
857 | { | |
858 | return __BT_UPCAST(bt_self_component, self_component); | |
859 | } | |
860 | ||
861 | /*! @} */ | |
862 | ||
863 | /*! @} */ | |
890882ef PP |
864 | |
865 | #ifdef __cplusplus | |
866 | } | |
867 | #endif | |
868 | ||
924dc299 | 869 | #endif /* BABELTRACE2_GRAPH_SELF_COMPONENT_H */ |