PreviousNext

Public and Private Objects and XOM

In Building a Name Object, you saw how a multilevel XDS object can be statically declared in C code. Now imagine that you have written an application that contains such a static DS_C_DS_DN object declaration. From the point of view of your application, that object is nothing but a series of arrays, and you can manipulate them with all the normal programming operators, just as you can any other data type. Nevertheless, the object is syntactically perfectly acceptable to any XDS (or XOM) function that is prepared to receive a DS_C_DS_DN object.

Objects are also created by the XDS functions themselves; this is the way they usually return information to callers. However, there is a difference between objects generated by the XDS interface and objects that are explicitly declared by the application: you cannot access the former, private, objects in the direct way that you can the latter, public, objects.

These two kinds of objects are the same as far as their classes and attributes are concerned. The only difference between them is in the way they are accessed. The public objects that an application explicitly creates or declares in its own memory area are just as accessible as any of the other data storage it uses. However, private objects are created and held in the XDS interface's own system memory. Applications get handles to private objects, and in order to access the private objects' contents, they have to pass the handles to object management functions. The object management (XOM) functions make up a sort of all-purpose companion interface to XDS. Whereas XDS functions typically require some specific class object as input, the XOM functions accept objects of any class and perform useful operations on them.

If a private object needs to be manipulated, one of the XOM functions, om_get( ), can be called to make a public copy of the private object. Then, calling the XOM om_create( ) function allows applications to generate private objects manipulatable by om_get( ). The main significance of private as opposed to public objects is that they do not have to be explicitly operated on; instead, you can access them cleanly through the XOM interface and let it do most of the work. You still have to know something about the objects' logical representation, however, to use XOM.

Except for a few more details, which will be mentioned as needed, this is practically all there is to XDS object representation.