GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
com.jogamp.gluegen.MethodBinding Class Reference

Represents the binding of a C function to a Java method. More...

Collaboration diagram for com.jogamp.gluegen.MethodBinding:

Classes

interface  ParameterConsumer
 forEachParameter(ParameterConsumer) Consumer More...
 

Public Member Functions

 MethodBinding (final MethodBinding bindingToCopy)
 Constructs a new MethodBinding that is an exact clone of the argument, including the java return type and java argument types. More...
 
 MethodBinding (final FunctionSymbol sym, final String delegationImplName, final JavaType javaReturnType, final List< JavaType > javaArgumentTypes, final JavaType containingType, final Type containingCType)
 Constructor for calling a C function or a function pointer contained in a struct. More...
 
void setJavaReturnType (final JavaType type)
 
void addJavaArgumentType (final JavaType type)
 
JavaType getJavaReturnType ()
 
int getNumArguments ()
 
JavaType getJavaArgumentType (final int i)
 
Type getCReturnType ()
 
Type getCArgumentType (final int i)
 
StringBuilder getCParameterList (final StringBuilder buf, final boolean useTypedef, final String callingConvention)
 Returns the function parameter list, i.e. More...
 
StringBuilder getCParameterList (final StringBuilder buf, final boolean useTypedef, final String callingConvention, final List< Integer > exclude)
 Returns the function parameter list, i.e. More...
 
StringBuilder getJavaParameterList (final StringBuilder buf)
 Returns the function parameter list, i.e. More...
 
StringBuilder getJavaParameterList (final StringBuilder buf, final List< Integer > exclude)
 Returns the function parameter list, i.e. More...
 
StringBuilder getJavaSelectParameter (final StringBuilder buf, final List< Integer > include, final boolean addTailSeparator)
 Returns the function parameter list, i.e. More...
 
StringBuilder getJavaCallArgumentList (final StringBuilder buf, final List< Integer > exclude)
 
StringBuilder getJavaCallSelectArguments (final StringBuilder buf, final List< Integer > include, final boolean addTailSeparator)
 
int forEachParameter (final ParameterConsumer c)
 
final boolean isReturnCompoundByValue ()
 
FunctionSymbol getCSymbol ()
 Returns the FunctionSymbol. More...
 
String getArgumentName (final int i)
 Returns either the argument name specified by the underlying FunctionSymbol or a fabricated argument name based on the position. More...
 
String getName ()
 Returns the FunctionSymbol's current aliased API name. More...
 
String getDelegationImplName ()
 The implementation delegation name, or null for no delegation. More...
 
String getInterfaceName ()
 Returns the FunctionSymbol's current aliased API name for the interface. More...
 
String getImplName ()
 Returns the FunctionSymbol's name for the implementation, which is the current aliased API name per default, or the delegation name. More...
 
String getNativeName ()
 Returns the FunctionSymbol's name for the native function which is the original C API name per default, but may be overridden via setNativeName(String). More...
 
void setNativeName (final String s)
 
MethodBinding replaceJavaArgumentType (final int argumentNumber, final JavaType newArgType)
 Creates a new MethodBinding replacing the specified Java argument type with a new argument type. More...
 
boolean argumentsUseNIO ()
 Returns true if any of the outgoing arguments in the method's signature require conversion or checking due to the use of New I/O. More...
 
boolean signatureUsesNIO ()
 Returns true if the return type or any of the outgoing arguments in the method's signature require conversion or checking due to the use of New I/O. More...
 
boolean signatureCanUseIndirectNIO ()
 Returns true if it is possible for any of the outgoing arguments to be indirect NIO buffers. More...
 
boolean signatureUsesCompoundTypeWrappers ()
 Returns true if the return type or any of the outgoing arguments in the method's signature use "compound type wrappers", or NIO-based wrappers for C data structures. More...
 
boolean signatureUsesArraysOfCompoundTypeWrappers ()
 Returns true if the return type or any of the outgoing arguments in the method's signature use arrays of "compound type wrappers", or NIO-based wrappers for C data structures. More...
 
