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(pDevhandle, ptr, size) ⇒ ZeroCopyMemory

Returns a new instance of ZeroCopyMemory.



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

def initialize(pDevhandle, ptr, size)
  @pDevhandle = pDevhandle
  @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)
  # puts format("libusb_dev_mem_free(%#x, %d)%s", address, @size||0, id ? " by GC" : '')
  return unless @size
  res = Call.libusb_dev_mem_free( @pDevhandle, self, @size )
  LIBUSB.raise_error res, "in libusb_dev_mem_free" if res!=0
  @size = nil
end