Class: Inline::C::Parameter
- Inherits:
-
Type
- Object
- Type
- Inline::C::Parameter
show all
- Defined in:
- lib/inline_acceleration.rb
Instance Attribute Summary collapse
Attributes inherited from Type
#c_type, #ruby_type_class
Instance Method Summary
collapse
Methods inherited from Type
#c_transfer_type, #ruby_type_conversion, #void?
Constructor Details
#initialize(c_type, ruby_type_class, index) ⇒ Parameter
Returns a new instance of Parameter.
357
358
359
360
|
# File 'lib/inline_acceleration.rb', line 357
def initialize(c_type, ruby_type_class, index)
type_initialize(c_type, ruby_type_class)
@index = index
end
|
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
362
363
364
|
# File 'lib/inline_acceleration.rb', line 362
def index
@index
end
|
Instance Method Details
#arg_name ⇒ Object
364
365
366
|
# File 'lib/inline_acceleration.rb', line 364
def arg_name
"arg#{index}"
end
|
#c_casted_call_arg ⇒ Object
376
377
378
|
# File 'lib/inline_acceleration.rb', line 376
def c_casted_call_arg
"(#{c_type}) #{arg_name}"
end
|
#c_method_parameter ⇒ Object
372
373
374
|
# File 'lib/inline_acceleration.rb', line 372
def c_method_parameter
"#{c_transfer_type} #{arg_name}"
end
|
#ref_name ⇒ Object
368
369
370
|
# File 'lib/inline_acceleration.rb', line 368
def ref_name
"ref#{index}"
end
|
#ruby_converted_return_value ⇒ Object
393
394
395
396
|
# File 'lib/inline_acceleration.rb', line 393
def ruby_converted_return_value
return nil if !is_pointer_type?
(is_simple_type? ? "#{ref_name}.to_#{c_type[0..-2].strip.gsub(' ', '_')}" : ref_name + (ruby_type_class.reallocate_pointers? ? '' : " if #{arg_name}.nil?"))
end
|
#ruby_method_parameter ⇒ Object
380
381
382
|
# File 'lib/inline_acceleration.rb', line 380
def ruby_method_parameter
"#{arg_name}=" + (is_pointer_type? ? 'nil' : '0')
end
|
#ruby_ref_assign ⇒ Object
384
385
386
387
|
# File 'lib/inline_acceleration.rb', line 384
def ruby_ref_assign
return nil if !is_pointer_type?
"#{ref_name} = #{ruby_type_class.name}.create(#{arg_name})"
end
|
389
390
391
|
# File 'lib/inline_acceleration.rb', line 389
def ruby_transformed_call_arg
is_pointer_type? ? "#{ref_name}.memory_address" : "Inline::C::Value.get_data(#{arg_name})"
end
|
#type_initialize ⇒ Object
356
|
# File 'lib/inline_acceleration.rb', line 356
alias_method :type_initialize, :initialize
|