Class: OpenCL::Enum
- Inherits:
-
Object
- Object
- OpenCL::Enum
- Defined in:
- lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb,
lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb
Overview
A parent class to represent OpenCL enums that use :cl_uint
Direct Known Subclasses
AddressingMode, ChannelOrder, ChannelType, CommandQueue::PriorityKHR, CommandQueue::ThrottleKHR, CommandType, Context::Properties, Device::AffinityDomainEXT, Device::LocalMemType, Device::MemCacheType, EnumInt, FilterMode, GLContextInfo, GLObjectType, Kernel::Arg::AccessQualifier, Kernel::Arg::AddressQualifier, Mem::Type, Program::BinaryType
Class Attribute Summary collapse
-
.codes ⇒ Object
readonly
Returns the value of attribute codes.
Instance Method Summary collapse
-
#==(val) ⇒ Object
Return true if val corresponds to the enum value.
-
#coerce(other) ⇒ Object
Enum should be considered an integer.
-
#initialize(val) ⇒ Enum
constructor
Initializes an enum with the given val.
-
#inspect ⇒ Object
Returns a String corresponding to the Enum description.
-
#is?(val) ⇒ Boolean
Returns true if val corresponds to the enum value.
-
#name ⇒ Object
Returns a String representing the Enum value name.
-
#to_i ⇒ Object
Returns the integer representing the Enum value.
-
#to_int ⇒ Object
Returns the integer representing the Enum value.
-
#to_s ⇒ Object
Returns a String corresponfing to the Enum value.
-
#val=(v) ⇒ Object
Sets the internal value of the enum.
Constructor Details
#initialize(val) ⇒ Enum
Initializes an enum with the given val
613 614 615 616 617 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 613 def initialize( val ) error_check( OpenCL::INVALID_VALUE ) if not self.class.codes[val] super() @val = val end |
Class Attribute Details
.codes ⇒ Object (readonly)
Returns the value of attribute codes.
608 609 610 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 608 def codes @codes end |
Instance Method Details
#==(val) ⇒ Object
Return true if val corresponds to the enum value
631 632 633 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 631 def ==(val) return true if @val == val end |
#coerce(other) ⇒ Object
Enum should be considered an integer
651 652 653 654 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 651 def coerce(other) return [other, Pointer::new(self.to_i)] if other.is_a?(Pointer) return [other, self.to_i] end |
#inspect ⇒ Object
Returns a String corresponding to the Enum description
636 637 638 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 636 def inspect return "#<#{self.class.name}: #{self.name}>" end |
#is?(val) ⇒ Boolean
Returns true if val corresponds to the enum value
626 627 628 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 626 def is?(val) return true if @val == val end |
#name ⇒ Object
Returns a String representing the Enum value name
646 647 648 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 646 def name return self.class.codes[@val] end |
#to_i ⇒ Object
Returns the integer representing the Enum value
657 658 659 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 657 def to_i return @val end |
#to_int ⇒ Object
Returns the integer representing the Enum value
662 663 664 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 662 def to_int return @val end |
#to_s ⇒ Object
Returns a String corresponfing to the Enum value
641 642 643 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 641 def to_s return "#{self.name}" end |
#val=(v) ⇒ Object
Sets the internal value of the enum
620 621 622 623 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 620 def val=(v) error_check( OpenCL::INVALID_VALUE ) if not self.class.codes[val] @val = v end |