Intrinsic Data Types
In the example class, all of the properties are assigned one of the intrinsic data types. Table 4.4 shows the other property data types allowed in MOF format.
Table 4.4 Intrinsic Data Types
Intrinsic data type |
Description |
boolean |
Boolean value (i.e. TRUE or FALSE, 1 or 0) |
char16 |
Unicode Style 2-byte character |
DATETIME |
A string that contains the date and time |
object |
An instance of a class within CIM |
real32 |
4-byte floating point value |
real64 |
8-byte floating point value |
<classname>ref |
A strongly typed reference |
sint64 |
8-byte signed integer |
sint32 |
4-byte signed integer |
sint16 |
2-byte signed integer |
sint8 |
1-byte signed integer |
uint64 |
8-byte unsigned integer |
uint32 |
4-byte unsigned integer |
uint16 |
2-byte unsigned integer |
uint8 |
1-byte unsigned integer |
Array of... |
An array of any of the above data types |
Instance Creation
Instance creation can take place only after the corresponding class definition within a MOF file, which we declared in the previous section. The only case in which this rule does not apply is if the class definition already exists in the CIM repository within the target namespace. We create instances of classes using the MOF statement
instance of <classname>
Remember that MOF keywords are not case sensitive, so the case you use does not matter. To create an instance of the CD_ROM class, we could use the declaration in Figure 4.9.
Figure 4.9 Creating an instance of MOF
Aliasing
When writing MOF files, it sometimes is expedient to create an alias that refers to a specific object instance. This alias can be used later in conjunction with a variable that is a pointer to an object (for example, the ref: keyword) to point to that specific object instance. If in the example in Figure 4.9 we declared an association class that referenced the CDROM class, we could use aliasing as in Figure 4.10.
Figure 4.10 Using an alias in MOF