31#include "daiValueTypes.h"
33#define SMARTPTR(classname) class classname; typedef OdSmartPtr<classname> classname##Ptr; typedef OdArray<classname##Ptr> classname##PtrArray;
35#define OD_IFC_CONS_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE,ClassType) \
37OD_IFC_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,OD_T(#ClassName),DOCREATE,ClassType)
39#define OD_IFC_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,szClassName,DOCREATE,ClassType) \
41OD_IFC_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor,0,0,0,szClassName,OdString::kEmpty,OdString::kEmpty,0,ClassType) \
43ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
45#define OD_IFC_DEFINE_MEMBERS2(ClassName,ParentClass,pseudoConsFn,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags,ClassType) \
47ODRX_DEFINE_RTTI_MEMBERS(ClassName,ParentClass) \
49OD_IFC_DEFINE_INIT_MEMBERS(ClassName,ParentClass,pseudoConsFn, \
50 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags, ClassType)
53#define OD_IFC_DEFINE_INIT_MEMBERS(ClassName, ParentClass, pseudoConsFn, DwgVer, \
54 MaintVer, nProxyFlags, szDWGClassName, \
55 szDxfName, szAppName, nCustomFlags, ClassType) \
56 OD_IFC_DEFINE_INIT_MEMBERS_GENERIC( \
58 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
59 MaintVer, nProxyFlags, szDxfName, szAppName, NULL, nCustomFlags)), \
60 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
61 MaintVer, nProxyFlags, szDxfName, szAppName, pAppNameChangeCallback, nCustomFlags)), \
64#define OD_IFC_DEFINE_INIT_MEMBERS_GENERIC(ClassName, CREATE_CLASS_INSTANCE, CREATE_CLASS_INSTANCE2, ClassType)\
65void ClassName::rxInit() \
67 if (!ClassName::g_pDesc) { \
68 ClassName::g_pDesc = CREATE_CLASS_INSTANCE; \
69 odIfcClassDictionary().putAt(ClassType, ClassName::desc()); \
71 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
72 throw OdError(eExtendedError); \
75void ClassName::rxInit(AppNameChangeFuncPtr pAppNameChangeCallback) \
77 if (!ClassName::g_pDesc) { \
78 ClassName::g_pDesc = CREATE_CLASS_INSTANCE2; \
79 odIfcClassDictionary().putAt(ClassType, ClassName::desc()); \
81 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
82 throw OdError(eExtendedError); \
87void ClassName::rxUninit() \
89 if (ClassName::g_pDesc) { \
90 ::deleteOdRxClass(ClassName::g_pDesc); \
91 ClassName::g_pDesc = 0; \
92 odIfcClassDictionary().remove(ClassType); \
94 ODA_ASSERT(("Class ["#ClassName"] is not initialized yet.",0)); \
95 throw OdError(eNotInitializedYet); \
99#define OD_IFC_DECLARE_MEMBERS_GENERIC(ClassType, ClassName) \
101 static OdSmartPtr<ClassName> cast(const OdRxObject* pObj) \
104 return OdSmartPtr<ClassName>(((ClassName*)pObj->queryX(ClassName::desc())), kOdRxObjAttach); \
105 return (ClassName*)0; \
107 static ClassType* g_pDesc; \
108 static ClassType* desc(); \
109 virtual ClassType* isA() const; \
110 virtual OdRxObject* queryX(const OdRxClass* protocolClass) const; \
111 static OdRxObjectPtr pseudoConstructor(); \
112 static OdSmartPtr<ClassName> createObject() \
113 { if (!desc()) throw OdError(eNotInitializedYet); return desc()->create(); } \
114 static OdSmartPtr<ClassName> createObject(OdIfcModel* pModel) \
117 throw OdError(eNoDatabase); \
119 throw OdError(eNotInitializedYet); \
120 OdSmartPtr<ClassName> pObj = desc()->create(); \
121 OdIfcEntityPtr pEnt = pModel->createEntityInstance(desc()->name().mid(2)); \
123 throw OdError(eIllegalEntityType); \
124 pModel->appendEntityInstance(pEnt); \
125 pObj->m_pEntInst = pEnt; \
126 pEnt->resolve(kResCompound, new OdIfcCompoundPtr(pObj)); \
129 static void rxInit(); \
130 static void rxInit(AppNameChangeFuncPtr appNameChangeFunc); \
132 static void rxUninit()
134#define OD_IFC_DECLARE_MEMBERS(ClassName) \
135 OD_IFC_DECLARE_MEMBERS_GENERIC(OdRxClass, ClassName)