Babeltrace 2 C API  2.0.0
Open-source trace manipulation framework

Detailed Description

Class of streams.

A stream class is the class of streams:

In the illustration above, notice that:

A stream class is a trace IR metadata object.

A stream class is a shared object: get a new reference with bt_stream_class_get_ref() and put an existing reference with bt_stream_class_put_ref().

Some library functions freeze stream classes on success. The documentation of those functions indicate this postcondition. You can still create and add an event classes to a frozen stream class with bt_event_class_create() or bt_event_class_create_with_id().

The type of a stream class is bt_stream_class.

A trace class contains stream classes. All the stream classes of a given trace class have unique numeric IDs. Borrow the trace class which contains a stream class with bt_stream_class_borrow_trace_class() or bt_stream_class_borrow_trace_class_const().

A stream class contains event classes. All the event classes of a given stream class have unique numeric IDs. Get the number of event classes in a stream class with bt_stream_class_get_event_class_count(). Borrow a specific event class from a stream class with bt_stream_class_borrow_event_class_by_index(), bt_stream_class_borrow_event_class_by_index_const(), bt_stream_class_borrow_event_class_by_id(), and bt_stream_class_borrow_event_class_by_id_const().

A stream class controls what its instances (streams) support:

Default clock

By default, a stream class's streams do not have default clocks.

Set the default clock class of a stream class with bt_stream_class_set_default_clock_class(). This makes all its streams have their own default clock.

Packets

By default, a stream class's streams do not support packets.

In other words, you cannot create a packet for such a stream, therefore you cannot create packet beginning messages and packet end messages for this stream either.

Enable packet support for a stream class's streams with bt_stream_class_set_supports_packets().

bt_stream_class_set_supports_packets() also configures whether or not the packets of the stream class's instances have beginning and/or end default clock snapshots.

Discarded events

By default, a stream class's streams do not support discarded events.

In other words, you cannot create discarded events messages for such a stream.

Enable discarded events support for a stream class's streams with bt_stream_class_set_supports_discarded_events().

bt_stream_class_set_supports_discarded_events() also configures whether or not the discarded events messages of the stream class's instances have beginning and end default clock snapshots to indicate the discarded events time range.

Discarded packets

By default, a stream class's streams do not support discarded packets.

In other words, you cannot create discarded packets messages for such a stream.

Enable discarded packets support for a stream class's streams with bt_stream_class_set_supports_discarded_packets(). This also implies that you must enable packet support with bt_stream_class_set_supports_packets().

bt_stream_class_set_supports_discarded_packets() also configures whether or not the discarded packets messages of the stream class's instances have beginning and end clock snapshots to indicate the discarded packets time range.

Set whether or not the event classes and streams you create for a stream class get automatic numeric IDs with bt_stream_class_set_assigns_automatic_event_class_id() and bt_stream_class_set_assigns_automatic_stream_id().

To create a default stream class:

If bt_trace_class_assigns_automatic_stream_class_id() returns BT_TRUE (the default) for the trace class to use

Use bt_stream_class_create().

If bt_trace_class_assigns_automatic_stream_class_id() returns BT_FALSE for the trace class to use
Use bt_stream_class_create_with_id().

Properties

A stream class has the following properties:

Numeric ID

Numeric ID, unique amongst the numeric IDs of the stream class's trace class's stream classes.

Depending on whether or not the stream class's trace class automatically assigns event class IDs (see bt_trace_class_assigns_automatic_stream_class_id()), set the stream class's numeric ID on creation with bt_stream_class_create() or bt_stream_class_create_with_id().

You cannot change the numeric ID once the stream class is created.

Get a stream class's numeric ID with bt_stream_class_get_id().

Optional: Name

Name of the stream class.

Use bt_stream_class_set_name() and bt_stream_class_get_name().

Optional: Default clock class

Default clock class of the stream class.

As of Babeltrace 2.0, a stream class either has a default clock class or none: it cannot have more than one clock class.

When a stream class has a default clock class, then all its instances (streams) have a default clock which is an instance of the stream class's default clock class.

Use bt_stream_class_set_default_clock_class(), bt_stream_class_borrow_default_clock_class(), and bt_stream_class_borrow_default_clock_class_const().

Optional: Packet context field class

Packet context field class of the stream class.

This property is only relevant if the stream class supports packets.

The context of a packet contains data which is common to all the packet's events.

Use bt_stream_class_set_packet_context_field_class() bt_stream_class_borrow_packet_context_field_class(), and bt_stream_class_borrow_packet_context_field_class_const().

Optional: Event common context field class

Event common context field class of the stream class.

The common context of an event contains contextual data of which the layout is common to all the stream class's event classes.

Use bt_stream_class_set_event_common_context_field_class() bt_stream_class_borrow_event_common_context_field_class(), and bt_stream_class_borrow_event_common_context_field_class_const().

Assigns automatic event class IDs?

Whether or not the event classes you create and add to the stream class get numeric IDs automatically.

Depending on the value of this property, to create an event class and add it to the stream class:

BT_TRUE

Use bt_event_class_create().

BT_FALSE
Use bt_event_class_create_with_id().

Use bt_stream_class_set_assigns_automatic_event_class_id() and bt_stream_class_assigns_automatic_event_class_id().

Assigns automatic stream IDs?

Whether or not the streams you create from the stream class get numeric IDs automatically.

Depending on the value of this property, to create a stream from the stream class:

BT_TRUE

Use bt_stream_create().

BT_FALSE
Use bt_stream_create_with_id().

Use bt_stream_class_set_assigns_automatic_stream_id() and bt_stream_class_assigns_automatic_stream_id().

Supports packets?

Whether or not the streams you create from the stream class have packets.

If a stream has packets, then all the stream's events are conceptually contained within packets, which means you must create event messages for such streams with bt_message_event_create_with_packet() or bt_message_event_create_with_packet_and_default_clock_snapshot() instead of bt_message_event_create() or bt_message_event_create_with_default_clock_snapshot().

