X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Fstream.h;h=d9e2bc26e3a00b4b749801904ef3571acbfbc624;hb=12c8a1a3121ed7125e8758065c44658d8eda1333;hp=abf50904a1cbb7ac29760fb72bf63c422c381edb;hpb=9773681407e4e8fce40f247132dc99fabe306bfe;p=babeltrace.git diff --git a/include/babeltrace/ctf-ir/stream.h b/include/babeltrace/ctf-ir/stream.h index abf50904..d9e2bc26 100644 --- a/include/babeltrace/ctf-ir/stream.h +++ b/include/babeltrace/ctf-ir/stream.h @@ -43,6 +43,10 @@ struct bt_ctf_stream; * bt_ctf_stream_get_discarded_events_count: get the number of discarded * events associated with this stream. * + * Note that discarded events are not stored if the stream's packet + * context has no "events_discarded" field. An error will be returned + * in that case. + * * @param stream Stream instance. * * Returns the number of discarded events, a negative value on error. @@ -53,7 +57,8 @@ extern int bt_ctf_stream_get_discarded_events_count( /* * bt_ctf_stream_append_discarded_events: increment discarded events count. * - * Increase the current packet's discarded event count. + * Increase the current packet's discarded event count. Has no effect if the + * stream class' packet context has no "events_discarded" field. * * @param stream Stream instance. * @param event_count Number of discarded events to add to the stream's current @@ -79,11 +84,41 @@ extern void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, extern int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, struct bt_ctf_event *event); +/* + * bt_ctf_stream_get_packet_context: get a stream's packet context. + * + * @param stream Stream instance. + * + * Returns a field instance on success, NULL on error. + */ +extern struct bt_ctf_field *bt_ctf_stream_get_packet_context( + struct bt_ctf_stream *stream); + +/* + * bt_ctf_stream_set_packet_context: set a stream's packet context. + * + * The packet context's type must match the stream class' packet + * context type. + * + * @param stream Stream instance. + * @param packet_context Packet context field instance. + * + * Returns a field instance on success, NULL on error. + */ +extern int bt_ctf_stream_set_packet_context( + struct bt_ctf_stream *stream, + struct bt_ctf_field *packet_context); + /* * bt_ctf_stream_flush: flush a stream. * - * The stream's current packet's events will be flushed to disk. Events - * subsequently appended to the stream will be added to a new packet. + * The stream's current packet's events will be flushed, thus closing the + * current packet. Events subsequently appended to the stream will be + * added to a new packet. + * + * Flushing will also set the packet context's default attributes if + * they remained unset while populating the current packet. These default + * attributes, along with their expected types, are detailed in stream-class.h. * * @param stream Stream instance. *