lib: add "borrow" functions where "get" functions exist
[babeltrace.git] / include / babeltrace / ctf-ir / stream-class.h
CommitLineData
adc315b8
JG
1#ifndef BABELTRACE_CTF_IR_STREAM_CLASS_H
2#define BABELTRACE_CTF_IR_STREAM_CLASS_H
3
4/*
5 * BabelTrace - CTF IR: Stream Class
6 *
de9dd397 7 * Copyright 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
adc315b8
JG
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
48d711a2 33#include <stdint.h>
9d408fca 34
094ff7c0
PP
35/* For bt_get() */
36#include <babeltrace/ref.h>
37
50842bdc 38/* For bt_visitor */
8bf65fbd 39#include <babeltrace/ctf-ir/visitor.h>
48d711a2 40
adc315b8
JG
41#ifdef __cplusplus
42extern "C" {
43#endif
44
594a3fb7
PP
45/**
46@defgroup ctfirstreamclass CTF IR stream class
47@ingroup ctfir
48@brief CTF IR stream class.
49
6dd2bd0c
PP
50@code
51#include <babeltrace/ctf-ir/stream-class.h>
52@endcode
53
319f672c 54@note
dfeca116
PP
55See \ref ctfwriterstreamclass which documents additional CTF IR stream
56class functions exclusive to the CTF writer mode.
319f672c 57
594a3fb7
PP
58A CTF IR <strong><em>stream class</em></strong> is a template that you
59can use to create concrete \link ctfirstream CTF IR streams\endlink.
60
61A stream class has the following properties, both of which \em must
62be unique amongst all the stream classes contained in the same
63\link ctfirtraceclass CTF IR trace class\endlink:
64
65- A \b name.
66- A numeric \b ID.
67
68In the Babeltrace CTF IR system, a \link ctfirtraceclass trace class\endlink
69contains zero or more stream classes,
70and a stream class contains zero or more
71\link ctfireventclass event classes\endlink.
72You can add an event class
50842bdc 73to a stream class with bt_stream_class_add_event_class().
594a3fb7 74You can add a stream class to a trace class with
50842bdc 75bt_trace_add_stream_class().
594a3fb7
PP
76
77A stream class owns three \link ctfirfieldtypes field types\endlink:
78
79- An optional <strong>stream packet context</strong> field type, which
80 represents the \c stream.packet.context CTF scope.
81- An optional <strong>stream event header</strong> field type, which
82 represents the \c stream.event.header CTF scope.
83- An optional <strong>stream event context</strong> field type, which
84 represents the \c stream.event.context CTF scope.
85
86Those three field types \em must be structure field types as of
87Babeltrace \btversion.
88
89As per the CTF specification, the event header field type \em must
90contain a field named \c id if the stream class contains more than one
91event class.
92
93As a reminder, here's the structure of a CTF packet:
94
95@imgpacketstructure
96
97Before you can create a stream from a stream class with
50842bdc
PP
98bt_stream_create(), you \em must add the prepared stream class to a
99trace class by calling bt_trace_add_stream_class().
594a3fb7
PP
100
101As with any Babeltrace object, CTF IR stream class objects have
102<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
103counts</a>. See \ref refs to learn more about the reference counting
104management of Babeltrace objects.
105
106The following functions \em freeze their stream class parameter on
107success:
108
50842bdc
PP
109- bt_trace_add_stream_class()
110- bt_event_create()
111- bt_writer_create_stream()
dfeca116 112 (\link ctfwriter CTF writer\endlink mode only)
594a3fb7
PP
113
114You cannot modify a frozen stream class: it is considered immutable,
115except for:
116
117- Adding an event class to it with
50842bdc 118 bt_stream_class_add_event_class(). If the stream class's parent
e0e2946b 119 \link ctfirtraceclass trace class\endlink is static, however,
50842bdc
PP
120 you cannot call bt_stream_class_add_event_class()
121 (see bt_trace_is_static() and bt_trace_set_is_static()).
594a3fb7
PP
122- \link refs Reference counting\endlink.
123
124@sa ctfirstream
125@sa ctfireventclass
126@sa ctfirtraceclass
dfeca116 127@sa ctfwriterstreamclass
594a3fb7
PP
128
129@file
130@brief CTF IR stream class type and functions.
131@sa ctfirstreamclass
132
133@addtogroup ctfirstreamclass
134@{
135*/
136
137/**
50842bdc 138@struct bt_stream_class
594a3fb7
PP
139@brief A CTF IR stream class.
140@sa ctfirstreamclass
141*/
50842bdc
PP
142struct bt_stream_class;
143struct bt_event_class;
144struct bt_clock;
adc315b8 145
594a3fb7
PP
146/**
147@name Creation and parent access functions
148@{
149*/
150
151/**
152@brief Creates a default CTF IR stream class named \p name­, or a
153 default unnamed stream class if \p name is \c NULL.
154
155On success, the packet context field type of the created stream class
156has the following fields:
157
158- <code>timestamp_begin</code>: a 64-bit unsigned integer field type.
159- <code>timestamp_end</code>: a 64-bit unsigned integer field type.
160- <code>content_size</code>: a 64-bit unsigned integer field type.
161- <code>packet_size</code>: a 64-bit unsigned integer field type.
162- <code>events_discarded</code>: a 64-bit unsigned integer field type.
163
164On success, the event header field type of the created stream class
165has the following fields:
166
167- <code>code</code>: a 32-bit unsigned integer field type.
168- <code>timestamp</code>: a 64-bit unsigned integer field type.
169
170You can modify those default field types after the stream class is
3dca2276
PP
171created with bt_stream_class_set_packet_context_field_type() and
172bt_stream_class_set_event_header_field_type().
594a3fb7 173
e0e2946b
PP
174@param[in] name Name of the stream class to create (copied on success),
175 or \c NULL to create an unnamed stream class.
176@returns Created default stream class, or \c NULL on error.
594a3fb7
PP
177
178@postsuccessrefcountret1
e0e2946b 179
50842bdc 180@sa bt_stream_class_create_empty(): Creates an empty stream class.
594a3fb7 181*/
50842bdc 182extern struct bt_stream_class *bt_stream_class_create(const char *name);
adc315b8 183
094ff7c0
PP
184extern struct bt_trace *bt_stream_class_borrow_trace(
185 struct bt_stream_class *stream_class);
186
594a3fb7
PP
187/**
188@brief Returns the parent CTF IR trace class of the CTF IR stream
189 class \p stream_class.
190
191It is possible that the stream class was not added to a trace class
192yet, in which case this function returns \c NULL. You can add a
193stream class to a trace class with
50842bdc 194bt_trace_add_stream_class().
594a3fb7
PP
195
196@param[in] stream_class Stream class of which to get the parent
197 trace class.
198@returns Parent trace class of \p stream_class,
199 or \c NULL if \p stream_class was not
200 added to a trace class yet or on error.
201
202@prenotnull{stream_class}
c2f29fb9 203@postrefcountsame{stream_class}
594a3fb7
PP
204@postsuccessrefcountretinc
205
50842bdc 206@sa bt_trace_add_stream_class(): Add a stream class to
594a3fb7
PP
207 a trace class.
208*/
094ff7c0
PP
209static inline
210struct bt_trace *bt_stream_class_get_trace(
211 struct bt_stream_class *stream_class)
212{
213 return bt_get(bt_stream_class_borrow_trace(stream_class));
214}
142c5610 215
594a3fb7
PP
216/** @} */
217
218/**
219@name Properties functions
220@{
221*/
222
223/**
224@brief Returns the name of the CTF IR stream class \p stream_class.
225
226On success, \p stream_class remains the sole owner of the returned
227string.
228
229@param[in] stream_class Stream class of which to get the name.
230@returns Name of stream class \p stream_class, or
231 \c NULL if \p stream_class is unnamed or
232 on error.
233
234@prenotnull{stream_class}
235@postrefcountsame{stream_class}
236
50842bdc 237@sa bt_stream_class_set_name(): Sets the name of a given
594a3fb7
PP
238 stream class.
239*/
50842bdc
PP
240extern const char *bt_stream_class_get_name(
241 struct bt_stream_class *stream_class);
69dc4535 242
594a3fb7
PP
243/**
244@brief Sets the name of the CTF IR stream class
03be3bcd
PP
245 \p stream_class to \p name, or resets the name of
246 \p stream_class.
594a3fb7 247
03be3bcd
PP
248If \p name is not \c NULL, it must be unique amongst the names of all
249the stream classes of the trace class to which you eventually add
250\p stream_class.
594a3fb7
PP
251
252@param[in] stream_class Stream class of which to set the name.
03be3bcd
PP
253@param[in] name Name of the stream class (copied on success), or
254 \c NULL to reset the name of \p stream_class
255 (make it unnamed).
594a3fb7
PP
256@returns 0 on success, or a negative value on error.
257
258@prenotnull{stream_class}
594a3fb7
PP
259@prehot{stream_class}
260@postrefcountsame{stream_class}
261
50842bdc 262@sa bt_stream_class_get_name(): Returns the name of a given
594a3fb7
PP
263 stream class.
264*/
50842bdc
PP
265extern int bt_stream_class_set_name(
266 struct bt_stream_class *stream_class, const char *name);
3ea33115 267
594a3fb7
PP
268/**
269@brief Returns the numeric ID of the CTF IR stream class \p stream_class.
2f100782 270
594a3fb7
PP
271@param[in] stream_class Stream class of which to get the numeric ID.
272@returns ID of stream class \p stream_class, or a
273 negative value on error.
274
275@prenotnull{stream_class}
276@postrefcountsame{stream_class}
277
50842bdc 278@sa bt_stream_class_set_id(): Sets the numeric ID of a given
594a3fb7
PP
279 stream class.
280*/
50842bdc
PP
281extern int64_t bt_stream_class_get_id(
282 struct bt_stream_class *stream_class);
2f100782 283
594a3fb7
PP
284/**
285@brief Sets the numeric ID of the CTF IR stream class
286 \p stream_class to \p id.
287
288\p id must be unique amongst the IDs of all the stream classes
289of the trace class to which you eventually add \p stream_class.
290
291@param[in] stream_class Stream class of which to set the numeric ID.
292@param[in] id ID of the stream class.
293@returns 0 on success, or a negative value on error.
294
295@prenotnull{stream_class}
296@prehot{stream_class}
9ac68eb1 297@pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX).
594a3fb7
PP
298@postrefcountsame{stream_class}
299
50842bdc 300@sa bt_stream_class_get_id(): Returns the numeric ID of a given
594a3fb7
PP
301 stream class.
302*/
50842bdc
PP
303extern int bt_stream_class_set_id(
304 struct bt_stream_class *stream_class, uint64_t id);
2f100782 305
594a3fb7 306/** @} */
adc315b8 307
594a3fb7
PP
308/**
309@name Contained field types functions
310@{
311*/
69dc4535 312
094ff7c0
PP
313extern struct bt_field_type *bt_stream_class_borrow_packet_context_field_type(
314 struct bt_stream_class *stream_class);
315
594a3fb7
PP
316/**
317@brief Returns the packet context field type of the CTF IR stream class
318 \p stream_class.
69dc4535 319
594a3fb7
PP
320@param[in] stream_class Stream class of which to get the packet
321 context field type.
322@returns Packet context field type of \p stream_class,
6b783f49
JG
323 or \c NULL if \p stream_class has no packet context
324 field type or on error.
69dc4535 325
594a3fb7 326@prenotnull{stream_class}
c2f29fb9 327@postrefcountsame{stream_class}
6b783f49
JG
328@post <strong>On success, if the return value is a field type</strong>, its
329 reference count is incremented.
0863f950 330
3dca2276 331@sa bt_stream_class_set_packet_context_field_type(): Sets the packet
594a3fb7
PP
332 context field type of a given stream class.
333*/
094ff7c0
PP
334static inline
335struct bt_field_type *bt_stream_class_get_packet_context_field_type(
336 struct bt_stream_class *stream_class)
337{
338 return bt_get(bt_stream_class_borrow_packet_context_field_type(
339 stream_class));
340}
12c8a1a3 341
594a3fb7
PP
342/**
343@brief Sets the packet context field type of the CTF IR stream class
6b783f49
JG
344 \p stream_class to \p packet_context_type, or unsets the current packet
345 context field type from \p stream_class.
346
347If \p packet_context_type is \c NULL, then this function unsets the current
348packet context field type from \p stream_class, effectively making
349\p stream_class a stream class without a packet context field type.
594a3fb7 350
6b783f49
JG
351As of Babeltrace \btversion, if \p packet_context_type is not \c NULL,
352\p packet_context_type \em must be a CTF IR structure field type object.
594a3fb7
PP
353
354@param[in] stream_class Stream class of which to set the packet
355 context field type.
6b783f49
JG
356@param[in] packet_context_type Packet context field type, or \c NULL to unset
357 the current packet context field type.
594a3fb7
PP
358@returns 0 on success, or a negative value on error.
359
360@prenotnull{stream_class}
594a3fb7 361@prehot{stream_class}
6b783f49
JG
362@pre <strong>\p packet_context_type, if not \c NULL</strong>, is a CTF IR
363 structure field type.
594a3fb7 364@postrefcountsame{stream_class}
6b783f49
JG
365@post <strong>On success, if \p packet_context_type is not \c NULL</strong>,
366 the reference count of \p packet_context_type is incremented.
594a3fb7 367
3dca2276 368@sa bt_stream_class_get_packet_context_field_type(): Returns the packet
594a3fb7
PP
369 context field type of a given stream class.
370*/
3dca2276 371extern int bt_stream_class_set_packet_context_field_type(
50842bdc
PP
372 struct bt_stream_class *stream_class,
373 struct bt_field_type *packet_context_type);
12c8a1a3 374
094ff7c0
PP
375extern struct bt_field_type *
376bt_stream_class_borrow_event_header_field_type(
377 struct bt_stream_class *stream_class);
378
594a3fb7
PP
379/**
380@brief Returns the event header field type of the CTF IR stream class
381 \p stream_class.
382
383@param[in] stream_class Stream class of which to get the event header
384 field type.
385@returns Event header field type of \p stream_class,
6b783f49
JG
386 or \c NULL if \p stream_class has no event header field
387 type or on error.
594a3fb7
PP
388
389@prenotnull{stream_class}
c2f29fb9 390@postrefcountsame{stream_class}
6b783f49
JG
391@post <strong>On success, if the return value is a field type</strong>, its
392 reference count is incremented.
594a3fb7 393
3dca2276 394@sa bt_stream_class_set_event_header_field_type(): Sets the event
594a3fb7
PP
395 header field type of a given stream class.
396*/
094ff7c0
PP
397static inline
398struct bt_field_type *bt_stream_class_get_event_header_field_type(
399 struct bt_stream_class *stream_class)
400{
401 return bt_get(bt_stream_class_borrow_event_header_field_type(
402 stream_class));
403}
662e778c 404
594a3fb7
PP
405/**
406@brief Sets the event header field type of the CTF IR stream class
6b783f49
JG
407 \p stream_class to \p event_header_type, or unsets the current event
408 header field type from \p stream_class.
409
410If \p event_header_type is \c NULL, then this function unsets the current
411event header field type from \p stream_class, effectively making \p stream_class
412a stream class without a event header field type.
594a3fb7 413
6b783f49
JG
414As of Babeltrace \btversion, if \p event_header_type is not \c NULL,
415\p event_header_type \em must be a CTF IR structure field type object.
594a3fb7 416
b2481397 417@param[in] stream_class Stream class of which to set the event
594a3fb7 418 header field type.
6b783f49
JG
419@param[in] event_header_type Event header field type, or \c NULL to unset
420 the current event header field type.
594a3fb7
PP
421@returns 0 on success, or a negative value on error.
422
423@prenotnull{stream_class}
594a3fb7 424@prehot{stream_class}
6b783f49
JG
425@pre <strong>\p event_header_type, if not \c NULL</strong>, is a CTF IR
426 structure field type.
594a3fb7 427@postrefcountsame{stream_class}
6b783f49
JG
428@post <strong>On success, if \p event_header_type is not \c NULL</strong>,
429 the reference count of \p event_header_type is incremented.
594a3fb7 430
3dca2276 431@sa bt_stream_class_get_event_header_field_type(): Returns the event
b2481397 432 header field type of a given stream class.
594a3fb7 433*/
3dca2276 434extern int bt_stream_class_set_event_header_field_type(
50842bdc
PP
435 struct bt_stream_class *stream_class,
436 struct bt_field_type *event_header_type);
662e778c 437
094ff7c0
PP
438extern struct bt_field_type *
439bt_stream_class_borrow_event_context_field_type(
440 struct bt_stream_class *stream_class);
441
594a3fb7 442/**
6b783f49
JG
443@brief Returns the event context field type of the CTF IR stream class
444 \p stream_class.
594a3fb7 445
6b783f49
JG
446@param[in] stream_class Stream class of which to get the event context
447 field type.
448@returns Event context field type of \p stream_class,
449 or \c NULL if \p stream_class has no event context field
450 type or on error.
594a3fb7
PP
451
452@prenotnull{stream_class}
c2f29fb9 453@postrefcountsame{stream_class}
6b783f49
JG
454@post <strong>On success, if the return value is a field type</strong>,
455 its reference count is incremented.
456
594a3fb7 457
3dca2276 458@sa bt_stream_class_set_event_context_field_type(): Sets the event
6b783f49 459 context field type of a given stream class.
594a3fb7 460*/
094ff7c0
PP
461static inline
462struct bt_field_type *
3dca2276 463bt_stream_class_get_event_context_field_type(
094ff7c0
PP
464 struct bt_stream_class *stream_class)
465{
466 return bt_get(bt_stream_class_borrow_event_context_field_type(
467 stream_class));
468}
af181248 469
594a3fb7 470/**
6b783f49
JG
471@brief Sets the event context field type of the CTF IR stream class
472 \p stream_class to \p event_context_type, or unsets the current event
473 context field type from \p stream_class.
594a3fb7 474
6b783f49
JG
475If \p event_context_type is \c NULL, then this function unsets the current
476event context field type from \p stream_class, effectively making \p
477stream_class a stream class without a event context field type.
594a3fb7 478
6b783f49
JG
479As of Babeltrace \btversion, if \p event_context_type is not \c NULL,
480\p event_context_type \em must be a CTF IR structure field type object.
481
482@param[in] stream_class Stream class of which to set the packet
483 context field type.
484@param[in] event_context_type Event context field type, or \c NULL to unset
485 the current event context field type.
594a3fb7
PP
486@returns 0 on success, or a negative value on error.
487
488@prenotnull{stream_class}
594a3fb7 489@prehot{stream_class}
6b783f49
JG
490@pre <strong>\p event_context_type, if not \c NULL</strong>, is a CTF IR
491 structure field type.
594a3fb7 492@postrefcountsame{stream_class}
6b783f49
JG
493@post <strong>On success, if \p event_context_type is not \c NULL</strong>,
494 the reference count of \p event_context_type is incremented.
594a3fb7 495
3dca2276 496@sa bt_stream_class_get_event_context_field_type(): Returns the event context
6b783f49 497 field type of a given stream class.
594a3fb7 498*/
3dca2276 499extern int bt_stream_class_set_event_context_field_type(
50842bdc
PP
500 struct bt_stream_class *stream_class,
501 struct bt_field_type *event_context_type);
af181248 502
594a3fb7
PP
503/** @} */
504
505/**
506@name Event class children functions
507@{
508*/
509
510/**
511@brief Returns the number of event classes contained in the
512 CTF IR stream class \p stream_class.
513
514@param[in] stream_class Stream class of which to get the number
515 of children event classes.
516@returns Number of children event classes
517 contained in \p stream_class, or
518 a negative value on error.
519
520@prenotnull{stream_class}
521@postrefcountsame{stream_class}
522*/
50842bdc
PP
523extern int64_t bt_stream_class_get_event_class_count(
524 struct bt_stream_class *stream_class);
594a3fb7 525
094ff7c0
PP
526extern struct bt_event_class *bt_stream_class_borrow_event_class_by_index(
527 struct bt_stream_class *stream_class, uint64_t index);
528
594a3fb7
PP
529/**
530@brief Returns the event class at index \p index in the CTF IR stream
531 class \p stream_class.
532
533@param[in] stream_class Stream class of which to get the event class.
534@param[in] index Index of the event class to find.
535@returns Event class at index \p index, or \c NULL
536 on error.
537
538@prenotnull{stream_class}
539@pre \p index is lesser than the number of event classes contained in the
540 stream class \p stream_class (see
50842bdc 541 bt_stream_class_get_event_class_count()).
594a3fb7
PP
542@postrefcountsame{stream_class}
543@postsuccessrefcountretinc
544
50842bdc 545@sa bt_stream_class_get_event_class_by_id(): Finds an event class
594a3fb7 546 by ID.
594a3fb7 547*/
094ff7c0
PP
548static inline
549struct bt_event_class *bt_stream_class_get_event_class_by_index(
550 struct bt_stream_class *stream_class, uint64_t index)
551{
552 return bt_get(bt_stream_class_borrow_event_class_by_index(stream_class,
553 index));
554}
555
556extern struct bt_event_class *bt_stream_class_borrow_event_class_by_id(
557 struct bt_stream_class *stream_class, uint64_t id);
594a3fb7 558
594a3fb7
PP
559/**
560@brief Returns the event class with ID \c id found in the CTF IR stream
561 class \p stream_class.
562
563@param[in] stream_class Stream class of which to get the event class.
564@param[in] id ID of the event class to find.
565@returns Event class with ID \p id, or \c NULL
566 on error.
567
568@prenotnull{stream_class}
569@postrefcountsame{stream_class}
570@postsuccessrefcountretinc
594a3fb7 571*/
094ff7c0
PP
572static inline
573struct bt_event_class *bt_stream_class_get_event_class_by_id(
574 struct bt_stream_class *stream_class, uint64_t id)
575{
576 return bt_get(bt_stream_class_borrow_event_class_by_id(stream_class,
577 id));
578}
594a3fb7
PP
579
580/**
581@brief Adds the CTF IR event class \p event_class to the
582 CTF IR stream class \p stream_class.
583
584On success, \p event_class becomes the child of \p stream_class.
585
586You can only add a given event class to one stream class.
587
588You can call this function even if \p stream_class is frozen. Adding
589event classes is the only operation that is permitted
590on a frozen stream class.
591
4cdafd51
PP
592This function tries to resolve the needed
593\link ctfirfieldtypes CTF IR field type\endlink of the dynamic field
594types that are found anywhere in the context or payload field
595types of \p event_class. If any automatic resolving fails:
596
597- If the needed field type should be found in one of the root field
598 types of \p event_class or \p stream_class, this function fails.
599- If \p stream_class is the child of a
600 \link ctfirtraceclass CTF IR trace class\endlink (it was added
50842bdc 601 with bt_trace_add_stream_class()), this function fails.
4cdafd51
PP
602- If \p stream_class is not the child of a trace class yet, the
603 automatic resolving is reported to the next call to
50842bdc 604 bt_trace_add_stream_class() with \p stream_class.
4cdafd51 605
594a3fb7
PP
606@param[in] stream_class Stream class to which to add \p event_class.
607@param[in] event_class Event class to add to \p stream_class.
608@returns 0 on success, or a negative value on error.
609
610@prenotnull{stream_class}
611@prenotnull{event_class}
612@prehot{event_class}
613@postrefcountsame{stream_class}
614@postsuccessrefcountinc{event_class}
2fc61597 615@postsuccessfrozen{event_class}
594a3fb7 616*/
50842bdc
PP
617extern int bt_stream_class_add_event_class(
618 struct bt_stream_class *stream_class,
619 struct bt_event_class *event_class);
594a3fb7
PP
620
621/** @} */
622
623/**
624@name Misc. function
625@{
626*/
627
628/**
629@brief Accepts the visitor \p visitor to visit the hierarchy of the
630 CTF IR stream class \p stream_class.
631
632This function traverses the hierarchy of \p stream_class in pre-order
633and calls \p visitor on each element.
634
635The stream class itself is visited first, and then all its children
636event classes.
637
638@param[in] stream_class Stream class to visit.
639@param[in] visitor Visiting function.
640@param[in] data User data.
641@returns 0 on success, or a negative value on error.
642
643@prenotnull{stream_class}
644@prenotnull{visitor}
645*/
50842bdc
PP
646extern int bt_stream_class_visit(struct bt_stream_class *stream_class,
647 bt_visitor visitor, void *data);
8bf65fbd 648
594a3fb7
PP
649/** @} */
650
651/** @} */
652
adc315b8
JG
653#ifdef __cplusplus
654}
655#endif
656
657#endif /* BABELTRACE_CTF_IR_STREAM_CLASS_H */
This page took 0.075222 seconds and 4 git commands to generate.