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

Models all compound types, i.e., those containing fields: structs and unions. More...

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

Public Member Functions

void rename (final String newName)
 Rename this symbol with the given newName if not equal current-name. More...
 
void addAliasedName (final String origName)
 Add the given origName to the list of aliases if not equal current-name. More...
 
boolean hasAliases ()
 Returns true if this symbol has aliases, i.e. More...
 
Set< String > getAliasedNames ()
 Return all aliases for this symbol, i.e. More...
 
String getAliasedString ()
 Return this object's toString() wrapped w/ the current-name and all aliases. More...
 
String getOrigName ()
 Return the original-name as set at creation. More...
 
String getStructName ()
 Returns the struct name of this CompoundType, i.e. More...
 
CompoundType asCompound ()
 Casts this to a CompoundType or returns null if not a CompoundType. More...
 
String getCName (final boolean includeCVAttrs)
 Returns the name of this type, optionally including const/volatile attributes. More...
 
int getNumFields ()
 Returns the number of fields in this type. More...
 
Field getField (final int i)
 Returns the ith field of this type. More...
 
Field getField (final String name)
 Returns the name matching field of this type. More...
 
void addField (final Field f)
 Adds a field to this type. More...
 
void setBodyParsed () throws IllegalStateException
 Indicates to this CompoundType that its body has been parsed and that no more addField operations will be made. More...
 
abstract boolean isStruct ()
 Indicates whether this type was declared as a struct. More...
 
abstract boolean isUnion ()
 Indicates whether this type was declared as a union. More...
 
String toString ()
 Returns a string representation of this type. More...
 
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...
 
String getStructString ()
 
- Public Member Functions inherited from com.jogamp.gluegen.cgram.types.MemoryLayoutType
boolean isLayouted ()
 
void setLayouted ()
 
- 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...
 
- Public Member Functions inherited from com.jogamp.gluegen.cgram.types.AliasedSymbol
void rename (final String newName)
 Rename this symbol with the given newName if not equal current-name. More...
 
void addAliasedName (final String origName)
 Add the given origName to the list of aliases if not equal current-name. More...
 
boolean hasAliases ()
 Returns true if this symbol has aliases, i.e. More...
 
Set< String > getAliasedNames ()
 Return all aliases for this symbol, i.e. More...
 
String getOrigName ()
 Return the original-name as set at creation. More...
 
String getName ()
 Return the current-name, which is the last renamed-name if issued, or the original-name. More...
 
String getAliasedString ()
 Return this object's toString() wrapped w/ the current-name and all aliases. More...
 

Static Public Member Functions

static CompoundType create (final String structName, final SizeThunk size, final CompoundTypeKind kind, final int cvAttributes, final ASTLocusTag astLocus)
 

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.MemoryLayoutType
 MemoryLayoutType (final String name, final SizeThunk size, final int cvAttributes, final ASTLocusTag astLocus)
 
- 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

Models all compound types, i.e., those containing fields: structs and unions.

The boolean type accessors indicate how the type is really defined.

Definition at line 51 of file CompoundType.java.

Member Function Documentation

◆ addAliasedName()

void com.jogamp.gluegen.cgram.types.CompoundType.addAliasedName ( final String  origName)

Add the given origName to the list of aliases if not equal current-name.

Operation will be ignored if newName is null.

Parameters
origNamethe new alias to be added, maybe null

Implements com.jogamp.gluegen.cgram.types.AliasedSymbol.

Definition at line 63 of file CompoundType.java.

◆ addField()

void com.jogamp.gluegen.cgram.types.CompoundType.addField ( final Field  f)

Adds a field to this type.

Definition at line 193 of file CompoundType.java.

Here is the call graph for this function:

◆ asCompound()

CompoundType com.jogamp.gluegen.cgram.types.CompoundType.asCompound ( )

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

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

Definition at line 158 of file CompoundType.java.

◆ create()

static CompoundType com.jogamp.gluegen.cgram.types.CompoundType.create ( final String  structName,
final SizeThunk  size,
final CompoundTypeKind  kind,
final int  cvAttributes,
final ASTLocusTag  astLocus 
)
static
Parameters
structNamestruct name of this CompoundType, i.e. the "foo" in the construct struct foo { int a, ... }; or struct foo; even for anonymous structs.
size
kind
cvAttributes
Returns

Definition at line 90 of file CompoundType.java.

Here is the caller graph for this function:

◆ equalSemanticsImpl()

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

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

Definition at line 146 of file CompoundType.java.

◆ equalsImpl()

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

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

Definition at line 131 of file CompoundType.java.

◆ getAliasedNames()

Set< String > com.jogamp.gluegen.cgram.types.CompoundType.getAliasedNames ( )

