Class: OpenCL::Bitfield

Inherits:
Object
  • Object
show all
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 bitfields that use :cl_bitfield

Instance Method Summary collapse

Constructor Details

#initialize(val = 0) ⇒ Bitfield

Initializes a new Bitfield to val



704
705
706
707
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 704

def initialize( val = 0 )
  super()
  @val = val
end

Instance Method Details

#&(f) ⇒ Object

Returns the bitwise & operation between f and the internal Bitfield representation



740
741
742
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 740

def &(f)
  return self.class::new( @val & f )
end

#^(f) ⇒ Object

Returns the bitwise ^ operation between f and the internal Bitfield representation



745
746
747
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 745

def ^(f)
  return self.class::new( @val ^ f )
end

#coerce(other) ⇒ Object

Bitfield should be considered an integer



735
736
737
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 735

def coerce(other)
  return [other, self.to_i]
end

#flagsObject

Returns the internal representation of the Bitfield



755
756
757
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 755

def flags
  return @val
end

#flags=(val) ⇒ Object

Sets the internal representation of the Bitfield to val



760
761
762
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 760

def flags=(val)
  @val = val
end

#include?(flag) ⇒ Boolean

Returns true if flag is bitwise included in the Bitfield

Returns:

  • (Boolean)


710
711
712
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 710

def include?(flag)
  return ( @val & flag ) == flag
end

#inspectObject

Returns a String corresponding to the Bitfield description



715
716
717
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 715

def inspect
  return "#<#{self.class.name}: #{self}>"
end

#to_iObject

Returns the integer representing the Bitfield value



725
726
727
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 725

def to_i
  return @val
end

#to_intObject

Returns the integer representing the Bitfield value



730
731
732
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 730

def to_int
  return @val
end

#to_sObject

Returns a String corresponfing to the Bitfield value



720
721
722
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 720

def to_s
  return "#{self.names.join('|')}"
end

#|(f) ⇒ Object

Returns the bitwise | operation between f and the internal Bitfield representation



750
751
752
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 750

def |(f)
  return self.class::new( @val | f )
end