Class: OpenCL::SVMPointer
- Defined in:
- lib/opencl_ruby_ffi/SVM.rb
Overview
maps the SVM pointer type
Instance Method Summary collapse
-
#+(offset) ⇒ Object
creates a new SVMPointer relative to an existing one from an offset.
-
#free ⇒ Object
frees the parent memory region associated to this SVMPointer.
-
#initialize(address, context, base = nil) ⇒ SVMPointer
constructor
create a new SVMPointer from its address and the context it pertains to.
- #inspect ⇒ Object
- #slice(offset, size) ⇒ Object
Constructor Details
#initialize(address, context, 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 |
# File 'lib/opencl_ruby_ffi/SVM.rb', line 8 def initialize( address, context, base = nil ) super( address ) @context = context if base then @base = base else @base = address end end |
Instance Method Details
#+(offset) ⇒ Object
creates a new SVMPointer relative to an existing one from an offset
28 29 30 |
# File 'lib/opencl_ruby_ffi/SVM.rb', line 28 def +( offset ) self.slice(offset, self.size - offset) end |
#free ⇒ Object
frees the parent memory region associated to this SVMPointer
33 34 35 |
# File 'lib/opencl_ruby_ffi/SVM.rb', line 33 def free return OpenCL::svm_free( @context, @base ) end |
#inspect ⇒ Object
18 19 20 |
# File 'lib/opencl_ruby_ffi/SVM.rb', line 18 def inspect return "#<#{self.class.name}: 0x#{address.to_s(16)} (#{size})>" end |
#slice(offset, size) ⇒ Object
22 23 24 25 |
# File 'lib/opencl_ruby_ffi/SVM.rb', line 22 def slice(offset, size) res = super(offset, size) return slef.class.new( res, @context, @base ) end |