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
FunctionTypeattribute 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 voidaddArgument(Type argumentType, String argumentName)Add an argument's name and type.static FunctionSymbolcloneWithDeepAliases(FunctionSymbol o)Shallow'ish copy, only aliased names are re-created.static booleancontainsExactly(List<FunctionSymbol> l, FunctionSymbol s)booleanequals(Object arg)booleanequalSemantics(TypeComparator.SemanticEqualityOp arg)Semantic equality test for Types exclusive its givenname.static intexactIndexOf(List<FunctionSymbol> l, FunctionSymbol s)booleanexactlyEqual(Object arg)Compares the function type as well, sinceequals(Object)andhashCode()won't.StringgetArgumentName(int i)Returns the name of the ith argument.TypegetArgumentType(int i)Returns the type of the ith argument.ASTLocusTaggetASTLocusTag()Returns this instance'sASTLocusTag, if available, otherwise returnsnull.intgetNumArguments()TypegetReturnType()Returns the return type of this function.FunctionTypegetType()Returns the type of this function.inthashCode()inthashCodeSemantics()Semantic hashcode for Types exclusive its givenname.StringtoString()StringtoString(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.ASTLocusTagProviderReturns this instance'sASTLocusTag, if available, otherwise returnsnull.- Specified by:
getASTLocusTagin 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.SemanticEqualityOpSemantic hashcode for Types exclusive its givenname.- Specified by:
hashCodeSemanticsin interfaceTypeComparator.SemanticEqualityOp- See Also:
TypeComparator.SemanticEqualityOp.equalSemantics(SemanticEqualityOp)
-
equalSemantics
public final boolean equalSemantics(TypeComparator.SemanticEqualityOp arg)
Description copied from interface:TypeComparator.SemanticEqualityOpSemantic equality test for Types exclusive its givenname.- Specified by:
equalSemanticsin 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.
-
-