Class: Babeltrace2::BTStream
- Inherits:
-
BTSharedObject
- Object
- BTObject
- BTSharedObject
- Babeltrace2::BTStream
- Defined in:
- lib/babeltrace2/trace-ir/stream.rb
Constant Summary collapse
- SetNameStatus =
BTStreamSetNameStatus
Instance Attribute Summary
Attributes inherited from BTObject
Instance Method Summary collapse
- #create_packet ⇒ Object
- #get_class ⇒ Object
- #get_id ⇒ Object (also: #id)
- #get_name ⇒ Object (also: #name)
- #get_trace ⇒ Object (also: #trace)
- #get_user_attributes ⇒ Object (also: #user_attributes)
-
#initialize(handle = nil, retain: true, auto_release: true, stream_class: nil, trace: nil, id: nil) ⇒ BTStream
constructor
A new instance of BTStream.
- #name=(name) ⇒ Object
- #set_name(name) ⇒ Object
- #set_user_attributes(user_attributes) ⇒ Object
- #user_attributes=(user_attributes) ⇒ Object
Methods inherited from BTSharedObject
Methods inherited from BTObject
Constructor Details
#initialize(handle = nil, retain: true, auto_release: true, stream_class: nil, trace: nil, id: nil) ⇒ BTStream
Returns a new instance of BTStream.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 73 def initialize(handle = nil, retain: true, auto_release: true, stream_class: nil, trace: nil, id: nil) if handle super(handle, retain: retain, auto_release: auto_release) else handle = if id Babeltrace2.bt_stream_create_with_id(stream_class, trace, id) else Babeltrace2.bt_stream_create(stream_class, trace) end raise Babeltrace2.process_error if handle.null? super(handle) end end |
Instance Method Details
#create_packet ⇒ Object
133 134 135 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 133 def create_packet BTPacket.new(stream: @handle) end |
#get_class ⇒ Object
88 89 90 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 88 def get_class BTStreamClass.new(Babeltrace2.bt_stream_borrow_class(@handle), retain: true) end |
#get_id ⇒ Object Also known as: id
97 98 99 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 97 def get_id Babeltrace2.bt_stream_get_id(@handle) end |
#get_name ⇒ Object Also known as: name
113 114 115 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 113 def get_name Babeltrace2.bt_stream_get_name(@handle) end |
#get_trace ⇒ Object Also known as: trace
92 93 94 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 92 def get_trace BTTrace.new(Babeltrace2.bt_stream_borrow_trace(@handle), retain: true) end |
#get_user_attributes ⇒ Object Also known as: user_attributes
128 129 130 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 128 def get_user_attributes BTValueMap.new(Babeltrace2.bt_stream_borrow_user_attributes(@handle), retain: true) end |
#name=(name) ⇒ Object
108 109 110 111 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 108 def name=(name) set_name(name) name end |
#set_name(name) ⇒ Object
102 103 104 105 106 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 102 def set_name(name) res = Babeltrace2.bt_stream_set_name(@handle, name) raise Babeltrace2.process_error(res) if res != :BT_STREAM_SET_NAME_STATUS_OK self end |
#set_user_attributes(user_attributes) ⇒ Object
118 119 120 121 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 118 def set_user_attributes(user_attributes) Babeltrace2.bt_stream_set_user_attributes(@handle, BTValue.from_value(user_attributes)) self end |
#user_attributes=(user_attributes) ⇒ Object
123 124 125 126 |
# File 'lib/babeltrace2/trace-ir/stream.rb', line 123 def user_attributes=(user_attributes) set_user_attributes(user_attributes) user_attributes end |