Fix -Wmissing-prototypes/-Wmissing-declarations warnings
[babeltrace.git] / include / babeltrace2-ctf-writer / event.h
CommitLineData
3fd40f46
PP
1#ifndef BABELTRACE2_CTF_WRITER_EVENT_H
2#define BABELTRACE2_CTF_WRITER_EVENT_H
8c18d80b 3
46bd0f2b 4/*
0dcb770f 5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
46bd0f2b
JG
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
46bd0f2b
JG
24 */
25
3996bc53 26#include <babeltrace2-ctf-writer/object.h>
8c18d80b
PP
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
8deee039
PP
32struct bt_ctf_event;
33struct bt_ctf_event_class;
34struct bt_ctf_stream;
35struct bt_ctf_field;
36struct bt_ctf_field_type;
8c18d80b 37
8deee039
PP
38enum bt_ctf_event_class_log_level {
39 /// Unknown, used for errors.
086dc475 40 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1,
8deee039
PP
41
42 /// Unspecified log level.
086dc475 43 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255,
8deee039
PP
44
45 /// System is unusable.
086dc475 46 BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0,
8deee039
PP
47
48 /// Action must be taken immediately.
086dc475 49 BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1,
8deee039
PP
50
51 /// Critical conditions.
086dc475 52 BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2,
8deee039
PP
53
54 /// Error conditions.
086dc475 55 BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3,
8deee039
PP
56
57 /// Warning conditions.
086dc475 58 BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4,
8deee039
PP
59
60 /// Normal, but significant, condition.
086dc475 61 BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5,
8deee039
PP
62
63 /// Informational message.
086dc475 64 BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6,
8deee039
PP
65
66 /// Debug information with system-level scope (set of programs).
086dc475 67 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7,
8deee039
PP
68
69 /// Debug information with program-level scope (set of processes).
086dc475 70 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8,
8deee039
PP
71
72 /// Debug information with process-level scope (set of modules).
086dc475 73 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9,
8deee039
PP
74
75 /// Debug information with module (executable/library) scope (set of units).
086dc475 76 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10,
8deee039
PP
77
78 /// Debug information with compilation unit scope (set of functions).
086dc475 79 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11,
8deee039
PP
80
81 /// Debug information with function-level scope.
086dc475 82 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12,
8deee039
PP
83
84 /// Debug information with line-level scope (default log level).
086dc475 85 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13,
8deee039
PP
86
87 /// Debug-level message.
086dc475 88 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14,
8deee039
PP
89};
90
91extern struct bt_ctf_event *bt_ctf_event_create(
92 struct bt_ctf_event_class *event_class);
93
94extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event,
95 const char *name);
96
97extern int bt_ctf_event_set_payload(struct bt_ctf_event *event,
98 const char *name, struct bt_ctf_field *field);
99
100extern struct bt_ctf_field *bt_ctf_event_get_payload_field(
101 struct bt_ctf_event *event);
102
103extern int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
104 struct bt_ctf_field *field);
105
106extern int bt_ctf_event_set_context(struct bt_ctf_event *event,
107 struct bt_ctf_field *field);
108
109extern struct bt_ctf_field *bt_ctf_event_get_context(
110 struct bt_ctf_event *event);
111
112extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event,
113 struct bt_ctf_field *field);
114
115extern struct bt_ctf_field *bt_ctf_event_get_stream_event_context(
116 struct bt_ctf_event *event);
117
118extern int bt_ctf_event_set_header(struct bt_ctf_event *event,
119 struct bt_ctf_field *field);
120
121extern struct bt_ctf_field *bt_ctf_event_get_header(
122 struct bt_ctf_event *event);
123
124extern struct bt_ctf_stream *bt_ctf_event_get_stream(
125 struct bt_ctf_event *event);
126
127extern struct bt_ctf_event_class *bt_ctf_event_get_class(
128 struct bt_ctf_event *event);
129
130/* Pre-2.0 CTF writer compatibility */
131static inline
132void bt_ctf_event_get(struct bt_ctf_event *event)
133{
c2606e2f 134 bt_ctf_object_get_ref(event);
8deee039
PP
135}
136
137/* Pre-2.0 CTF writer compatibility */
138static inline
139void bt_ctf_event_put(struct bt_ctf_event *event)
140{
c2606e2f 141 bt_ctf_object_put_ref(event);
8deee039
PP
142}
143
144extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name);
145
146extern struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class(
147 struct bt_ctf_event_class *event_class);
148
149extern const char *bt_ctf_event_class_get_name(
150 struct bt_ctf_event_class *event_class);
151
152extern int64_t bt_ctf_event_class_get_id(
153 struct bt_ctf_event_class *event_class);
154
155extern int bt_ctf_event_class_set_id(
156 struct bt_ctf_event_class *event_class, uint64_t id);
157
158extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level(
159 struct bt_ctf_event_class *event_class);
160
161extern int bt_ctf_event_class_set_log_level(
162 struct bt_ctf_event_class *event_class,
163 enum bt_ctf_event_class_log_level log_level);
164
165extern const char *bt_ctf_event_class_get_emf_uri(
166 struct bt_ctf_event_class *event_class);
167
168extern int bt_ctf_event_class_set_emf_uri(
169 struct bt_ctf_event_class *event_class,
170 const char *emf_uri);
171
172extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_field_type(
173 struct bt_ctf_event_class *event_class);
174
175extern int bt_ctf_event_class_set_context_field_type(
176 struct bt_ctf_event_class *event_class,
177 struct bt_ctf_field_type *context_type);
178
179extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_field_type(
180 struct bt_ctf_event_class *event_class);
181
f3847c75
SM
182extern int64_t bt_ctf_event_class_get_payload_type_field_count(
183 struct bt_ctf_event_class *event_class);
184
185extern int bt_ctf_event_class_get_payload_type_field_by_index(
186 struct bt_ctf_event_class *event_class,
187 const char **field_name, struct bt_ctf_field_type **field_type,
188 uint64_t index);
189
190extern struct bt_ctf_field_type *
191bt_ctf_event_class_get_payload_type_field_type_by_name(
192 struct bt_ctf_event_class *event_class, const char *name);
193
8deee039
PP
194extern int bt_ctf_event_class_set_payload_field_type(
195 struct bt_ctf_event_class *event_class,
196 struct bt_ctf_field_type *payload_type);
197
198extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class,
199 struct bt_ctf_field_type *field_type,
200 const char *name);
201
202extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
203 struct bt_ctf_event_class *event_class, const char *name);
204
205/* Pre-2.0 CTF writer compatibility */
206static inline
207void bt_ctf_event_class_get(struct bt_ctf_event_class *event_class)
208{
c2606e2f 209 bt_ctf_object_get_ref(event_class);
8deee039
PP
210}
211
212/* Pre-2.0 CTF writer compatibility */
213static inline
214void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class)
215{
c2606e2f 216 bt_ctf_object_put_ref(event_class);
8deee039 217}
8c18d80b
PP
218
219#ifdef __cplusplus
220}
221#endif
222
3fd40f46 223#endif /* BABELTRACE2_CTF_WRITER_EVENT_H */
This page took 0.068316 seconds and 4 git commands to generate.