boolean needsNIOWrappingOrUnwrapping ()
 Returns true if the function needs NIO-related wrapping/unwrapping or conversion of various arguments. More...
 
boolean signatureUsesCVoidPointers ()
 Returns true if the return type or any of the outgoing arguments in the method's signature represent C void* pointers. More...
 
boolean signatureUsesCPrimitivePointers ()
 Returns true if the return type or any of the outgoing arguments in the method's signature represent C primitive pointers. More...
 
boolean signatureUsesCArrays ()
 Returns true if the return type or any of the outgoing arguments in the method's signature represent C arrays. More...
 
boolean signatureUsesJavaPrimitiveArrays ()
 Returns true if the return type or any of the outgoing arguments in the method's signature represent Java primitive arrays. More...
 
boolean hasContainingType ()
 Indicates whether this MethodBinding is for a function pointer contained in a struct, or to access array- or pointer-data from a struct. More...
 
JavaType getContainingType ()
 Retrieves the containing type of this MethodBinding if it is for a function pointer contained in a struct. More...
 
Type getContainingCType ()
 Retrieves the containing C type of this MethodBinding if it is for a function pointer contained in a struct. More...
 
void findThisPointer ()
 Find the leftmost argument matching the type of the containing type (for function pointer MethodBindings) and record that as a "this" pointer, meaning that it does not need to be explicitly passed at the Java level. More...
 
void clearThisPointer ()
 Clears any record of a this pointer for this MethodBinding. More...
 
boolean isArgumentThisPointer (final int i)
 Indicates whether the ith argument to this MethodBinding is actually a "this" pointer. More...
 
boolean equals (final Object obj)
 
int hashCode ()
 
String toString ()
 Returns the signature of this binding. More...
 
String getDescriptor (final boolean forImplementingMethodCall, final boolean eraseBufferAndArrayTypes)
 Returns a String containing the descriptor (signature in internal format) of this MethodBinding as it will be emitted. More...
 

Protected Member Functions

void computeSignatureProperties ()
 Computes summary information about the method's C and Java signatures. More...
 
String erasedTypeDescriptor (final JavaType type, final boolean eraseBufferAndArrayTypes, final boolean skipBuffers)
 

Detailed Description

Represents the binding of a C function to a Java method.

Also used to represent calls through function pointers contained in structs.

Definition at line 54 of file MethodBinding.java.

Constructor & Destructor Documentation

◆ MethodBinding() [1/2]

com.jogamp.gluegen.MethodBinding.MethodBinding ( final MethodBinding  bindingToCopy)

Constructs a new MethodBinding that is an exact clone of the argument, including the java return type and java argument types.

It's safe to modify this binding after construction.

Definition at line 80 of file MethodBinding.java.

◆ MethodBinding() [2/2]

com.jogamp.gluegen.MethodBinding.MethodBinding ( final FunctionSymbol  sym,
final String  delegationImplName,
final JavaType  javaReturnType,
final List< JavaType javaArgumentTypes,
final JavaType  containingType,
final Type  containingCType 
)

Constructor for calling a C function or a function pointer contained in a struct.

In case of the latter, a struct function pointer, the arguments containingType and containingCType must not be null!

Definition at line 109 of file MethodBinding.java.

Member Function Documentation

◆ addJavaArgumentType()

void com.jogamp.gluegen.MethodBinding.addJavaArgumentType ( final JavaType  type)

Definition at line 130 of file MethodBinding.java.

Here is the caller graph for this function:

◆ argumentsUseNIO()

boolean com.jogamp.gluegen.MethodBinding.argumentsUseNIO ( )

Returns true if any of the outgoing arguments in the method's signature require conversion or checking due to the use of New I/O.

Definition at line 410 of file MethodBinding.java.

◆ clearThisPointer()

void com.jogamp.gluegen.MethodBinding.clearThisPointer ( )

Clears any record of a this pointer for this MethodBinding.

Definition at line 650 of file MethodBinding.java.

◆ computeSignatureProperties()

