XCSG:Pointer
A Pointer in XCSG is a possible data type for a Variable; in XCSG, such a variable is represented as variable node whose TypeOf edge goes to a Pointer.
Specification
Metaclass | Pointer |
---|---|
Extends | , ReferenceType, AddressableEntity |
Description | An explicit reference to an addressable entity |
All Superkinds | Type, Node, ModelElement |
---|
Specified In Edges
| ||||
---|---|---|---|---|
Inherited From | In Edge | Predecessor | Multiplicity | Description |
Type | AliasedType | TypeAlias | ✱ | Connects a TypeAlias to the Type or TypeAlias it was declared to duplicate.
|
ArrayElementType | ArrayType | 0..1 | Connects an ArrayType to the Type of elements contained by arrays of that type. | |
C:CompletedBy | OpaqueType | 1 | Connects an OpaqueType to the complete definition of the corresponding Type. | |
ReferencedType | Pointer | ✱ | Connects a Pointer to the Type of the data pointed to. | |
Returns | Function | ✱ | Connects a Function to the Type of its return value (which may be Void). | |
TypeOf | Variable | ✱ | Links a Variable or DataFlow node to its Type
| |
DataFlow (Node) | ✱ |
Specified Out Edges | ||||
---|---|---|---|---|
Out Edge | Successor | Multiplicity | Description | |
ReferencedType | Type | 1 | Connects a Pointer to the Type of the data pointed to.
| |
Inherited From | Out Edge | Successor | Multiplicity | Description |
Type | TypeChecked | InstanceOf | ✱ | Connects a Type (usually a Classifier) to an InstanceOf test. |
Known Possible In Edges
| ||||
---|---|---|---|---|
Inherited From | In Edge | Predecessor | Multiplicity | Description |
Node | Contains | Node | 1 | Indicates that the predecessor contains the successor in a sense specified by the specific type of Contains edge. |
Known Possible Out Edges
| ||||
---|---|---|---|---|
Inherited From | Out Edge | Successor | Multiplicity | Description |
Node | Contains | Node | ✱ | Indicates that the predecessor contains the successor in a sense specified by the specific type of Contains edge. |
Tag | Managed |
---|---|
Description | Present if the referenced object is allocated in garbage collected (managed) memory [31, p. 73, Managed and unmanaged pointers] |
Attribute | LevelOfIndirection |
---|---|
Description | The number of times the pointer must be dereferenced to reach the referenced type. |
Type | Integer |
Required | Yes |
Semantics
Variables whose declared type is a ReferenceType represent references. Such references are opaque. The addresses they represent cannot be manipulated. The only operations on such references are involve assignment to type-compatible variables, comparison using equality and inequality, and use of the reference to gain access to the referenced object.
In contrast, variables whose type is Pointer represent explicit references that can be manipuled. For instance, it is possible to increment and decrement array element pointers, add or subtract values from them, and subtract one pointer from another if they both refer to the same array dimension.
Since the JVM does not support pointers in this sense, our definition of pointer semantics is based on Microsoft’s MS-IL, and on languages with pointer operations (such as C++). refType specifies the type of the entity referred by the Pointer.
The value of the Pointer is a reference to an entity this type.
The levelOfIndirection associated with the Pointer must be greater than or equal to one. If greater than one, it represents a pointer to a pointer to and instance of the referenced type, a pointer to a pointer to a pointer to an instance of the referenced type, etc.
The deallocation of referenced objects is the responsibility of the application unless the pointer is managed. Otherwise, it is the responsibility of the garbage collector.
Managed pointers cannot be null, and a managed pointer cannot point to another managed pointer [28, p. 6].