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

Describes a function type, used to model both function declarations and (via PointerType) function pointers. More...

Inheritance diagram for com.jogamp.gluegen.cgram.types.FunctionType:
Collaboration diagram for com.jogamp.gluegen.cgram.types.FunctionType:

Classes

interface  ParameterConsumer
 forEachParameter(ParameterConsumer) Consumer More...
 

Public Member Functions

 FunctionType (final String name, final SizeThunk size, final Type returnType, final int cvAttributes)
 
 FunctionType (final String name, final SizeThunk size, final Type returnType, final int cvAttributes, final ASTLocusTag astLocus)
 
FunctionType asFunction ()
 Casts this to a FunctionType or returns null if not a FunctionType. More...
 
Type getReturnType ()
 Returns the return type of this function. More...
 
int getNumArguments ()
 
String getArgumentName (final int i)
 Returns the name of the ith argument. More...
 
Type getArgumentType (final int i)
 Returns the type of the ith argument. More...
 
StringBuilder getParameterList (final StringBuilder buf, final boolean useTypedef, final String callingConvention)
 Returns the function parameter list, i.e. More...
 
StringBuilder getParameterList (final StringBuilder buf, final boolean useTypedef, final String callingConvention, final List< Integer > exclude)
 Returns the function parameter list, i.e. More...
 
int forEachParameter (final ParameterConsumer c)
 
void addArgument (final Type argumentType, final String argumentName)
 Add an argument's name and type. More...
 
void setArgumentName (final int i, final String name)
 
String toString ()
 Returns a string representation of this type. More...
 
String toString (final String functionName, final boolean emitNativeTag)
 
String toString (final String functionName, final boolean emitNativeTag, final boolean isPointer)
 
String toString (final String functionName, final String callingConvention, final boolean emitNativeTag, final boolean isPointer)
 
void visit (final TypeVisitor arg)
 Traverse this Type and all of its component types; for example, the return type and argument types of a FunctionType. More...
 
- Public Member Functions inherited from com.jogamp.gluegen.cgram.types.Type
final Type newCVVariant (final int cvAttributes)
 Return a variant of this type matching the given const/volatile attributes. More...
 
Type clone (final ASTLocusTag newLoc)
 Clones this instance using a new ASTLocusTag. More...
 
final ASTLocusTag getASTLocusTag ()
 Returns this instance's ASTLocusTag, if available, otherwise returns null. More...
 
boolean isAnon ()
 
final String getCName ()
 Returns the name of this type. More...
 
String getCName (final boolean includeCVAttrs)
 Returns the name of this type, optionally including const/volatile attributes. More...
 
final String getName ()
 Returns the name of this type. More...
 
String getName (final boolean includeCVAttrs)
 Returns the name of this type, optionally including const/volatile attributes. More...
 
String toString ()
 Returns a string representation of this type. More...
 
final StringBuilder getSignature (StringBuilder sb)
 
final String getDebugString ()
 
boolean setTypedefName (final String name)
 Set the typedef name of this type and renders this type a typedef, if given name has a length. More...
 
final boolean isTypedef ()
 Indicates whether this type is a typedef type, i.e. More...
 
final boolean hasSize ()
 Returns true if getSize() is not null, otherwise false. More...
 
final SizeThunk getSize ()
 SizeThunk which computes size of this type in bytes. More...
 
final long getSize (final MachineDataInfo machDesc)
 Size of this type in bytes according to the given MachineDataInfo. More...
 
BitType asBit ()
 Casts this to a BitType or returns null if not a BitType. More...
 
IntType asInt ()
 Casts this to an IntType or returns null if not an IntType. More...
 
EnumType asEnum ()
 Casts this to an EnumType or returns null if not an EnumType. More...
 
FloatType asFloat ()
 Casts this to a FloatType or returns null if not a FloatType. More...
 
DoubleType asDouble ()
 Casts this to a DoubleType or returns null if not a DoubleType. More...
 
PointerType asPointer ()
 Casts this to a PointerType or returns null if not a PointerType. More...
 
ArrayType asArray ()
 Casts this to an ArrayType or returns null if not an ArrayType. More...
 
CompoundType asCompound ()
 Casts this to a CompoundType or returns null if not a CompoundType. More...
 
FunctionType asFunction ()
 Casts this to a FunctionType or returns null if not a FunctionType. More...
 
VoidType asVoid ()
 Casts this to a VoidType or returns null if not a VoidType. More...
 
final boolean isBit ()
 Indicates whether this is a BitType. More...
 
final boolean isInt ()
 Indicates whether this is an IntType. More...
 
final boolean isEnum ()
 Indicates whether this is an EnumType. More...
 