It also means you must create packet beginning messages and packet end messages to indicate where packets begin and end within the stream's message sequence.

Use bt_stream_class_set_supports_packets() and bt_stream_class_supports_packets().

Packets have a beginning default clock snapshot?

Whether or not the packets of the streams you create from the stream class have beginning default clock snapshots.

This property is only relevant if the stream class supports packets and has a default clock class.

If the stream packets have a beginning default clock snapshot, then you must create packet beginning messages with bt_message_packet_beginning_create_with_default_clock_snapshot() instead of bt_message_packet_beginning_create().

Use bt_stream_class_set_supports_packets() and bt_stream_class_packets_have_beginning_default_clock_snapshot().

Packets have an end default clock snapshot?

Whether or not the packets of the streams you create from the stream class have end default clock snapshots.

This property is only relevant if the stream class supports packets and has a default clock class.

If the stream packets have an end default clock snapshot, then you must create packet end messages with bt_message_packet_end_create_with_default_clock_snapshot() instead of bt_message_packet_end_create().

Use bt_stream_class_set_supports_packets() and bt_stream_class_packets_have_end_default_clock_snapshot().

Supports discarded events?

Whether or not the streams you create from the stream class can have discarded events.

If the stream class supports discarded events, then you can create discarded events messages for this stream.

Use bt_stream_class_set_supports_discarded_events() and bt_stream_class_supports_discarded_events().

Discarded events have default clock snapshots?

Whether or not the stream's discarded events messages have default beginning and end clock snapshots to indicate the discarded events time range.

This property is only relevant if the stream class supports discarded events and has a default clock class.

If the stream's discarded events messages have beginning and end default clock snapshots, then you must create them with bt_message_discarded_events_create_with_default_clock_snapshots() instead of bt_message_discarded_events_create().

Use bt_stream_class_set_supports_discarded_events() and bt_stream_class_discarded_events_have_default_clock_snapshots().

Supports discarded packets?

Whether or not the streams you create from the stream class can have discarded packets.

This property is only relevant if the stream class supports packets.

If the stream class supports discarded packets, then you can create discarded packets messages for this stream.

Use bt_stream_class_set_supports_discarded_packets() and bt_stream_class_supports_discarded_packets().

Discarded packets have default clock snapshots?

Whether or not the stream's discarded packets messages have default beginning and end clock snapshots to indicate the discarded packets time range.

This property is only relevant if the stream class supports discarded packets and has a default clock class.

If the stream's discarded packets messages have default clock snapshots, then you must create them with bt_message_discarded_packets_create_with_default_clock_snapshots() instead of bt_message_discarded_packets_create().

Use bt_stream_class_set_supports_discarded_packets() and bt_stream_class_discarded_packets_have_default_clock_snapshots().

Optional: User attributes

User attributes of the stream class.

User attributes are custom attributes attached to a stream class.

Use bt_stream_class_set_user_attributes(), bt_stream_class_borrow_user_attributes(), and bt_stream_class_borrow_user_attributes_const().

Type

typedef struct bt_stream_class bt_stream_class
 Stream class.
 

Creation

bt_stream_classbt_stream_class_create (bt_trace_class *trace_class)
 Creates a default stream class and adds it to the trace class trace_class. More...
 
bt_stream_classbt_stream_class_create_with_id (bt_trace_class *trace_class, uint64_t id)
 Creates a default stream class with the numeric ID id and adds it to the trace class trace_class. More...
 

Trace class access

bt_trace_classbt_stream_class_borrow_trace_class (bt_stream_class *stream_class)
 Borrows the trace class which contains the stream class stream_class. More...
 
const bt_trace_classbt_stream_class_borrow_trace_class_const (const bt_stream_class *stream_class)
 Borrows the trace class which contains the stream class stream_class (const version). More...
 

Event class access

uint64_t bt_stream_class_get_event_class_count (const bt_stream_class *stream_class)
 Returns the number of event classes contained in the stream class stream_class. More...
 
bt_event_classbt_stream_class_borrow_event_class_by_index (bt_stream_class *stream_class, uint64_t index)
 Borrows the event class at index index from the stream class stream_class. More...
 
const bt_event_classbt_stream_class_borrow_event_class_by_index_const (const bt_stream_class *stream_class, uint64_t index)
 Borrows the event class at index index from the stream class stream_class (const version). More...
 
bt_event_classbt_stream_class_borrow_event_class_by_id (bt_stream_class *stream_class, uint64_t id)
 Borrows the event class having the numeric ID id from the stream class stream_class. More...
 
const bt_event_classbt_stream_class_borrow_event_class_by_id_const (const bt_stream_class *stream_class, uint64_t id)
 Borrows the event class having the numeric ID id from the stream class stream_class (const version). More...
 

Properties

enum  bt_stream_class_set_name_status {
  BT_STREAM_CLASS_SET_NAME_STATUS_OK,
  BT_STREAM_CLASS_SET_NAME_STATUS_MEMORY_ERROR
}
 Status codes for bt_stream_class_set_name(). More...
 
enum  bt_stream_class_set_default_clock_class_status { BT_STREAM_CLASS_SET_DEFAULT_CLOCK_CLASS_STATUS_OK }
 Status codes for bt_stream_class_set_default_clock_class(). More...
 
enum  bt_stream_class_set_field_class_status {
  BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_OK,
  BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR
}
 Status codes for bt_stream_class_set_packet_context_field_class() and bt_stream_class_set_event_common_context_field_class(). More...
 
typedef enum bt_stream_class_set_name_status bt_stream_class_set_name_status
 Status codes for bt_stream_class_set_name().
 
typedef enum bt_stream_class_set_default_clock_class_status bt_stream_class_set_default_clock_class_status
 Status codes for bt_stream_class_set_default_clock_class().
 
typedef enum bt_stream_class_set_field_class_status bt_stream_class_set_field_class_status
 Status codes for bt_stream_class_set_packet_context_field_class() and bt_stream_class_set_event_common_context_field_class().
 