void com.jogamp.gluegen.MethodBinding.computeSignatureProperties ( )
protected

Computes summary information about the method's C and Java signatures.

Definition at line 504 of file MethodBinding.java.

Here is the call graph for this function:

◆ equals()

boolean com.jogamp.gluegen.MethodBinding.equals ( final Object  obj)

Definition at line 660 of file MethodBinding.java.

Here is the call graph for this function:

◆ erasedTypeDescriptor()

String com.jogamp.gluegen.MethodBinding.erasedTypeDescriptor ( final JavaType  type,
final boolean  eraseBufferAndArrayTypes,
final boolean  skipBuffers 
)
protected

Definition at line 811 of file MethodBinding.java.

Here is the call graph for this function:

◆ findThisPointer()

void com.jogamp.gluegen.MethodBinding.findThisPointer ( )

Find the leftmost argument matching the type of the containing type (for function pointer MethodBindings) and record that as a "this" pointer, meaning that it does not need to be explicitly passed at the Java level.

Definition at line 634 of file MethodBinding.java.

Here is the call graph for this function:

◆ forEachParameter()

int com.jogamp.gluegen.MethodBinding.forEachParameter ( final ParameterConsumer  c)

Definition at line 306 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getArgumentName()

String com.jogamp.gluegen.MethodBinding.getArgumentName ( final int  i)

Returns either the argument name specified by the underlying FunctionSymbol or a fabricated argument name based on the position.

Note that it is currently not guaranteed that there are no namespace clashes with these fabricated argument names.

Definition at line 338 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getCArgumentType()

Type com.jogamp.gluegen.MethodBinding.getCArgumentType ( final int  i)

Definition at line 154 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContainingCType()

Type com.jogamp.gluegen.MethodBinding.getContainingCType ( )

Retrieves the containing C type of this MethodBinding if it is for a function pointer contained in a struct.

Definition at line 626 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getContainingType()

JavaType com.jogamp.gluegen.MethodBinding.getContainingType ( )

Retrieves the containing type of this MethodBinding if it is for a function pointer contained in a struct.

Definition at line 620 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getCParameterList() [1/2]

StringBuilder com.jogamp.gluegen.MethodBinding.getCParameterList ( final StringBuilder  buf,
final boolean  useTypedef,
final String  callingConvention 
)

Returns the function parameter list, i.e.

a comma separated list of argument type and name.

Parameters
bufStringBuilder instance
useTypedefif true and type is typedef'ed, use its name
callingConventionoptional calling-convention
Returns
given StringBuilder instance

Definition at line 165 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCParameterList() [2/2]

StringBuilder com.jogamp.gluegen.MethodBinding.getCParameterList ( final StringBuilder  buf,
final boolean  useTypedef,
final String  callingConvention,
final List< Integer >  exclude 
)

Returns the function parameter list, i.e.

a comma separated list of argument type and name.

Parameters
bufStringBuilder instance
useTypedefif true and type is typedef'ed, use its name
callingConventionoptional calling-convention
excludeoptional list of excluded parameter indices
Returns
given StringBuilder instance

Definition at line 176 of file MethodBinding.java.

Here is the call graph for this function:

◆ getCReturnType()

Type com.jogamp.gluegen.MethodBinding.getCReturnType ( )

Definition at line 150 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCSymbol()

FunctionSymbol com.jogamp.gluegen.MethodBinding.getCSymbol ( )

Returns the FunctionSymbol.

Definition at line 329 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getDelegationImplName()

String com.jogamp.gluegen.MethodBinding.getDelegationImplName ( )

The implementation delegation name, or null for no delegation.

See also
getImplName()

Definition at line 356 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getDescriptor()

String com.jogamp.gluegen.MethodBinding.getDescriptor ( final boolean  forImplementingMethodCall,
final boolean  eraseBufferAndArrayTypes 
)

Returns a String containing the descriptor (signature in internal format) of this MethodBinding as it will be emitted.

This is used to disambiguate between overloadings when manually specifying prologue and epilogue code, for example.

Definition at line 756 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getImplName()

