final class NativeClosureProxy
extends java.lang.Object
implements com.kenai.jffi.Closure
| Modifier and Type | Field and Description |
|---|---|
private CallSite |
callSite |
protected NativeFunctionInfo |
closureInfo |
private static int |
LONG_SIZE |
private java.lang.ref.WeakReference<java.lang.Object> |
proc |
protected Ruby |
runtime |
| Constructor and Description |
|---|
NativeClosureProxy(Ruby runtime,
NativeFunctionInfo closureInfo,
java.lang.Object proc) |
NativeClosureProxy(Ruby runtime,
NativeFunctionInfo closureInfo,
java.lang.Object proc,
CallSite callSite) |
| Modifier and Type | Method and Description |
|---|---|
private static long |
addressValue(IRubyObject value)
Extracts the primitive value from a Ruby object.
|
private static IRubyObject |
fromNative(Ruby runtime,
Type type,
com.kenai.jffi.Closure.Buffer buffer,
int index)
Converts a native value into a ruby object.
|
private static IRubyObject |
getStringParameter(Ruby runtime,
com.kenai.jffi.Closure.Buffer buffer,
int index)
Converts a native string value into a ruby string object.
|
void |
invoke(com.kenai.jffi.Closure.Buffer buffer) |
protected void |
invoke(com.kenai.jffi.Closure.Buffer buffer,
java.lang.Object recv) |
private static long |
longValue(IRubyObject value)
Extracts the primitive value from a Ruby object.
|
private static void |
setReturnValue(Ruby runtime,
Type type,
com.kenai.jffi.Closure.Buffer buffer,
IRubyObject value)
Converts a ruby return value into a native callback return value.
|
private static final int LONG_SIZE
protected final Ruby runtime
protected final NativeFunctionInfo closureInfo
private final java.lang.ref.WeakReference<java.lang.Object> proc
private final CallSite callSite
NativeClosureProxy(Ruby runtime, NativeFunctionInfo closureInfo, java.lang.Object proc)
NativeClosureProxy(Ruby runtime, NativeFunctionInfo closureInfo, java.lang.Object proc, CallSite callSite)
public void invoke(com.kenai.jffi.Closure.Buffer buffer)
invoke in interface com.kenai.jffi.Closureprotected final void invoke(com.kenai.jffi.Closure.Buffer buffer,
java.lang.Object recv)
private static final long longValue(IRubyObject value)
value - The Ruby object to convertprivate static final long addressValue(IRubyObject value)
value - The Ruby object to convertprivate static final void setReturnValue(Ruby runtime, Type type, com.kenai.jffi.Closure.Buffer buffer, IRubyObject value)
runtime - The ruby runtime the callback is attached totype - The ruby type of the return valuebuffer - The native parameter buffervalue - The ruby valueprivate static final IRubyObject fromNative(Ruby runtime, Type type, com.kenai.jffi.Closure.Buffer buffer, int index)
runtime - The ruby runtime to create the ruby object intype - The type of the native parameterbuffer - The JFFI Closure parameter buffer.index - The index of the parameter in the buffer.private static final IRubyObject getStringParameter(Ruby runtime, com.kenai.jffi.Closure.Buffer buffer, int index)
runtime - The ruby runtime to create the ruby string inbuffer - The JFFI Closure parameter buffer.index - The index of the parameter in the buffer.