Remove the concept of event class attributes
[babeltrace.git] / include / babeltrace / ctf-ir / event-class.h
CommitLineData
272df73e
PP
1#ifndef BABELTRACE_CTF_IR_EVENT_CLASS_H
2#define BABELTRACE_CTF_IR_EVENT_CLASS_H
3
4/*
5 * BabelTrace - CTF IR: Event class
6 *
7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 *
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 *
29 * The Common Trace Format (CTF) Specification is available at
30 * http://www.efficios.com/ctf
31 */
32
33#include <stdint.h>
34#include <stddef.h>
35#include <babeltrace/values.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
d5a28207
PP
41/**
42@defgroup ctfireventclass CTF IR event class
43@ingroup ctfir
44@brief CTF IR event class.
45
6dd2bd0c
PP
46@code
47#include <babeltrace/ctf-ir/event-class.h>
48@endcode
49
d5a28207
PP
50A CTF IR <strong><em>event class</em></strong> is a template that you
51can use to create concrete \link ctfirevent CTF IR events\endlink.
52
cf76ce92 53An event class has the following properties:
d5a28207
PP
54
55- A \b name.
cf76ce92
PP
56- A numeric \b ID (\em must be unique amongst all the event classes
57 contained in the same
58 \link ctfirstreamclass CTF IR stream class\endlink).
59- A optional <strong>log level</strong>.
60- An optional <strong>Eclipse Modeling Framework URI</strong>.
d5a28207
PP
61
62A CTF IR event class owns two
63\link ctfirfieldtypes field types\endlink:
64
65- An optional <strong>event context</strong> field type, which
66 represents the \c event.context CTF scope.
67- A mandatory <strong>event payload</strong> field type, which
68 represents the \c event.fields CTF scope.
69
70Both field types \em must be structure field types as of
71Babeltrace \btversion.
72The event payload field type <em>must not</em> be empty.
73
74As a reminder, here's the structure of a CTF packet:
75
76@imgpacketstructure
77
78In the Babeltrace CTF IR system, a \link ctfirtraceclass trace
79class\endlink contains zero or more \link ctfirstreamclass stream
80classes\endlink, and a stream class contains zero or more event classes.
81
82Before you can create an event from an event class with
83bt_ctf_event_create(), you \em must add the prepared event class to a
84stream class by calling bt_ctf_stream_class_add_event_class(). This
85function, when successful, \em freezes the event class, disallowing any
86future modification of its properties and field types by the user.
87
88As with any Babeltrace object, CTF IR event class objects have
89<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
90counts</a>. See \ref refs to learn more about the reference counting
91management of Babeltrace objects.
92
93bt_ctf_stream_class_add_event_class() \em freezes its event class
94parameter on success. You cannot modify a frozen event class: it is
95considered immutable, except for \link refs reference counting\endlink.
96
97@sa ctfirevent
98@sa ctfirstreamclass
99
100@file
101@brief CTF IR event class type and functions.
102@sa ctfireventclass
103
104@addtogroup ctfireventclass
105@{
106*/
107
108/**
109@struct bt_ctf_event_class
110@brief A CTF IR event class.
111@sa ctfireventclass
112*/
272df73e
PP
113struct bt_ctf_event_class;
114struct bt_ctf_field;
115struct bt_ctf_field_type;
116struct bt_ctf_stream_class;
117
cf76ce92
PP
118/**
119@brief Log level of an event class.
120*/
121enum bt_ctf_event_class_log_level {
122 /// Unknown, used for errors.
123 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1,
124
125 /// Unspecified log level.
126 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255,
127
128 /// System is unusable.
129 BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0,
130
131 /// Action must be taken immediately.
132 BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1,
133
134 /// Critical conditions.
135 BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2,
136
137 /// Error conditions.
138 BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3,
139
140 /// Warning conditions.
141 BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4,
142
143 /// Normal, but significant, condition.
144 BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5,
145
146 /// Informational message.
147 BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6,
148
149 /// Debug information with system-level scope (set of programs).
150 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7,
151
152 /// Debug information with program-level scope (set of processes).
153 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8,
154
155 /// Debug information with process-level scope (set of modules).
156 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9,
157
158 /// Debug information with module (executable/library) scope (set of units).
159 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10,
160
161 /// Debug information with compilation unit scope (set of functions).
162 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11,
163
164 /// Debug information with function-level scope.
165 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12,
166
167 /// Debug information with line-level scope (default log level).
168 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13,
169
170 /// Debug-level message.
171 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14,
172};
173
d5a28207
PP
174/**
175@name Creation and parent access functions
176@{
177*/
178
179/**
180@brief Creates a default CTF IR event class named \p name­.
181
53a1cae7
PP
182On success, the context and payload field types are empty structure
183field types. You can modify those default field types after the
184event class is created with
185bt_ctf_event_class_set_context_type() and
186bt_ctf_event_class_set_payload_type().
d5a28207
PP
187
188Upon creation, the event class's ID is <em>not set</em>. You
189can set it to a specific value with bt_ctf_event_class_set_id(). If it
190is still unset when you call bt_ctf_stream_class_add_event_class(), then
191the stream class assigns a unique ID to this event class before
192freezing it.
193
cf76ce92
PP
194The created event class's log level is initially set to
195#BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED and it has no Eclipse Modeling
196Framework URI.
197
d5a28207
PP
198@param[in] name Name of the event class to create (copied on success).
199@returns Created event class, or \c NULL on error.
200
201@prenotnull{name}
202@postsuccessrefcountret1
203*/
272df73e
PP
204extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name);
205
d5a28207
PP
206/**
207@brief Returns the parent CTF IR stream class of the CTF IR event
208 class \p event_class.
209
210It is possible that the event class was not added to a stream class
211yet, in which case this function returns \c NULL. You can add an
212event class to a stream class with
213bt_ctf_stream_class_add_event_class().
214
215@param[in] event_class Event class of which to get the parent
216 stream class.
217@returns Parent stream class of \p event_class,
218 or \c NULL if \p event_class was not
219 added to a stream class yet or on error.
220
221@prenotnull{event_class}
c2f29fb9 222@postrefcountsame{event_class}
d5a28207
PP
223@postsuccessrefcountretinc
224
225@sa bt_ctf_stream_class_add_event_class(): Add an event class to
226 a stream class.
227*/
228extern struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class(
229 struct bt_ctf_event_class *event_class);
230
231/** @} */
232
233/**
234@name Attribute functions
235@{
236*/
237
238/**
239@brief Returns the name of the CTF IR event class \p event_class.
240
241On success, \p event_class remains the sole owner of the returned
242string.
243
244@param[in] event_class Event class of which to get the name.
245@returns Name of event class \p event_class, or
246 \c NULL on error.
247
248@prenotnull{event_class}
249@postrefcountsame{event_class}
250*/
272df73e
PP
251extern const char *bt_ctf_event_class_get_name(
252 struct bt_ctf_event_class *event_class);
253
d5a28207
PP
254/**
255@brief Returns the numeric ID of the CTF IR event class \p event_class.
256
257@param[in] event_class Event class of which to get the numeric ID.
258@returns ID of event class \p event_class, or a
259 negative value on error.
260
261@prenotnull{event_class}
262@postrefcountsame{event_class}
263
264@sa bt_ctf_event_class_set_id(): Sets the numeric ID of a given
265 event class.
266*/
272df73e
PP
267extern int64_t bt_ctf_event_class_get_id(
268 struct bt_ctf_event_class *event_class);
269
d5a28207
PP
270/**
271@brief Sets the numeric ID of the CTF IR event class
272 \p event_class to \p id.
273
274\p id must be unique amongst the IDs of all the event classes
275of the stream class to which you eventually add \p event_class.
276
277@param[in] event_class Event class of which to set the numeric ID.
278@param[in] id ID of the event class.
279@returns 0 on success, or a negative value on error.
280
281@prenotnull{event_class}
282@prehot{event_class}
9ac68eb1 283@pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX).
d5a28207
PP
284@postrefcountsame{event_class}
285
286@sa bt_ctf_event_class_get_id(): Returns the numeric ID of a given
287 event class.
288*/
272df73e 289extern int bt_ctf_event_class_set_id(
9ac68eb1 290 struct bt_ctf_event_class *event_class, uint64_t id);
272df73e 291
d5a28207 292/**
cf76ce92 293@brief Returns the log level of the CTF IR event class \p event_class.
272df73e 294
cf76ce92
PP
295@param[in] event_class Event class of which to get the log level.
296@returns Log level of event class \p event_class,
297 #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED if
298 not specified, or
299 #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN on error.
d5a28207
PP
300
301@prenotnull{event_class}
302@postrefcountsame{event_class}
303
cf76ce92
PP
304@sa bt_ctf_event_class_set_log_level(): Sets the log level of a given
305 event class.
d5a28207 306*/
cf76ce92 307extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level(
272df73e
PP
308 struct bt_ctf_event_class *event_class);
309
d5a28207 310/**
cf76ce92
PP
311@brief Sets the log level of the CTF IR event class
312 \p event_class to \p log_level.
d5a28207 313
cf76ce92
PP
314@param[in] event_class Event class of which to set the log level.
315@param[in] log_level Log level of the event class.
316@returns 0 on success, or a negative value on error.
d5a28207
PP
317
318@prenotnull{event_class}
cf76ce92
PP
319@prehot{event_class}
320@pre \p log_level is #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED,
321 #BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY,
322 #BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT,
323 #BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL,
324 #BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR,
325 #BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING,
326 #BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE,
327 #BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO,
328 #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM,
329 #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM,
330 #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS,
331 #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE,
332 #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT,
333 #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION,
334 #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE, or
335 #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG.
d5a28207
PP
336@postrefcountsame{event_class}
337
cf76ce92
PP
338@sa bt_ctf_event_class_get_log_level(): Returns the log level of a given
339 event class.
d5a28207 340*/
cf76ce92
PP
341extern int bt_ctf_event_class_set_log_level(
342 struct bt_ctf_event_class *event_class,
343 enum bt_ctf_event_class_log_level log_level);
272df73e 344
d5a28207 345/**
cf76ce92
PP
346@brief Returns the Eclipse Modeling Framework URI of the CTF IR event
347 class \p event_class.
d5a28207 348
cf76ce92
PP
349@param[in] event_class Event class of which to get the
350 Eclipse Modeling Framework URI.
351@returns Eclipse Modeling Framework URI of event
352 class \p event_class, or \c NULL on error.
d5a28207
PP
353
354@prenotnull{event_class}
d5a28207
PP
355@postrefcountsame{event_class}
356
cf76ce92
PP
357@sa bt_ctf_event_class_set_emf_uri(): Sets the Eclipse Modeling
358 Framework URI of a given event class.
d5a28207 359*/
cf76ce92
PP
360extern const char *bt_ctf_event_class_get_emf_uri(
361 struct bt_ctf_event_class *event_class);
272df73e 362
d5a28207 363/**
cf76ce92
PP
364@brief Sets the Eclipse Modeling Framework URI of the CTF IR event class
365 \p event_class to \p emf_uri, or unsets the event class's EMF URI.
d5a28207 366
cf76ce92
PP
367@param[in] event_class Event class of which to set the
368 Eclipse Modeling Framework URI.
369@param[in] emf_uri Eclipse Modeling Framework URI of the
370 event class (copied on success), or \c NULL
371 to unset the current EMF URI.
372@returns 0 on success, or a negative value if there's
373 no EMF URI or on error.
d5a28207
PP
374
375@prenotnull{event_class}
cf76ce92 376@prenotnull{emf_uri}
d5a28207
PP
377@prehot{event_class}
378@postrefcountsame{event_class}
d5a28207 379
cf76ce92
PP
380@sa bt_ctf_event_class_get_emf_uri(): Returns the Eclipse Modeling
381 Framework URI of a given event class.
d5a28207 382*/
cf76ce92
PP
383extern int bt_ctf_event_class_set_emf_uri(
384 struct bt_ctf_event_class *event_class,
385 const char *emf_uri);
d5a28207
PP
386
387/** @} */
388
389/**
390@name Contained field types functions
391@{
392*/
393
29620c97
PP
394/**
395@brief Returns the context field type of the CTF IR event class
396 \p event_class.
397
6b783f49
JG
398@param[in] event_class Event class of which to get the context field type.
399@returns Context field type of \p event_class, or \c NULL if
400 \p event_class has no context field type or on error.
29620c97
PP
401
402@prenotnull{event_class}
c2f29fb9 403@postrefcountsame{event_class}
6b783f49
JG
404@post <strong>On success, if the return value is a field type</strong>, its
405 reference count is incremented.
29620c97 406
6b783f49
JG
407@sa bt_ctf_event_class_set_context_type(): Sets the context field type of a
408 given event class.
29620c97
PP
409*/
410extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_type(
411 struct bt_ctf_event_class *event_class);
412
413/**
6b783f49
JG
414@brief Sets the context field type of the CTF IR event class \p event_class to
415 \p context_type, or unsets the current context field type from
416 \p event_class.
29620c97 417
6b783f49
JG
418If \p context_type is \c NULL, then this function unsets the current context
419field type from \p event_class, effectively making \p event_class an event class
420without a context field type.
29620c97 421
6b783f49
JG
422As of Babeltrace \btversion, if \p context_type is not \c NULL,
423\p context_type \em must be a CTF IR structure field type object.
424
425@param[in] event_class Event class of which to set the context field
426 type.
427@param[in] context_type Context field type, or \c NULL to unset the
428 current context field type.
429@returns 0 on success, or a negative value on error.
29620c97
PP
430
431@prenotnull{event_class}
29620c97 432@prehot{event_class}
6b783f49
JG
433@pre <strong>If \p context_type is not \c NULL</strong>, \p context_type is a
434 CTF IR structure field type.
29620c97 435@postrefcountsame{event_class}
6b783f49
JG
436@post <strong>On success, if \p context_type is not \c NULL</strong>,
437 the reference count of \p context_type is incremented.
29620c97 438
6b783f49
JG
439@sa bt_ctf_event_class_get_context_type(): Returns the context field type of a
440 given event class.
29620c97
PP
441*/
442extern int bt_ctf_event_class_set_context_type(
443 struct bt_ctf_event_class *event_class,
444 struct bt_ctf_field_type *context_type);
445
d5a28207
PP
446/**
447@brief Returns the payload field type of the CTF IR event class
448 \p event_class.
449
6b783f49
JG
450@param[in] event_class Event class of which to get the payload field type.
451@returns Payload field type of \p event_class, or \c NULL if
452 \p event_class has no payload field type or on error.
d5a28207
PP
453
454@prenotnull{event_class}
c2f29fb9 455@postrefcountsame{event_class}
6b783f49
JG
456@post <strong>On success, if the return value is a field type</strong>, its
457 reference count is incremented.
d5a28207 458
6b783f49
JG
459@sa bt_ctf_event_class_set_payload_type(): Sets the payload field type of a
460 given event class.
d5a28207 461*/
272df73e
PP
462extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_type(
463 struct bt_ctf_event_class *event_class);
464
d5a28207 465/**
6b783f49
JG
466@brief Sets the payload field type of the CTF IR event class \p event_class to
467 \p payload_type, or unsets the current payload field type from
468 \p event_class.
d5a28207 469
6b783f49
JG
470If \p payload_type is \c NULL, then this function unsets the current payload
471field type from \p event_class, effectively making \p event_class an event class
472without a payload field type.
d5a28207 473
6b783f49
JG
474As of Babeltrace \btversion, if \p payload_type is not \c NULL,
475\p payload_type \em must be a CTF IR structure field type object.
476
477@param[in] event_class Event class of which to set the payload field
478 type.
479@param[in] payload_type Payload field type, or \c NULL to unset the
480 current payload field type.
481@returns 0 on success, or a negative value on error.
d5a28207
PP
482
483@prenotnull{event_class}
d5a28207 484@prehot{event_class}
6b783f49
JG
485@pre <strong>If \p payload_type is not \c NULL</strong>, \p payload_type is a
486 CTF IR structure field type.
d5a28207 487@postrefcountsame{event_class}
6b783f49
JG
488@post <strong>On success, if \p payload_type is not \c NULL</strong>,
489 the reference count of \p payload_type is incremented.
d5a28207 490
6b783f49
JG
491@sa bt_ctf_event_class_get_payload_type(): Returns the payload field type of a
492 given event class.
d5a28207 493*/
272df73e
PP
494extern int bt_ctf_event_class_set_payload_type(
495 struct bt_ctf_event_class *event_class,
d5a28207 496 struct bt_ctf_field_type *payload_type);
272df73e 497
d5a28207
PP
498/**
499@brief Returns the number of fields contained in the
500 payload field type of the CTF IR event class \p event_class.
272df73e 501
d5a28207
PP
502@remarks
503Calling this function is the equivalent of getting the payload field
504type of \p event_class with bt_ctf_event_class_get_payload_type() and
505getting its field count with
506bt_ctf_field_type_structure_get_field_count().
507
508@param[in] event_class Event class of which to get the number
509 of fields contained in its payload field type.
510@returns Number of fields in the payload field type
511 of \p event_class, or a negative value on error.
512
513@prenotnull{event_class}
514@postrefcountsame{event_class}
515*/
9ac68eb1 516extern int64_t bt_ctf_event_class_get_payload_type_field_count(
272df73e
PP
517 struct bt_ctf_event_class *event_class);
518
d5a28207
PP
519/**
520@brief Returns the type and the name of the field at index \p index
521 in the payload field type of the CTF IR event class
522 \p event_class.
523
524On success, the field's type is placed in \p *field_type if
525\p field_type is not \c NULL. The field's name is placed in
526\p *name if \p name is not \c NULL. \p event_class remains the sole
527owner of \p *name.
528
529Both \p name and \p field_type can be \c NULL if the caller is not
530interested in one of them.
531
532@remarks
533Calling this function is the equivalent of getting the payload field
534type of \p event_class with bt_ctf_event_class_get_payload_type() and
535getting the type and name of one of its field with
536bt_ctf_field_type_structure_get_field().
537
538@param[in] event_class Event class of which to get the type and name
539 of a field in its payload field type.
540@param[out] field_name Name of the field at the index
541 \p index in the payload field type of
542 \p event_class (can be \c NULL).
543@param[out] field_type Type of the field at the index \p index in the
544 payload field type of \p event_class
545 (can be \c NULL).
546@param[in] index Index of the payload field type's field to find.
547@returns 0 on success, or a negative value on error.
548
549@prenotnull{event_class}
550@pre \p index is lesser than the number of fields contained in the
551 payload field type of \p event_class (see
9ac68eb1 552 bt_ctf_event_class_get_payload_type_field_count()).
d5a28207
PP
553@postrefcountsame{event_class}
554@post <strong>On success, if \p field_type is not \c NULL</strong>, the
555 reference count of \p *field_type is incremented.
556*/
9ac68eb1
PP
557extern int bt_ctf_event_class_get_payload_type_field_by_index(
558 struct bt_ctf_event_class *event_class,
272df73e 559 const char **field_name, struct bt_ctf_field_type **field_type,
9ac68eb1 560 uint64_t index);
272df73e 561
d5a28207
PP
562/**
563@brief Returns the type of the field named \p name in the payload
564 field type of the CTF IR event class \p event_class.
565
566@remarks
567Calling this function is the equivalent of getting the payload field
568type of \p event_class with bt_ctf_event_class_get_payload_type() and
569getting the type of one of its field with
570bt_ctf_field_type_structure_get_field_type_by_name().
571
572@param[in] event_class Event class of which to get the type of a
573 payload field type's field.
574@param[in] name Name of the payload field type's field to get.
575@returns Type of the field named \p name in the payload
576 field type of \p event_class, or \c NULL if
577 the function cannot find the field or
578 on error.
579
580@prenotnull{event_class}
581@prenotnull{name}
582@postrefcountsame{event_class}
583@postsuccessrefcountretinc
d5a28207 584*/
9ac68eb1
PP
585extern struct bt_ctf_field_type *
586bt_ctf_event_class_get_payload_type_field_type_by_name(
272df73e
PP
587 struct bt_ctf_event_class *event_class, const char *name);
588
9ac68eb1
PP
589/* Pre-2.0 CTF writer compatibility */
590#define bt_ctf_event_class_get_field_by_name bt_ctf_event_class_get_payload_type_field_type_by_name
591
d5a28207
PP
592/**
593@brief Adds a field named \p name with the type \p field_type to the
594 payload field type of the CTF IR event class \p event_class.
595
596@remarks
597Calling this function is the equivalent of getting the payload field
598type of \p event_class with bt_ctf_event_class_get_payload_type() and
599adding a field to it with bt_ctf_field_type_structure_add_field().
600
601@param[in] event_class Event class containing the payload field
602 type in which to add a field.
603@param[in] field_type Type of the field to add.
604@param[in] name Name of the field to add (copied on
605 success).
606@returns 0 on success, or a negative value on error.
607
608@prenotnull{event_class}
609@prenotnull{type}
610@prenotnull{name}
611@prehot{event_class}
612@postrefcountsame{event_class}
613@postsuccessrefcountinc{field_type}
614*/
615extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class,
616 struct bt_ctf_field_type *field_type,
617 const char *name);
618
d5a28207
PP
619/** @} */
620
621/** @} */
272df73e 622
272df73e
PP
623#ifdef __cplusplus
624}
625#endif
626
627#endif /* BABELTRACE_CTF_IR_EVENT_CLASS_H */
This page took 0.059479 seconds and 4 git commands to generate.