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,
lib/opencl_ruby_ffi/intel/accelerator.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.



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

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



500
501
502
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 500

def code
  @code
end

Class Method Details

.error_class(errcode) ⇒ Object

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



512
513
514
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 512

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

.error_class_constructor(name, capitalized_name) ⇒ Object



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 530

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



517
518
519
520
521
522
523
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 517

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



526
527
528
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 526

def name
  return "#{@code}"
end