class Yadriggy::C::CType::CArray

@api private Array type available only in C code. See also {IntArray} and {FloatArray} in `ffi.rb`.

Attributes

debug[RW]

debug mode.

sizes[R]

@return [Array<Integer>] sizes array size.

Public Class Methods

new(*sizes) click to toggle source

@param [Array<Integer>] sizes size of each dimension.

# File lib/yadriggy/c/ctype.rb, line 50
def initialize(*sizes)
  raise 'unknown array size' unless sizes.size > 0
  @sizes = sizes
  @debug = false
end

Public Instance Methods

check_range(indexes) click to toggle source

@api private

# File lib/yadriggy/c/ctype.rb, line 64
def check_range(indexes)
  raise 'wrong number of indexes' unless indexes.size == @sizes.size
  indexes.each_index do |i|
    if indexes[i] >= @sizes[i]
      raise "out of range: #{self.to_s}[#{indexes[i]}]"
    end
  end
end
type() click to toggle source

@api private @abstract @return [Type] the element type.

# File lib/yadriggy/c/ctype.rb, line 59
def type()
  Undef
end
typedecl(arg) click to toggle source

@api private

# File lib/yadriggy/c/ctype.rb, line 41
def typedecl(arg) end