Top Description Inners Fields Constructors Methods
com.jogamp.gluegen.runtime

public abstract Class ProcAddressTable

extends Object
Class Inheritance
Imports
com.jogamp.common.os.DynamicLookupHelper, com.jogamp.common.util.SecurityUtil, java.io.BufferedOutputStream, .File, .FileOutputStream, .IOException, .PrintStream, java.lang.reflect.AccessibleObject, .Field, java.security.AccessController, .PrivilegedAction, java.util.Iterator, .LinkedHashSet, .Map, .Set, .SortedMap, .TreeMap

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.
Authors
Kenneth Russel, Michael Bien, Sven Gothel
See Also
FunctionAddressResolver, DynamicLookupHelper

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
protected static boolean
protected static String
protected static int
private static final String
private static final int
private final FunctionAddressResolver

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
private final Field
private final Field
fieldForFunctionInSec(final String name)

Warning

Returns an accessible probably protected field!

private final String
fieldToFunctionName(final String addressFieldName)

public long
getAddressFor(final String functionName)

This is a convenience method to query the native function handle by name.

private static final PrintStream
public final Set<String>
getNullPointerFunctions()

Returns all functions pointing to null.

public void
initEntry(final String name, final DynamicLookupHelper lookup)

Initializes the mapping for a single function.

private final boolean
isAddressField(final String fieldName)

public final boolean
isFunctionAvailable(final String functionName)

Returns true only if non null function pointer to this function exists.

protected boolean
isFunctionAvailableImpl(final String functionName)

This is a convenience method to query the native function existence by name.

public void
reset(final DynamicLookupHelper lookup)

Resets the complete table.

private final void
setEntry(final Field addressField, final String funcName, final DynamicLookupHelper lookup)

private final Map<String, Long>
toMap()

Returns this table as map with the function name as key and the address as value.

public final String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

DEBUGback to summary
protected static boolean DEBUG
DEBUG_PREFIXback to summary
protected static String DEBUG_PREFIX
debugNumback to summary
protected static int debugNum
PROCADDRESS_VAR_PREFIXback to summary
private static final String PROCADDRESS_VAR_PREFIX
PROCADDRESS_VAR_PREFIX_LENback to summary
private static final int PROCADDRESS_VAR_PREFIX_LEN
resolverback to summary
private final FunctionAddressResolver resolver

Constructor Detail

ProcAddressTableback to summary
public ProcAddressTable()
ProcAddressTableback to summary
public ProcAddressTable(final FunctionAddressResolver resolver)

Method Detail

fieldForFunctionback to summary
private final Field fieldForFunction(final String name) throws IllegalArgumentException
fieldForFunctionInSecback to summary
private final Field fieldForFunctionInSec(final String name) throws IllegalArgumentException

Warning

Returns an accessible probably protected field!

Caller should have checked link permissions for all libraries, i.e. for new RuntimePermission("loadLibrary.*"); if exposing the field or address!

fieldToFunctionNameback to summary
private final String fieldToFunctionName(final String addressFieldName)
getAddressForback to summary
public long getAddressFor(final 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. for new RuntimePermission("loadLibrary.*");!

Exceptions
SecurityException:
if user is not granted access for all libraries.
IllegalArgumentException:
if this function is not in this table.
getDebugOutStreamback to summary
private static final PrintStream getDebugOutStream()
getNullPointerFunctionsback to summary
public final Set<String> getNullPointerFunctions()

Returns all functions pointing to null.

initEntryback to summary
public void initEntry(final String name, final 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. for new RuntimePermission("loadLibrary.*");!

Exceptions
SecurityException:
if user is not granted access for all libraries.
IllegalArgumentException:
if this function is not in this table.
isAddressFieldback to summary
private final boolean isAddressField(final String fieldName)
isFunctionAvailableback to summary
public final boolean isFunctionAvailable(final String functionName)

Returns true only if non null function pointer to this function exists.

isFunctionAvailableImplback to summary
protected boolean isFunctionAvailableImpl(final 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.

Exceptions
IllegalArgumentException:
if this function is not in this table.
resetback to summary
public void reset(final DynamicLookupHelper lookup) throws SecurityException, RuntimeException

Resets the complete table.

If a SecurityManager is installed, user needs link permissions for all libraries, i.e. for new RuntimePermission("loadLibrary.*");!

Exceptions
SecurityException:
if user is not granted access for all libraries.
setEntryback to summary
private final void setEntry(final Field addressField, final String funcName, final DynamicLookupHelper lookup) throws SecurityException
toMapback to summary
private final Map<String, Long> toMap()

Returns this table as map with the function name as key and the address as value.

toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
com.jogamp.gluegen.runtime back to summary

private Class ProcAddressTable.One2OneResolver

extends Object
implements FunctionAddressResolver
Class Inheritance
All Implemented Interfaces
com.jogamp.gluegen.runtime.FunctionAddressResolver

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public long
resolve(final String name, final DynamicLookupHelper lookup)

Implements com.jogamp.gluegen.runtime.FunctionAddressResolver.resolve.

Resolves the name of the function bound to the method and returns the address.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

One2OneResolverback to summary
private One2OneResolver()

Method Detail

resolveback to summary
public long resolve(final String name, final DynamicLookupHelper lookup) throws SecurityException

Implements com.jogamp.gluegen.runtime.FunctionAddressResolver.resolve.

Doc from com.jogamp.gluegen.runtime.FunctionAddressResolver.resolve.

Resolves the name of the function bound to the method and returns the address.

Implementation shall ensure SecurityUtil#checkLinkPermission(String) is performed.

Annotations
@Override
Exceptions
SecurityException:
if user is not granted access for the library set.