Interface IStructureType

All Superinterfaces:
ICodeItem, ICodeType, INativeItem, INativeItemListenable, INativeType
All Known Subinterfaces:
IClassType

@Ser public interface IStructureType extends INativeType
Type item representing a structure or union (structure wit overlapping fields).

Fields manipulation (addition, removal, etc.) can be done via the structure's controlling type manager.

  • Method Details

    • isStructure

      boolean isStructure()
      Determine whether this type is a structure (not a union).
      Returns:
      true if this type is a structure
    • isUnion

      boolean isUnion()
      Determine whether this type is a union (not a structure).
      Returns:
      true if this type is a union
    • getPadding

      int getPadding()
      Retrieve the structure's fields alignment, aka fields padding/packing.

      This value should not be negative. It is 0 if this object represents a union (no padding). In the general case, the value is Integer.MAX_VALUE to indicate that structure fields are aligned on the size of their underlying primitive types, i.e. "natural" padding. Example: a 4-byte integer field would be aligned on a 4-byte boundary. A padding value is value indicates that members are byte-aligned (i.e. not aligned); a padding value of 2 indicates members are aligned on at most 2-bytes, etc.

      Returns:
      padding in bytes, or 0 for a union
    • getAlignment

      int getAlignment()
      Retrieve the structure's actual global alignment. It may be bigger than the alignment set when the structure was created (if any was provided).
      Returns:
      alignment in bytes
    • getFieldsCount

      int getFieldsCount()
      Get the number of fields.
      Returns:
      field count
    • getFields

      List<? extends IStructureTypeField> getFields()
      Get the list of true (non-synthetic) fields.
      Returns:
      true fields
    • getIndexOfField

      int getIndexOfField(IStructureTypeField field)
      Get the index of the provided field.
      Parameters:
      field - field to locate
      Returns:
      field index, or -1
    • getFieldsWithGaps

      List<? extends IStructureTypeField> getFieldsWithGaps()
      Get a complete list of fields as well as gaps in-between fields (synthetic fields).
      Returns:
      fields including synthetic gaps
    • getField

      IStructureTypeField getField(int index)
      Retrieve a field by index.
      Parameters:
      index - field index
      Returns:
      field, or null
    • getFieldByName

      IStructureTypeField getFieldByName(String name)
      Retrieve a field by name.
      Parameters:
      name - field name
      Returns:
      field, or null
    • getFieldAt

      IStructureTypeField getFieldAt(int offset)
      Retrieve a field starting at an offset.
      Parameters:
      offset - field offset
      Returns:
      field, or null
    • getFieldAt

      IStructureTypeField getFieldAt(int offset, int bitstart)
      Retrieve a bit field starting at an offset and bit position.
      Parameters:
      offset - field offset
      bitstart - bit start
      Returns:
      field, or null
    • getFieldOver

      IStructureTypeField getFieldOver(int offset)
      Retrieve a field spanning an offset.
      Parameters:
      offset - offset to test
      Returns:
      field, or null
    • getFieldAfter

      IStructureTypeField getFieldAfter(int offset)
      Retrieve the first field after an offset.
      Parameters:
      offset - offset to test
      Returns:
      field, or null
    • isCircular

      boolean isCircular(INativeType type)
      Determine whether using a type would make this structure circular.
      Parameters:
      type - candidate field type
      Returns:
      true if the type would create a circular reference