Package org.jruby.ext.ffi.jffi
Class Factory
java.lang.Object
org.jruby.ext.ffi.Factory
org.jruby.ext.ffi.jffi.Factory
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
alignmentOf
(NativeType type) allocateDirectMemory
(Ruby runtime, int size, boolean clear) Allocates memory on the native C heap and wraps it in aMemoryIO
accessor.allocateDirectMemory
(Ruby runtime, int size, int align, boolean clear) Allocates memory on the native C heap and wraps it in aMemoryIO
accessor.allocateTransientDirectMemory
(Ruby runtime, int size, int align, boolean clear) Allocates transient native memory (not from C heap) and wraps it in aMemoryIO
accessor.void
init
(Ruby runtime, RubyModule FFI) Registers FFI ruby classes/modulesnewFunction
(Ruby runtime, Pointer address, CallbackInfo cbInfo) int
sizeOf
(NativeType type) wrapDirectMemory
(Ruby runtime, long address) Wraps a native C memory address in aMemoryIO
accessor.Methods inherited from class org.jruby.ext.ffi.Factory
getInstance
-
Constructor Details
-
Factory
public Factory()
-
-
Method Details
-
init
Description copied from class:Factory
Registers FFI ruby classes/modules -
allocateDirectMemory
Allocates memory on the native C heap and wraps it in aMemoryIO
accessor.- Specified by:
allocateDirectMemory
in classFactory
- Parameters:
size
- The number of bytes to allocate.clear
- If the memory should be cleared.- Returns:
- A new
MemoryIO
.
-
allocateDirectMemory
Allocates memory on the native C heap and wraps it in aMemoryIO
accessor.- Specified by:
allocateDirectMemory
in classFactory
- Parameters:
size
- The number of bytes to allocate.align
- The minimum alignment of the memoryclear
- If the memory should be cleared.- Returns:
- A new
MemoryIO
.
-
allocateTransientDirectMemory
Description copied from class:Factory
Allocates transient native memory (not from C heap) and wraps it in aMemoryIO
accessor.- Specified by:
allocateTransientDirectMemory
in classFactory
- Parameters:
size
- The number of bytes to allocate.align
- The minimum alignment of the memoryclear
- If the memory should be cleared.- Returns:
- A new
AllocatedDirectMemoryIO
.
-
wrapDirectMemory
Description copied from class:Factory
Wraps a native C memory address in aMemoryIO
accessor.- Specified by:
wrapDirectMemory
in classFactory
- Parameters:
address
- The native address to wrap.- Returns:
- A new
MemoryIO
.
-
newFunction
- Specified by:
newFunction
in classFactory
-
getCallbackManager
- Specified by:
getCallbackManager
in classFactory
-
sizeOf
-
alignmentOf
- Specified by:
alignmentOf
in classFactory
-