PreviousNext

The OM_descriptor Data Type

The OM_descriptor data type is used to describe an OM attribute type and value. A data value of this type is a descriptor, which embodies an OM attribute value. An array of descriptors can represent all the values of an object.

OM_descriptor is defined in the xom.h header file as follows:

/*Descriptor */

typedef struct OM_descriptor_struct {

OM_type type;

OM_syntax syntax;

union OM_value_union value;

} OM_descriptor;

OM_descriptor is made up of a series of nested data structures, as shown in the following figure.


Data Type OM_descriptor_struct

The preceding figure shows that type and syntax are integer constants for an OM attribute type and syntax, as shown in the following code fragment from example.c:

static OM_descriptor country[] = {

OM_OID_DESC(OM_CLASS, DS_C_AVA),

OM_OID_DESC(DS_ATTRIBUTE_TYPE, DS_A_COUNTRY_NAME),

{ DS_ATTRIBUTE_VALUES,OM_S_PRINTABLE_STRING,OM_STRING("US") },

OM_NULL_DESCRIPTOR

};

The code fragment initializes four descriptors, as shown in the following figure. The type and syntax evaluate to integers for all four descriptors.


Initializing Descriptors

The value component is a little more complex. The figure, Data Type OM_descriptor_struct, shows that value is a union of OM_value_union. OM_value_union has five members: string, boolean, enumeration, integer, and object. The members boolean, enumeration, and integer have integer values. The string member contains a string of type OM_string, which is a structure composed of a length and a pointer to a string of characters. The object member is a structure of type OM_padded_object that points to another object nested below it. Many OM attributes have other objects as values. These subobjects, in turn, may have other subobjects and so on.

For example, as shown in the following figure, the OM class DS_C_READ_RESULT has one OM attribute: DS_ENTRY. The syntax of DS_ENTRY is OM_S_OBJECT with a value of DS_C_ENTRY_INFO, indicating that it points to the subobject DS_C_ENTRY_INFO. DS_C_ENTRY_INFO has the OM attribute DS_OBJECT_NAME with the syntax OM_S_OBJECT, indicating that it points to the subobject DS_C_NAME.


An Object and a Subordinate Object