Babeltrace 2 C API 2.1.0
Open-source trace manipulation framework
Loading...
Searching...
No Matches
port.h
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5 */
6
7#ifndef BABELTRACE2_GRAPH_PORT_H
8#define BABELTRACE2_GRAPH_PORT_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 <stdint.h>
17
18#include <babeltrace2/types.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
178
196extern bt_port_type bt_port_get_type(const bt_port *port) __BT_NOEXCEPT;
197
213static inline
214bt_bool bt_port_is_input(const bt_port *port) __BT_NOEXCEPT
215{
216 return bt_port_get_type(port) == BT_PORT_TYPE_INPUT;
217}
218
234static inline
235bt_bool bt_port_is_output(const bt_port *port) __BT_NOEXCEPT
236{
238}
239
263 const bt_port *port) __BT_NOEXCEPT;
264
285 const bt_port *port) __BT_NOEXCEPT;
286
312extern const char *bt_port_get_name(const bt_port *port) __BT_NOEXCEPT;
313
328extern bt_bool bt_port_is_connected(const bt_port *port) __BT_NOEXCEPT;
329
352extern void bt_port_get_ref(const bt_port *port) __BT_NOEXCEPT;
353
369extern void bt_port_put_ref(const bt_port *port) __BT_NOEXCEPT;
370
385#define BT_PORT_PUT_REF_AND_RESET(_port) \
386 do { \
387 bt_port_put_ref(_port); \
388 (_port) = NULL; \
389 } while (0)
390
416#define BT_PORT_MOVE_REF(_dst, _src) \
417 do { \
418 bt_port_put_ref(_dst); \
419 (_dst) = (_src); \
420 (_src) = NULL; \
421 } while (0)
422
445static inline
447 const bt_port_input *port) __BT_NOEXCEPT
448{
449 return __BT_UPCAST_CONST(bt_port, port);
450}
451
467extern void bt_port_input_get_ref(const bt_port_input *port) __BT_NOEXCEPT;
468
484extern void bt_port_input_put_ref(const bt_port_input *port) __BT_NOEXCEPT;
485
500#define BT_PORT_INPUT_PUT_REF_AND_RESET(_port) \
501 do { \
502 bt_port_input_put_ref(_port); \
503 (_port) = NULL; \
504 } while (0)
505
531#define BT_PORT_INPUT_MOVE_REF(_dst, _src) \
532 do { \
533 bt_port_input_put_ref(_dst); \
534 (_dst) = (_src); \
535 (_src) = NULL; \
536 } while (0)
537
560static inline
562 const bt_port_output *port) __BT_NOEXCEPT
563{
564 return __BT_UPCAST_CONST(bt_port, port);
565}
566
582extern void bt_port_output_get_ref(const bt_port_output *port) __BT_NOEXCEPT;
583
599extern void bt_port_output_put_ref(const bt_port_output *port) __BT_NOEXCEPT;
600
615#define BT_PORT_OUTPUT_PUT_REF_AND_RESET(_port) \
616 do { \
617 bt_port_output_put_ref(_port); \
618 (_port) = NULL; \
619 } while (0)
620
646#define BT_PORT_OUTPUT_MOVE_REF(_dst, _src) \
647 do { \
648 bt_port_output_put_ref(_dst); \
649 (_dst) = (_src); \
650 (_src) = NULL; \
651 } while (0)
652
657#ifdef __cplusplus
658}
659#endif
660
661#endif /* BABELTRACE2_GRAPH_PORT_H */
int bt_bool
Babeltrace&#160;2 boolean type.
Definition types.h:126
struct bt_component bt_component
Component.
Definition types.h:24
struct bt_connection bt_connection
Connection.
Definition types.h:33
void bt_port_output_get_ref(const bt_port_output *port)
Increments the reference count of the output port port.
void bt_port_input_get_ref(const bt_port_input *port)
Increments the reference count of the input port port.
void bt_port_put_ref(const bt_port *port)
Decrements the reference count of the port port.
struct bt_port_output bt_port_output
Output port.
Definition types.h:67
struct bt_port bt_port
Port.
Definition types.h:65
bt_bool bt_port_is_connected(const bt_port *port)
Returns whether or not the port port is connected.
bt_port_type bt_port_get_type(const bt_port *port)
Returns the type enumerator of the port port.
const bt_component * bt_port_borrow_component_const(const bt_port *port)
Borrows the component to which the port port belongs.
static bt_bool bt_port_is_input(const bt_port *port)
Returns whether or not the port port is an input port.
Definition port.h:214
void bt_port_output_put_ref(const bt_port_output *port)
Decrements the reference count of the output port port.
static const bt_port * bt_port_output_as_port_const(const bt_port_output *port)
Upcasts the output port port to the common bt_port type.
Definition port.h:561
struct bt_port_input bt_port_input
Input port.
Definition types.h:66
static bt_bool bt_port_is_output(const bt_port *port)
Returns whether or not the port port is an output port.
Definition port.h:235
bt_port_type
Port type enumerators.
Definition port.h:165
void bt_port_get_ref(const bt_port *port)
Increments the reference count of the port port.
const bt_connection * bt_port_borrow_connection_const(const bt_port *port)
Borrows the connection of the port port.
void bt_port_input_put_ref(const bt_port_input *port)
Decrements the reference count of the input port port.
static const bt_port * bt_port_input_as_port_const(const bt_port_input *port)
Upcasts the input port port to the common bt_port type.
Definition port.h:446
const char * bt_port_get_name(const bt_port *port)
Returns the name of the port port.
@ BT_PORT_TYPE_INPUT
Input port.
Definition port.h:170
@ BT_PORT_TYPE_OUTPUT
Output port.
Definition port.h:176