2 * SPDX-License-Identifier: MIT
4 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 * The Common Trace Format (CTF) Specification is available at
7 * http://www.efficios.com/ctf
10 #ifndef BABELTRACE_CTF_WRITER_STREAM_INTERNAL_H
11 #define BABELTRACE_CTF_WRITER_STREAM_INTERNAL_H
13 #include "common/assert.h"
14 #include "common/macros.h"
15 #include <babeltrace2-ctf-writer/stream.h>
16 #include "ctfser/ctfser.h"
19 #include "assert-pre.h"
24 struct bt_ctf_stream_common
;
26 struct bt_ctf_stream_common
{
27 struct bt_ctf_object base
;
29 struct bt_ctf_stream_class_common
*stream_class
;
34 int bt_ctf_stream_common_initialize(
35 struct bt_ctf_stream_common
*stream
,
36 struct bt_ctf_stream_class_common
*stream_class
, const char *name
,
37 uint64_t id
, bt_ctf_object_release_func release_func
);
40 void bt_ctf_stream_common_finalize(struct bt_ctf_stream_common
*stream
);
43 struct bt_ctf_stream_class_common
*bt_ctf_stream_common_borrow_class(
44 struct bt_ctf_stream_common
*stream
)
46 BT_ASSERT_DBG(stream
);
47 return stream
->stream_class
;
51 const char *bt_ctf_stream_common_get_name(struct bt_ctf_stream_common
*stream
)
53 BT_CTF_ASSERT_PRE_NON_NULL(stream
, "Stream");
54 return stream
->name
? stream
->name
->str
: NULL
;
58 int64_t bt_ctf_stream_common_get_id(struct bt_ctf_stream_common
*stream
)
62 BT_CTF_ASSERT_PRE_NON_NULL(stream
, "Stream");
65 BT_LOGT("Stream's ID is not set: addr=%p, name=\"%s\"",
66 stream
, bt_ctf_stream_common_get_name(stream
));
72 struct bt_ctf_stream
{
73 struct bt_ctf_stream_common common
;
74 struct bt_ctf_field
*packet_header
;
75 struct bt_ctf_field
*packet_context
;
77 /* Array of pointers to bt_ctf_event for the current packet */
79 struct bt_ctfser ctfser
;
80 unsigned int flushed_packet_count
;
81 uint64_t discarded_events
;
86 struct bt_ctf_stream
*bt_ctf_stream_create_with_id(
87 struct bt_ctf_stream_class
*stream_class
,
88 const char *name
, uint64_t id
);
90 #endif /* BABELTRACE_CTF_WRITER_STREAM_INTERNAL_H */