Babeltrace 2 C API  2.0.6
Open-source trace manipulation framework
stream.h
1 #ifndef BABELTRACE2_TRACE_IR_STREAM_H
2 #define BABELTRACE2_TRACE_IR_STREAM_H
3 
4 /*
5  * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in
15  * all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25 
26 #ifndef __BT_IN_BABELTRACE_H
27 # error "Please include <babeltrace2/babeltrace.h> instead."
28 #endif
29 
30 #include <stdint.h>
31 
32 #include <babeltrace2/types.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
259 extern bt_stream *bt_stream_create(bt_stream_class *stream_class,
260  bt_trace *trace);
261 
327  bt_stream_class *stream_class,
328  bt_trace *trace, uint64_t id);
329 
354 
363  const bt_stream *stream);
364 
387 extern bt_trace *bt_stream_borrow_trace(bt_stream *stream);
388 
397  const bt_stream *stream);
398 
424 extern uint64_t bt_stream_get_id(const bt_stream *stream);
425 
435  BT_STREAM_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
436 
441  BT_STREAM_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
443 
469  const char *name);
470 
495 extern const char *bt_stream_get_name(const bt_stream *stream);
496 
527  bt_stream *stream, const bt_value *user_attributes);
528 
555 
564  const bt_stream *stream);
565 
588 extern void bt_stream_get_ref(const bt_stream *stream);
589 
605 extern void bt_stream_put_ref(const bt_stream *stream);
606 
621 #define BT_STREAM_PUT_REF_AND_RESET(_stream) \
622  do { \
623  bt_stream_put_ref(_stream); \
624  (_stream) = NULL; \
625  } while (0)
626 
652 #define BT_STREAM_MOVE_REF(_dst, _src) \
653  do { \
654  bt_stream_put_ref(_dst); \
655  (_dst) = (_src); \
656  (_src) = NULL; \
657  } while (0)
658 
663 #ifdef __cplusplus
664 }
665 #endif
666 
667 #endif /* BABELTRACE2_TRACE_IR_STREAM_H */
Out of memory.
Definition: stream.h:441
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:430
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:103
struct bt_trace bt_trace
Trace.
Definition: types.h:105
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:107
Success.
Definition: stream.h:435
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:104