Package com.jogamp.gluegen.cgram.types
Class FunctionSymbol
- java.lang.Object
-
- com.jogamp.gluegen.cgram.types.AliasedSymbol.AliasedSymbolImpl
-
- com.jogamp.gluegen.cgram.types.FunctionSymbol
-
- All Implemented Interfaces:
ASTLocusTag.ASTLocusTagProvider
,AliasedSymbol
,TypeComparator.AliasedSemanticSymbol
,TypeComparator.SemanticEqualityOp
public class FunctionSymbol extends AliasedSymbol.AliasedSymbolImpl implements TypeComparator.AliasedSemanticSymbol, ASTLocusTag.ASTLocusTagProvider
Describes a function symbol, which includes the name and type. Since we are currently only concerned with processing functions this is the only symbol type, though plausibly more types should be added and a true symbol table constructed during parsing.Note: Since C does not support method-overloading polymorphism like C++ or Java, we ignore the
FunctionType
attribute inequals(Object)
andhashCode()
.
Hence we assume all method occurrences w/ same name are of equal or compatible type.
Deep comparison can be performed via#isCompletelyEqual(Object o)
;
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jogamp.gluegen.cgram.types.AliasedSymbol
AliasedSymbol.AliasedSymbolImpl, AliasedSymbol.NoneAliasedSymbol
-
-
Constructor Summary
Constructors Constructor Description FunctionSymbol(String name, FunctionType type)
FunctionSymbol(String name, FunctionType type, ASTLocusTag locus)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addArgument(Type argumentType, String argumentName)
Add an argument's name and type.static FunctionSymbol
cloneWithDeepAliases(FunctionSymbol o)
Shallow'ish copy, only aliased names are re-created.static boolean
containsExactly(List<FunctionSymbol> l, FunctionSymbol s)
boolean
equals(Object arg)
boolean
equalSemantics(TypeComparator.SemanticEqualityOp arg)
Semantic equality test for Types exclusive its givenname
.static int
exactIndexOf(List<FunctionSymbol> l, FunctionSymbol s)
boolean
exactlyEqual(Object arg)
Compares the function type as well, sinceequals(Object)
andhashCode()
won't.String
getArgumentName(int i)
Returns the name of the ith argument.Type
getArgumentType(int i)
Returns the type of the ith argument.ASTLocusTag
getASTLocusTag()
Returns this instance'sASTLocusTag
, if available, otherwise returnsnull
.int
getNumArguments()
Type
getReturnType()
Returns the return type of this function.FunctionType
getType()
Returns the type of this function.int
hashCode()
int
hashCodeSemantics()
Semantic hashcode for Types exclusive its givenname
.String
toString()
String
toString(boolean emitNativeTag)
Helper routine for emitting native javadoc tags-
Methods inherited from class com.jogamp.gluegen.cgram.types.AliasedSymbol.AliasedSymbolImpl
addAliasedName, getAliasedNames, getAliasedString, getName, getOrigName, hasAliases, rename
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.jogamp.gluegen.cgram.types.AliasedSymbol
addAliasedName, getAliasedNames, getAliasedString, getName, getOrigName, hasAliases, rename
-
-
-
-
Constructor Detail
-
FunctionSymbol
public FunctionSymbol(String name, FunctionType type)
-
FunctionSymbol
public FunctionSymbol(String name, FunctionType type, ASTLocusTag locus)
-
-
Method Detail
-
cloneWithDeepAliases
public static FunctionSymbol cloneWithDeepAliases(FunctionSymbol o)
Shallow'ish copy, only aliased names are re-created.
-
getASTLocusTag
public ASTLocusTag getASTLocusTag()
Description copied from interface:ASTLocusTag.ASTLocusTagProvider
Returns this instance'sASTLocusTag
, if available, otherwise returnsnull
.- Specified by:
getASTLocusTag
in interfaceASTLocusTag.ASTLocusTagProvider
-
getType
public FunctionType getType()
Returns the type of this function. Do not add arguments to it directly; use addArgument instead.
-
getReturnType
public Type getReturnType()
Returns the return type of this function.
-
getNumArguments
public int getNumArguments()
-
getArgumentName
public String getArgumentName(int i)
Returns the name of the ith argument. May return null if no argument names were available during parsing.
-
getArgumentType
public Type getArgumentType(int i)
Returns the type of the ith argument.
-
addArgument
public void addArgument(Type argumentType, String argumentName)
Add an argument's name and type. Use null for unknown argument names.
-
toString
public String toString(boolean emitNativeTag)
Helper routine for emitting native javadoc tags
-
hashCodeSemantics
public int hashCodeSemantics()
Description copied from interface:TypeComparator.SemanticEqualityOp
Semantic hashcode for Types exclusive its givenname
.- Specified by:
hashCodeSemantics
in interfaceTypeComparator.SemanticEqualityOp
- See Also:
TypeComparator.SemanticEqualityOp.equalSemantics(SemanticEqualityOp)
-
equalSemantics
public final boolean equalSemantics(TypeComparator.SemanticEqualityOp arg)
Description copied from interface:TypeComparator.SemanticEqualityOp
Semantic equality test for Types exclusive its givenname
.- Specified by:
equalSemantics
in interfaceTypeComparator.SemanticEqualityOp
- See Also:
TypeComparator.SemanticEqualityOp.hashCodeSemantics()
-
containsExactly
public static boolean containsExactly(List<FunctionSymbol> l, FunctionSymbol s)
-
exactIndexOf
public static int exactIndexOf(List<FunctionSymbol> l, FunctionSymbol s)
-
exactlyEqual
public boolean exactlyEqual(Object arg)
Compares the function type as well, sinceequals(Object)
andhashCode()
won't.
-
-