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



680
681
682
683
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 680

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

Instance Method Details

#&(f) ⇒ Object

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



717
718
719
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 717

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

#^(f) ⇒ Object

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



722
723
724
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 722

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

#coerce(other) ⇒ Object

Bitfield should be considered an integer



712
713
714
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 712

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

#flagsObject

Returns the internal representation of the Bitfield



732
733
734
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 732

def flags
  return @val
end

#flags=(val) ⇒ Object

Setss the internal representation of the Bitfield to val



737
738
739
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 737

def flags=(val)
  @val = val
end

#include?(flag) ⇒ Boolean

Returns true if flag is bitwise included in the Bitfield

Returns:

  • (Boolean)


686
687
688
689
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 686

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

#inspectObject

Returns a String corresponding to the Bitfield description



692
693
694
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 692

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

#to_iObject

Returns the integer representing the Bitfield value



702
703
704
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 702

def to_i
  return @val
end

#to_intObject

Returns the integer representing the Bitfield value



707
708
709
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 707

def to_int
  return @val
end

#to_sObject

Returns a String corresponfing to the Bitfield value



697
698
699
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 697

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

#|(f) ⇒ Object

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



727
728
729
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 727

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