uint64_t bt_stream_class_get_id (const bt_stream_class *stream_class)
 Returns the numeric ID of the stream class stream_class. More...
 
bt_stream_class_set_name_status bt_stream_class_set_name (bt_stream_class *stream_class, const char *name)
 Sets the name of the stream class stream_class to a copy of name. More...
 
const char * bt_stream_class_get_name (const bt_stream_class *stream_class)
 Returns the name of the stream class stream_class. More...
 
bt_stream_class_set_default_clock_class_status bt_stream_class_set_default_clock_class (bt_stream_class *stream_class, bt_clock_class *clock_class)
 Sets the default clock class of the stream class stream_class to clock_class. More...
 
bt_clock_classbt_stream_class_borrow_default_clock_class (bt_stream_class *stream_class)
 Borrows the default clock class from the stream class stream_class. More...
 
const bt_clock_classbt_stream_class_borrow_default_clock_class_const (const bt_stream_class *stream_class)
 Borrows the default clock class from the stream class stream_class (const version). More...
 
bt_stream_class_set_field_class_status bt_stream_class_set_packet_context_field_class (bt_stream_class *stream_class, bt_field_class *field_class)
 Sets the packet context field class of the stream class stream_class to field_class. More...
 
bt_field_classbt_stream_class_borrow_packet_context_field_class (bt_stream_class *stream_class)
 Borrows the packet context field class from the stream class stream_class. More...
 
const bt_field_classbt_stream_class_borrow_packet_context_field_class_const (const bt_stream_class *stream_class)
 Borrows the packet context field class from the stream class stream_class (const version). More...
 
bt_stream_class_set_field_class_status bt_stream_class_set_event_common_context_field_class (bt_stream_class *stream_class, bt_field_class *field_class)
 Sets the event common context field class of the stream class stream_class to field_class. More...
 
bt_field_classbt_stream_class_borrow_event_common_context_field_class (bt_stream_class *stream_class)
 Borrows the event common context field class from the stream class stream_class. More...
 
const bt_field_classbt_stream_class_borrow_event_common_context_field_class_const (const bt_stream_class *stream_class)
 Borrows the event common context field class from the stream class stream_class (const version()). More...
 
void bt_stream_class_set_assigns_automatic_event_class_id (bt_stream_class *stream_class, bt_bool assigns_automatic_event_class_id)
 Sets whether or not the stream class stream_class automatically assigns a numeric ID to an event class you create and add to it. More...
 
bt_bool bt_stream_class_assigns_automatic_event_class_id (const bt_stream_class *stream_class)
 Returns whether or not the stream class stream_class automatically assigns a numeric ID to an event class you create and add to it. More...
 
void bt_stream_class_set_assigns_automatic_stream_id (bt_stream_class *stream_class, bt_bool assigns_automatic_stream_id)
 Sets whether or not the stream class stream_class automatically assigns a numeric ID to a stream you create from it. More...
 
bt_bool bt_stream_class_assigns_automatic_stream_id (const bt_stream_class *stream_class)
 Returns whether or not the stream class stream_class automatically assigns a numeric ID to a stream you create from it. More...
 
void bt_stream_class_set_supports_packets (bt_stream_class *stream_class, bt_bool supports_packets, bt_bool with_beginning_default_clock_snapshot, bt_bool with_end_default_clock_snapshot)
 Sets whether or not the instances (streams) of the stream class stream_class have packets and, if so, if those packets have beginning and/or end default clock snapshots. More...
 
bt_bool bt_stream_class_supports_packets (const bt_stream_class *stream_class)
 Returns whether or not the instances (streams) of the stream class stream_class have packets. More...
 
bt_bool bt_stream_class_packets_have_beginning_default_clock_snapshot (const bt_stream_class *stream_class)
 Returns whether or not the packets of the instances (streams) of the stream class stream_class have a beginning default clock snapshot. More...
 
bt_bool bt_stream_class_packets_have_end_default_clock_snapshot (const bt_stream_class *stream_class)
 Returns whether or not the packets of the instances (streams) of the stream class stream_class have an end default clock snapshot. More...
 
void bt_stream_class_set_supports_discarded_events (bt_stream_class *stream_class, bt_bool supports_discarded_events, bt_bool with_default_clock_snapshots)
 Sets whether or not the instances (streams) of the stream class stream_class can have discarded events and, if so, if the discarded events messages of those streams have beginning and end default clock snapshots. More...
 
bt_bool bt_stream_class_supports_discarded_events (const bt_stream_class *stream_class)
 Returns whether or not the instances (streams) of the stream class stream_class can have discarded events. More...
 
bt_bool bt_stream_class_discarded_events_have_default_clock_snapshots (const bt_stream_class *stream_class)
 Returns whether or not the discarded events messages of the instances (streams) of the stream class stream_class have beginning and end default clock snapshots. More...
 
void bt_stream_class_set_supports_discarded_packets (bt_stream_class *stream_class, bt_bool supports_discarded_packets, bt_bool with_default_clock_snapshots)
 Sets whether or not the instances (streams) of the stream class stream_class can have discarded packets and, if so, if the discarded packets messages of those streams have beginning and end default clock snapshots. More...
 
bt_bool bt_stream_class_supports_discarded_packets (const bt_stream_class *stream_class)
 Returns whether or not the instances (streams) of the stream class stream_class can have discarded packets. More...
 
bt_bool bt_stream_class_discarded_packets_have_default_clock_snapshots (const bt_stream_class *stream_class)
 Returns whether or not the discarded packets messages of the instances (streams) of the stream class stream_class have beginning and end default clock snapshots. More...
 
void bt_stream_class_set_user_attributes (bt_stream_class *stream_class, const bt_value *user_attributes)
 Sets the user attributes of the stream class stream_class to user_attributes. More...
 
bt_valuebt_stream_class_borrow_user_attributes (bt_stream_class *stream_class)
 Borrows the user attributes of the stream class stream_class. More...
 
