Babeltrace 2 C API  2.0.0
Open-source trace manipulation framework
Modules

Detailed Description

Private views of components for instance methods.

The bt_self_component, bt_self_component_source, bt_self_component_filter, bt_self_component_sink types are private views of a component from within a component class instance method.

Add a port to a component with bt_self_component_source_add_output_port(), bt_self_component_filter_add_input_port(), bt_self_component_filter_add_output_port(), and bt_self_component_sink_add_input_port().

When you add a port to a component, you can attach custom user data to it (void *). You can retrieve this user data afterwards with bt_self_component_port_get_data().

Borrow a self component port from a component by index with bt_self_component_source_borrow_output_port_by_index(), bt_self_component_filter_borrow_input_port_by_index(), bt_self_component_filter_borrow_output_port_by_index(), and bt_self_component_sink_borrow_input_port_by_index().

Borrow a self component port from a component by name with bt_self_component_source_borrow_output_port_by_name(), bt_self_component_filter_borrow_input_port_by_name(), bt_self_component_filter_borrow_output_port_by_name(), and bt_self_component_sink_borrow_input_port_by_name().

Set and get user data attached to a component with bt_self_component_set_data() and bt_self_component_get_data().

Get a component's owning trace processing graph's effective Message Interchange Protocol version with bt_self_component_get_graph_mip_version().

Check whether or not a sink component is interrupted with bt_self_component_sink_is_interrupted().

Upcast the "self" (private) types to the public and common self component types with the bt_self_component*_as_component*() and bt_self_component_*_as_self_component() functions.

Modules

 Self component ports
 Private views of ports for component class instance methods.
 

Types

typedef struct bt_self_component bt_self_component
 Self component.
 
typedef struct bt_self_component_source bt_self_component_source
 Self source component.
 
typedef struct bt_self_component_filter bt_self_component_filter
 Self filter component.
 
typedef struct bt_self_component_sink bt_self_component_sink
 Self sink component.
 
typedef struct bt_self_component_source_configuration bt_self_component_source_configuration
 Self source component configuration.
 
typedef struct bt_self_component_filter_configuration bt_self_component_filter_configuration
 Self filter component configuration.
 
typedef struct bt_self_component_sink_configuration bt_self_component_sink_configuration
 Self sink component configuration.
 

Port adding

enum  bt_self_component_add_port_status {
  BT_SELF_COMPONENT_ADD_PORT_STATUS_OK,
  BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR,
  BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR
}
 Status codes for bt_self_component_source_add_output_port(), bt_self_component_filter_add_input_port(), bt_self_component_filter_add_output_port(), and bt_self_component_sink_add_input_port(). More...
 
typedef enum bt_self_component_add_port_status bt_self_component_add_port_status
 Status codes for bt_self_component_source_add_output_port(), bt_self_component_filter_add_input_port(), bt_self_component_filter_add_output_port(), and bt_self_component_sink_add_input_port().
 
bt_self_component_add_port_status bt_self_component_source_add_output_port (bt_self_component_source *self_component, const char *name, void *user_data, bt_self_component_port_output **self_component_port)
 Adds an output port named name and having the user data user_data to the source component self_component, and sets *self_component_port to the resulting port. More...
 
bt_self_component_add_port_status bt_self_component_filter_add_input_port (bt_self_component_filter *self_component, const char *name, void *user_data, bt_self_component_port_input **self_component_port)
 Adds an input port named name and having the user data user_data to the filter component self_component, and sets *self_component_port to the resulting port. More...
 
bt_self_component_add_port_status bt_self_component_filter_add_output_port (bt_self_component_filter *self_component, const char *name, void *user_data, bt_self_component_port_output **self_component_port)
 Adds an output port named name and having the user data user_data to the filter component self_component, and sets *self_component_port to the resulting port. More...
 
bt_self_component_add_port_status bt_self_component_sink_add_input_port (bt_self_component_sink *self_component, const char *name, void *user_data, bt_self_component_port_input **self_component_port)
 Adds an input port named name and having the user data user_data to the sink component self_component, and sets *self_component_port to the resulting port. More...
 

Port access

bt_self_component_port_outputbt_self_component_source_borrow_output_port_by_index (bt_self_component_source *self_component, uint64_t index)
 Borrows the self component output port at index index from the source component self_component. More...
 