String com.jogamp.gluegen.MethodBinding.getImplName ( )

Returns the FunctionSymbol's name for the implementation, which is the current aliased API name per default, or the delegation name.

See also
getDelegationImplName()

Definition at line 370 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getInterfaceName()

String com.jogamp.gluegen.MethodBinding.getInterfaceName ( )

Returns the FunctionSymbol's current aliased API name for the interface.

Definition at line 361 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getJavaArgumentType()

JavaType com.jogamp.gluegen.MethodBinding.getJavaArgumentType ( final int  i)

Definition at line 146 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getJavaCallArgumentList()

StringBuilder com.jogamp.gluegen.MethodBinding.getJavaCallArgumentList ( final StringBuilder  buf,
final List< Integer >  exclude 
)

Definition at line 260 of file MethodBinding.java.

Here is the call graph for this function:

◆ getJavaCallSelectArguments()

StringBuilder com.jogamp.gluegen.MethodBinding.getJavaCallSelectArguments ( final StringBuilder  buf,
final List< Integer >  include,
final boolean  addTailSeparator 
)

Definition at line 274 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getJavaParameterList() [1/2]

StringBuilder com.jogamp.gluegen.MethodBinding.getJavaParameterList ( final StringBuilder  buf)

Returns the function parameter list, i.e.

a comma separated list of argument type and name.

Parameters
bufStringBuilder instance
Returns
given StringBuilder instance

Definition at line 213 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getJavaParameterList() [2/2]

StringBuilder com.jogamp.gluegen.MethodBinding.getJavaParameterList ( final StringBuilder  buf,
final List< Integer >  exclude 
)

Returns the function parameter list, i.e.

a comma separated list of argument type and name.

Parameters
bufStringBuilder instance
excludeoptional list of excluded parameter indices
Returns
given StringBuilder instance

Definition at line 222 of file MethodBinding.java.

Here is the call graph for this function:

◆ getJavaReturnType()

JavaType com.jogamp.gluegen.MethodBinding.getJavaReturnType ( )

Definition at line 138 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getJavaSelectParameter()

StringBuilder com.jogamp.gluegen.MethodBinding.getJavaSelectParameter ( final StringBuilder  buf,
final List< Integer >  include,
final boolean  addTailSeparator 
)

Returns the function parameter list, i.e.

a comma separated list of argument type and name.

Parameters
bufStringBuilder instance
includelist of explicit included parameter indices
addTailSeparatoradd a comma separator in the end if result is not empty
Returns
given StringBuilder instance

Definition at line 243 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getName()

String com.jogamp.gluegen.MethodBinding.getName ( )

Returns the FunctionSymbol's current aliased API name.

Definition at line 347 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getNativeName()

String com.jogamp.gluegen.MethodBinding.getNativeName ( )

Returns the FunctionSymbol's name for the native function which is the original C API name per default, but may be overridden via setNativeName(String).

Definition at line 378 of file MethodBinding.java.

Here is the caller graph for this function:

◆ getNumArguments()

int com.jogamp.gluegen.MethodBinding.getNumArguments ( )

Definition at line 142 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasContainingType()

boolean com.jogamp.gluegen.MethodBinding.hasContainingType ( )

Indicates whether this MethodBinding is for a function pointer contained in a struct, or to access array- or pointer-data from a struct.

The native calling convention, i.e. via a 'this' function pointer or by a static native function must be decided in the JavaEmitter handling structs and passed to the CMethodBindingEmitter#setIsCStructFunctionPointer(boolean).

Definition at line 614 of file MethodBinding.java.

Here is the caller graph for this function:

◆ hashCode()

int com.jogamp.gluegen.MethodBinding.hashCode ( )

Definition at line 694 of file MethodBinding.java.

Here is the call graph for this function:

◆ isArgumentThisPointer()

boolean com.jogamp.gluegen.MethodBinding.isArgumentThisPointer ( final int  i)

Indicates whether the ith argument to this MethodBinding is actually a "this" pointer.

Definition at line 656 of file MethodBinding.java.

Here is the caller graph for this function:

