X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-writer%2Fstream.h;h=bc368f4e435ea73e84873adeb54620600c8fb61f;hb=98bd6ec2cbc37814f9d92372fd8e9aa2c5956489;hp=56b6bff8c29edb10bd5e1da77050d4345d6c506f;hpb=37949e9ed8092b74cec31996580cab9cea02e1b1;p=babeltrace.git diff --git a/include/babeltrace/ctf-writer/stream.h b/include/babeltrace/ctf-writer/stream.h index 56b6bff8..bc368f4e 100644 --- a/include/babeltrace/ctf-writer/stream.h +++ b/include/babeltrace/ctf-writer/stream.h @@ -2,8 +2,6 @@ #define BABELTRACE_CTF_WRITER_STREAM_H /* - * BabelTrace - CTF Writer: Stream - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,13 +28,15 @@ * http://www.efficios.com/ctf */ -#include -#include +#include #ifdef __cplusplus extern "C" { #endif +struct bt_ctf_stream; +struct bt_ctf_event; + /* * bt_ctf_stream_get_discarded_events_count: get the number of discarded * events associated with this stream. @@ -154,24 +154,31 @@ extern int bt_ctf_stream_flush(struct bt_ctf_stream *stream); extern int bt_ctf_stream_is_writer(struct bt_ctf_stream *stream); -/* - * bt_ctf_stream_get and bt_ctf_stream_put: increment and decrement the - * stream's reference count. - * - * You may also use bt_ctf_get() and bt_ctf_put() with stream objects. - * - * These functions ensure that the stream 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 - * destroy a stream. - * - * When the stream's reference count is decremented to 0 by a - * bt_ctf_stream_put, the stream is freed. - * - * @param stream Stream instance. - */ -extern void bt_ctf_stream_get(struct bt_ctf_stream *stream); -extern void bt_ctf_stream_put(struct bt_ctf_stream *stream); +extern +struct bt_ctf_stream *bt_ctf_stream_create( + struct bt_ctf_stream_class *stream_class, + const char *name, uint64_t id); + +extern struct bt_ctf_stream_class *bt_ctf_stream_get_class( + struct bt_ctf_stream *stream); + +extern const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream); + +extern int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream); + +/* Pre-2.0 CTF writer compatibility */ +static inline +void bt_ctf_stream_get(struct bt_ctf_stream *stream) +{ + bt_ctf_object_get_ref(stream); +} + +/* Pre-2.0 CTF writer compatibility */ +static inline +void bt_ctf_stream_put(struct bt_ctf_stream *stream) +{ + bt_ctf_object_put_ref(stream); +} #ifdef __cplusplus }