bt_self_component_port_inputbt_self_component_filter_borrow_input_port_by_index (bt_self_component_filter *self_component, uint64_t index)
 Borrows the self component input port at index index from the filter component self_component. More...
 
bt_self_component_port_outputbt_self_component_filter_borrow_output_port_by_index (bt_self_component_filter *self_component, uint64_t index)
 Borrows the self component output port at index index from the filter component self_component. More...
 
bt_self_component_port_inputbt_self_component_sink_borrow_input_port_by_index (bt_self_component_sink *self_component, uint64_t index)
 Borrows the self component input port at index index from the sink component self_component. More...
 
bt_self_component_port_outputbt_self_component_source_borrow_output_port_by_name (bt_self_component_source *self_component, const char *name)
 Borrows the self component output port named name from the source component self_component. More...
 
bt_self_component_port_inputbt_self_component_filter_borrow_input_port_by_name (bt_self_component_filter *self_component, const char *name)
 Borrows the self component input port named name from the filter component self_component. More...
 
bt_self_component_port_outputbt_self_component_filter_borrow_output_port_by_name (bt_self_component_filter *self_component, const char *name)
 Borrows the self component output port named name from the filter component self_component. More...
 
bt_self_component_port_inputbt_self_component_sink_borrow_input_port_by_name (bt_self_component_sink *self_component, const char *name)
 Borrows the self component input port named name from the sink component self_component. More...
 

User data

void bt_self_component_set_data (bt_self_component *self_component, void *user_data)
 Sets the user data of the component self_component to data. More...
 
void * bt_self_component_get_data (const bt_self_component *self_component)
 Returns the user data of the component self_component. More...
 

Trace processing graph's effective MIP version access

uint64_t bt_self_component_get_graph_mip_version (bt_self_component *self_component)
 Returns the effective Message Interchange Protocol (MIP) version of the trace processing graph which contains the component self_component. More...
 

Sink component's interruption query

bt_bool bt_self_component_sink_is_interrupted (const bt_self_component_sink *self_component)
 Returns whether or not the sink component self_component is interrupted, that is, whether or not any of its interrupters is set. More...
 

Self to public upcast

static const bt_componentbt_self_component_as_component (bt_self_component *self_component)
 Upcasts the self component self_component to the public bt_component type. More...
 
static const bt_component_sourcebt_self_component_source_as_component_source (bt_self_component_source *self_component)
 Upcasts the self source component self_component to the public bt_component_source type. More...
 
static const bt_component_filterbt_self_component_filter_as_component_filter (bt_self_component_filter *self_component)
 Upcasts the self filter component self_component to the public bt_component_filter type. More...
 
static const bt_component_sinkbt_self_component_sink_as_component_sink (bt_self_component_sink *self_component)
 Upcasts the self sink component self_component to the public bt_component_sink type. More...
 

Self to common self upcast

static bt_self_componentbt_self_component_source_as_self_component (bt_self_component_source *self_component)
 Upcasts the self source component self_component to the common bt_self_component type. More...
 
static bt_self_componentbt_self_component_filter_as_self_component (bt_self_component_filter *self_component)
 Upcasts the self filter component self_component to the common bt_self_component type. More...
 
static bt_self_componentbt_self_component_sink_as_self_component (bt_self_component_sink *self_component)
 Upcasts the self sink component self_component to the common bt_self_component type. More...
 

Enumeration Type Documentation

◆ bt_self_component_add_port_status

Status codes for bt_self_component_source_add_output_port(), bt_self_component_filter_add_input_port(), bt_self_component_filter_add_output_port(), and bt_self_component_sink_add_input_port().

Enumerator
BT_SELF_COMPONENT_ADD_PORT_STATUS_OK 

Success.

BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR 

Out of memory.

BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR 

Other error.

Function Documentation

◆ bt_self_component_source_add_output_port()

bt_self_component_add_port_status bt_self_component_source_add_output_port ( bt_self_component_source self_component,
const char *  name,
void *  user_data,
bt_self_component_port_output **  self_component_port 
)

Adds an output port named name and having the user data user_data to the source component self_component, and sets *self_component_port to the resulting port.