const bt_valuebt_stream_class_borrow_user_attributes_const (const bt_stream_class *stream_class)
 Borrows the user attributes of the stream class stream_class (const version). More...
 

Reference count

void bt_stream_class_get_ref (const bt_stream_class *stream_class)
 Increments the reference count of the stream class stream_class. More...
 
void bt_stream_class_put_ref (const bt_stream_class *stream_class)
 Decrements the reference count of the stream class stream_class. More...
 
#define BT_STREAM_CLASS_PUT_REF_AND_RESET(_stream_class)
 Decrements the reference count of the stream class _stream_class, and then sets _stream_class to NULL. More...
 
#define BT_STREAM_CLASS_MOVE_REF(_dst, _src)
 Decrements the reference count of the stream class _dst, sets _dst to _src, and then sets _src to NULL. More...
 

Enumeration Type Documentation

◆ bt_stream_class_set_name_status

Status codes for bt_stream_class_set_name().

Enumerator
BT_STREAM_CLASS_SET_NAME_STATUS_OK 

Success.

BT_STREAM_CLASS_SET_NAME_STATUS_MEMORY_ERROR 

Out of memory.

◆ bt_stream_class_set_default_clock_class_status

Status codes for bt_stream_class_set_default_clock_class().

Enumerator
BT_STREAM_CLASS_SET_DEFAULT_CLOCK_CLASS_STATUS_OK 

Success.

◆ bt_stream_class_set_field_class_status

Status codes for bt_stream_class_set_packet_context_field_class() and bt_stream_class_set_event_common_context_field_class().

Enumerator
BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_OK 

Success.

BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR 

Out of memory.

Macro Definition Documentation

◆ BT_STREAM_CLASS_PUT_REF_AND_RESET

#define BT_STREAM_CLASS_PUT_REF_AND_RESET (   _stream_class)

Decrements the reference count of the stream class _stream_class, and then sets _stream_class to NULL.

Parameters
_stream_class

Stream class of which to decrement the reference count.

Can contain NULL.

Precondition
_stream_class is an assignable expression.

◆ BT_STREAM_CLASS_MOVE_REF

#define BT_STREAM_CLASS_MOVE_REF (   _dst,
  _src 
)

Decrements the reference count of the stream class _dst, sets _dst to _src, and then sets _src to NULL.

This macro effectively moves a stream class reference from the expression _src to the expression _dst, putting the existing _dst reference.

Parameters
_dst

Destination expression.

Can contain NULL.

_src

Source expression.

Can contain NULL.

Precondition
_dst is an assignable expression.
_src is an assignable expression.

Function Documentation

◆ bt_stream_class_create()

bt_stream_class* bt_stream_class_create ( bt_trace_class trace_class)

Creates a default stream class and adds it to the trace class trace_class.

Attention

Only use this function if

returns BT_TRUE.

Otherwise, use bt_stream_class_create_with_id().

On success, the returned stream class has the following property values:

Property Value
Numeric ID Automatically assigned by trace_class
Name None
Default clock class None
Packet context field class None
Event common context field class None
Assigns automatic event class IDs? Yes
Assigns automatic stream IDs? Yes
Supports packets? No
Packets have a beginning default clock snapshot? No
Packets have an end default clock snapshot? No
Supports discarded events? No
Discarded events have default clock snapshots? No
Supports discarded packets? No
Discarded packets have default clock snapshots? No
User attributes Empty map value
Parameters
[in]trace_classTrace class to add the created stream class to.
Returns
New stream class reference, or NULL on memory error.
Precondition
trace_class is not NULL.
bt_trace_class_assigns_automatic_stream_class_id(trace_class) returns BT_TRUE.
Postcondition
On success, trace_class is frozen.
See also
bt_stream_class_create_with_id() — Creates a stream class with a specific numeric ID and adds it to a trace class.

◆ bt_stream_class_create_with_id()

bt_stream_class* bt_stream_class_create_with_id ( bt_trace_class trace_class,
uint64_t  id 
)

Creates a default stream class with the numeric ID id and adds it to the trace class trace_class.

Attention

Only use this function if

returns BT_FALSE.

Otherwise, use bt_stream_class_create().

On success, the returned stream class has the following property values:

Property Value
Numeric ID id
Name None
Default clock class None
Packet context field class None
Event common context field class None
Assigns automatic event class IDs? Yes
Assigns automatic stream IDs? Yes
Supports packets? No
Packets have a beginning default clock snapshot? No
Packets have an end default clock snapshot? No
Supports discarded events? No
Discarded events have default clock snapshots? No
Supports discarded packets? No
Discarded packets have default clock snapshots? No
User attributes Empty map value
Parameters
[in]trace_classTrace class to add the created stream class to.
[in]idNumeric ID of the stream class to create and add to trace_class.
Returns
New stream class reference, or NULL on memory error.
Precondition
trace_class is not NULL.
bt_trace_class_assigns_automatic_stream_class_id(trace_class) returns BT_FALSE.
trace_class does not contain a stream class with the numeric ID id.
Postcondition
On success, trace_class is frozen.
See also
bt_stream_class_create() — Creates a stream class with an automatic numeric ID and adds it to a trace class.

◆ bt_stream_class_borrow_trace_class()

bt_trace_class* bt_stream_class_borrow_trace_class ( bt_stream_class stream_class)

Borrows the trace class which contains the stream class stream_class.

Parameters
[in]stream_classStream class from which to borrow the trace class which contains it.
Returns
Trace class which contains stream_class.
Precondition
stream_class is not NULL.
See also
bt_stream_class_borrow_trace_class_const()const version of this function.

◆ bt_stream_class_borrow_trace_class_const()

const bt_trace_class* bt_stream_class_borrow_trace_class_const ( const bt_stream_class stream_class)

Borrows the trace class which contains the stream class stream_class (const version).

See bt_stream_class_borrow_trace_class().

◆ bt_stream_class_get_event_class_count()

uint64_t bt_stream_class_get_event_class_count ( const bt_stream_class stream_class)

Returns the number of event classes contained in the stream class stream_class.

