The OdRxClass abstract class is the describing structure that stores information about a class. Each class that is registered in the application must have an instance of the class describing structure. All class describing instances form the dictionary of classes (named class dictionary).
The OdRxClass abstract class provides the base interface for getting and storing information about a class and is used only for deriving new classes. You cannot create an instance of the OdRxClass class. The OdRxClass abstract class is a successor of the OdRxObject class and inherits its functionality. It declares the following methods:
These methods do not have an implementation and are the declaration of the run-time type identification interface. Classes derived from the OdRxClass class must redefine these methods.
The C++ platform has the following classes for implementing pure methods declared by the OdRxClass class:
Note: The OdRxClassProtocolExtImpl class also creates the default implementation for the create() method which returns the NULL pointer and does not create an instance, the setConstructor() method that generates the eNotApplicable exception, the dxfName() method that returns an empty string, the appName() method that returns an empty string, and the getClassVersion() method that returns the kMRelease0 (=0) version number.
Note: The OdRxClassConsImpl class initializes the class describing instance by the empty pseudo-constructor. If the setConstructor() method gets NULL instead of the pseudo-constructor, it sets the empty pseudo-constructor by default. If the class describing instance has an empty pseudo-constructor, the create() method generates the eNotApplicable exception instead of creating an instance.
The OdPseudoConstructorType type is a raw pointer to the function that does not take arguments and returns the non-typified smart pointer to the instance of the class that this function creates. This type has the following definition:
typedef OdRxObjectPtr (*OdPseudoConstructorType)()
Each of the listed classes declares and implements its own init() method that initializes the members of the class by specified values. The OdDxfClassImpl class is generally used.
The listed classes form the following hierarchy:
Usually, you do not need to create an instance of these classes. The RTTI substituting macro automatically generates the implementation of the rxInit() method that calls the newOdRxClass() global function for registering the class in the application. This function automatically creates and initializes the instance of the OdDxfClassImpl class and wraps it with the OdRxObjectImpl class to implement the reference counting methods. The newOdRxClass() function returns a raw pointer to the created class describing instance of the OdRxClass type. The rxInit() method stores this pointer in the g_pDesc member of the instance of the class for which the describing instance is created.
Implementing RTTI Methods for the Derived Class
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|