X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-writer%2Fstream-internal.h;fp=include%2Fbabeltrace%2Fctf-writer%2Fstream-internal.h;h=3da0966433a669b0130722d0f00d855d156078eb;hp=1d6e8fcf06cd5ebf0168266bbbbb5081109b4d45;hb=16ca5ff0568c72f5600ebc88b195fbc5ee88556d;hpb=0f6bea4ef916464f2d2a0a597c28a6701ac51762 diff --git a/include/babeltrace/ctf-writer/stream-internal.h b/include/babeltrace/ctf-writer/stream-internal.h index 1d6e8fcf..3da09664 100644 --- a/include/babeltrace/ctf-writer/stream-internal.h +++ b/include/babeltrace/ctf-writer/stream-internal.h @@ -30,14 +30,67 @@ * http://www.efficios.com/ctf */ +#include #include -#include -#include +#include #include +#include +#include +#include +#include +#include #include +struct bt_ctf_stream_common; + +struct bt_ctf_stream_common { + struct bt_object base; + int64_t id; + struct bt_ctf_stream_class_common *stream_class; + GString *name; +}; + +BT_HIDDEN +int bt_ctf_stream_common_initialize( + struct bt_ctf_stream_common *stream, + struct bt_ctf_stream_class_common *stream_class, const char *name, + uint64_t id, bt_object_release_func release_func); + +BT_HIDDEN +void bt_ctf_stream_common_finalize(struct bt_ctf_stream_common *stream); + +static inline +struct bt_ctf_stream_class_common *bt_ctf_stream_common_borrow_class( + struct bt_ctf_stream_common *stream) +{ + BT_ASSERT(stream); + return stream->stream_class; +} + +static inline +const char *bt_ctf_stream_common_get_name(struct bt_ctf_stream_common *stream) +{ + BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + return stream->name ? stream->name->str : NULL; +} + +static inline +int64_t bt_ctf_stream_common_get_id(struct bt_ctf_stream_common *stream) +{ + int64_t ret; + + BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + ret = stream->id; + if (ret < 0) { + BT_LOGV("Stream's ID is not set: addr=%p, name=\"%s\"", + stream, bt_ctf_stream_common_get_name(stream)); + } + + return ret; +} + struct bt_ctf_stream { - struct bt_stream_common common; + struct bt_ctf_stream_common common; struct bt_ctf_field *packet_header; struct bt_ctf_field *packet_context; @@ -51,7 +104,7 @@ struct bt_ctf_stream { }; BT_HIDDEN -int bt_stream_set_fd(struct bt_stream *stream, int fd); +int bt_ctf_stream_set_fd(struct bt_ctf_stream *stream, int fd); BT_HIDDEN struct bt_ctf_stream *bt_ctf_stream_create_with_id(