50 #define OD_EXP_DECLARE_MEMBERS_GENERIC(ClassType, ClassName)\
53 static OdDAI::Entity* g_pExpEntityDef; \
56 static OdSmartPtr<ClassName> cast(const OdRxObject* pObj) \
59 return OdSmartPtr<ClassName>(((ClassName*)pObj->queryX(ClassName::desc())), kOdRxObjAttach); \
60 return (ClassName*)0; \
63 static ClassType* g_pDesc; \
68 static ClassType* desc(); \
73 virtual ClassType* isA() const; \
77 virtual OdRxObject* queryX(const OdRxClass* protocolClass) const; \
81 static OdRxObjectPtr pseudoConstructor(); \
85 static OdSmartPtr<ClassName> createObject() \
86 { if (!desc()) throw OdError(eNotInitializedYet); return desc()->create(); } \
89 static void rxInit(); \
90 static void rxInit(AppNameChangeFuncPtr appNameChangeFunc); \
93 static void rxUninit()
95 #define OD_EXP_DECLARE_MEMBERS(ClassName)\
96 OD_EXP_DECLARE_MEMBERS_GENERIC(OdRxClass, ClassName)
102 #define OD_EXP_DEFINE_RTTI_MEMBERS_GENERIC(ClassType, ClassName, ParentClass) \
104 OdDAI::Entity* ClassName::g_pExpEntityDef = 0; \
105 ClassType* ClassName::g_pDesc = 0; \
106 ClassType* ClassName::desc() { return g_pDesc; } \
107 ClassType* ClassName::isA() const { return g_pDesc; } \
109 OdRxObject* ClassName::queryX(const OdRxClass* pClass) const { \
110 return ::odQueryXImpl<ClassName, ParentClass>(this, pClass); \
113 #define OD_EXP_DEFINE_INIT_MEMBERS_GENERIC(ClassName, CREATE_CLASS_INSTANCE, CREATE_CLASS_INSTANCE2) \
116 void ClassName::rxInit() \
118 if (!ClassName::g_pDesc) { \
119 ClassName::g_pDesc = CREATE_CLASS_INSTANCE; \
121 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
122 throw OdError(eExtendedError); \
125 void ClassName::rxInit(AppNameChangeFuncPtr pAppNameChangeCallback) \
127 if (!ClassName::g_pDesc) { \
128 ClassName::g_pDesc = CREATE_CLASS_INSTANCE2; \
130 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
131 throw OdError(eExtendedError); \
136 void ClassName::rxUninit() \
138 if (ClassName::g_pDesc) { \
139 ::deleteOdRxClass(ClassName::g_pDesc); \
140 ClassName::g_pDesc = 0; \
142 ODA_ASSERT(("Class ["#ClassName"] is not initialized yet.",0)); \
143 throw OdError(eNotInitializedYet); \
148 #define OD_EXP_DEFINE_RTTI_MEMBERS(ClassName, ParentClass) \
149 OD_EXP_DEFINE_RTTI_MEMBERS_GENERIC(OdRxClass, ClassName, ParentClass)
151 #define OD_EXP_DEFINE_INIT_MEMBERS(SchemaName,ClassName, ParentClass, pseudoConsFn, DwgVer, \
152 MaintVer, nProxyFlags, szDWGClassName, \
153 szDxfName, szAppName, nCustomFlags) \
154 OD_EXP_DEFINE_INIT_MEMBERS_GENERIC( \
156 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
157 MaintVer, nProxyFlags, szDxfName, szAppName, NULL, nCustomFlags)), \
158 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
159 MaintVer, nProxyFlags, szDxfName, szAppName, pAppNameChangeCallback, nCustomFlags)))
163 #define OD_EXP_DEFINE_MEMBERS2(SchemaName,ClassName,ParentClass,pseudoConsFn,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags) \
165 OD_EXP_DEFINE_RTTI_MEMBERS(ClassName,ParentClass) \
167 OD_EXP_DEFINE_INIT_MEMBERS(SchemaName,ClassName,ParentClass,pseudoConsFn, \
168 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags)
172 #define OD_EXP_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE) \
174 OdRxObjectPtr ClassName::pseudoConstructor() { return OdRxObjectPtr(DOCREATE(ClassName)); }
178 #define OD_EXP_CONS_DEFINE_MEMBERS_ALTNAME(SchemaName,ClassName,ParentClass,szClassName,DOCREATE) \
180 OD_EXP_DEFINE_MEMBERS2(SchemaName,ClassName,ParentClass,ClassName::pseudoConstructor,0,0,0,szClassName,OdString::kEmpty,OdString::kEmpty,0) \
182 OD_EXP_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
186 #define OD_EXP_CONS_DEFINE_MEMBERS(SchemaName,ClassName,ParentClass,DOCREATE) \
188 OD_EXP_CONS_DEFINE_MEMBERS_ALTNAME(SchemaName,ClassName,ParentClass,OD_T(#ClassName),DOCREATE)
OdRxObjectPtr(* OdPseudoConstructorType)()
void(* OdRxMemberCollectionConstructorPtr)(OdRxMemberCollectionBuilder &, void *)
void(* AppNameChangeFuncPtr)(const OdRxClass *classObj, OdString &newAppName, int saveVer)
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
DAI_EXPORT OdDAI::Entity * getOdDAIEntityClass(const OdString &szClassName, OdRxClass *pBaseClass, OdDAI::SchemaPtr expSchema, OdPseudoConstructorType pConstr=0, int DwgVer=0, int MaintVer=0, int nProxyFlags=0, const OdString &sDxfName=OdString::kEmpty, const OdString &sAppName=OdString::kEmpty, AppNameChangeFuncPtr fNameChangeFunc=NULL, int nCustomFlags=0, OdRxMemberCollectionConstructorPtr memberConstruct=0, void *userData=0)