Parameters
[in]stream_classStream class of which to get the number of contained event classes.
Returns
Number of contained event classes in stream_class.
Precondition
stream_class is not NULL.

◆ bt_stream_class_borrow_event_class_by_index()

bt_event_class* bt_stream_class_borrow_event_class_by_index ( bt_stream_class stream_class,
uint64_t  index 
)

Borrows the event class at index index from the stream class stream_class.

Parameters
[in]stream_classStream class from which to borrow the event class at index index.
[in]indexIndex of the event class to borrow from stream_class.
Returns

Borrowed reference of the event class of stream_class at index index.

The returned pointer remains valid as long as stream_class exists.

Precondition
stream_class is not NULL.
index is less than the number of event classes in stream_class (as returned by bt_stream_class_get_event_class_count()).
See also
bt_stream_class_get_event_class_count() — Returns the number of event classes contained in a stream class.
bt_stream_class_borrow_event_class_by_index_const()const version of this function.

◆ bt_stream_class_borrow_event_class_by_index_const()

const bt_event_class* bt_stream_class_borrow_event_class_by_index_const ( const bt_stream_class stream_class,
uint64_t  index 
)

Borrows the event class at index index from the stream class stream_class (const version).

See bt_stream_class_borrow_event_class_by_index().

◆ bt_stream_class_borrow_event_class_by_id()

bt_event_class* bt_stream_class_borrow_event_class_by_id ( bt_stream_class stream_class,
uint64_t  id 
)

Borrows the event class having the numeric ID id from the stream class stream_class.

If there's no event class having the numeric ID id in stream_class, this function returns NULL.

Parameters
[in]stream_classStream class from which to borrow the event class having the numeric ID id.
[in]idID of the event class to borrow from stream_class.
Returns

Borrowed reference of the event class of stream_class having the numeric ID id, or NULL if none.

The returned pointer remains valid as long as stream_class exists.

Precondition
stream_class is not NULL.
See also
bt_stream_class_borrow_event_class_by_id_const()const version of this function.

◆ bt_stream_class_borrow_event_class_by_id_const()

const bt_event_class* bt_stream_class_borrow_event_class_by_id_const ( const bt_stream_class stream_class,
uint64_t  id 
)

Borrows the event class having the numeric ID id from the stream class stream_class (const version).

See bt_stream_class_borrow_event_class_by_id().

◆ bt_stream_class_get_id()

uint64_t bt_stream_class_get_id ( const bt_stream_class stream_class)

Returns the numeric ID of the stream class stream_class.

See the numeric ID property.

Parameters
[in]stream_classStream class of which to get the numeric ID.
Returns
Numeric ID of stream_class.
Precondition
stream_class is not NULL.
See also
bt_stream_class_create_with_id() — Creates a stream class with a specific numeric ID and adds it to a trace class.

◆ bt_stream_class_set_name()

bt_stream_class_set_name_status bt_stream_class_set_name ( bt_stream_class stream_class,
const char *  name 
)

Sets the name of the stream class stream_class to a copy of name.

See the name property.

Parameters
[in]stream_classStream class of which to set the name to name.
[in]nameNew name of stream_class (copied).
Return values
BT_STREAM_CLASS_SET_NAME_STATUS_OKSuccess.
BT_STREAM_CLASS_SET_NAME_STATUS_MEMORY_ERROROut of memory.
Precondition
stream_class is not NULL.
stream_class is not frozen.
name is not NULL.
See also
bt_stream_class_get_name() — Returns the name of a stream class.

◆ bt_stream_class_get_name()

const char* bt_stream_class_get_name ( const bt_stream_class stream_class)

Returns the name of the stream class stream_class.

See the name property.

If stream_class has no name, this function returns NULL.

Parameters
[in]stream_classStream class of which to get the name.
Returns

Name of stream_class, or NULL if none.

The returned pointer remains valid as long as stream_class is not modified.

Precondition
stream_class is not NULL.
See also
bt_stream_class_set_name() — Sets the name of a stream class.

◆ bt_stream_class_set_default_clock_class()

bt_stream_class_set_default_clock_class_status bt_stream_class_set_default_clock_class ( bt_stream_class stream_class,
bt_clock_class clock_class 
)

Sets the default clock class of the stream class stream_class to clock_class.

See the default clock class property.

Parameters
[in]stream_classStream class of which to set the default clock class to clock_class.
[in]clock_classNew default clock class of stream_class.
Return values
BT_STREAM_CLASS_SET_DEFAULT_CLOCK_CLASS_STATUS_OKSuccess.
Precondition
stream_class is not NULL.
stream_class is not frozen.
clock_class is not NULL.
See also
bt_stream_class_borrow_default_clock_class() — Borrows the default clock class of a stream class.
bt_stream_class_borrow_default_clock_class_const() — Borrows the default clock class of a stream class (const version).

◆ bt_stream_class_borrow_default_clock_class()

bt_clock_class* bt_stream_class_borrow_default_clock_class ( bt_stream_class stream_class)

Borrows the default clock class from the stream class stream_class.

See the default clock class property.

If stream_class has no default clock class, this function returns NULL.

Parameters
[in]stream_classStream class from which to borrow the default clock class.
Returns
Borrowed reference of the default clock class of stream_class, or NULL if none.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_default_clock_class() — Sets the default clock class of a stream class.
bt_stream_class_borrow_default_clock_class_const()const version of this function.

◆ bt_stream_class_borrow_default_clock_class_const()

const bt_clock_class* bt_stream_class_borrow_default_clock_class_const ( const bt_stream_class stream_class)

Borrows the default clock class from the stream class stream_class (const version).

See bt_stream_class_borrow_default_clock_class().

◆ bt_stream_class_set_packet_context_field_class()

bt_stream_class_set_field_class_status bt_stream_class_set_packet_context_field_class ( bt_stream_class stream_class,
bt_field_class field_class 
)

Sets the packet context field class of the stream class stream_class to field_class.

See the packet context field class property.

