Class: OpenCL::Bitfield

Inherits:
Object
  • Object
show all
Defined in:
lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.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



2385
2386
2387
2388
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2385

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

Instance Method Details

#&(f) ⇒ Object

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



2412
2413
2414
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2412

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

#^(f) ⇒ Object

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



2417
2418
2419
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2417

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

#flagsObject

Returns the internal representation of the Bitfield



2427
2428
2429
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2427

def flags
  return @val
end

#flags=(val) ⇒ Object

Setss the internal representation of the Bitfield to val



2432
2433
2434
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2432

def flags=(val)
  @val = val
end

#include?(flag) ⇒ Boolean

Returns true if flag is bitwise included in the Bitfield

Returns:



2391
2392
2393
2394
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2391

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

#to_iObject

Returns the integer representing the Bitfield value



2402
2403
2404
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2402

def to_i
  return @val
end

#to_intObject

Returns the integer representing the Bitfield value



2407
2408
2409
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2407

def to_int
  return @val
end

#to_sObject

Returns a String corresponfing to the Bitfield value



2397
2398
2399
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2397

def to_s
  return "#{self.names}"
end

#|(f) ⇒ Object

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



2422
2423
2424
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 2422

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