Attention
You can only call this function from within the initialization, "input port connected", and "output port connected" methods.
Parameters
[in]self_componentSource component instance.
[in]nameName of the output port to add to self_component (copied).
[in]user_dataUser data of the output port to add to self_component.
[out]self_component_portOn success, if not NULL, *self_component_port is a borrowed reference of the created port.
Return values
BT_SELF_COMPONENT_ADD_PORT_STATUS_OKSuccess.
BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROROut of memory.
BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROROther error.
Precondition
self_component is not NULL.
name is not NULL.
No other output port within self_component has the name name.

◆ bt_self_component_filter_add_input_port()

bt_self_component_add_port_status bt_self_component_filter_add_input_port ( bt_self_component_filter self_component,
const char *  name,
void *  user_data,
bt_self_component_port_input **  self_component_port 
)

Adds an input port named name and having the user data user_data to the filter component self_component, and sets *self_component_port to the resulting port.

Attention
You can only call this function from within the initialization, "input port connected", and "output port connected" methods.
Parameters
[in]self_componentFilter component instance.
[in]nameName of the input port to add to self_component (copied).
[in]user_dataUser data of the input port to add to self_component.
[out]self_component_portOn success, if not NULL, *self_component_port is a borrowed reference of the created port.
Return values
BT_SELF_COMPONENT_ADD_PORT_STATUS_OKSuccess.
BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROROut of memory.
BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROROther error.
Precondition
self_component is not NULL.
name is not NULL.
No other input port within self_component has the name name.

◆ bt_self_component_filter_add_output_port()

bt_self_component_add_port_status bt_self_component_filter_add_output_port ( bt_self_component_filter self_component,
const char *  name,
void *  user_data,
bt_self_component_port_output **  self_component_port 
)

Adds an output port named name and having the user data user_data to the filter component self_component, and sets *self_component_port to the resulting port.

Attention
You can only call this function from within the initialization, "input port connected", and "output port connected" methods.
Parameters
[in]self_componentFilter component instance.
[in]nameName of the output port to add to self_component (copied).
[in]user_dataUser data of the output port to add to self_component.
[out]self_component_portOn success, if not NULL, *self_component_port is a borrowed reference of the created port.
Return values
BT_SELF_COMPONENT_ADD_PORT_STATUS_OKSuccess.
BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROROut of memory.
BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROROther error.
Precondition
self_component is not NULL.
name is not NULL.
No other output port within self_component has the name name.

◆ bt_self_component_sink_add_input_port()

bt_self_component_add_port_status bt_self_component_sink_add_input_port ( bt_self_component_sink self_component,
const char *  name,
void *  user_data,
bt_self_component_port_input **  self_component_port 
)

Adds an input port named name and having the user data user_data to the sink component self_component, and sets *self_component_port to the resulting port.

Attention
You can only call this function from within the initialization, "input port connected", and "output port connected" methods.
Parameters
[in]self_componentSink component instance.
[in]nameName of the input port to add to self_component (copied).
[in]user_dataUser data of the input port to add to self_component.
[out]self_component_portOn success, if not NULL, *self_component_port is a borrowed reference of the created port.
Return values
BT_SELF_COMPONENT_ADD_PORT_STATUS_OKSuccess.
BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROROut of memory.
BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROROther error.
Precondition
self_component is not NULL.
name is not NULL.
No other input port within self_component has the name name.

◆ bt_self_component_source_borrow_output_port_by_index()

bt_self_component_port_output* bt_self_component_source_borrow_output_port_by_index ( bt_self_component_source self_component,
uint64_t  index 
)

Borrows the self component output port at index index from the source component self_component.

Parameters
[in]self_componentSource component instance.
[in]indexIndex of the output port to borrow from self_component.
Returns

Borrowed reference of the output port of self_component at index index.

The returned pointer remains valid as long as self_component exists.

Precondition
self_component is not NULL.
index is less than the number of output ports self_component has (as returned by bt_component_source_get_output_port_count()).
See also
bt_component_source_get_output_port_count() — Returns the number of output ports that a source component has.

◆ bt_self_component_filter_borrow_input_port_by_index()

bt_self_component_port_input* bt_self_component_filter_borrow_input_port_by_index ( bt_self_component_filter self_component,
uint64_t  index 
)

