Class: Babeltrace2::BTPacket
- Inherits:
-
BTSharedObject
- Object
- BTObject
- BTSharedObject
- Babeltrace2::BTPacket
- Defined in:
- lib/babeltrace2/trace-ir/packet.rb
Instance Attribute Summary
Attributes inherited from BTObject
Instance Method Summary collapse
- #get_context_field ⇒ Object (also: #context_field)
- #get_stream ⇒ Object (also: #stream)
-
#initialize(handle = nil, retain: true, auto_release: true, stream: nil) ⇒ BTPacket
constructor
A new instance of BTPacket.
Methods inherited from BTSharedObject
Methods inherited from BTObject
Constructor Details
#initialize(handle = nil, retain: true, auto_release: true, stream: nil) ⇒ BTPacket
Returns a new instance of BTPacket.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/babeltrace2/trace-ir/packet.rb', line 34 def initialize(handle = nil, retain: true, auto_release: true, stream: nil) if handle super(handle, retain: retain, auto_release: auto_release) else handle = Babeltrace2.bt_packet_create(stream) raise Babeltrace2.process_error if handle.null? super(handle) end end |
Instance Method Details
#get_context_field ⇒ Object Also known as: context_field
50 51 52 53 54 |
# File 'lib/babeltrace2/trace-ir/packet.rb', line 50 def get_context_field handle = Babeltrace2.bt_packet_borrow_context_field(@handle) return nil if handle.null? BTField.from_handle(handle) end |
#get_stream ⇒ Object Also known as: stream
45 46 47 |
# File 'lib/babeltrace2/trace-ir/packet.rb', line 45 def get_stream BTStream.new(Babeltrace2.bt_packet_borrow_stream(@handle), retain: true) end |