- All Superinterfaces:
CIVLType
- All Known Subinterfaces:
CIVLRegularRangeType
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.civl.mc.model.IF.type.CIVLType
CIVLType.TypeKind -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete(StructOrUnionField[] fields) Completes this struct type by specifying the fields as an array.voidcomplete(Collection<StructOrUnionField> fields) Completes this struct type by specifying the fields as a collection.fields()Returns an iterable object over all the fields of this struct/union type, in ascending order.getField(int index) Returns the index-th field of this struct or union type.intgetFieldIndex(String field) booleanIs this struct or union type complete?name()Returns the name of this struct or union type.intReturns the number of fields in this struct or union type.voidsetHandleObjectType(boolean value) Updates the option whether this type is the object type of some handle type, with the given value.Methods inherited from interface dev.civl.mc.model.IF.type.CIVLType
analyze, areSubtypesScalar, copyAs, freeVariables, getDynamicType, getDynamicTypeIndex, getStateVariable, hasReferences, hasState, isArrayType, isBoolType, isBundleType, isCharType, isDomainType, isEnumerationType, isFunction, isHeapType, isIncompleteArrayType, isIntegerType, isNumericType, isPointerType, isProcessType, isRangeType, isRealType, isScalar, isScopeType, isSetType, isSetTypeOf, isStructType, isSuperTypeOf, isUnionType, isVoidType, setStateVariable, typeKind
-
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
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
Iterable<StructOrUnionField> 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
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
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
-