Class: Ikra::Types::LocationAwareVariableSizeArrayType

Inherits:
LocationAwareArrayType show all
Defined in:
lib/types/types/array_type.rb

Instance Attribute Summary

Attributes inherited from LocationAwareArrayType

#location

Attributes inherited from ArrayType

#inner_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LocationAwareArrayType

#==, #initialize, #to_c_type

Methods inherited from ArrayType

#==, #initialize, new_original, #to_c_type, #to_ffi_type, #to_ruby_type, #to_s

Methods included from RubyType

#class_id, #eql?, #hash, #inspect, #is_primitive?, #is_union_type?, #should_generate_self_arg?, #to_array_type, #to_c_type, #to_ruby_type, #to_str, #to_union_type

Constructor Details

This class inherits a constructor from Ikra::Types::LocationAwareArrayType

Class Method Details

.new(inner_type, location: :device) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/types/types/array_type.rb', line 75

def new(inner_type, location: :device)
    if @cache == nil
        @cache = {}
        @cache.default_proc = Proc.new do |hash, key|
            hash[key] = new_original(*key)
        end
    end

    return @cache[[inner_type, location]]
end

Instance Method Details

#to_commandObject



87
88
89
90
91
92
# File 'lib/types/types/array_type.rb', line 87

def to_command
    # No fusion possible here. The first parameter (target) is a reference to the
    # array command struct representing the [ArrayInHostSectionCommand].
    # TODO: The code depends on the template (variable name `cmd` and `input_0`).
    return Symbolic::ArrayInHostSectionCommand.new("((#{@inner_type.to_c_type} *) cmd->input_0)", @inner_type)
end