Class: FFI::Pointer

Inherits:
Object
  • Object
show all
Defined in:
lib/hts/ffi_ext/pointer.rb

Instance Method Summary collapse

Instance Method Details

#read_array_of_struct(type, length) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/hts/ffi_ext/pointer.rb', line 6

def read_array_of_struct(type, length)
  ary = []
  size = type.size
  tmp = self
  length.times do |j|
    ary << type.new(tmp)
    tmp += size unless j == length - 1 # avoid OOB
  end
  ary
end