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