stream_class must support packets (see bt_stream_class_set_supports_packets()).

Parameters
[in]stream_classStream class of which to set the packet context field class to field_class.
[in]field_classNew packet context field class of stream_class.
Return values
BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_OKSuccess.
BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROROut of memory.
Precondition
stream_class is not NULL.
stream_class is not frozen.
bt_stream_class_supports_packets(stream_class) returns BT_TRUE.
field_class is not NULL.
field_class is a structure field class.
field_class, or any of its contained field classes, is not already part of a stream class or of an event class.
If any of the field classes recursively contained in field_class has a link to another field class, it must honor the field class link rules.
If any of the field classes recursively contained in field_class has a link to another field class, it must honor the field class link rules.
Postcondition
On success, field_class is frozen.
See also
bt_stream_class_borrow_packet_context_field_class() — Borrows the packet context field class of a stream class.
bt_stream_class_borrow_packet_context_field_class_const() — Borrows the packet context field class of a stream class (const version).

◆ bt_stream_class_borrow_packet_context_field_class()

bt_field_class* bt_stream_class_borrow_packet_context_field_class ( bt_stream_class stream_class)

Borrows the packet context field class from the stream class stream_class.

See the packet context field class property.

If stream_class has no packet context field class, this function returns NULL.

Parameters
[in]stream_classStream class from which to borrow the packet context field class.
Returns
Borrowed reference of the packet context field class of stream_class, or NULL if none.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_packet_context_field_class() — Sets the packet context field class of a stream class.
bt_stream_class_borrow_packet_context_field_class_const()const version of this function.

◆ bt_stream_class_borrow_packet_context_field_class_const()

const bt_field_class* bt_stream_class_borrow_packet_context_field_class_const ( const bt_stream_class stream_class)

Borrows the packet context field class from the stream class stream_class (const version).

See bt_stream_class_borrow_packet_context_field_class().

◆ bt_stream_class_set_event_common_context_field_class()

bt_stream_class_set_field_class_status bt_stream_class_set_event_common_context_field_class ( bt_stream_class stream_class,
bt_field_class field_class 
)

Sets the event common context field class of the stream class stream_class to field_class.

See the event common context field class property.

Parameters
[in]stream_classStream class of which to set the event common context field class to field_class.
[in]field_classNew event common context field class of stream_class.
Return values
BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_OKSuccess.
BT_STREAM_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROROut of memory.
Precondition
stream_class is not NULL.
stream_class is not frozen.
field_class is not NULL.
field_class is a structure field class.
field_class, or any of its contained field classes, is not already part of a stream class or of an event class.
If any of the field classes recursively contained in field_class has a link to another field class, it must honor the field class link rules.
Postcondition
On success, field_class is frozen.
See also
bt_stream_class_borrow_event_common_context_field_class() — Borrows the event common context field class of a stream class.
bt_stream_class_borrow_event_common_context_field_class_const() — Borrows the event common context field class of a stream class (const version).

◆ bt_stream_class_borrow_event_common_context_field_class()

bt_field_class* bt_stream_class_borrow_event_common_context_field_class ( bt_stream_class stream_class)

Borrows the event common context field class from the stream class stream_class.

See the event common context field class property.

If stream_class has no event common context field class, this function returns NULL.

Parameters
[in]stream_classStream class from which to borrow the event common context field class.
Returns
Borrowed reference of the event common context field class of stream_class, or NULL if none.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_event_common_context_field_class() — Sets the event common context field class of a stream class.
bt_stream_class_borrow_event_common_context_field_class_const()const version of this function.

◆ bt_stream_class_borrow_event_common_context_field_class_const()

const bt_field_class* bt_stream_class_borrow_event_common_context_field_class_const ( const bt_stream_class stream_class)

Borrows the event common context field class from the stream class stream_class (const version()).

See bt_stream_class_borrow_event_common_context_field_class().

◆ bt_stream_class_set_assigns_automatic_event_class_id()

void bt_stream_class_set_assigns_automatic_event_class_id ( bt_stream_class stream_class,
bt_bool  assigns_automatic_event_class_id 
)

Sets whether or not the stream class stream_class automatically assigns a numeric ID to an event class you create and add to it.

See the assigns automatic event class IDs? property.

Parameters
[in]stream_classStream class of which to set whether or not it assigns automatic event class IDs.
[in]assigns_automatic_event_class_idBT_TRUE to make stream_class assign automatic event class IDs.
Precondition
stream_class is not NULL.
stream_class is not frozen.
See also
bt_stream_class_assigns_automatic_event_class_id() — Returns whether or not a stream class automatically assigns event class IDs.

◆ bt_stream_class_assigns_automatic_event_class_id()

bt_bool bt_stream_class_assigns_automatic_event_class_id ( const bt_stream_class stream_class)

Returns whether or not the stream class stream_class automatically assigns a numeric ID to an event class you create and add to it.

See the assigns automatic event class IDs? property.

Parameters
[in]stream_classStream class of which to get whether or not it assigns automatic event class IDs.
Returns
BT_TRUE if stream_class automatically assigns event class IDs.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_assigns_automatic_event_class_id() — Sets whether or not a stream class automatically assigns event class IDs.

◆ bt_stream_class_set_assigns_automatic_stream_id()

void bt_stream_class_set_assigns_automatic_stream_id ( bt_stream_class stream_class,
bt_bool  assigns_automatic_stream_id 
)

Sets whether or not the stream class stream_class automatically assigns a numeric ID to a stream you create from it.

See the assigns automatic stream IDs? property.

Parameters
[in]stream_classStream class of which to set whether or not it assigns automatic stream IDs.
[in]assigns_automatic_stream_idBT_TRUE to make stream_class assign automatic stream IDs.
Precondition
stream_class is not NULL.
stream_class is not frozen.
See also
bt_stream_class_assigns_automatic_stream_id() — Returns whether or not a stream class automatically assigns stream IDs.

◆ bt_stream_class_assigns_automatic_stream_id()

