Class: LIBUSB::Transfer::ZeroCopyMemory

Inherits:
FFI::Pointer
  • Object
show all
Defined in:
lib/libusb/transfer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dev_handle, ptr, size) ⇒ ZeroCopyMemory

Returns a new instance of ZeroCopyMemory.


31
32
33
34
35
# File 'lib/libusb/transfer.rb', line 31

def initialize(dev_handle, ptr, size)
  @dev_handle = dev_handle
  @size = size
  super(ptr)
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size


29
30
31
# File 'lib/libusb/transfer.rb', line 29

def size
  @size
end

Instance Method Details

#free(id = nil) ⇒ Object


37
38
39
40
41
42
43
# File 'lib/libusb/transfer.rb', line 37

def free(id=nil)
  return unless @size
#         puts format("libusb_dev_mem_free(%#x, %d)%s", address, @size, id ? " by GC" : '')
  res = Call.libusb_dev_mem_free( @dev_handle.pHandle, self, @size )
  LIBUSB.raise_error res, "in libusb_dev_mem_free" if res!=0
  @size = nil
end