[This is preliminary documentation and subject to change.]
An object reference is a path to the location of an object. It can be either a fully qualified path to a server and namespace or a relative path to another object in the same namespace. Object references can be used as properties or parameters to methods.
MOF supports the use of object references with the ref data type. Object references are implemented programmatically as strings. Using object references reduces transport time and encoding if the object already exists in its entirety within the CIM repository.
MOF supports the concept of a weakly typed reference and a strongly typed reference. Both types map to the VT_BSTR Automation type. A weakly typed reference uses the ref data type with the object keyword whereas a strongly typed reference uses ref with the class name:
class MyClass
{
object ref RefToAnyClass; // weakly typed
ClassX ref RefToClassX; // strongly typed
}
In the preceeding example, RefToAnyClass can be legally set to point to any class or instance while RefToClassX can only be set to point to objects of the class ClassX. This includes instances of ClassX as well as instances of any class derived from Class X.
The following class definition shows how to include two object references: one to a Win32LogicalDisk object and the other to a generic object:
Class MyClass
{
sint32 MyMethod1 ([in] Win32LogicalDisk ref DiskRef);
sint32 MyMethod2 ([in] object ref AnyObject);
}
If the object to be referenced is located within the same MOF file, an alias can be used. For information on referencing another object in the same MOF file, see Using Aliases.