DOFTypeTypedef ClassOpenDOF Object Access Library
Create a type that is defined in terms of another type.
Inheritance Hierarchy

SystemObject
  org.opendof.core.oalDOFType
    org.opendof.core.oalDOFTypeTypedef

Namespace: org.opendof.core.oal
Assembly: dof-oal (in dof-oal.dll) Version: 7.0.1.2
Syntax

C#
[SerializableAttribute]
public sealed class Typedef : DOFType, 
	DOFTypeContextResolver

The DOFTypeTypedef type exposes the following members.

Constructors

  NameDescription
Public methodDOFTypeTypedef
Construct a typedef that can be used for a forward reference.
Public methodDOFTypeTypedef(DOFType)
Construct a typedef that is an alias for another existing type.
Top
Methods

  NameDescription
Public methoddefineAs
Finalize a forward reference.
Public methodEquals
Typedefs are equal only if their references are equal.
(Overrides DOFTypeEquals(Object).)
Public methodgetEncoding (Overrides DOFTypegetEncoding.)
Public methodGetHashCode (Overrides DOFTypeGetHashCode.)
Public methodgetInstance (Overrides DOFTypegetInstance(DOFPacket).)
Public methodgetMaxLength (Overrides DOFTypegetMaxLength.)
Public methodgetMinLength (Overrides DOFTypegetMinLength.)
Public methodgetSubtypes (Overrides DOFTypegetSubtypes.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodgetTypeID (Overrides DOFTypegetTypeID.)
Public methodisDefined (Overrides DOFTypeisDefined.)
Public methodmarshal (Overrides DOFTypemarshal(DOFTypeContext, DOFPacket).)
Public methodToString (Overrides DOFTypeToString.)
Top
Remarks

Create a type that is defined in terms of another type.

There are two primary cases for using this class: first, in order to declare an alias to an existing type for clarity of code and documentation; and second, in order to declare a forward reference in order to facilitate self-referential types.

In the first case the constructor is passed the type to create the reference to. The class is fully defined at that point. All queries to the Typedef will return information from the referenced type, and in fact there is no clear way of determining that there is any reference type at all.

In the second case the constructor is given no information. The type is only partially defined, as DOFType.isDefined() will return

false
. At some point the defineAs(DOFType) method must be called, and at that point the type becomes fully defined. However, after the defineAs(DOFType) method call the type begins to appear just like the referenced type.
See Also

Reference