bt_bool bt_stream_class_assigns_automatic_stream_id ( const bt_stream_class stream_class)

Returns whether or not the stream class stream_class automatically assigns a numeric ID to a stream you create from it.

See the assigns automatic stream IDs? property.

Parameters
[in]stream_classStream class of which to get whether or not it assigns automatic stream IDs.
Returns
BT_TRUE if stream_class automatically assigns stream IDs.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_assigns_automatic_stream_id() — Sets whether or not a stream class automatically assigns stream IDs.

◆ bt_stream_class_set_supports_packets()

void bt_stream_class_set_supports_packets ( bt_stream_class stream_class,
bt_bool  supports_packets,
bt_bool  with_beginning_default_clock_snapshot,
bt_bool  with_end_default_clock_snapshot 
)

Sets whether or not the instances (streams) of the stream class stream_class have packets and, if so, if those packets have beginning and/or end default clock snapshots.

See the supports packets?, packets have a beginning default clock snapshot?, and packets have an end default clock snapshot? properties.

Parameters
[in]stream_classStream class of which to set whether or not its streams have packets.
[in]supports_packetsBT_TRUE to make the streams of stream_class have packets.
[in]with_beginning_default_clock_snapshotBT_TRUE to make the packets of the streams of stream_class have a beginning default clock snapshot.
[in]with_end_default_clock_snapshotBT_TRUE to make the packets of the streams of stream_class have an end default clock snapshot.
Precondition
stream_class is not NULL.
stream_class is not frozen.
If with_beginning_default_clock_snapshot is BT_TRUE, supports_packets is also BT_TRUE.
If with_beginning_default_clock_snapshot is BT_TRUE, supports_packets is also BT_TRUE.
If with_beginning_default_clock_snapshot or with_end_default_clock_snapshot is BT_TRUE, stream_class has a default clock class.
See also
bt_stream_class_supports_packets() — Returns whether or not a stream class's streams have packets.
bt_stream_class_packets_have_beginning_default_clock_snapshot() — Returns whether or not the packets of a stream class's streams have a beginning default clock snapshot.
bt_stream_class_packets_have_end_default_clock_snapshot() — Returns whether or not the packets of a stream class's streams have an end default clock snapshot.

◆ bt_stream_class_supports_packets()

bt_bool bt_stream_class_supports_packets ( const bt_stream_class stream_class)

Returns whether or not the instances (streams) of the stream class stream_class have packets.

See the supports packets? property.

Parameters
[in]stream_classStream class of which to get whether or not its streams have packets.
Returns
BT_TRUE if the streams of stream_class have packets.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_supports_packets() — Sets whether or not a stream class's streams have packets.

◆ bt_stream_class_packets_have_beginning_default_clock_snapshot()

bt_bool bt_stream_class_packets_have_beginning_default_clock_snapshot ( const bt_stream_class stream_class)

Returns whether or not the packets of the instances (streams) of the stream class stream_class have a beginning default clock snapshot.

See the packets have a beginning default clock snapshot? property.

Parameters
[in]stream_classStream class of which to get whether or not its streams's packets have a beginning default clock snapshot.
Returns
BT_TRUE if the packets of the streams of stream_class have a beginning default clock snapshot.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_supports_packets() — Sets whether or not a stream class's streams have packets.
bt_stream_class_packets_have_end_default_clock_snapshot() — Returns whether or not the packets of a stream class's streams have an end default clock snapshot.

◆ bt_stream_class_packets_have_end_default_clock_snapshot()

bt_bool bt_stream_class_packets_have_end_default_clock_snapshot ( const bt_stream_class stream_class)

Returns whether or not the packets of the instances (streams) of the stream class stream_class have an end default clock snapshot.

See the packets have an end default clock snapshot? property.

Parameters
[in]stream_classStream class of which to get whether or not its streams's packets have an end default clock snapshot.
Returns
BT_TRUE if the packets of the streams of stream_class have an end default clock snapshot.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_supports_packets() — Sets whether or not a stream class's streams have packets.
bt_stream_class_packets_have_beginning_default_clock_snapshot() — Returns whether or not the packets of a stream class's streams have a beginning default clock snapshot.

◆ bt_stream_class_set_supports_discarded_events()

void bt_stream_class_set_supports_discarded_events ( bt_stream_class stream_class,
bt_bool  supports_discarded_events,
bt_bool  with_default_clock_snapshots 
)

Sets whether or not the instances (streams) of the stream class stream_class can have discarded events and, if so, if the discarded events messages of those streams have beginning and end default clock snapshots.

See the supports discarded events? and discarded events have default clock snapshots? properties.

Parameters
[in]stream_classStream class of which to set whether or not its streams can have discarded events.
[in]supports_discarded_eventsBT_TRUE to make the streams of stream_class be able to have discarded events.
[in]with_default_clock_snapshotsBT_TRUE to make the discarded events messages the streams of stream_class have beginning and end default clock snapshots.
Precondition
stream_class is not NULL.
stream_class is not frozen.
If with_default_clock_snapshots is BT_TRUE, supports_discarded_events is also BT_TRUE.
If with_default_clock_snapshots is BT_TRUE, stream_class has a default clock class.
See also
bt_stream_class_supports_discarded_events() — Returns whether or not a stream class's streams can have discarded events.
bt_stream_class_discarded_events_have_default_clock_snapshots() — Returns whether or not the discarded events messages of a stream class's streams have beginning and end default clock snapshots.

◆ bt_stream_class_supports_discarded_events()

bt_bool bt_stream_class_supports_discarded_events ( const bt_stream_class stream_class)

Returns whether or not the instances (streams) of the stream class stream_class can have discarded events.

See the supports discarded events? property.

Parameters
[in]stream_classStream class of which to get whether or not its streams can have discarded events.
Returns
BT_TRUE if the streams of stream_class can have discarded events.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_supports_discarded_events() — Sets whether or not a stream class's streams can have discarded events.

◆ bt_stream_class_discarded_events_have_default_clock_snapshots()

