Top Description Inners Constructors Methods
org.jruby.ext.ffi

public abstract Class Factory

extends Object
Class Inheritance
Known Direct Subclasses
org.jruby.ext.ffi.NoImplFactory, org.jruby.ext.ffi.jffi.Factory
Imports
java.util.ArrayList, .List, org.jruby.Ruby, .RubyHash, .RubyModule, org.jruby.ext.ffi.io.FileDescriptorIO

A factory that can create a FFI Provider

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public abstract int
public abstract MemoryIO

Returns:

A new AllocatedDirectMemoryIO.
allocateDirectMemory
(Ruby runtime, int
The number of bytes to allocate.
size
,
boolean
If the memory should be cleared.
clear
)

Allocates memory on the native C heap and wraps it in a MemoryIO accessor.

public abstract MemoryIO

Returns:

A new AllocatedDirectMemoryIO.
allocateDirectMemory
(Ruby runtime, int
The number of bytes to allocate.
size
,
int
The minimum alignment of the memory
align
,
boolean
If the memory should be cleared.
clear
)

Allocates memory on the native C heap and wraps it in a MemoryIO accessor.

public abstract MemoryIO

Returns:

A new AllocatedDirectMemoryIO.
allocateTransientDirectMemory
(Ruby runtime, int
The number of bytes to allocate.
size
,
int
The minimum alignment of the memory
align
,
boolean
If the memory should be cleared.
clear
)

Allocates transient native memory (not from C heap) and wraps it in a MemoryIO accessor.

public abstract CallbackManager
public static final Factory

Returns:

an instance of FFIProvider
getInstance
()

Gets an instance of FFIProvider

public void
init(Ruby
The ruby runtime
runtime
,
RubyModule
the module to register the classes under
FFI
)

Registers FFI ruby classes/modules

public abstract AbstractInvoker
newFunction(Ruby runtime, Pointer address, CallbackInfo cbInfo)

public abstract int
public abstract MemoryIO

Returns:

A new MemoryIO.
wrapDirectMemory
(Ruby runtime, long
The native address to wrap.
address
)

Wraps a native C memory address in a MemoryIO accessor.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Factoryback to summary
protected Factory()

Method Detail

alignmentOfback to summary
public abstract int alignmentOf(NativeType type)
allocateDirectMemoryback to summary
public abstract MemoryIO allocateDirectMemory(Ruby runtime, int size, boolean clear)

Allocates memory on the native C heap and wraps it in a MemoryIO accessor.

Parameters
size:int

The number of bytes to allocate.

clear:boolean

If the memory should be cleared.

Returns:MemoryIO

A new AllocatedDirectMemoryIO.

allocateDirectMemoryback to summary
public abstract MemoryIO allocateDirectMemory(Ruby runtime, int size, int align, boolean clear)

Allocates memory on the native C heap and wraps it in a MemoryIO accessor.

Parameters
size:int

The number of bytes to allocate.

align:int

The minimum alignment of the memory

clear:boolean

If the memory should be cleared.

Returns:MemoryIO

A new AllocatedDirectMemoryIO.

allocateTransientDirectMemoryback to summary
public abstract MemoryIO allocateTransientDirectMemory(Ruby runtime, int size, int align, boolean clear)

Allocates transient native memory (not from C heap) and wraps it in a MemoryIO accessor.

Parameters
size:int

The number of bytes to allocate.

align:int

The minimum alignment of the memory

clear:boolean

If the memory should be cleared.

Returns:MemoryIO

A new AllocatedDirectMemoryIO.

getCallbackManagerback to summary
public abstract CallbackManager getCallbackManager()
getInstanceback to summary
public static final Factory getInstance()

Gets an instance of FFIProvider

Returns:Factory

an instance of FFIProvider

initback to summary
public void init(Ruby runtime, RubyModule FFI)

Registers FFI ruby classes/modules

Parameters
runtime:Ruby

The ruby runtime

FFI:RubyModule

the module to register the classes under

newFunctionback to summary
public abstract AbstractInvoker newFunction(Ruby runtime, Pointer address, CallbackInfo cbInfo)
sizeOfback to summary
public abstract int sizeOf(NativeType type)
wrapDirectMemoryback to summary
public abstract MemoryIO wrapDirectMemory(Ruby runtime, long address)

Wraps a native C memory address in a MemoryIO accessor.

Parameters
address:long

The native address to wrap.

Returns:MemoryIO

A new MemoryIO.

org.jruby.ext.ffi back to summary

private final Class Factory.SingletonHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final Factory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static final Factory
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
private static final Factory INSTANCE

Constructor Detail

SingletonHolderback to summary
private SingletonHolder()

Method Detail

getInstanceback to summary
private static final Factory getInstance()