Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/hdf5.rb
Instance Method Summary collapse
-
#ffi_mem_pointer_hsize_t ⇒ Object
This method currently assumes that hsize_t is an int64…
-
#ffi_mem_pointer_int64 ⇒ Object
Allocate an integer64 chunk of memory, copy the contents of the array into it and return an FFI::MemoryPointer to the memory.
Instance Method Details
#ffi_mem_pointer_hsize_t ⇒ Object
This method currently assumes that hsize_t is an int64… this needs to be generalised ASAP.
26 27 28 |
# File 'lib/hdf5.rb', line 26 def ffi_mem_pointer_hsize_t ffi_mem_pointer_int64 end |
#ffi_mem_pointer_int64 ⇒ Object
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.
17 18 19 20 21 22 |
# File 'lib/hdf5.rb', line 17 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 |