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