Babeltrace 2 C API  2.1.1
Open-source trace manipulation framework
stream.h
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5  */
6 
7 #ifndef BABELTRACE2_TRACE_IR_STREAM_H
8 #define BABELTRACE2_TRACE_IR_STREAM_H
9 
10 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11 
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
14 #endif
15 
16 #include <stdint.h>
17 
18 #include <babeltrace2/types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
245 extern bt_stream *bt_stream_create(bt_stream_class *stream_class,
246  bt_trace *trace) __BT_NOEXCEPT;
247 
313  bt_stream_class *stream_class,
314  bt_trace *trace, uint64_t id) __BT_NOEXCEPT;
315 
339 extern bt_stream_class *bt_stream_borrow_class(bt_stream *stream) __BT_NOEXCEPT;
340 
349  const bt_stream *stream) __BT_NOEXCEPT;
350 
373 extern bt_trace *bt_stream_borrow_trace(bt_stream *stream) __BT_NOEXCEPT;
374 
383  const bt_stream *stream) __BT_NOEXCEPT;
384 
410 extern uint64_t bt_stream_get_id(const bt_stream *stream) __BT_NOEXCEPT;
411 
421  BT_STREAM_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
422 
427  BT_STREAM_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
429 
455  const char *name) __BT_NOEXCEPT;
456 
481 extern const char *bt_stream_get_name(const bt_stream *stream) __BT_NOEXCEPT;
482 
513  bt_stream *stream, const bt_value *user_attributes)
514  __BT_NOEXCEPT;
515 
542  __BT_NOEXCEPT;
543 
552  const bt_stream *stream) __BT_NOEXCEPT;
553 
576 extern void bt_stream_get_ref(const bt_stream *stream) __BT_NOEXCEPT;
577 
593 extern void bt_stream_put_ref(const bt_stream *stream) __BT_NOEXCEPT;
594 
609 #define BT_STREAM_PUT_REF_AND_RESET(_stream) \
610  do { \
611  bt_stream_put_ref(_stream); \
612  (_stream) = NULL; \
613  } while (0)
614 
640 #define BT_STREAM_MOVE_REF(_dst, _src) \
641  do { \
642  bt_stream_put_ref(_dst); \
643  (_dst) = (_src); \
644  (_src) = NULL; \
645  } while (0)
646 
651 #ifdef __cplusplus
652 }
653 #endif
654 
655 #endif /* BABELTRACE2_TRACE_IR_STREAM_H */
Out of memory.
Definition: stream.h:427
const bt_trace * bt_stream_borrow_trace_const(const bt_stream *stream)
Borrows the trace which contains the stream stream (const version).
const bt_value * bt_stream_borrow_user_attributes_const(const bt_stream *stream)
Borrows the user attributes of the stream stream (const version).
bt_stream * bt_stream_create_with_id(bt_stream_class *stream_class, bt_trace *trace, uint64_t id)
Creates a stream with the numeric ID id from the stream class stream_class and adds it to the trace t...
const char * bt_stream_get_name(const bt_stream *stream)
Returns the name of the stream stream.
bt_trace * bt_stream_borrow_trace(bt_stream *stream)
Borrows the trace which contains the stream stream.
bt_stream_class * bt_stream_borrow_class(bt_stream *stream)
Borrows the class of the stream stream.
bt_value * bt_stream_borrow_user_attributes(bt_stream *stream)
Borrows the user attributes of the stream stream.
void bt_stream_set_user_attributes(bt_stream *stream, const bt_value *user_attributes)
Sets the user attributes of the stream stream to user_attributes.
bt_stream * bt_stream_create(bt_stream_class *stream_class, bt_trace *trace)
Creates a stream from the stream class stream_class and adds it to the trace trace.
bt_stream_set_name_status
Status codes for bt_stream_set_name().
Definition: stream.h:416
void bt_stream_put_ref(const bt_stream *stream)
Decrements the reference count of the stream stream.
uint64_t bt_stream_get_id(const bt_stream *stream)
Returns the numeric ID of the stream stream.
struct bt_stream bt_stream
Stream.
Definition: types.h:89
struct bt_trace bt_trace
Trace.
Definition: types.h:91
const bt_stream_class * bt_stream_borrow_class_const(const bt_stream *stream)
Borrows the class of the stream stream (const version).
struct bt_value bt_value
Value.
Definition: types.h:93
Success.
Definition: stream.h:421
bt_stream_set_name_status bt_stream_set_name(bt_stream *stream, const char *name)
Sets the name of the stream stream to a copy of name.
void bt_stream_get_ref(const bt_stream *stream)
Increments the reference count of the stream stream.
struct bt_stream_class bt_stream_class
Stream class.
Definition: types.h:90