X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Fstream-class.h;h=75be6b678f7f37b07aa19d5f14491abf45b5c5ad;hb=de3dd40e6fcad56e227f5fc8a8290fbaa88b4e07;hp=71b10679ceac550ed0a1f4f197489daf7300cf3d;hpb=de876b7fd76bbc7ff498b88f0cf11bd828e5743a;p=babeltrace.git diff --git a/include/babeltrace/ctf-ir/stream-class.h b/include/babeltrace/ctf-ir/stream-class.h index 71b10679..75be6b67 100644 --- a/include/babeltrace/ctf-ir/stream-class.h +++ b/include/babeltrace/ctf-ir/stream-class.h @@ -30,6 +30,8 @@ * http://www.efficios.com/ctf */ +#include + #ifdef __cplusplus extern "C" { #endif @@ -52,12 +54,27 @@ struct bt_ctf_clock; * - uint64_t packet_size * - uint64_t events_discarded * - * @param name Stream name. + * A stream class's event header is a structure initialized the following + * fields: + * - uint32_t id + * - uint64_t timestamp + * + * @param name Stream name, NULL to create an unnamed stream class. * * Returns an allocated stream class on success, NULL on error. */ extern struct bt_ctf_stream_class *bt_ctf_stream_class_create(const char *name); +/* + * bt_ctf_stream_class_get_trace: Get a stream class' associated trace. + * + * @param stream_class Stream class. + * + * Returns the stream class' associated trace, NULL on error. + */ +extern struct bt_ctf_trace *bt_ctf_stream_class_get_trace( + struct bt_ctf_stream_class *stream_class); + /* * bt_ctf_stream_class_get_name: Get a stream class' name. * @@ -68,6 +85,16 @@ extern struct bt_ctf_stream_class *bt_ctf_stream_class_create(const char *name); extern const char *bt_ctf_stream_class_get_name( struct bt_ctf_stream_class *stream_class); +/* + * bt_ctf_stream_class_set_name: Set a stream class' name. + * + * @param stream_class Stream class. + * + * Returns 0 on success, a negative value on error. + */ +extern int bt_ctf_stream_class_set_name( + struct bt_ctf_stream_class *stream_class, const char *name); + /* * bt_ctf_stream_class_get_clock: get the clock associated with a stream class. * @@ -127,6 +154,9 @@ extern int bt_ctf_stream_class_set_id( * The stream class will share the ownership of "event_class" by incrementing * its reference count. * + * Note that an event class may only be added to one stream class. It + * also becomes immutable. + * * @param stream_class Stream class. * @param event_class Event class to add to the provided stream class. * @@ -170,6 +200,18 @@ extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class( extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_name( struct bt_ctf_stream_class *stream_class, const char *name); +/* + * bt_ctf_stream_class_get_event_class_by_name: Get stream class event class by + * ID. + * + * @param stream_class Stream class. + * @param id Event class ID. + * + * Returns event class, NULL on error. + */ +extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id( + struct bt_ctf_stream_class *stream_class, uint32_t id); + /* * bt_ctf_stream_class_get_packet_context_type: get the stream class' packet * context type. @@ -194,6 +236,31 @@ extern int bt_ctf_stream_class_set_packet_context_type( struct bt_ctf_stream_class *stream_class, struct bt_ctf_field_type *packet_context_type); +/* + * bt_ctf_stream_class_get_event_header_type: get the stream class' + * event header type. + * + * @param stream_class Stream class. + * + * Returns the stream event header's type (a structure), NULL on error. + */ +extern struct bt_ctf_field_type * +bt_ctf_stream_class_get_event_header_type( + struct bt_ctf_stream_class *stream_class); + +/* + * bt_ctf_stream_class_set_event_header_type: set the stream class' + * event header type. + * + * @param stream_class Stream class. + * @param event_header_type Event header type (must be a structure). + * + * Returns 0 on success, a negative value on error. + */ +extern int bt_ctf_stream_class_set_event_header_type( + struct bt_ctf_stream_class *stream_class, + struct bt_ctf_field_type *event_header_type); + /* * bt_ctf_stream_class_get_event_context_type: get the stream class' * event context type. @@ -223,6 +290,8 @@ extern int bt_ctf_stream_class_set_event_context_type( * bt_ctf_stream_class_get and bt_ctf_stream_class_put: increment and * decrement the stream class' reference count. * + * You may also use bt_ctf_get() and bt_ctf_put() with stream class objects. + * * These functions ensure that the stream class won't be destroyed while it * is in use. The same number of get and put (plus one extra put to * release the initial reference done at creation) have to be done to