bt2c::Logger: remove unused cLevel() method
[babeltrace.git] / include / babeltrace2 / graph / self-component.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5 */
6
7 #ifndef BABELTRACE2_GRAPH_SELF_COMPONENT_H
8 #define BABELTRACE2_GRAPH_SELF_COMPONENT_H
9
10 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
14 #endif
15
16 #include <babeltrace2/types.h>
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
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 */
127 typedef enum bt_self_component_add_port_status {
128 /*!
129 @brief
130 Success.
131 */
132 BT_SELF_COMPONENT_ADD_PORT_STATUS_OK = __BT_FUNC_STATUS_OK,
133
134 /*!
135 @brief
136 Out of memory.
137 */
138 BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
139
140 /*!
141 @brief
142 Other error.
143 */
144 BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
145 } bt_self_component_add_port_status;
146
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 __BT_NOEXCEPT;
191
192 /*!
193 @brief
194 Adds an \bt_iport named \bt_p{name} and having the user data
195 \bt_p{user_data} to the \bt_flt_comp \bt_p{self_component},
196 and sets \bt_p{*self_component_port} to the resulting port.
197
198 @attention
199 You can only call this function from within the
200 \ref api-comp-cls-dev-meth-init "initialization",
201 \link api-comp-cls-dev-meth-iport-connected "input port connected"\endlink,
202 and
203 \link api-comp-cls-dev-meth-oport-connected "output port connected"\endlink
204 methods.
205
206 @param[in] self_component
207 Filter component instance.
208 @param[in] name
209 Name of the input port to add to \bt_p{self_component} (copied).
210 @param[in] user_data
211 User data of the input port to add to \bt_p{self_component}.
212 @param[out] self_component_port
213 <strong>On success, if not \c NULL</strong>,
214 \bt_p{*self_component_port} is a \em borrowed reference of the
215 created port.
216
217 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
218 Success.
219 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR
220 Out of memory.
221 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR
222 Other error.
223
224 @bt_pre_not_null{self_component}
225 @bt_pre_not_null{name}
226 @pre
227 No other input port within \bt_p{self_component} has the name
228 \bt_p{name}.
229 */
230 extern bt_self_component_add_port_status
231 bt_self_component_filter_add_input_port(
232 bt_self_component_filter *self_component,
233 const char *name, void *user_data,
234 bt_self_component_port_input **self_component_port)
235 __BT_NOEXCEPT;
236
237 /*!
238 @brief
239 Adds an \bt_oport named \bt_p{name} and having the user data
240 \bt_p{user_data} to the \bt_flt_comp \bt_p{self_component},
241 and sets \bt_p{*self_component_port} to the resulting port.
242
243 @attention
244 You can only call this function from within the
245 \ref api-comp-cls-dev-meth-init "initialization",
246 \link api-comp-cls-dev-meth-iport-connected "input port connected"\endlink,
247 and
248 \link api-comp-cls-dev-meth-oport-connected "output port connected"\endlink
249 methods.
250
251 @param[in] self_component
252 Filter component instance.
253 @param[in] name
254 Name of the output port to add to \bt_p{self_component} (copied).
255 @param[in] user_data
256 User data of the output port to add to \bt_p{self_component}.
257 @param[out] self_component_port
258 <strong>On success, if not \c NULL</strong>,
259 \bt_p{*self_component_port} is a \em borrowed reference of the
260 created port.
261
262 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
263 Success.
264 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR
265 Out of memory.
266 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR
267 Other error.
268
269 @bt_pre_not_null{self_component}
270 @bt_pre_not_null{name}
271 @pre
272 No other output port within \bt_p{self_component} has the name
273 \bt_p{name}.
274 */
275 extern bt_self_component_add_port_status
276 bt_self_component_filter_add_output_port(
277 bt_self_component_filter *self_component,
278 const char *name, void *user_data,
279 bt_self_component_port_output **self_component_port)
280 __BT_NOEXCEPT;
281
282 /*!
283 @brief
284 Adds an \bt_iport named \bt_p{name} and having the user data
285 \bt_p{user_data} to the \bt_sink_comp \bt_p{self_component},
286 and sets \bt_p{*self_component_port} to the resulting port.
287
288 @attention
289 You can only call this function from within the
290 \ref api-comp-cls-dev-meth-init "initialization",
291 \link api-comp-cls-dev-meth-iport-connected "input port connected"\endlink,
292 and
293 \link api-comp-cls-dev-meth-oport-connected "output port connected"\endlink
294 methods.
295
296 @param[in] self_component
297 Sink component instance.
298 @param[in] name
299 Name of the input port to add to \bt_p{self_component} (copied).
300 @param[in] user_data
301 User data of the input port to add to \bt_p{self_component}.
302 @param[out] self_component_port
303 <strong>On success, if not \c NULL</strong>,
304 \bt_p{*self_component_port} is a \em borrowed reference of the
305 created port.
306
307 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
308 Success.
309 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR
310 Out of memory.
311 @retval #BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR
312 Other error.
313
314 @bt_pre_not_null{self_component}
315 @bt_pre_not_null{name}
316 @pre
317 No other input port within \bt_p{self_component} has the name
318 \bt_p{name}.
319 */
320
321 extern bt_self_component_add_port_status
322 bt_self_component_sink_add_input_port(
323 bt_self_component_sink *self_component,
324 const char *name, void *user_data,
325 bt_self_component_port_input **self_component_port)
326 __BT_NOEXCEPT;
327
328 /*! @} */
329
330 /*!
331 @name Port access
332 @{
333 */
334
335 /*!
336 @brief
337 Borrows the \bt_self_comp_oport at index \bt_p{index} from the
338 \bt_src_comp \bt_p{self_component}.
339
340 @param[in] self_component
341 Source component instance.
342 @param[in] index
343 Index of the output port to borrow from \bt_p{self_component}.
344
345 @returns
346 @parblock
347 \em Borrowed reference of the output port of
348 \bt_p{self_component} at index \bt_p{index}.
349
350 The returned pointer remains valid as long as \bt_p{self_component}
351 exists.
352 @endparblock
353
354 @bt_pre_not_null{self_component}
355 @pre
356 \bt_p{index} is less than the number of output ports
357 \bt_p{self_component} has (as returned by
358 bt_component_source_get_output_port_count()).
359
360 @sa bt_component_source_get_output_port_count() &mdash;
361 Returns the number of output ports that a source component has.
362 */
363 extern bt_self_component_port_output *
364 bt_self_component_source_borrow_output_port_by_index(
365 bt_self_component_source *self_component,
366 uint64_t index) __BT_NOEXCEPT;
367
368 /*!
369 @brief
370 Borrows the \bt_self_comp_iport at index \bt_p{index} from the
371 \bt_flt_comp \bt_p{self_component}.
372
373 @param[in] self_component
374 Filter component instance.
375 @param[in] index
376 Index of the input port to borrow from \bt_p{self_component}.
377
378 @returns
379 @parblock
380 \em Borrowed reference of the input port of
381 \bt_p{self_component} at index \bt_p{index}.
382
383 The returned pointer remains valid as long as \bt_p{self_component}
384 exists.
385 @endparblock
386
387 @bt_pre_not_null{self_component}
388 @pre
389 \bt_p{index} is less than the number of input ports
390 \bt_p{self_component} has (as returned by
391 bt_component_filter_get_input_port_count()).
392
393 @sa bt_component_filter_get_input_port_count() &mdash;
394 Returns the number of input ports that a filter component has.
395 */
396 extern bt_self_component_port_input *
397 bt_self_component_filter_borrow_input_port_by_index(
398 bt_self_component_filter *self_component,
399 uint64_t index) __BT_NOEXCEPT;
400
401 /*!
402 @brief
403 Borrows the \bt_self_comp_oport at index \bt_p{index} from the
404 \bt_flt_comp \bt_p{self_component}.
405
406 @param[in] self_component
407 Filter component instance.
408 @param[in] index
409 Index of the output port to borrow from \bt_p{self_component}.
410
411 @returns
412 @parblock
413 \em Borrowed reference of the output port of
414 \bt_p{self_component} at index \bt_p{index}.
415
416 The returned pointer remains valid as long as \bt_p{self_component}
417 exists.
418 @endparblock
419
420 @bt_pre_not_null{self_component}
421 @pre
422 \bt_p{index} is less than the number of output ports
423 \bt_p{self_component} has (as returned by
424 bt_component_filter_get_output_port_count()).
425
426 @sa bt_component_filter_get_output_port_count() &mdash;
427 Returns the number of output ports that a filter component has.
428 */
429 extern bt_self_component_port_output *
430 bt_self_component_filter_borrow_output_port_by_index(
431 bt_self_component_filter *self_component,
432 uint64_t index) __BT_NOEXCEPT;
433
434 /*!
435 @brief
436 Borrows the \bt_self_comp_iport at index \bt_p{index} from the
437 \bt_sink_comp \bt_p{self_component}.
438
439 @param[in] self_component
440 Sink component instance.
441 @param[in] index
442 Index of the input port to borrow from \bt_p{self_component}.
443
444 @returns
445 @parblock
446 \em Borrowed reference of the input port of
447 \bt_p{self_component} at index \bt_p{index}.
448
449 The returned pointer remains valid as long as \bt_p{self_component}
450 exists.
451 @endparblock
452
453 @bt_pre_not_null{self_component}
454 @pre
455 \bt_p{index} is less than the number of input ports
456 \bt_p{self_component} has (as returned by
457 bt_component_sink_get_input_port_count()).
458
459 @sa bt_component_sink_get_input_port_count() &mdash;
460 Returns the number of input ports that a sink component has.
461 */
462 extern bt_self_component_port_input *
463 bt_self_component_sink_borrow_input_port_by_index(
464 bt_self_component_sink *self_component, uint64_t index)
465 __BT_NOEXCEPT;
466
467 /*!
468 @brief
469 Borrows the \bt_self_comp_oport named \bt_p{name} from the
470 \bt_src_comp \bt_p{self_component}.
471
472 If \bt_p{self_component} has no output port named \bt_p{name}, this
473 function returns \c NULL.
474
475 @param[in] self_component
476 Source component instance.
477 @param[in] name
478 Name of the output port to borrow from \bt_p{self_component}.
479
480 @returns
481 @parblock
482 \em Borrowed reference of the output port of
483 \bt_p{self_component} named \bt_p{name}, or \c NULL if none.
484
485 The returned pointer remains valid as long as \bt_p{self_component}
486 exists.
487 @endparblock
488
489 @bt_pre_not_null{self_component}
490 @bt_pre_not_null{name}
491 */
492 extern bt_self_component_port_output *
493 bt_self_component_source_borrow_output_port_by_name(
494 bt_self_component_source *self_component,
495 const char *name) __BT_NOEXCEPT;
496
497 /*!
498 @brief
499 Borrows the \bt_self_comp_iport named \bt_p{name} from the
500 \bt_flt_comp \bt_p{self_component}.
501
502 If \bt_p{self_component} has no input port named \bt_p{name}, this
503 function returns \c NULL.
504
505 @param[in] self_component
506 Filter component instance.
507 @param[in] name
508 Name of the input port to borrow from \bt_p{self_component}.
509
510 @returns
511 @parblock
512 \em Borrowed reference of the input port of
513 \bt_p{self_component} named \bt_p{name}, or \c NULL if none.
514
515 The returned pointer remains valid as long as \bt_p{self_component}
516 exists.
517 @endparblock
518
519 @bt_pre_not_null{self_component}
520 @bt_pre_not_null{name}
521 */
522 extern bt_self_component_port_input *
523 bt_self_component_filter_borrow_input_port_by_name(
524 bt_self_component_filter *self_component,
525 const char *name) __BT_NOEXCEPT;
526
527 /*!
528 @brief
529 Borrows the \bt_self_comp_oport named \bt_p{name} from the
530 \bt_flt_comp \bt_p{self_component}.
531
532 If \bt_p{self_component} has no output port named \bt_p{name}, this
533 function returns \c NULL.
534
535 @param[in] self_component
536 Filter component instance.
537 @param[in] name
538 Name of the output port to borrow from \bt_p{self_component}.
539
540 @returns
541 @parblock
542 \em Borrowed reference of the output port of
543 \bt_p{self_component} named \bt_p{name}, or \c NULL if none.
544
545 The returned pointer remains valid as long as \bt_p{self_component}
546 exists.
547 @endparblock
548
549 @bt_pre_not_null{self_component}
550 @bt_pre_not_null{name}
551 */
552 extern bt_self_component_port_output *
553 bt_self_component_filter_borrow_output_port_by_name(
554 bt_self_component_filter *self_component,
555 const char *name) __BT_NOEXCEPT;
556
557 /*!
558 @brief
559 Borrows the \bt_self_comp_iport named \bt_p{name} from the
560 \bt_sink_comp \bt_p{self_component}.
561
562 If \bt_p{self_component} has no input port named \bt_p{name}, this
563 function returns \c NULL.
564
565 @param[in] self_component
566 Sink component instance.
567 @param[in] name
568 Name of the input port to borrow from \bt_p{self_component}.
569
570 @returns
571 @parblock
572 \em Borrowed reference of the input port of
573 \bt_p{self_component} named \bt_p{name}, or \c NULL if none.
574
575 The returned pointer remains valid as long as \bt_p{self_component}
576 exists.
577 @endparblock
578
579 @bt_pre_not_null{self_component}
580 @bt_pre_not_null{name}
581 */
582 extern bt_self_component_port_input *
583 bt_self_component_sink_borrow_input_port_by_name(
584 bt_self_component_sink *self_component,
585 const char *name) __BT_NOEXCEPT;
586
587 /*! @} */
588
589 /*!
590 @name User data
591 @{
592 */
593
594 /*!
595 @brief
596 Sets the user data of the \bt_comp \bt_p{self_component} to
597 \bt_p{data}.
598
599 @param[in] self_component
600 Component instance.
601 @param[in] user_data
602 New user data of \bt_p{self_component}.
603
604 @bt_pre_not_null{self_component}
605
606 @sa bt_self_component_get_data() &mdash;
607 Returns the user data of a component.
608 */
609 extern void bt_self_component_set_data(
610 bt_self_component *self_component, void *user_data)
611 __BT_NOEXCEPT;
612
613 /*!
614 @brief
615 Returns the user data of the \bt_comp \bt_p{self_component}.
616
617 @param[in] self_component
618 Component instance.
619
620 @returns
621 User data of \bt_p{self_component}.
622
623 @bt_pre_not_null{self_component}
624
625 @sa bt_self_component_set_data() &mdash;
626 Sets the user data of a component.
627 */
628 extern void *bt_self_component_get_data(
629 const bt_self_component *self_component) __BT_NOEXCEPT;
630
631 /*! @} */
632
633 /*!
634 @name Trace processing graph's effective MIP version access
635 @{
636 */
637
638 /*!
639 @brief
640 Returns the effective \bt_mip (MIP) version of the trace processing
641 \bt_graph which contains the \bt_comp \bt_p{self_component}.
642
643 @note
644 As of \bt_name_version_min_maj, because bt_get_maximal_mip_version()
645 returns 0, this function always returns 0.
646
647 @param[in] self_component
648 Component instance.
649
650 @returns
651 Effective MIP version of the trace processing graph which
652 contains \bt_p{self_component}.
653
654 @bt_pre_not_null{self_component}
655 */
656 extern
657 uint64_t bt_self_component_get_graph_mip_version(
658 bt_self_component *self_component) __BT_NOEXCEPT;
659
660 /*! @} */
661
662 /*!
663 @name Sink component's interruption query
664 @{
665 */
666
667 /*!
668 @brief
669 Returns whether or not the \bt_sink_comp \bt_p{self_component}
670 is interrupted, that is, whether or not any of its \bt_p_intr
671 is set.
672
673 @param[in] self_component
674 Component instance.
675
676 @returns
677 #BT_TRUE if \bt_p{self_component} is interrupted (any of its
678 interrupters is set).
679
680 @bt_pre_not_null{self_component}
681
682 @sa bt_graph_borrow_default_interrupter() &mdash;
683 Borrows a trace processing graph's default interrupter.
684 @sa bt_graph_add_interrupter() &mdash;
685 Adds an interrupter to a graph.
686 */
687 extern bt_bool bt_self_component_sink_is_interrupted(
688 const bt_self_component_sink *self_component) __BT_NOEXCEPT;
689
690 /*! @} */
691
692 /*!
693 @name Self to public upcast
694 @{
695 */
696
697 /*!
698 @brief
699 \ref api-fund-c-typing "Upcasts" the self \bt_comp
700 \bt_p{self_component} to the public #bt_component type.
701
702 @param[in] self_component
703 @parblock
704 Component to upcast.
705
706 Can be \c NULL.
707 @endparblock
708
709 @returns
710 \bt_p{self_component} as a public component.
711 */
712 static inline
713 const bt_component *bt_self_component_as_component(
714 bt_self_component *self_component) __BT_NOEXCEPT
715 {
716 return __BT_UPCAST(bt_component, self_component);
717 }
718
719 /*!
720 @brief
721 \ref api-fund-c-typing "Upcasts" the self \bt_src_comp
722 \bt_p{self_component} to the public #bt_component_source
723 type.
724
725 @param[in] self_component
726 @parblock
727 Source component to upcast.
728
729 Can be \c NULL.
730 @endparblock
731
732 @returns
733 \bt_p{self_component} as a public source component.
734 */
735 static inline
736 const bt_component_source *
737 bt_self_component_source_as_component_source(
738 bt_self_component_source *self_component) __BT_NOEXCEPT
739 {
740 return __BT_UPCAST_CONST(bt_component_source, self_component);
741 }
742
743 /*!
744 @brief
745 \ref api-fund-c-typing "Upcasts" the self \bt_flt_comp
746 \bt_p{self_component} to the public #bt_component_filter
747 type.
748
749 @param[in] self_component
750 @parblock
751 Filter component to upcast.
752
753 Can be \c NULL.
754 @endparblock
755
756 @returns
757 \bt_p{self_component} as a public filter component.
758 */
759 static inline
760 const bt_component_filter *
761 bt_self_component_filter_as_component_filter(
762 bt_self_component_filter *self_component) __BT_NOEXCEPT
763 {
764 return __BT_UPCAST_CONST(bt_component_filter, self_component);
765 }
766
767 /*!
768 @brief
769 \ref api-fund-c-typing "Upcasts" the self \bt_sink_comp
770 \bt_p{self_component} to the public #bt_component_sink
771 type.
772
773 @param[in] self_component
774 @parblock
775 Sink component to upcast.
776
777 Can be \c NULL.
778 @endparblock
779
780 @returns
781 \bt_p{self_component} as a public sink component.
782 */
783 static inline
784 const bt_component_sink *
785 bt_self_component_sink_as_component_sink(
786 bt_self_component_sink *self_component) __BT_NOEXCEPT
787 {
788 return __BT_UPCAST_CONST(bt_component_sink, self_component);
789 }
790
791 /*! @} */
792
793 /*!
794 @name Self to common self upcast
795 @{
796 */
797
798 /*!
799 @brief
800 \ref api-fund-c-typing "Upcasts" the self \bt_src_comp
801 \bt_p{self_component} to the common #bt_self_component
802 type.
803
804 @param[in] self_component
805 @parblock
806 Source component to upcast.
807
808 Can be \c NULL.
809 @endparblock
810
811 @returns
812 \bt_p{self_component} as a common self component.
813 */
814 static inline
815 bt_self_component *bt_self_component_source_as_self_component(
816 bt_self_component_source *self_component) __BT_NOEXCEPT
817 {
818 return __BT_UPCAST(bt_self_component, self_component);
819 }
820
821 /*!
822 @brief
823 \ref api-fund-c-typing "Upcasts" the self \bt_flt_comp
824 \bt_p{self_component} to the common #bt_self_component
825 type.
826
827 @param[in] self_component
828 @parblock
829 Filter component to upcast.
830
831 Can be \c NULL.
832 @endparblock
833
834 @returns
835 \bt_p{self_component} as a common self component.
836 */
837 static inline
838 bt_self_component *bt_self_component_filter_as_self_component(
839 bt_self_component_filter *self_component) __BT_NOEXCEPT
840 {
841 return __BT_UPCAST(bt_self_component, self_component);
842 }
843
844 /*!
845 @brief
846 \ref api-fund-c-typing "Upcasts" the self \bt_sink_comp
847 \bt_p{self_component} to the common #bt_self_component
848 type.
849
850 @param[in] self_component
851 @parblock
852 Sink component to upcast.
853
854 Can be \c NULL.
855 @endparblock
856
857 @returns
858 \bt_p{self_component} as a common self component.
859 */
860 static inline
861 bt_self_component *bt_self_component_sink_as_self_component(
862 bt_self_component_sink *self_component) __BT_NOEXCEPT
863 {
864 return __BT_UPCAST(bt_self_component, self_component);
865 }
866
867 /*! @} */
868
869 /*! @} */
870
871 #ifdef __cplusplus
872 }
873 #endif
874
875 #endif /* BABELTRACE2_GRAPH_SELF_COMPONENT_H */
This page took 0.049067 seconds and 5 git commands to generate.