lib: Reset libbabeltrace2 to SONANE 0
[babeltrace.git] / include / babeltrace / ctf-writer / event.h
CommitLineData
8c18d80b
PP
1#ifndef BABELTRACE_CTF_WRITER_EVENT_H
2#define BABELTRACE_CTF_WRITER_EVENT_H
3
46bd0f2b 4/*
de9dd397 5 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
46bd0f2b
JG
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
e1e02a22 31#include <babeltrace/ctf-writer/object.h>
8c18d80b
PP
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
3dca2276
PP
37struct bt_ctf_event;
38struct bt_ctf_event_class;
39struct bt_ctf_stream;
40struct bt_ctf_field;
41struct bt_ctf_field_type;
8c18d80b 42
3dca2276
PP
43enum bt_ctf_event_class_log_level {
44 /// Unknown, used for errors.
16ca5ff0 45 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1,
3dca2276
PP
46
47 /// Unspecified log level.
16ca5ff0 48 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255,
3dca2276
PP
49
50 /// System is unusable.
16ca5ff0 51 BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0,
3dca2276
PP
52
53 /// Action must be taken immediately.
16ca5ff0 54 BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1,
3dca2276
PP
55
56 /// Critical conditions.
16ca5ff0 57 BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2,
3dca2276
PP
58
59 /// Error conditions.
16ca5ff0 60 BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3,
3dca2276
PP
61
62 /// Warning conditions.
16ca5ff0 63 BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4,
3dca2276
PP
64
65 /// Normal, but significant, condition.
16ca5ff0 66 BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5,
3dca2276
PP
67
68 /// Informational message.
16ca5ff0 69 BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6,
3dca2276
PP
70
71 /// Debug information with system-level scope (set of programs).
16ca5ff0 72 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7,
3dca2276
PP
73
74 /// Debug information with program-level scope (set of processes).
16ca5ff0 75 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8,
3dca2276
PP
76
77 /// Debug information with process-level scope (set of modules).
16ca5ff0 78 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9,
3dca2276
PP
79
80 /// Debug information with module (executable/library) scope (set of units).
16ca5ff0 81 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10,
3dca2276
PP
82
83 /// Debug information with compilation unit scope (set of functions).
16ca5ff0 84 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11,
3dca2276
PP
85
86 /// Debug information with function-level scope.
16ca5ff0 87 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12,
3dca2276
PP
88
89 /// Debug information with line-level scope (default log level).
16ca5ff0 90 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13,
3dca2276
PP
91
92 /// Debug-level message.
16ca5ff0 93 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14,
3dca2276
PP
94};
95
96extern struct bt_ctf_event *bt_ctf_event_create(
97 struct bt_ctf_event_class *event_class);
98
99extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event,
100 const char *name);
101
102extern int bt_ctf_event_set_payload(struct bt_ctf_event *event,
103 const char *name, struct bt_ctf_field *field);
104
105extern struct bt_ctf_field *bt_ctf_event_get_payload_field(
106 struct bt_ctf_event *event);
107
108extern int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
109 struct bt_ctf_field *field);
110
111extern int bt_ctf_event_set_context(struct bt_ctf_event *event,
112 struct bt_ctf_field *field);
113
114extern struct bt_ctf_field *bt_ctf_event_get_context(
115 struct bt_ctf_event *event);
116
117extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event,
118 struct bt_ctf_field *field);
119
120extern struct bt_ctf_field *bt_ctf_event_get_stream_event_context(
121 struct bt_ctf_event *event);
122
123extern int bt_ctf_event_set_header(struct bt_ctf_event *event,
124 struct bt_ctf_field *field);
125
126extern struct bt_ctf_field *bt_ctf_event_get_header(
127 struct bt_ctf_event *event);
128
129extern struct bt_ctf_stream *bt_ctf_event_get_stream(
130 struct bt_ctf_event *event);
131
132extern struct bt_ctf_event_class *bt_ctf_event_get_class(
133 struct bt_ctf_event *event);
134
135/* Pre-2.0 CTF writer compatibility */
136static inline
137void bt_ctf_event_get(struct bt_ctf_event *event)
138{
e1e02a22 139 bt_ctf_object_get_ref(event);
3dca2276
PP
140}
141
142/* Pre-2.0 CTF writer compatibility */
143static inline
144void bt_ctf_event_put(struct bt_ctf_event *event)
145{
e1e02a22 146 bt_ctf_object_put_ref(event);
3dca2276
PP
147}
148
149extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name);
150
151extern struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class(
152 struct bt_ctf_event_class *event_class);
153
154extern const char *bt_ctf_event_class_get_name(
155 struct bt_ctf_event_class *event_class);
156
157extern int64_t bt_ctf_event_class_get_id(
158 struct bt_ctf_event_class *event_class);
159
160extern int bt_ctf_event_class_set_id(
161 struct bt_ctf_event_class *event_class, uint64_t id);
162
163extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level(
164 struct bt_ctf_event_class *event_class);
165
166extern int bt_ctf_event_class_set_log_level(
167 struct bt_ctf_event_class *event_class,
168 enum bt_ctf_event_class_log_level log_level);
169
170extern const char *bt_ctf_event_class_get_emf_uri(
171 struct bt_ctf_event_class *event_class);
172
173extern int bt_ctf_event_class_set_emf_uri(
174 struct bt_ctf_event_class *event_class,
175 const char *emf_uri);
176
177extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_field_type(
178 struct bt_ctf_event_class *event_class);
179
180extern int bt_ctf_event_class_set_context_field_type(
181 struct bt_ctf_event_class *event_class,
182 struct bt_ctf_field_type *context_type);
183
184extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_field_type(
185 struct bt_ctf_event_class *event_class);
186
187extern int bt_ctf_event_class_set_payload_field_type(
188 struct bt_ctf_event_class *event_class,
189 struct bt_ctf_field_type *payload_type);
190
191extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class,
192 struct bt_ctf_field_type *field_type,
193 const char *name);
194
195extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
196 struct bt_ctf_event_class *event_class, const char *name);
197
198/* Pre-2.0 CTF writer compatibility */
199static inline
200void bt_ctf_event_class_get(struct bt_ctf_event_class *event_class)
201{
e1e02a22 202 bt_ctf_object_get_ref(event_class);
3dca2276
PP
203}
204
205/* Pre-2.0 CTF writer compatibility */
206static inline
207void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class)
208{
e1e02a22 209 bt_ctf_object_put_ref(event_class);
3dca2276 210}
8c18d80b
PP
211
212#ifdef __cplusplus
213}
214#endif
215
216#endif /* BABELTRACE_CTF_WRITER_EVENT_H */
This page took 0.058823 seconds and 4 git commands to generate.