Class Factory

java.lang.Object
org.jruby.ext.ffi.Factory
org.jruby.ext.ffi.jffi.Factory

public class Factory extends Factory
  • Constructor Details

    • Factory

      public Factory()
  • Method Details

    • init

      public void init(Ruby runtime, RubyModule FFI)
      Description copied from class: Factory
      Registers FFI ruby classes/modules
      Overrides:
      init in class Factory
      Parameters:
      runtime - The ruby runtime
      FFI - the module to register the classes under
    • allocateDirectMemory

      public MemoryIO allocateDirectMemory(Ruby runtime, int size, boolean clear)
      Allocates memory on the native C heap and wraps it in a MemoryIO accessor.
      Specified by:
      allocateDirectMemory in class Factory
      Parameters:
      size - The number of bytes to allocate.
      clear - If the memory should be cleared.
      Returns:
      A new MemoryIO.
    • allocateDirectMemory

      public MemoryIO allocateDirectMemory(Ruby runtime, int size, int align, boolean clear)
      Allocates memory on the native C heap and wraps it in a MemoryIO accessor.
      Specified by:
      allocateDirectMemory in class Factory
      Parameters:
      size - The number of bytes to allocate.
      align - The minimum alignment of the memory
      clear - If the memory should be cleared.
      Returns:
      A new MemoryIO.
    • allocateTransientDirectMemory

      public MemoryIO allocateTransientDirectMemory(Ruby runtime, int size, int align, boolean clear)
      Description copied from class: Factory
      Allocates transient native memory (not from C heap) and wraps it in a MemoryIO accessor.
      Specified by:
      allocateTransientDirectMemory in class Factory
      Parameters:
      size - The number of bytes to allocate.
      align - The minimum alignment of the memory
      clear - If the memory should be cleared.
      Returns:
      A new AllocatedDirectMemoryIO.
    • wrapDirectMemory

      public MemoryIO wrapDirectMemory(Ruby runtime, long address)
      Description copied from class: Factory
      Wraps a native C memory address in a MemoryIO accessor.
      Specified by:
      wrapDirectMemory in class Factory
      Parameters:
      address - The native address to wrap.
      Returns:
      A new MemoryIO.
    • newFunction

      public Function newFunction(Ruby runtime, Pointer address, CallbackInfo cbInfo)
      Specified by:
      newFunction in class Factory
    • getCallbackManager

      public CallbackManager getCallbackManager()
      Specified by:
      getCallbackManager in class Factory
    • sizeOf

      public int sizeOf(NativeType type)
      Specified by:
      sizeOf in class Factory
    • alignmentOf

      public int alignmentOf(NativeType type)
      Specified by:
      alignmentOf in class Factory