Class: Rubex::DataType::CArray

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/rubex/data_type/c_array.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#==, #c_function_ptr?, #char_ptr?, #from_ruby_object, #to_ruby_object

Constructor Details

#initialize(dimension, type) ⇒ CArray

Returns a new instance of CArray.



10
11
12
13
# File 'lib/rubex/data_type/c_array.rb', line 10

def initialize(dimension, type)
  @dimension = dimension
  @type = type
end

Instance Attribute Details

#dimensionObject (readonly)

Dimension of the array



6
7
8
# File 'lib/rubex/data_type/c_array.rb', line 6

def dimension
  @dimension
end

#typeObject (readonly)

Type of elements stored in array



8
9
10
# File 'lib/rubex/data_type/c_array.rb', line 8

def type
  @type
end

Instance Method Details

#<=>(other) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/rubex/data_type/c_array.rb', line 19

def <=>(other)
  @type <=>
    if self.class == other.class
      other.type
    else
      other
    end
end

#base_typeObject



28
29
30
# File 'lib/rubex/data_type/c_array.rb', line 28

def base_type
  @type
end

#carray?Boolean

Returns:



15
16
17
# File 'lib/rubex/data_type/c_array.rb', line 15

def carray?
  true
end