To register protocol extension classes with your application
- Initialize your new protocol extension parent class and add it to the runtime class hierarchy as shown in the following example:
AsdkEntTemperature::rxInit(); acrxBuildClassHierarchy();
These function calls are required for any new ObjectARX class, see Deriving a Custom ObjectARX Class.
- Create an object of each protocol extension class and add the objects to the appropriate AcRxClass descriptor objects using the addX() function as shown in the following example:
pDefaultTemp = new AsdkDefaultTemperature(); pRegionTemp = new AsdkRegionTemperature(); pCircleTemp = new AsdkCircleTemperature(); // Add the protocol extension objects to the appropriate // AcRxClass objects. // AcDbEntity::desc()->addX(AsdkEntTemperature::desc(), pDefaultTemp); AcDbRegion::desc()->addX(AsdkEntTemperature::desc(), pRegionTemp); AcDbCircle::desc()->addX(AsdkEntTemperature::desc(), pCircleTemp);
At runtime, ObjectARX constructs a class descriptor object structure that includes the basic ObjectARX class hierarchy as well as the protocol extension objects associated with the ObjectARX class descriptor objects. The following figure shows the class descriptor object structure for the classes that relate to the AsdkEntTemperature example in this section:
