Class: OpenCL::SVMPointer

Inherits:
Pointer
  • Object
show all
Defined in:
lib/opencl_ruby_ffi/SVM.rb

Overview

maps the SVM pointer type

Instance Method Summary collapse

Constructor Details

#initialize(address, context, size, base = nil) ⇒ SVMPointer

create a new SVMPointer from its address and the context it pertains to



8
9
10
11
12
13
14
15
16
17
# File 'lib/opencl_ruby_ffi/SVM.rb', line 8

def initialize( address, context, size, base = nil )
  super( address )
  @context = context
  if base then
    @base = base
  else
    @base = address
  end
  @size = size
end

Instance Method Details

#+(offset) ⇒ Object

creates a new SVMPointer relative to an existing one from an offset



24
25
26
# File 'lib/opencl_ruby_ffi/SVM.rb', line 24

def +( offset )
  return SVMPointer::new(  self.address + offset, @context, @size, @base )
end

#freeObject

frees the parent memory region associated to this SVMPointer



29
30
31
# File 'lib/opencl_ruby_ffi/SVM.rb', line 29

def free
  return OpenCL::svm_free( @context, @base )
end

#inspectObject



19
20
21
# File 'lib/opencl_ruby_ffi/SVM.rb', line 19

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