class Yadriggy::C::IntArray
Array of 32bit integers. In C
, the type of this array is `arrayof(Int)`.
Public Class Methods
element_type()
click to toggle source
# File lib/yadriggy/c/ffi.rb, line 72 def self.element_type() Integer end
new(size, ptr=nil)
click to toggle source
@param [Integer] size array size. @param [FFI::MemoryPointer] ptr a memory pointer or nil.
If nil, a new memory block is allocated.
# File lib/yadriggy/c/ffi.rb, line 56 def initialize(size, ptr=nil) if ptr.nil? @array = FFI::MemoryPointer.new(:int32, size) else @array = ptr end end
Public Instance Methods
[](index)
click to toggle source
# File lib/yadriggy/c/ffi.rb, line 64 def [](index) @array.get_int32(index * 4) end
[]=(index, value)
click to toggle source
# File lib/yadriggy/c/ffi.rb, line 68 def []=(index, value) @array.put_int32(index * 4, value) end