Building an Ownership Hierarchy

The following example illustrates how to build an ownership hierarchy using ObjectARX ® functions. The example shows header and source files for a new class, OwnerDemo, which illustrates how to create an ownership tree. This class has two data members, a simple integer to represent normal data, and a hard ownership ID data member to hold the object ID of an owned object. Functions are provided for getting and setting the values of both data members. The example also overrides the four required virtual functions: dwgInFields(), dwgOutFields(), dxfInFields(), and dxfOutFields().

The ownership hierarchy is set up in the createObjs() routine toward the end of the example. Object A owns object B. Object B owns object C. Object A is added to a dictionary (ASDK_DICT) in the named object dictionary. The printOut() and listTree() routines print information on the objects in the ASDK_DICT dictionary.