Class: OpenCL::Short2

Inherits:
Struct
  • Object
show all
Defined in:
lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb

Overview

Maps the cl_short2 type of OpenCL

Instance Method Summary collapse

Constructor Details

#initialize(s0 = 0, s1 = 0) ⇒ Short2

Creates a new Short2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Short2 maps the memory pointed.



426
427
428
429
430
431
432
433
434
# File 'lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb', line 426

def initialize( s0 = 0, s1 = 0 )
  if s0.is_a?(FFI::Pointer) then
    super(s0)
  else
    super()
    self[:s0] = s0
    self[:s1] = s1
  end
end

Instance Method Details

#inspectObject



452
453
454
# File 'lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb', line 452

def inspect
  return "#<#{self.class.name}: #{self[:s0]}, #{self[:s1]}>"
end

#s0Object

Reads the s0 member



436
437
438
# File 'lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb', line 436

def s0
 return self[:s0]
end

#s0=(value) ⇒ Object

Sets the s0 member to value



444
445
446
# File 'lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb', line 444

def s0=(value)
 self[:s0] = value
end

#s1Object

Reads the s1 member



440
441
442
# File 'lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb', line 440

def s1
 return self[:s1]
end

#s1=(value) ⇒ Object

Sets the s1 member to value



448
449
450
# File 'lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb', line 448

def s1=(value)
 self[:s1] = value
end

#to_sObject



456
457
458
# File 'lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb', line 456

def to_s
  return "Short2{ #{self[:s0]}, #{self[:s1]} }"
end