Class: Babeltrace::CTF::Iter
- Inherits:
-
FFI::ManagedStruct
- Object
- FFI::ManagedStruct
- Babeltrace::CTF::Iter
- Defined in:
- lib/babeltrace/ctf/iterator.rb,
lib/babeltrace/ctf/callbacks.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_time_pos(timestamp) ⇒ Object
- #each ⇒ Object
- #get_iter ⇒ Object
- #get_lost_events_count ⇒ Object
- #get_pos ⇒ Object
- #next ⇒ Object
- #read_event ⇒ Object
- #read_event_flag ⇒ Object
- #rewind ⇒ Object
- #set_pos(pos) ⇒ Object
Class Method Details
.release(ptr) ⇒ Object
19 20 21 |
# File 'lib/babeltrace/ctf/iterator.rb', line 19 def self.release(ptr) CTF.bt_ctf_iter_destroy(ptr) end |
Instance Method Details
#create_time_pos(timestamp) ⇒ Object
61 62 63 |
# File 'lib/babeltrace/ctf/iterator.rb', line 61 def create_time_pos() get_iter.create_time_pos() end |
#each ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/babeltrace/ctf/iterator.rb', line 65 def each rewind if block_given? loop do e = self.read_event break if e.pointer.null? yield e r = self.next break if r != 0 end else return to_enum(:each) end end |
#get_iter ⇒ Object
23 24 25 26 27 28 |
# File 'lib/babeltrace/ctf/iterator.rb', line 23 def get_iter return @iter if @iter @iter = CTF.bt_ctf_get_iter(self) @iter.child = self @iter end |
#get_lost_events_count ⇒ Object
41 42 43 |
# File 'lib/babeltrace/ctf/iterator.rb', line 41 def get_lost_events_count CTF.bt_ctf_get_lost_events_count(self) end |
#get_pos ⇒ Object
49 50 51 |
# File 'lib/babeltrace/ctf/iterator.rb', line 49 def get_pos get_iter.get_pos end |
#next ⇒ Object
45 46 47 |
# File 'lib/babeltrace/ctf/iterator.rb', line 45 def next get_iter.next end |
#read_event ⇒ Object
30 31 32 |
# File 'lib/babeltrace/ctf/iterator.rb', line 30 def read_event CTF.bt_ctf_iter_read_event(self) end |
#read_event_flag ⇒ Object
34 35 36 37 38 39 |
# File 'lib/babeltrace/ctf/iterator.rb', line 34 def read_event_flag ptr = FFI::MemoryPointer::new(:int) event = CTF.bt_ctf_iter_read_event_flags(self, ptr) flags = ptr.read(:int) [event, flags] end |
#rewind ⇒ Object
57 58 59 |
# File 'lib/babeltrace/ctf/iterator.rb', line 57 def rewind get_iter.rewind end |
#set_pos(pos) ⇒ Object
53 54 55 |
# File 'lib/babeltrace/ctf/iterator.rb', line 53 def set_pos(pos) get_iter.set_pos(pos) end |