com.kenai.jaffl
Class FFIProvider

java.lang.Object
  extended by com.kenai.jaffl.FFIProvider
Direct Known Subclasses:
Provider

public abstract class FFIProvider
extends Object

This class defines the facilities a jaffl FFI provider must provide.


Constructor Summary
protected FFIProvider()
           
 
Method Summary
abstract  int getLastError()
          Gets the last native error code.
abstract  MemoryManager getMemoryManager()
          Gets the native memory manager for this provider.
static FFIProvider getProvider()
          Gets an instance of FFIProvider
abstract  Type getType(NativeType type)
           
abstract
<T> T
loadLibrary(Class<T> interfaceClass, Map<LibraryOption,?> libraryOptions, String... libraryNames)
          Loads a native library and links the methods defined in interfaceClass to native methods in the library.
abstract
<T> T
loadLibrary(String libraryName, Class<T> interfaceClass, Map<LibraryOption,?> libraryOptions)
          Loads a native library and links the methods defined in interfaceClass to native methods in the library.
abstract  void setLastError(int error)
          Sets the native error code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FFIProvider

protected FFIProvider()
Method Detail

getProvider

public static final FFIProvider getProvider()
Gets an instance of FFIProvider

Returns:
an instance of FFIProvider

getMemoryManager

public abstract MemoryManager getMemoryManager()
Gets the native memory manager for this provider.

Returns:
a MemoryManager

loadLibrary

public abstract <T> T loadLibrary(String libraryName,
                                  Class<T> interfaceClass,
                                  Map<LibraryOption,?> libraryOptions)
Loads a native library and links the methods defined in interfaceClass to native methods in the library.

Parameters:
libraryName - the name of the library to load
interfaceClass - the interface that describes the native library interface
libraryOptions - options
Returns:
an instance of interfaceclass that will call the native methods.

loadLibrary

public abstract <T> T loadLibrary(Class<T> interfaceClass,
                                  Map<LibraryOption,?> libraryOptions,
                                  String... libraryNames)
Loads a native library and links the methods defined in interfaceClass to native methods in the library.

Parameters:
interfaceClass - the interface that describes the native library interface
libraryOptions - options
libraryNames - the list of libraries to load
Returns:
an instance of interfaceclass that will call the native methods.

getLastError

public abstract int getLastError()
Gets the last native error code.

This returns the errno value that was set at the time of the last native function call.

Returns:
The errno value.

setLastError

public abstract void setLastError(int error)
Sets the native error code.

Parameters:
error - The value to set errno to.

getType

public abstract Type getType(NativeType type)


Copyright © 2011. All Rights Reserved.