Borrows the self component input port at index index from the filter component self_component.

Parameters
[in]self_componentFilter component instance.
[in]indexIndex of the input port to borrow from self_component.
Returns

Borrowed reference of the input port of self_component at index index.

The returned pointer remains valid as long as self_component exists.

Precondition
self_component is not NULL.
index is less than the number of input ports self_component has (as returned by bt_component_filter_get_input_port_count()).
See also
bt_component_filter_get_input_port_count() — Returns the number of input ports that a filter component has.

◆ bt_self_component_filter_borrow_output_port_by_index()

bt_self_component_port_output* bt_self_component_filter_borrow_output_port_by_index ( bt_self_component_filter self_component,
uint64_t  index 
)

Borrows the self component output port at index index from the filter component self_component.

Parameters
[in]self_componentFilter component instance.
[in]indexIndex of the output port to borrow from self_component.
Returns

Borrowed reference of the output port of self_component at index index.

The returned pointer remains valid as long as self_component exists.

Precondition
self_component is not NULL.
index is less than the number of output ports self_component has (as returned by bt_component_filter_get_output_port_count()).
See also
bt_component_filter_get_output_port_count() — Returns the number of output ports that a filter component has.

◆ bt_self_component_sink_borrow_input_port_by_index()

bt_self_component_port_input* bt_self_component_sink_borrow_input_port_by_index ( bt_self_component_sink self_component,
uint64_t  index 
)

Borrows the self component input port at index index from the sink component self_component.

Parameters
[in]self_componentSink component instance.
[in]indexIndex of the input port to borrow from self_component.
Returns

Borrowed reference of the input port of self_component at index index.

The returned pointer remains valid as long as self_component exists.

Precondition
self_component is not NULL.
index is less than the number of input ports self_component has (as returned by bt_component_sink_get_input_port_count()).
See also
bt_component_sink_get_input_port_count() — Returns the number of input ports that a sink component has.

◆ bt_self_component_source_borrow_output_port_by_name()

bt_self_component_port_output* bt_self_component_source_borrow_output_port_by_name ( bt_self_component_source self_component,
const char *  name 
)

Borrows the self component output port named name from the source component self_component.

If self_component has no output port named name, this function returns NULL.

Parameters
[in]self_componentSource component instance.
[in]nameName of the output port to borrow from self_component.
Returns

Borrowed reference of the output port of self_component named name, or NULL if none.

The returned pointer remains valid as long as self_component exists.

Precondition
self_component is not NULL.
name is not NULL.

◆ bt_self_component_filter_borrow_input_port_by_name()

bt_self_component_port_input* bt_self_component_filter_borrow_input_port_by_name ( bt_self_component_filter self_component,
const char *  name 
)

Borrows the self component input port named name from the filter component self_component.

If self_component has no input port named name, this function returns NULL.

Parameters
[in]self_componentFilter component instance.
[in]nameName of the input port to borrow from self_component.
Returns

Borrowed reference of the input port of self_component named name, or NULL if none.

The returned pointer remains valid as long as self_component exists.

Precondition
self_component is not NULL.
name is not NULL.

◆ bt_self_component_filter_borrow_output_port_by_name()

bt_self_component_port_output* bt_self_component_filter_borrow_output_port_by_name ( bt_self_component_filter self_component,
const char *  name 
)

Borrows the self component output port named name from the filter component self_component.

If self_component has no output port named name, this function returns NULL.

Parameters
[in]self_componentFilter component instance.
[in]nameName of the output port to borrow from self_component.
Returns

Borrowed reference of the output port of self_component named name, or NULL if none.

The returned pointer remains valid as long as self_component exists.

Precondition
self_component is not NULL.
name is not NULL.

◆ bt_self_component_sink_borrow_input_port_by_name()

bt_self_component_port_input* bt_self_component_sink_borrow_input_port_by_name ( bt_self_component_sink self_component,
const char *  name 
)

Borrows the self component input port named name from the sink component self_component.

If self_component has no input port named name, this function returns NULL.

Parameters
[in]self_componentSink component instance.
[in]nameName of the input port to borrow from self_component.
Returns

Borrowed reference of the input port of self_component named name, or NULL if none.