final boolean isFloat ()
 Indicates whether this is a FloatType. More...
 
final boolean isDouble ()
 Indicates whether this is a DoubleType. More...
 
final boolean isPointer ()
 Indicates whether this is a PointerType. More...
 
final boolean isArray ()
 Indicates whether this is an ArrayType. More...
 
final boolean isCompound ()
 Indicates whether this is a CompoundType. More...
 
final boolean isFunction ()
 Indicates whether this is a FunctionType. More...
 
final boolean isVoid ()
 Indicates whether this is a VoidType. More...
 
final boolean isVolatile ()
 Indicates whether this type is volatile. More...
 
final boolean isConst ()
 Indicates whether this type is const. More...
 
boolean isPrimitive ()
 Indicates whether this type is a primitive type. More...
 
boolean isFunctionPointer ()
 Convenience routine indicating whether this Type is a pointer to a function. More...
 
final boolean isBaseTypeConst ()
 Checks the base type of pointer-to-pointer, pointer, array or plain for const-ness. More...
 
final int hashCode ()
 Hashcode for Types. More...
 
final boolean equals (final Object arg)
 Equality test for Types inclusive its given name. More...
 
final int hashCodeSemantics ()
 Semantic hashcode for Types exclusive its given name. More...
 
final boolean equalSemantics (final SemanticEqualityOp arg)
 Semantic equality test for Types exclusive its given name. More...
 
void visit (final TypeVisitor visitor)
 Traverse this Type and all of its component types; for example, the return type and argument types of a FunctionType. More...
 
final int getCVAttributes ()
 
final String getCVAttributesString ()
 Returns a string indicating the const/volatile attributes of this type. More...
 
int pointerDepth ()
 Helper method for determining how many pointer indirections this type represents (i.e., "void **" returns 2). More...
 
int arrayDimension ()
 Helper method for determining how many array dimentions this type represents (i.e., "char[][]" returns 2). More...
 
Type getBaseType ()
 Helper method to returns the bottom-most element type of this type, i.e. More...
 
Type getTargetType ()
 Helper method to returns the target type of this type, in case another type is being referenced, i.e. More...
 
Type getArrayBaseOrPointerTargetType ()
 Return getBaseType() if isArray() or returns getTargetType() otherwise. More...
 
FunctionType getTargetFunction ()
 Returns the target FunctionType if this type is isFunctionPointer(). More...
 
int hashCodeSemantics ()
 Semantic hashcode for Types exclusive its given name. More...
 
boolean equalSemantics (final SemanticEqualityOp arg)
 Semantic equality test for Types exclusive its given name. More...
 
ASTLocusTag getASTLocusTag ()
 Returns this instance's ASTLocusTag, if available, otherwise returns null. More...
 

Protected Member Functions

int hashCodeImpl ()
 
boolean equalsImpl (final Type arg)
 
int hashCodeSemanticsImpl ()
 
boolean equalSemanticsImpl (final Type arg)
 
- Protected Member Functions inherited from com.jogamp.gluegen.cgram.types.Type
 Type (final String name, final SizeThunk size, final int cvAttributes, final ASTLocusTag astLocus)
 
final void clearCache ()
 
abstract int hashCodeImpl ()
 
abstract boolean equalsImpl (final Type t)
 
abstract int hashCodeSemanticsImpl ()
 
abstract boolean equalSemanticsImpl (final Type t)
 

Additional Inherited Members

- Public Attributes inherited from com.jogamp.gluegen.cgram.types.Type
final boolean relaxedEqSem
 

Detailed Description

Describes a function type, used to model both function declarations and (via PointerType) function pointers.

Definition at line 48 of file FunctionType.java.

Constructor & Destructor Documentation

◆ FunctionType() [1/2]

com.jogamp.gluegen.cgram.types.FunctionType.FunctionType ( final String  name,
final SizeThunk  size,
final Type  returnType,
final int  cvAttributes 
)

Definition at line 54 of file FunctionType.java.

Here is the caller graph for this function:

◆ FunctionType() [2/2]

com.jogamp.gluegen.cgram.types.FunctionType.FunctionType ( final String  name,
final SizeThunk  size,
final Type  returnType,
final int  cvAttributes,
final ASTLocusTag  astLocus 
)

Definition at line 58 of file FunctionType.java.

Member Function Documentation

◆ addArgument()

void com.jogamp.gluegen.cgram.types.FunctionType.addArgument ( final Type  argumentType,
final String  argumentName 
)

Add an argument's name and type.

Use null for unknown argument names.

Definition at line 215 of file FunctionType.java.

Here is the caller graph for this function:

◆ asFunction()

