Class: OpenCL::Enum

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

Overview

A parent class to represent OpenCL enums that use :cl_uint

Constant Summary collapse

@@codes =

native_type :cl_uint

{}

Instance Method Summary collapse

Constructor Details

#initialize(val) ⇒ Enum

Initializes an enum with the given val



621
622
623
624
625
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 621

def initialize( val )
  OpenCL::check_error( OpenCL::INVALID_VALUE ) if not @@codes[val]
  super()
  @val = val
end

Instance Method Details

#==(val) ⇒ Object

Return true if val corresponds to the enum value



639
640
641
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 639

def ==(val)
  return true if @val == val
end

#is?(val) ⇒ Boolean

Returns true if val corresponds to the enum value

Returns:

  • (Boolean)


634
635
636
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 634

def is?(val)
  return true if @val == val
end

#to_iObject

Returns the integer representing the Enum value



649
650
651
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 649

def to_i
  return @val
end

#to_intObject

Returns the integer representing the Enum value



654
655
656
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 654

def to_int
  return @val
end

#to_sObject

Returns a String corresponfing to the Enum value



644
645
646
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 644

def to_s
  return "#{self.name}"
end

#val=(v) ⇒ Object

Sets the internal value of the enum



628
629
630
631
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 628

def val=(v)
  OpenCL::check_error( OpenCL::INVALID_VALUE ) if not @@codes[val]
  @val = v
end