The returned pointer remains valid as long as self_component exists.

Precondition
self_component is not NULL.
name is not NULL.

◆ bt_self_component_set_data()

void bt_self_component_set_data ( bt_self_component self_component,
void *  user_data 
)

Sets the user data of the component self_component to data.

Parameters
[in]self_componentComponent instance.
[in]user_dataNew user data of self_component.
Precondition
self_component is not NULL.
See also
bt_self_component_get_data() — Returns the user data of a component.

◆ bt_self_component_get_data()

void* bt_self_component_get_data ( const bt_self_component self_component)

Returns the user data of the component self_component.

Parameters
[in]self_componentComponent instance.
Returns
User data of self_component.
Precondition
self_component is not NULL.
See also
bt_self_component_set_data() — Sets the user data of a component.

◆ bt_self_component_get_graph_mip_version()

uint64_t bt_self_component_get_graph_mip_version ( bt_self_component self_component)

Returns the effective Message Interchange Protocol (MIP) version of the trace processing graph which contains the component self_component.

Note
As of Babeltrace 2.0, because bt_get_maximal_mip_version() returns 0, this function always returns 0.
Parameters
[in]self_componentComponent instance.
Returns
Effective MIP version of the trace processing graph which contains self_component.
Precondition
self_component is not NULL.

◆ bt_self_component_sink_is_interrupted()

bt_bool bt_self_component_sink_is_interrupted ( const bt_self_component_sink self_component)

Returns whether or not the sink component self_component is interrupted, that is, whether or not any of its interrupters is set.

Parameters
[in]self_componentComponent instance.
Returns
BT_TRUE if self_component is interrupted (any of its interrupters is set).
Precondition
self_component is not NULL.
See also
bt_graph_borrow_default_interrupter() — Borrows a trace processing graph's default interrupter.
bt_graph_add_interrupter() — Adds an interrupter to a graph.

◆ bt_self_component_as_component()

static const bt_component* bt_self_component_as_component ( bt_self_component self_component)
inlinestatic

Upcasts the self component self_component to the public bt_component type.

Parameters
[in]self_component

Component to upcast.

Can be NULL.

Returns
self_component as a public component.

◆ bt_self_component_source_as_component_source()

static const bt_component_source* bt_self_component_source_as_component_source ( bt_self_component_source self_component)
inlinestatic

Upcasts the self source component self_component to the public bt_component_source type.

Parameters
[in]self_component

Source component to upcast.

Can be NULL.

Returns
self_component as a public source component.

◆ bt_self_component_filter_as_component_filter()

static const bt_component_filter* bt_self_component_filter_as_component_filter ( bt_self_component_filter self_component)
inlinestatic

Upcasts the self filter component self_component to the public bt_component_filter type.

Parameters
[in]self_component

Filter component to upcast.

Can be NULL.

Returns
self_component as a public filter component.

◆ bt_self_component_sink_as_component_sink()

static const bt_component_sink* bt_self_component_sink_as_component_sink ( bt_self_component_sink self_component)
inlinestatic

Upcasts the self sink component self_component to the public bt_component_sink type.

Parameters
[in]self_component

Sink component to upcast.

Can be NULL.

Returns
self_component as a public sink component.

◆ bt_self_component_source_as_self_component()

static bt_self_component* bt_self_component_source_as_self_component ( bt_self_component_source self_component)
inlinestatic

Upcasts the self source component self_component to the common bt_self_component type.

Parameters
[in]self_component

Source component to upcast.

Can be NULL.

Returns
self_component as a common self component.

◆ bt_self_component_filter_as_self_component()

static bt_self_component* bt_self_component_filter_as_self_component ( bt_self_component_filter self_component)
inlinestatic

Upcasts the self filter component self_component to the common bt_self_component type.

Parameters
[in]self_component

Filter component to upcast.

Can be NULL.

Returns
self_component as a common self component.

◆ bt_self_component_sink_as_self_component()

static bt_self_component* bt_self_component_sink_as_self_component ( bt_self_component_sink self_component)
inlinestatic

Upcasts the self sink component self_component to the common bt_self_component type.

Parameters
[in]self_component

Sink component to upcast.

Can be NULL.

Returns
self_component as a common self component.