bt_bool bt_stream_class_discarded_events_have_default_clock_snapshots ( const bt_stream_class stream_class)

Returns whether or not the discarded events messages of the instances (streams) of the stream class stream_class have beginning and end default clock snapshots.

See the discarded events have default clock snapshots? property.

Parameters
[in]stream_classStream class of which to get whether or not its streams's discarded events messages have a beginning and end default clock snapshots.
Returns
BT_TRUE if the discarded events messages of the streams of stream_class have beginning and end default clock snapshots.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_supports_discarded_events() — Sets whether or not a stream class's streams can have discarded events.

◆ bt_stream_class_set_supports_discarded_packets()

void bt_stream_class_set_supports_discarded_packets ( bt_stream_class stream_class,
bt_bool  supports_discarded_packets,
bt_bool  with_default_clock_snapshots 
)

Sets whether or not the instances (streams) of the stream class stream_class can have discarded packets and, if so, if the discarded packets messages of those streams have beginning and end default clock snapshots.

See the supports discarded packets? and discarded packets have default clock snapshots? properties.

stream_class must support packets (see bt_stream_class_set_supports_packets()).

Parameters
[in]stream_classStream class of which to set whether or not its streams can have discarded packets.
[in]supports_discarded_packetsBT_TRUE to make the streams of stream_class be able to have discarded packets.
[in]with_default_clock_snapshotsBT_TRUE to make the discarded packets messages the streams of stream_class have beginning and end default clock snapshots.
Precondition
stream_class is not NULL.
stream_class is not frozen.
bt_stream_class_supports_packets(stream_class) returns BT_TRUE.
If with_default_clock_snapshots is BT_TRUE, supports_discarded_packets is also BT_TRUE.
If with_default_clock_snapshots is BT_TRUE, stream_class has a default clock class.
See also
bt_stream_class_supports_discarded_packets() — Returns whether or not a stream class's streams can have discarded packets.
bt_stream_class_discarded_packets_have_default_clock_snapshots() — Returns whether or not the discarded packets messages of a stream class's streams have beginning and end default clock snapshots.

◆ bt_stream_class_supports_discarded_packets()

bt_bool bt_stream_class_supports_discarded_packets ( const bt_stream_class stream_class)

Returns whether or not the instances (streams) of the stream class stream_class can have discarded packets.

See the supports discarded packets? property.

Parameters
[in]stream_classStream class of which to get whether or not its streams can have discarded packets.
Returns
BT_TRUE if the streams of stream_class can have discarded packets.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_supports_discarded_packets() — Sets whether or not a stream class's streams can have discarded packets.

◆ bt_stream_class_discarded_packets_have_default_clock_snapshots()

bt_bool bt_stream_class_discarded_packets_have_default_clock_snapshots ( const bt_stream_class stream_class)

Returns whether or not the discarded packets messages of the instances (streams) of the stream class stream_class have beginning and end default clock snapshots.

See the discarded packets have default clock snapshots? property.

Parameters
[in]stream_classStream class of which to get whether or not its streams's discarded packets messages have a beginning and end default clock snapshots.
Returns
BT_TRUE if the discarded packets messages of the streams of stream_class have beginning and end default clock snapshots.
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_supports_discarded_packets() — Sets whether or not a stream class's streams can have discarded packets.

◆ bt_stream_class_set_user_attributes()

void bt_stream_class_set_user_attributes ( bt_stream_class stream_class,
const bt_value user_attributes 
)

Sets the user attributes of the stream class stream_class to user_attributes.

See the user attributes property.

Note
When you create a default stream class with bt_stream_class_create() or bt_stream_class_create_with_id(), the stream class's initial user attributes is an empty map value. Therefore you can borrow it with bt_stream_class_borrow_user_attributes() and fill it directly instead of setting a new one with this function.
Parameters
[in]stream_classStream class of which to set the user attributes to user_attributes.
[in]user_attributesNew user attributes of stream_class.
Precondition
stream_class is not NULL.
stream_class is not frozen.
user_attributes is not NULL.
user_attributes is a map value (bt_value_is_map() returns BT_TRUE).
See also
bt_stream_class_borrow_user_attributes() — Borrows the user attributes of a stream class.

◆ bt_stream_class_borrow_user_attributes()

bt_value* bt_stream_class_borrow_user_attributes ( bt_stream_class stream_class)

Borrows the user attributes of the stream class stream_class.

See the user attributes property.

Note
When you create a default stream class with bt_stream_class_create() or bt_stream_class_create_with_id(), the stream class's initial user attributes is an empty map value.
Parameters
[in]stream_classStream class from which to borrow the user attributes.
Returns
User attributes of stream_class (a map value).
Precondition
stream_class is not NULL.
See also
bt_stream_class_set_user_attributes() — Sets the user attributes of a stream class.
bt_stream_class_borrow_user_attributes_const()const version of this function.

◆ bt_stream_class_borrow_user_attributes_const()

const bt_value* bt_stream_class_borrow_user_attributes_const ( const bt_stream_class stream_class)

Borrows the user attributes of the stream class stream_class (const version).

See bt_stream_class_borrow_user_attributes().

◆ bt_stream_class_get_ref()

void bt_stream_class_get_ref ( const bt_stream_class stream_class)

Increments the reference count of the stream class stream_class.

Parameters
[in]stream_class

Stream class of which to increment the reference count.

Can be NULL.

See also
bt_stream_class_put_ref() — Decrements the reference count of a stream class.

◆ bt_stream_class_put_ref()

void bt_stream_class_put_ref ( const bt_stream_class stream_class)

Decrements the reference count of the stream class stream_class.

Parameters
[in]stream_class

Stream class of which to decrement the reference count.

Can be NULL.

See also
bt_stream_class_get_ref() — Increments the reference count of a stream class.
bt_trace_class_assigns_automatic_stream_class_id
bt_bool bt_trace_class_assigns_automatic_stream_class_id(const bt_trace_class *trace_class)
Returns whether or not the trace class trace_class automatically assigns a numeric ID to a stream cla...