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



2312
2313
2314
2315
2316
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2312

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



2330
2331
2332
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2330

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

#is?(val) ⇒ Boolean

Returns true if val corresponds to the enum value

Returns:

  • (Boolean)


2325
2326
2327
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2325

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

#to_iObject

Returns the integer representing the Enum value



2340
2341
2342
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2340

def to_i
  return @val
end

#to_intObject

Returns the integer representing the Enum value



2345
2346
2347
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2345

def to_int
  return @val
end

#to_sObject

Returns a String corresponfing to the Enum value



2335
2336
2337
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2335

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

#val=(v) ⇒ Object

Sets the internal value of the enum



2319
2320
2321
2322
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2319

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