|
Babeltrace 2 C API 2.1.0-rc2
Open-source trace manipulation framework
|
Component input and output ports.
A port is a point of connection between components:
A port is a shared object: get a new reference with bt_port_get_ref() and put an existing reference with bt_port_put_ref().
The common C type of a port is bt_port.
There are two types of ports:
Input connection point from which messages are received.
Filter and sink components have input ports.
The specific type of an input port is bt_port_input and its type enumerator is BT_PORT_TYPE_INPUT.
Upcast the bt_port_input type to the bt_port type with bt_port_input_as_port_const().
Get a new input port reference with bt_port_input_get_ref() and put an existing one with bt_port_input_put_ref().
Output connection point to which messages are sent.
Source and filter components have output ports.
The specific type of an output port is bt_port_output and its type enumerator is BT_PORT_TYPE_OUTPUT.
Upcast the bt_port_output type to the bt_port type with bt_port_output_as_port_const().
Get a new output port reference with bt_port_output_get_ref() and put an existing one with bt_port_output_put_ref().
Get the type enumerator of a port with bt_port_get_type(). You can also use the bt_port_is_input() and bt_port_is_output() helper functions.
A component can add a port with:
Borrow the connection of a port, if any, with bt_port_borrow_connection_const().
Borrow the component to which a port belongs with bt_port_borrow_component_const().
A port has the following common properties:
Name of the port.
For a given component:
The name of a port is set when the component adds it; you cannot change it afterwards.
Get the name of a port with bt_port_get_name().
Whether or not the port is currently connected to another port.
Get whether or not a port is connected with bt_port_is_connected().
When a port is unconnected, bt_port_borrow_connection_const() returns NULL.
Type query | |
| enum | bt_port_type { BT_PORT_TYPE_INPUT , BT_PORT_TYPE_OUTPUT } |
| Port type enumerators. More... | |
| typedef enum bt_port_type | bt_port_type |
| Port type enumerators. | |
| bt_port_type | bt_port_get_type (const bt_port *port) |
| Returns the type enumerator of the port port. | |
| static bt_bool | bt_port_is_input (const bt_port *port) |
| Returns whether or not the port port is an input port. | |
| static bt_bool | bt_port_is_output (const bt_port *port) |
| Returns whether or not the port port is an output port. | |
Types | |
| typedef struct bt_port | bt_port |
| Port. | |
| typedef struct bt_port_input | bt_port_input |
| Input port. | |
| typedef struct bt_port_output | bt_port_output |
| Output port. | |
Connection access | |
| const bt_connection * | bt_port_borrow_connection_const (const bt_port *port) |
| Borrows the connection of the port port. | |
Component access | |
| const bt_component * | bt_port_borrow_component_const (const bt_port *port) |
| Borrows the component to which the port port belongs. | |
Properties | |
| const char * | bt_port_get_name (const bt_port *port) |
| Returns the name of the port port. | |
| bt_bool | bt_port_is_connected (const bt_port *port) |
| Returns whether or not the port port is connected. | |
Reference count (common) | |
| void | bt_port_get_ref (const bt_port *port) |
| Increments the reference count of the port port. | |
| void | bt_port_put_ref (const bt_port *port) |
| Decrements the reference count of the port port. | |
| #define | BT_PORT_PUT_REF_AND_RESET(_port) |
Decrements the reference count of the port _port, and then sets _port to NULL. | |
| #define | BT_PORT_MOVE_REF(_dst, _src) |
Decrements the reference count of the port _dst, sets _dst to _src, and then sets _src to NULL. | |
Input 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. | |
| void | bt_port_input_get_ref (const bt_port_input *port) |
| Increments the reference count of the input port port. | |
| void | bt_port_input_put_ref (const bt_port_input *port) |
| Decrements the reference count of the input port port. | |
| #define | BT_PORT_INPUT_PUT_REF_AND_RESET(_port) |
Decrements the reference count of the input port _port, and then sets _port to NULL. | |
| #define | BT_PORT_INPUT_MOVE_REF(_dst, _src) |
Decrements the reference count of the input port _dst, sets _dst to _src, and then sets _src to NULL. | |
Output 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. | |
| void | bt_port_output_get_ref (const bt_port_output *port) |
| Increments the reference count of the output port port. | |
| void | bt_port_output_put_ref (const bt_port_output *port) |
| Decrements the reference count of the output port port. | |
| #define | BT_PORT_OUTPUT_PUT_REF_AND_RESET(_port) |
Decrements the reference count of the output port _port, and then sets _port to NULL. | |
| #define | BT_PORT_OUTPUT_MOVE_REF(_dst, _src) |
Decrements the reference count of the output port _dst, sets _dst to _src, and then sets _src to NULL. | |
| enum bt_port_type |
| #define BT_PORT_PUT_REF_AND_RESET | ( | _port | ) |
Decrements the reference count of the port _port, and then sets _port to NULL.
| _port | Port of which to decrement the reference count. Can contain |
| #define BT_PORT_MOVE_REF | ( | _dst, | |
| _src ) |
Decrements the reference count of the port _dst, sets _dst to _src, and then sets _src to NULL.
This macro effectively moves a port reference from the expression _src to the expression _dst, putting the existing _dst reference.
| _dst | Destination expression. Can contain |
| _src | Source expression. Can contain |
| #define BT_PORT_INPUT_PUT_REF_AND_RESET | ( | _port | ) |
Decrements the reference count of the input port _port, and then sets _port to NULL.
| _port | Input port of which to decrement the reference count. Can contain |
| #define BT_PORT_INPUT_MOVE_REF | ( | _dst, | |
| _src ) |
Decrements the reference count of the input port _dst, sets _dst to _src, and then sets _src to NULL.
This macro effectively moves an input port reference from the expression _src to the expression _dst, putting the existing _dst reference.
| _dst | Destination expression. Can contain |
| _src | Source expression. Can contain |
| #define BT_PORT_OUTPUT_PUT_REF_AND_RESET | ( | _port | ) |
Decrements the reference count of the output port _port, and then sets _port to NULL.
| _port | Output port of which to decrement the reference count. Can contain |
| #define BT_PORT_OUTPUT_MOVE_REF | ( | _dst, | |
| _src ) |
Decrements the reference count of the output port _dst, sets _dst to _src, and then sets _src to NULL.
This macro effectively moves an output port reference from the expression _src to the expression _dst, putting the existing _dst reference.
| _dst | Destination expression. Can contain |
| _src | Source expression. Can contain |
|
extern |
Returns the type enumerator of the port port.
| [in] | port | Port of which to get the type enumerator |
NULL.Returns whether or not the port port is an input port.
| [in] | port | Port to check. |
NULL.Returns whether or not the port port is an output port.
| [in] | port | Port to check. |
NULL.
|
extern |
Borrows the connection of the port port.
This function returns NULL if port is unconnected (bt_port_is_connected() returns BT_FALSE).
| [in] | port | Port of which to borrow the connection. |
NULL.
|
extern |
Borrows the component to which the port port belongs.
| [in] | port | Port of which to borrow the component which owns it. |
NULL.
|
extern |
Returns the name of the port port.
See the name property.
| [in] | port | Port of which to get the name. |
Name of port, or NULL if none.
The returned pointer remains valid as long as port exists.
NULL. Returns whether or not the port port is connected.
See the is connected? property.
| [in] | port | Port of which to get whether or not it's connected. |
NULL.
|
extern |
Increments the reference count of the port port.
| [in] | port | Port of which to increment the reference count. Can be |
|
extern |
Decrements the reference count of the port port.
| [in] | port | Port of which to decrement the reference count. Can be |
|
inlinestatic |
Upcasts the input port port to the common bt_port type.
| [in] | port | Input port to upcast. Can be |
|
extern |
Increments the reference count of the input port port.
| [in] | port | Input port of which to increment the reference count. Can be |
|
extern |
Decrements the reference count of the input port port.
| [in] | port | Input port of which to decrement the reference count. Can be |
|
inlinestatic |
Upcasts the output port port to the common bt_port type.
| [in] | port | Output port to upcast. Can be |
|
extern |
Increments the reference count of the output port port.
| [in] | port | Output port of which to increment the reference count. Can be |
|
extern |
Decrements the reference count of the output port port.
| [in] | port | Output port of which to decrement the reference count. Can be |