com.kenai.jffi
Class CallContext

java.lang.Object
  extended by com.kenai.jffi.CallContext

public final class CallContext
extends Object

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... parameterTypes)
          Creates a new instance of Function with default calling convention.
CallContext(Type returnType, Type[] parameterTypes, CallingConvention convention)
          Creates a new instance of Function.
CallContext(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno)
           
 
Method Summary
 void dispose()
          Deprecated. 
 boolean equals(Object o)
           
protected  void finalize()
           
static CallContext getCallContext(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno)
          Returns a CallContext instance.
static CallContext getCallContext(Type returnType, Type[] parameterTypes, CallingConvention convention, boolean saveErrno, boolean faultProtect)
           
 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.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallContext

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

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

CallContext

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

Parameters:
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[] parameterTypes,
                   CallingConvention convention,
                   boolean saveErrno)
Method Detail

getCallContext

public static CallContext getCallContext(Type returnType,
                                         Type[] parameterTypes,
                                         CallingConvention convention,
                                         boolean saveErrno)
Returns a CallContext instance. This may return a previously cached instance that matches the signature requested, and should be used in preference to instantiating new instances.

Parameters:
returnType - The return type of the native function.
parameterTypes - The parameter types the function accepts.
convention - The calling convention of the function.
saveErrno - Indicates that the errno should be saved
Returns:
An instance of CallContext

getCallContext

public static CallContext getCallContext(Type returnType,
                                         Type[] parameterTypes,
                                         CallingConvention convention,
                                         boolean saveErrno,
                                         boolean faultProtect)

getParameterCount

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

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.

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.

Returns:
The native return type of this function.

getParameterType

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

Parameters:
index - The index of the parameter in the function signature
Returns:
The Type of the parameter.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

dispose

@Deprecated
public final void dispose()
Deprecated. 


finalize

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


Copyright © 2013. All Rights Reserved.