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:
    Cloneable
  Direct Known Subclasses:
    StructType, UnionType

      public abstract class CompoundType
      extends MemoryLayoutType
      implements Cloneable

  Models all compound types, i.e., those containing fields: structs and unions. The boolean type accessors indicate how the type is really defined.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addField(Field f)` Adds a field to this type.
    `CompoundType` | `asCompound()` Casts this to a CompoundType or returns null if not a CompoundType.
    `Object` | `clone()`
    `static CompoundType` | `create(String name, SizeThunk size, CompoundTypeKind kind, int cvAttributes)`
    `boolean` | `equals(Object arg)` Equality test for Types.
    `Field` | `getField(int i)` Returns the ith field of this type.
    `int` | `getNumFields()` Returns the number of fields in this type.
    `String` | `getStructName()` Returns the struct name of this CompoundType, i.e.
    `String` | `getStructString()`
    `int` | `hashCode()` Hashcode for Types.
    `abstract boolean` | `isStruct()` Indicates whether this type was declared as a struct.
    `abstract boolean` | `isUnion()` Indicates whether this type was declared as a union.
    `void` | `setBodyParsed()` Indicates to this CompoundType that its body has been parsed and that no more `addField(com.jogamp.gluegen.cgram.types.Field)` operations will be made.
    `void` | `setSize(SizeThunk size)` Set the size of this type; only available for CompoundTypes.
    `void` | `setStructName(String structName)` Sets the struct name of this CompoundType, i.e.
    `String` | `toString()` Returns a string representation of this type.
    `void` | `visit(TypeVisitor arg)` Visit this type and all of the component types of this one; for example, the return type and argument types of a FunctionType.

    - ### Methods inherited from class com.jogamp.gluegen.cgram.types.MemoryLayoutType

      `isLayouted, setLayouted`

    - ### Methods inherited from class com.jogamp.gluegen.cgram.types.Type

      `arrayDimension, asArray, asBit, asDouble, asEnum, asFloat, asFunction, asInt, asPointer, asVoid, getBaseElementType, getCVAttributes, getCVAttributesString, getCVVariant, getDebugString, getName, getName, getSize, getSize, hasTypedefName, isArray, isBit, isCompound, isConst, isDouble, isEnum, isFloat, isFunction, isFunctionPointer, isInt, isPointer, isPrimitive, isVoid, isVolatile, pointerDepth, setName`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### create

          public static CompoundType create(String name,
                            SizeThunk size,
                            CompoundTypeKind kind,
                            int cvAttributes)

    - #### clone

          public Object clone()

      Overrides:
        `clone` in class `Type`

    - #### hashCode

          public int hashCode()

      Description copied from class: `Type`
      Hashcode for Types.
      Overrides:
        `hashCode` in class `Type`

    - #### equals

          public boolean equals(Object arg)

      Description copied from class: `Type`
      Equality test for Types.
      Overrides:
        `equals` in class `Type`

    - #### getStructName

          public String getStructName()

      Returns the struct name of this CompoundType, i.e. the "foo" in the construct "struct foo { ... };".

    - #### setStructName

          public void setStructName(String structName)

      Sets the struct name of this CompoundType, i.e. the "foo" in the construct "struct foo { ... };".

    - #### setSize

          public void setSize(SizeThunk size)

      Description copied from class: `Type`
      Set the size of this type; only available for CompoundTypes.

    - #### asCompound

          public CompoundType asCompound()

      Description copied from class: `Type`
      Casts this to a CompoundType or returns null if not a CompoundType.
      Overrides:
        `asCompound` in class `Type`

    - #### getNumFields

          public int getNumFields()

      Returns the number of fields in this type.

    - #### getField

          public Field getField(int i)

      Returns the ith field of this type.

    - #### addField

          public void addField(Field f)

      Adds a field to this type.

    - #### setBodyParsed

          public void setBodyParsed()

      Indicates to this CompoundType that its body has been parsed and that no more `addField(com.jogamp.gluegen.cgram.types.Field)` operations will be made.

    - #### 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

          public String toString()

      Description copied from class: `Type`
      Returns a string representation of this type. This string is not necessarily suitable for use as a type specifier; for example, it will contain an expanded description of structs/unions.
      Overrides:
        `toString` in class `Type`

    - #### visit

          public void visit(TypeVisitor arg)

      Description copied from class: `Type`
      Visit this type and all of the component types of this one; for example, the return type and argument types of a FunctionType.
      Overrides:
        `visit` in class `Type`

    - #### getStructString

          public String getStructString()