FunctionType com.jogamp.gluegen.cgram.types.FunctionType.asFunction ( )

Casts this to a FunctionType or returns null if not a FunctionType.

Reimplemented from com.jogamp.gluegen.cgram.types.Type.

Definition at line 114 of file FunctionType.java.

◆ equalSemanticsImpl()

boolean com.jogamp.gluegen.cgram.types.FunctionType.equalSemanticsImpl ( final Type  arg)
protected

Reimplemented from com.jogamp.gluegen.cgram.types.Type.

Definition at line 107 of file FunctionType.java.

Here is the call graph for this function:

◆ equalsImpl()

boolean com.jogamp.gluegen.cgram.types.FunctionType.equalsImpl ( final Type  arg)
protected

Reimplemented from com.jogamp.gluegen.cgram.types.Type.

Definition at line 93 of file FunctionType.java.

Here is the call graph for this function:

◆ forEachParameter()

int com.jogamp.gluegen.cgram.types.FunctionType.forEachParameter ( final ParameterConsumer  c)

Definition at line 201 of file FunctionType.java.

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

◆ getArgumentName()

String com.jogamp.gluegen.cgram.types.FunctionType.getArgumentName ( final int  i)

Returns the name of the ith argument.

May return null if no argument names were available during parsing.

Definition at line 129 of file FunctionType.java.

Here is the caller graph for this function:

◆ getArgumentType()

Type com.jogamp.gluegen.cgram.types.FunctionType.getArgumentType ( final int  i)

Returns the type of the ith argument.

Definition at line 134 of file FunctionType.java.

Here is the caller graph for this function:

◆ getNumArguments()

int com.jogamp.gluegen.cgram.types.FunctionType.getNumArguments ( )

Definition at line 123 of file FunctionType.java.

Here is the caller graph for this function:

◆ getParameterList() [1/2]

StringBuilder com.jogamp.gluegen.cgram.types.FunctionType.getParameterList ( 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 145 of file FunctionType.java.

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

◆ getParameterList() [2/2]

StringBuilder com.jogamp.gluegen.cgram.types.FunctionType.getParameterList ( 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 156 of file FunctionType.java.

Here is the call graph for this function:

◆ getReturnType()

Type com.jogamp.gluegen.cgram.types.FunctionType.getReturnType ( )

Returns the return type of this function.

Definition at line 119 of file FunctionType.java.

Here is the caller graph for this function:

◆ hashCodeImpl()

int com.jogamp.gluegen.cgram.types.FunctionType.hashCodeImpl ( )
protected

Reimplemented from com.jogamp.gluegen.cgram.types.Type.

Definition at line 86 of file FunctionType.java.

Here is the call graph for this function:

◆ hashCodeSemanticsImpl()

int com.jogamp.gluegen.cgram.types.FunctionType.hashCodeSemanticsImpl ( )
protected

Reimplemented from com.jogamp.gluegen.cgram.types.Type.

Definition at line 100 of file FunctionType.java.

Here is the call graph for this function:

◆ setArgumentName()

void com.jogamp.gluegen.cgram.types.FunctionType.setArgumentName ( final int  i,
final String  name 
)

Definition at line 225 of file FunctionType.java.

◆ toString() [1/4]

String com.jogamp.gluegen.cgram.types.FunctionType.toString ( )

Returns a string representation of this type.

The returned string is suitable for use as a type specifier for native C. It does contain an expanded description of structs/unions, hence may not be suitable for type declarations.

Reimplemented from com.jogamp.gluegen.cgram.types.Type.

Definition at line 231 of file FunctionType.java.

Here is the caller graph for this function:

◆ toString() [2/4]

String com.jogamp.gluegen.cgram.types.FunctionType.toString ( final String  functionName,
final boolean  emitNativeTag 
)

Definition at line 235 of file FunctionType.java.

◆ toString() [3/4]

String com.jogamp.gluegen.cgram.types.FunctionType.toString ( final String  functionName,
final boolean  emitNativeTag,
final boolean  isPointer 
)

Definition at line 238 of file FunctionType.java.

◆ toString() [4/4]

String com.jogamp.gluegen.cgram.types.FunctionType.toString ( final String  functionName,
final String  callingConvention,
final boolean  emitNativeTag,
final boolean  isPointer 
)

Definition at line 242 of file FunctionType.java.

◆ visit()

void com.jogamp.gluegen.cgram.types.FunctionType.visit ( final TypeVisitor  visitor)

Traverse this Type and all of its component types; for example, the return type and argument types of a FunctionType.

Reimplemented from com.jogamp.gluegen.cgram.types.Type.

Definition at line 274 of file FunctionType.java.

Here is the call graph for this function:

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