Return all aliases for this symbol, i.e.

original names, for this symbol.

Inclusive original-name, if renamed,

Exclusive current-name.

May return null or a zero sized Set for no aliases.

Implements com.jogamp.gluegen.cgram.types.AliasedSymbol.

Definition at line 71 of file CompoundType.java.

◆ getAliasedString()

String com.jogamp.gluegen.cgram.types.CompoundType.getAliasedString ( )

Return this object's toString() wrapped w/ the current-name and all aliases.

Implements com.jogamp.gluegen.cgram.types.AliasedSymbol.

Definition at line 75 of file CompoundType.java.

Here is the call graph for this function:

◆ getCName()

String com.jogamp.gluegen.cgram.types.CompoundType.getCName ( final boolean  includeCVAttrs)

Returns the name of this type, optionally including const/volatile attributes.

The returned string is suitable for use as a type specifier for native C.

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

Definition at line 161 of file CompoundType.java.

Here is the call graph for this function:

◆ getField() [1/2]

Field com.jogamp.gluegen.cgram.types.CompoundType.getField ( final int  i)

Returns the ith field of this type.

Definition at line 178 of file CompoundType.java.

Here is the caller graph for this function:

◆ getField() [2/2]

Field com.jogamp.gluegen.cgram.types.CompoundType.getField ( final String  name)

Returns the name matching field of this type.

Definition at line 183 of file CompoundType.java.

◆ getNumFields()

int com.jogamp.gluegen.cgram.types.CompoundType.getNumFields ( )

Returns the number of fields in this type.

Definition at line 173 of file CompoundType.java.

Here is the caller graph for this function:

◆ getOrigName()

String com.jogamp.gluegen.cgram.types.CompoundType.getOrigName ( )

Return the original-name as set at creation.

Implements com.jogamp.gluegen.cgram.types.AliasedSymbol.

Definition at line 79 of file CompoundType.java.

Here is the call graph for this function:

◆ getStructName()

String com.jogamp.gluegen.cgram.types.CompoundType.getStructName ( )

Returns the struct name of this CompoundType, i.e.

the "foo" in the construct "struct foo { ... };".

Definition at line 153 of file CompoundType.java.

Here is the caller graph for this function:

◆ getStructString()

String com.jogamp.gluegen.cgram.types.CompoundType.getStructString ( )

Definition at line 256 of file CompoundType.java.

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

◆ hasAliases()

boolean com.jogamp.gluegen.cgram.types.CompoundType.hasAliases ( )

Returns true if this symbol has aliases, i.e.

either being renamed or aliases-added.

Otherwise false is being returned.

Implements com.jogamp.gluegen.cgram.types.AliasedSymbol.

Definition at line 67 of file CompoundType.java.

◆ hashCodeImpl()

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

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

Definition at line 124 of file CompoundType.java.

◆ hashCodeSemanticsImpl()

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

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

Definition at line 140 of file CompoundType.java.

◆ isStruct()

abstract boolean com.jogamp.gluegen.cgram.types.CompoundType.isStruct ( )
abstract

Indicates whether this type was declared as a struct.

Reimplemented in com.jogamp.gluegen.cgram.types.StructType, and com.jogamp.gluegen.cgram.types.UnionType.

Here is the caller graph for this function:

◆ isUnion()

abstract boolean com.jogamp.gluegen.cgram.types.CompoundType.isUnion ( )
abstract

Indicates whether this type was declared as a union.

Reimplemented in com.jogamp.gluegen.cgram.types.StructType, and com.jogamp.gluegen.cgram.types.UnionType.

Here is the caller graph for this function:

◆ rename()

void com.jogamp.gluegen.cgram.types.CompoundType.rename ( final String  newName)

Rename this symbol with the given newName if not equal current-name.

Before renaming the current-name will be added to the list of aliases. while the given newName will be removed.

Operation will be ignored if newName is null.

Parameters
newNamethe new current-name, maybe null

Implements com.jogamp.gluegen.cgram.types.AliasedSymbol.

Definition at line 59 of file CompoundType.java.

◆ setBodyParsed()

void com.jogamp.gluegen.cgram.types.CompoundType.setBodyParsed ( ) throws IllegalStateException

Indicates to this CompoundType that its body has been parsed and that no more addField operations will be made.

Exceptions
IllegalStateExceptionIf called twice.

Definition at line 211 of file CompoundType.java.

Here is the caller graph for this function:

◆ toString()

String com.jogamp.gluegen.cgram.types.CompoundType.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 226 of file CompoundType.java.

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

◆ visit()

void com.jogamp.gluegen.cgram.types.CompoundType.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 239 of file CompoundType.java.

Here is the call graph for this function:

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