com.kenai.jffi
Class CallContext

java.lang.Object
  extended by com.kenai.jffi.CallContext
All Implemented Interfaces:
CallInfo

public final class CallContext
extends java.lang.Object
implements CallInfo

Native function call context This class holds all the information that JFFI needs to correctly call a native function, or to implement a callback from native code to java.


Constructor Summary
CallContext(Type returnType, Type... paramTypes)
          Creates a new instance of Function with default calling convention.
CallContext(Type returnType, Type[] paramTypes, CallingConvention convention)
          Creates a new instance of Function.
CallContext(Type returnType, Type[] paramTypes, CallingConvention convention, boolean saveErrno)
          Creates a new instance of Function.
 
Method Summary
 void dispose()
           
protected  void finalize()
           
 int getParameterCount()
          Gets the number of parameters the native function accepts.
 Type getParameterType(int index)
          Gets the type of a parameter.
 int getRawParameterSize()
          Gets the number of bytes required to pack all the parameters this function accepts, into a region of memory.
 Type getReturnType()
          Gets the native return type of this function.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallContext

public CallContext(Type returnType,
                   Type... paramTypes)
Creates a new instance of Function with default calling convention.

Parameters:
address - The native address of the function to invoke.
returnType - The return type of the native function.
parameterTypes - The parameter types the function accepts.

CallContext

public CallContext(Type returnType,
                   Type[] paramTypes,
                   CallingConvention convention)
Creates a new instance of Function. Function instances created with this constructor will save the C errno contents after each call.

Parameters:
address - The native address of the function to invoke.
returnType - The return type of the native function.
parameterTypes - The parameter types the function accepts.
convention - The calling convention of the function.

CallContext

public CallContext(Type returnType,
                   Type[] paramTypes,
                   CallingConvention convention,
                   boolean saveErrno)
Creates a new instance of Function.

Parameters:
address - The native address of the function to invoke.
returnType - The return type of the native function.
parameterTypes - The parameter types the function accepts.
convention - The calling convention of the function.
saveErrno - Whether the errno should be saved or not
Method Detail

getParameterCount

public final int getParameterCount()
Gets the number of parameters the native function accepts.

Specified by:
getParameterCount in interface CallInfo
Returns:
The number of parameters the native function accepts.

getRawParameterSize

public final int getRawParameterSize()
Gets the number of bytes required to pack all the parameters this function accepts, into a region of memory.

Specified by:
getRawParameterSize in interface CallInfo
Returns:
The number of bytes required to store all paraameters of this function.

getReturnType

public final Type getReturnType()
Gets the native return type of this function.

Specified by:
getReturnType in interface CallInfo
Returns:
The native return type of this function.

getParameterType

public final Type getParameterType(int index)
Gets the type of a parameter.

Specified by:
getParameterType in interface CallInfo
Parameters:
index - The index of the parameter in the function signature
Returns:
The Type of the parameter.

dispose

public final void dispose()

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable