lib: remove unused _NO_SINK graph status
[babeltrace.git] / include / babeltrace / ctf-writer / stream-internal.h
1 #ifndef BABELTRACE_CTF_WRITER_STREAM_INTERNAL_H
2 #define BABELTRACE_CTF_WRITER_STREAM_INTERNAL_H
3
4 /*
5 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 *
7 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 *
27 * The Common Trace Format (CTF) Specification is available at
28 * http://www.efficios.com/ctf
29 */
30
31 #include <babeltrace/assert-internal.h>
32 #include <babeltrace/assert-pre-internal.h>
33 #include <babeltrace/babeltrace-internal.h>
34 #include <babeltrace/ctf-writer/stream-internal.h>
35 #include <babeltrace/ctf-writer/stream.h>
36 #include <babeltrace/ctf-writer/utils-internal.h>
37 #include <babeltrace/ctf-writer/object-internal.h>
38 #include <babeltrace/ctfser-internal.h>
39 #include <stdint.h>
40
41 struct bt_ctf_stream_common;
42
43 struct bt_ctf_stream_common {
44 struct bt_ctf_object base;
45 int64_t id;
46 struct bt_ctf_stream_class_common *stream_class;
47 GString *name;
48 };
49
50 BT_HIDDEN
51 int bt_ctf_stream_common_initialize(
52 struct bt_ctf_stream_common *stream,
53 struct bt_ctf_stream_class_common *stream_class, const char *name,
54 uint64_t id, bt_ctf_object_release_func release_func);
55
56 BT_HIDDEN
57 void bt_ctf_stream_common_finalize(struct bt_ctf_stream_common *stream);
58
59 static inline
60 struct bt_ctf_stream_class_common *bt_ctf_stream_common_borrow_class(
61 struct bt_ctf_stream_common *stream)
62 {
63 BT_ASSERT(stream);
64 return stream->stream_class;
65 }
66
67 static inline
68 const char *bt_ctf_stream_common_get_name(struct bt_ctf_stream_common *stream)
69 {
70 BT_ASSERT_PRE_NON_NULL(stream, "Stream");
71 return stream->name ? stream->name->str : NULL;
72 }
73
74 static inline
75 int64_t bt_ctf_stream_common_get_id(struct bt_ctf_stream_common *stream)
76 {
77 int64_t ret;
78
79 BT_ASSERT_PRE_NON_NULL(stream, "Stream");
80 ret = stream->id;
81 if (ret < 0) {
82 BT_LOGV("Stream's ID is not set: addr=%p, name=\"%s\"",
83 stream, bt_ctf_stream_common_get_name(stream));
84 }
85
86 return ret;
87 }
88
89 struct bt_ctf_stream {
90 struct bt_ctf_stream_common common;
91 struct bt_ctf_field *packet_header;
92 struct bt_ctf_field *packet_context;
93
94 /* Array of pointers to bt_ctf_event for the current packet */
95 GPtrArray *events;
96 struct bt_ctfser ctfser;
97 unsigned int flushed_packet_count;
98 uint64_t discarded_events;
99 uint64_t last_ts_end;
100 };
101
102 BT_HIDDEN
103 struct bt_ctf_stream *bt_ctf_stream_create_with_id(
104 struct bt_ctf_stream_class *stream_class,
105 const char *name, uint64_t id);
106
107 #endif /* BABELTRACE_CTF_WRITER_STREAM_INTERNAL_H */
This page took 0.036694 seconds and 4 git commands to generate.