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
637 638 639 640 641 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 637 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.
632 633 634 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 632 def codes @codes end |
Instance Method Details
#==(val) ⇒ Object
Return true if val corresponds to the enum value
655 656 657 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 655 def ==(val) return true if @val == val end |
#coerce(other) ⇒ Object
Enum should be considered an integer
675 676 677 678 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 675 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
660 661 662 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 660 def inspect return "#<#{self.class.name}: #{self.name}>" end |
#is?(val) ⇒ Boolean
Returns true if val corresponds to the enum value
650 651 652 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 650 def is?(val) return true if @val == val end |
#name ⇒ Object
Returns a String representing the Enum value name
670 671 672 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 670 def name return self.class.codes[@val] end |
#to_i ⇒ Object
Returns the integer representing the Enum value
681 682 683 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 681 def to_i return @val end |
#to_int ⇒ Object
Returns the integer representing the Enum value
686 687 688 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 686 def to_int return @val end |
#to_s ⇒ Object
Returns a String corresponfing to the Enum value
665 666 667 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 665 def to_s return "#{self.name}" end |
#val=(v) ⇒ Object
Sets the internal value of the enum
644 645 646 647 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 644 def val=(v) error_check( OpenCL::INVALID_VALUE ) if not self.class.codes[val] @val = v end |