◆ isReturnCompoundByValue()

final boolean com.jogamp.gluegen.MethodBinding.isReturnCompoundByValue ( )

Definition at line 317 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ needsNIOWrappingOrUnwrapping()

boolean com.jogamp.gluegen.MethodBinding.needsNIOWrappingOrUnwrapping ( )

Returns true if the function needs NIO-related wrapping/unwrapping or conversion of various arguments.

Currently this returns the logical OR of signatureUsesNIO(), signatureUsesCompoundTypeWrappers() and signatureUsesArraysOfCompoundTypeWrappers().

Definition at line 460 of file MethodBinding.java.

Here is the caller graph for this function:

◆ replaceJavaArgumentType()

MethodBinding com.jogamp.gluegen.MethodBinding.replaceJavaArgumentType ( final int  argumentNumber,
final JavaType  newArgType 
)

Creates a new MethodBinding replacing the specified Java argument type with a new argument type.

If argumentNumber is less than 0 then replaces the return type.

Definition at line 386 of file MethodBinding.java.

Here is the call graph for this function:

◆ setJavaReturnType()

void com.jogamp.gluegen.MethodBinding.setJavaReturnType ( final JavaType  type)

Definition at line 125 of file MethodBinding.java.

Here is the caller graph for this function:

◆ setNativeName()

void com.jogamp.gluegen.MethodBinding.setNativeName ( final String  s)

Definition at line 381 of file MethodBinding.java.

◆ signatureCanUseIndirectNIO()

boolean com.jogamp.gluegen.MethodBinding.signatureCanUseIndirectNIO ( )

Returns true if it is possible for any of the outgoing arguments to be indirect NIO buffers.

Definition at line 429 of file MethodBinding.java.

◆ signatureUsesArraysOfCompoundTypeWrappers()

boolean com.jogamp.gluegen.MethodBinding.signatureUsesArraysOfCompoundTypeWrappers ( )

Returns true if the return type or any of the outgoing arguments in the method's signature use arrays of "compound type wrappers", or NIO-based wrappers for C data structures.

Definition at line 449 of file MethodBinding.java.

◆ signatureUsesCArrays()

boolean com.jogamp.gluegen.MethodBinding.signatureUsesCArrays ( )

Returns true if the return type or any of the outgoing arguments in the method's signature represent C arrays.

Definition at line 486 of file MethodBinding.java.

◆ signatureUsesCompoundTypeWrappers()

boolean com.jogamp.gluegen.MethodBinding.signatureUsesCompoundTypeWrappers ( )

Returns true if the return type or any of the outgoing arguments in the method's signature use "compound type wrappers", or NIO-based wrappers for C data structures.

Definition at line 439 of file MethodBinding.java.

◆ signatureUsesCPrimitivePointers()

boolean com.jogamp.gluegen.MethodBinding.signatureUsesCPrimitivePointers ( )

Returns true if the return type or any of the outgoing arguments in the method's signature represent C primitive pointers.

Definition at line 477 of file MethodBinding.java.

◆ signatureUsesCVoidPointers()

boolean com.jogamp.gluegen.MethodBinding.signatureUsesCVoidPointers ( )

Returns true if the return type or any of the outgoing arguments in the method's signature represent C void* pointers.

Definition at line 468 of file MethodBinding.java.

◆ signatureUsesJavaPrimitiveArrays()

boolean com.jogamp.gluegen.MethodBinding.signatureUsesJavaPrimitiveArrays ( )

Returns true if the return type or any of the outgoing arguments in the method's signature represent Java primitive arrays.

Definition at line 495 of file MethodBinding.java.

◆ signatureUsesNIO()

boolean com.jogamp.gluegen.MethodBinding.signatureUsesNIO ( )

Returns true if the return type or any of the outgoing arguments in the method's signature require conversion or checking due to the use of New I/O.

Definition at line 420 of file MethodBinding.java.

◆ toString()

String com.jogamp.gluegen.MethodBinding.toString ( )

Returns the signature of this binding.

Definition at line 719 of file MethodBinding.java.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: