class OMX::Array

Public Instance Methods

ffi_mem_pointer_hsize_t() click to toggle source

This method currently assumes that hsize_t is an int64… this needs to be generalised ASAP.

# File lib/OpenMatriX.rb, line 31
def ffi_mem_pointer_hsize_t
  ffi_mem_pointer_int64
end
ffi_mem_pointer_int64() click to toggle source

Allocate an integer64 chunk of memory, copy the contents of the array into it and return an FFI::MemoryPointer to the memory. The memory will be garbage collected when the pointer goes out of scope. Obviously the array should contain only integers. This method is not fast and shouldn't be used for giant arrays.

# File lib/OpenMatriX.rb, line 22
def ffi_mem_pointer_int64
  raise TypeError.new("Array must contain only integers.") if self.find{|el| not el.kind_of? Integer}
  ptr = FFI::MemoryPointer.new(:int64, size)
  ptr.write_array_of_int64(self)
  ptr
end