Exception: OpenCL::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb,
lib/opencl_ruby_ffi/khr/icd.rb,
lib/opencl_ruby_ffi/khr/egl_image.rb,
lib/opencl_ruby_ffi/khr/gl_sharing.rb,
lib/opencl_ruby_ffi/khr/d3d10_sharing.rb,
lib/opencl_ruby_ffi/khr/d3d11_sharing.rb,
lib/opencl_ruby_ffi/ext/device_fission.rb,
lib/opencl_ruby_ffi/khr/dx9_media_sharing.rb

Overview

Parent class to map OpenCL errors, and is used to raise unknown errors

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Error

Returns a new instance of Error.



480
481
482
483
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 480

def initialize(code)
  @code = code
  super("#{code}")
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



478
479
480
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 478

def code
  @code
end

Class Method Details

.error_class(errcode) ⇒ Object

Returns the class corresponding to the error code (if any)



490
491
492
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 490

def self.error_class(errcode)
  return CLASSES[errcode]
end

.error_class_constructor(name, capitalized_name) ⇒ Object



508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 508

def self.error_class_constructor( name, capitalized_name )
  return  <<EOF
class #{name} < Error

  def initialize
    super(#{OpenCL::const_get(name)})
  end

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

  def name
    return "#{name}"
  end

  def self.code
    return #{OpenCL::const_get(name)}
  end

end

CLASSES[#{OpenCL::const_get(name)}] = #{name}
#{capitalized_name} = #{name}
EOF
end

.name(code) ⇒ Object

Returns a string representing the name corresponding to the error code



495
496
497
498
499
500
501
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 495

def self.name(code)
  if CLASSES[code] then
    return CLASSES[code].name
  else
    return "#{code}"
  end
end

Instance Method Details

#nameObject

Returns a string representing the name corresponding to the error



504
505
506
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 504

def name
  return "#{@code}"
end