Module dev.civl.mc

Interface CIVLStructOrUnionType

All Superinterfaces:
CIVLType
All Known Subinterfaces:
CIVLRegularRangeType

public interface CIVLStructOrUnionType extends CIVLType
Represents a "record" type (i.e. a struct or union). This is essentially a tuple type with a name. This type has state. Initially, it is incomplete, meaning the component types are not specified. It is completed by specifying them. This is necessary to allow circular definitions such as linked lists. Two CIVL struct or union types are considered equal iff they are equal as objects. They can be different even if the fields and names are equal.
  • Method Details

    • isComplete

      boolean isComplete()
      Is this struct or union type complete?
      Returns:
      true iff this is complete
    • numFields

      int numFields()
      Returns the number of fields in this struct or union type.
      Returns:
      the number of fields
      Throws:
      CIVLInternalException - if the type is not complete
    • getField

      StructOrUnionField getField(int index)
      Returns the index-th field of this struct or union type.
      Parameters:
      index - nonnegative integer in range [0,numFields-1].
      Returns:
      the index-th field
      Throws:
      CIVLInternalException - if this type is not complete
    • fields

      Returns an iterable object over all the fields of this struct/union type, in ascending order.

      Precondition: the type is complete (i.e., the fileds have been specified).

      Returns:
      A list of the field types in this struct.
    • name

      Identifier name()
      Returns the name of this struct or union type.
      Returns:
      The name of this struct or union.
    • complete

      void complete(Collection<StructOrUnionField> fields)
      Completes this struct type by specifying the fields as a collection.
      Parameters:
      fields - the fields
      Throws:
      CIVLInternalException - if this struct type is already complete
    • complete

      void complete(StructOrUnionField[] fields)
      Completes this struct type by specifying the fields as an array. The array is copied.
      Parameters:
      fields - the fields
      Throws:
      CIVLInternalException - if this struct type is already complete
    • setHandleObjectType

      void setHandleObjectType(boolean value)
      Updates the option whether this type is the object type of some handle type, with the given value.
      Parameters:
      value - The value to be used.
    • getFieldIndex

      int getFieldIndex(String field)