Package com.jogamp.gluegen.cgram.types
Class CompoundType
java.lang.Object
com.jogamp.gluegen.cgram.types.Type
com.jogamp.gluegen.cgram.types.MemoryLayoutType
com.jogamp.gluegen.cgram.types.CompoundType
- All Implemented Interfaces:
ASTLocusTag.ASTLocusTagProvider,AliasedSymbol,TypeComparator.SemanticEqualityOp,Cloneable
- Direct Known Subclasses:
StructType,UnionType
Models all compound types, i.e., those containing fields: structs
and unions. The boolean type accessors indicate how the type is
really defined.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jogamp.gluegen.cgram.types.AliasedSymbol
AliasedSymbol.AliasedSymbolImpl, AliasedSymbol.NoneAliasedSymbol -
Field Summary
Fields inherited from class com.jogamp.gluegen.cgram.types.Type
relaxedEqSem -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAliasedName(String origName) voidAdds a field to this type.Casts this to a CompoundType or returns null if not a CompoundType.static CompoundTypecreate(String structName, SizeThunk size, CompoundTypeKind kind, int cvAttributes, ASTLocusTag astLocus) protected booleanequalSemanticsImpl(Type arg) protected booleanequalsImpl(Type arg) Return all aliases for this symbol, i.e.getCName(boolean includeCVAttrs) Returns the name of this type, optionally including const/volatile attributes.getField(int i) Returns the ith field of this type.intReturns the number of fields in this type.Return the original-name as set at creation.Returns the struct name of this CompoundType, i.e.booleanReturnstrueif this symbol has aliases, i.e.protected intprotected intabstract booleanisStruct()Indicates whether this type was declared as a struct.abstract booleanisUnion()Indicates whether this type was declared as a union.voidRename this symbol with the givennewNameif not equalcurrent-name.voidIndicates to this CompoundType that its body has been parsed and that no moreaddField(com.jogamp.gluegen.cgram.types.Field)operations will be made.toString()Returns a string representation of this type.voidvisit(TypeVisitor arg) Traverse thisTypeand all of its component types; for example, the return type and argument types of a FunctionType.Methods inherited from class com.jogamp.gluegen.cgram.types.MemoryLayoutType
isLayouted, setLayoutedMethods inherited from class com.jogamp.gluegen.cgram.types.Type
arrayDimension, asArray, asBit, asDouble, asEnum, asFloat, asFunction, asInt, asPointer, asVoid, clearCache, clone, equals, equalSemantics, getASTLocusTag, getBaseElementType, getCName, getCVAttributes, getCVAttributesString, getDebugString, getName, getName, getSize, getSize, getTargetType, hashCode, hashCodeSemantics, isAnon, isArray, isBaseTypeConst, isBit, isCompound, isConst, isDouble, isEnum, isFloat, isFunction, isFunctionPointer, isInt, isPointer, isPrimitive, isTypedef, isVoid, isVolatile, newCVVariant, pointerDepth, setTypedefNameMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.jogamp.gluegen.cgram.types.AliasedSymbol
getName
-
Method Details
-
rename
Description copied from interface:AliasedSymbolRename this symbol with the givennewNameif not equalcurrent-name.Before renaming the
current-namewill be added to the list ofaliases. while the givennewNamewill be removed.Operation will be ignored if
newNameisnull.- Specified by:
renamein interfaceAliasedSymbol- Parameters:
newName- the newcurrent-name, maybenull
-
addAliasedName
Description copied from interface:AliasedSymbolAdd the givenorigNameto the list ofaliasesif not equalcurrent-name.Operation will be ignored if
newNameisnull.- Specified by:
addAliasedNamein interfaceAliasedSymbol- Parameters:
origName- the new alias to be added, maybenull
-
hasAliases
public boolean hasAliases()Description copied from interface:AliasedSymbolReturnstrueif this symbol has aliases, i.e. either beingrenamedoraliases-added.Otherwise
falseis being returned.- Specified by:
hasAliasesin interfaceAliasedSymbol
-
getAliasedNames
Description copied from interface:AliasedSymbolReturn all aliases for this symbol, i.e. original names, for this symbol.Inclusive
original-name, ifrenamed,Exclusive
current-name.May return
nullor a zero sizedSetfor no aliases.- Specified by:
getAliasedNamesin interfaceAliasedSymbol
-
getAliasedString
Description copied from interface:AliasedSymbol- Specified by:
getAliasedStringin interfaceAliasedSymbol
-
getOrigName
Description copied from interface:AliasedSymbolReturn the original-name as set at creation.- Specified by:
getOrigNamein interfaceAliasedSymbol
-
create
public static CompoundType create(String structName, SizeThunk size, CompoundTypeKind kind, int cvAttributes, ASTLocusTag astLocus) - Parameters:
structName- struct name of this CompoundType, i.e. the "foo" in the constructstruct foo { int a, ... };orstruct foo;even for anonymous structs.size-kind-cvAttributes-- Returns:
-
hashCodeImpl
protected int hashCodeImpl()- Specified by:
hashCodeImplin classType
-
equalsImpl
- Specified by:
equalsImplin classType
-
hashCodeSemanticsImpl
protected int hashCodeSemanticsImpl()- Specified by:
hashCodeSemanticsImplin classType
-
equalSemanticsImpl
- Specified by:
equalSemanticsImplin classType
-
getStructName
Returns the struct name of this CompoundType, i.e. the "foo" in the construct "struct foo { ... };". -
asCompound
Description copied from class:TypeCasts this to a CompoundType or returns null if not a CompoundType.- Overrides:
asCompoundin classType
-
getCName
Description copied from class:TypeReturns the name of this type, optionally including const/volatile attributes. The returned string is suitable for use as a type specifier for native C. -
getNumFields
public int getNumFields()Returns the number of fields in this type. -
getField
Returns the ith field of this type. -
addField
Adds a field to this type. -
setBodyParsed
Indicates to this CompoundType that its body has been parsed and that no moreaddField(com.jogamp.gluegen.cgram.types.Field)operations will be made.- Throws:
IllegalStateException- If called twice.
-
isStruct
public abstract boolean isStruct()Indicates whether this type was declared as a struct. -
isUnion
public abstract boolean isUnion()Indicates whether this type was declared as a union. -
toString
Description copied from class:TypeReturns 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. -
visit
Description copied from class:TypeTraverse thisTypeand all of its component types; for example, the return type and argument types of a FunctionType. -
getStructString
-