Package com.jogamp.gluegen.runtime
Class ProcAddressTable
- java.lang.Object
-
- com.jogamp.gluegen.runtime.ProcAddressTable
-
public abstract class ProcAddressTable extends Object
Superclass for all generated ProcAddressTables. A ProcAddressTable is a cache of pointers to the dynamically-linkable C functions this autogenerated Java binding has exposed. Some libraries such as OpenGL, OpenAL and others define function pointer signatures rather than statically linkable entry points for the purposes of being able to query at run-time whether a particular extension is available. This table acts as a cache of these function pointers. Each function pointer is typically looked up at run-time by a platform-dependent mechanism such as dlsym(), wgl/glXGetProcAddress(), or alGetProcAddress(). If the field containing the function pointer is 0, the function is considered to be unavailable and can not be called.- Author:
- Kenneth Russel, Michael Bien, Sven Gothel
- See Also:
FunctionAddressResolver
,DynamicLookupHelper
-
-
Field Summary
Fields Modifier and Type Field Description protected static boolean
DEBUG
protected static String
DEBUG_PREFIX
protected static int
debugNum
-
Constructor Summary
Constructors Constructor Description ProcAddressTable()
ProcAddressTable(FunctionAddressResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getAddressFor(String functionName)
This is a convenience method to query the native function handle by name.Set<String>
getNullPointerFunctions()
Returns all functions pointing to null.void
initEntry(String name, DynamicLookupHelper lookup)
Initializes the mapping for a single function.boolean
isFunctionAvailable(String functionName)
Returns true only if non null function pointer to this function exists.protected boolean
isFunctionAvailableImpl(String functionName)
This is a convenience method to query the native function existence by name.void
reset(DynamicLookupHelper lookup)
Resets the complete table.String
toString()
-
-
-
Field Detail
-
DEBUG
protected static boolean DEBUG
-
DEBUG_PREFIX
protected static String DEBUG_PREFIX
-
debugNum
protected static int debugNum
-
-
Constructor Detail
-
ProcAddressTable
public ProcAddressTable()
-
ProcAddressTable
public ProcAddressTable(FunctionAddressResolver resolver)
-
-
Method Detail
-
reset
public void reset(DynamicLookupHelper lookup) throws SecurityException, RuntimeException
Resets the complete table.If a
SecurityManager
is installed, user needs link permissions for all libraries, i.e. fornew RuntimePermission("loadLibrary.*");
!- Throws:
SecurityException
- if user is not granted access for all libraries.RuntimeException
-
initEntry
public void initEntry(String name, DynamicLookupHelper lookup) throws SecurityException, IllegalArgumentException
Initializes the mapping for a single function.If a
SecurityManager
is installed, user needs link permissions for all libraries, i.e. fornew RuntimePermission("loadLibrary.*");
!- Throws:
IllegalArgumentException
- if this function is not in this table.SecurityException
- if user is not granted access for all libraries.
-
isFunctionAvailable
public final boolean isFunctionAvailable(String functionName)
Returns true only if non null function pointer to this function exists.
-
isFunctionAvailableImpl
protected boolean isFunctionAvailableImpl(String functionName) throws IllegalArgumentException
This is a convenience method to query the native function existence by name.It lets you avoid having to manually compute the "
PROCADDRESS_VAR_PREFIX
+ <functionName>" member variable name and look it up via reflection.- Throws:
IllegalArgumentException
- if this function is not in this table.
-
getAddressFor
public long getAddressFor(String functionName) throws SecurityException, IllegalArgumentException
This is a convenience method to query the native function handle by name.It lets you avoid having to manually compute the "
PROCADDRESS_VAR_PREFIX
+ <functionName>" member variable name and look it up via reflection.If a
SecurityManager
is installed, user needs link permissions for all libraries, i.e. fornew RuntimePermission("loadLibrary.*");
!- Throws:
IllegalArgumentException
- if this function is not in this table.SecurityException
- if user is not granted access for all libraries.
-
getNullPointerFunctions
public final Set<String> getNullPointerFunctions()
Returns all functions pointing to null.
-
-