24 #ifndef _ODRXOBJECT_INCLUDED_
25 #define _ODRXOBJECT_INCLUDED_ /
58 #define ODRX_DECLARE_MEMBERS_GENERIC(ClassType, ClassName)\
62 static OdSmartPtr<ClassName> cast(const OdRxObject* pObj) \
65 return OdSmartPtr<ClassName>(((ClassName*)pObj->queryX(ClassName::desc())), kOdRxObjAttach); \
66 return (ClassName*)0; \
69 static ClassType* g_pDesc; \
74 static ClassType* desc(); \
79 virtual ClassType* isA() const; \
83 virtual OdRxObject* queryX(const OdRxClass* protocolClass) const; \
87 static OdRxObjectPtr pseudoConstructor(); \
91 static OdSmartPtr<ClassName> createObject() \
92 { if (!desc()) throw OdError(eNotInitializedYet); return desc()->create(); } \
95 static void rxInit(); \
96 static void rxInit(AppNameChangeFuncPtr appNameChangeFunc); \
99 static void rxUninit()
112 #define ODRX_DECLARE_MEMBERS(ClassName)\
113 ODRX_DECLARE_MEMBERS_GENERIC(OdRxClass, ClassName)
121 #define EMPTY_CONSTR(ClassName)(ClassName*)0
133 #define NEWOBJ_CONSTR(ClassName) OdSmartPtr<ClassName>(new ClassName, kOdRxObjAttach)
135 #define ODRX_DEFINE_RTTI_MEMBERS_GENERIC(ClassType, ClassName, ParentClass) \
137 ClassType* ClassName::g_pDesc = 0; \
138 ClassType* ClassName::desc() { return g_pDesc; } \
139 ClassType* ClassName::isA() const { return g_pDesc; } \
141 OdRxObject* ClassName::queryX(const OdRxClass* pClass) const { \
142 return ::odQueryXImpl<ClassName, ParentClass>(this, pClass); \
151 #define ODRX_DEFINE_RTTI_MEMBERS(ClassName, ParentClass) \
152 ODRX_DEFINE_RTTI_MEMBERS_GENERIC(OdRxClass, ClassName, ParentClass)
154 #define ODRX_DEFINE_INIT_MEMBERS_GENERIC(ClassName, CREATE_CLASS_INSTANCE, CREATE_CLASS_INSTANCE2) \
157 void ClassName::rxInit() \
159 if (!ClassName::g_pDesc) { \
160 ClassName::g_pDesc = CREATE_CLASS_INSTANCE; \
162 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
163 throw OdError(eExtendedError); \
166 void ClassName::rxInit(AppNameChangeFuncPtr pAppNameChangeCallback) \
168 if (!ClassName::g_pDesc) { \
169 ClassName::g_pDesc = CREATE_CLASS_INSTANCE2; \
171 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
172 throw OdError(eExtendedError); \
177 void ClassName::rxUninit() \
179 if (ClassName::g_pDesc) { \
180 ::deleteOdRxClass(ClassName::g_pDesc); \
181 ClassName::g_pDesc = 0; \
183 ODA_ASSERT(("Class ["#ClassName"] is not initialized yet.",0)); \
184 throw OdError(eNotInitializedYet); \
196 #define ODRX_DEFINE_INIT_MEMBERS(ClassName, ParentClass, pseudoConsFn, DwgVer, \
197 MaintVer, nProxyFlags, szDWGClassName, \
198 szDxfName, szAppName, nCustomFlags) \
199 ODRX_DEFINE_INIT_MEMBERS_GENERIC( \
201 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
202 MaintVer, nProxyFlags, szDxfName, szAppName, NULL, nCustomFlags)), \
203 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
204 MaintVer, nProxyFlags, szDxfName, szAppName, pAppNameChangeCallback, nCustomFlags)))
213 #define ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE) \
215 OdRxObjectPtr ClassName::pseudoConstructor() { return OdRxObjectPtr(DOCREATE(ClassName)); }
223 #define ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,pseudoConsFn,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags) \
225 ODRX_DEFINE_RTTI_MEMBERS(ClassName,ParentClass) \
227 ODRX_DEFINE_INIT_MEMBERS(ClassName,ParentClass,pseudoConsFn, \
228 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags)
230 #define ODRX_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName)\
232 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
233 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,0) \
235 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
237 #define ODRX_DEFINE_MEMBERS_EX(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags)\
239 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
240 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags) \
242 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
245 #define ODRX_NO_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,szClassName) \
247 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,0,0,0,0,szClassName,OdString::kEmpty,OdString::kEmpty,0) \
249 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,EMPTY_CONSTR)
253 #define ODRX_NO_CONS_DEFINE_MEMBERS(ClassName,ParentClass) \
255 ODRX_NO_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,OD_T(#ClassName))
259 #define ODRX_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,szClassName,DOCREATE) \
261 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor,0,0,0,szClassName,OdString::kEmpty,OdString::kEmpty,0) \
263 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
267 #define ODRX_CONS_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE) \
269 ODRX_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,OD_T(#ClassName),DOCREATE)
273 #define ODRX_DXF_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer, nProxyFlags,DxfName,AppName) \
275 ODRX_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE, \
276 DwgVer,MaintVer,nProxyFlags,OD_T(#ClassName),OD_T(#DxfName),OD_T(#AppName))
280 #define ODRX_DXF_CONS_DEFINE_MEMBERS(ClassName,ParentClass,DwgVer,MaintVer,nProxyFlags,DxfName,AppName) \
282 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
283 DwgVer,MaintVer,nProxyFlags,OD_T(#ClassName),OD_T(#DxfName),OD_T(#AppName),0) \
285 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,NEWOBJ_CONSTR)
349 inline void internalAddRef();
483 { assign(
source);
return *
this; }
487 { assign(
source);
return *
this; }
491 { assign(
source.get());
return *
this; }
732 pRes.
attach(queryX(pClass));
803 void OdRxObjectPtr::internalAddRef()
834 class OdRxOverruleIterator;
1104 template <
class Class,
class Parent>
1109 if(pClass == Class::desc())
1116 pObj = Class::desc()->getX(pClass).detach();
1118 pObj = pThis->Parent::queryX(pClass);
1156 int nProxyFlags = 0,
1160 int nCustomFlags = 0
FIRSTDLL_EXPORT OdRxObjectPtr odrxCreateObject(const OdString &sClassName)
OdRxObjectPtr(* OdPseudoConstructorType)()
FIRSTDLL_EXPORT void deleteOdRxClass(OdRxClass *pClass)
void(* ODRXOBJECT_CALLBACK)(const OdRxObject *)
FIRSTDLL_EXPORT OdRxClass * newOdRxClass(const OdString &sClassName, OdRxClass *pBaseClass, 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)
OdSmartPtr< OdRxClass > OdRxClassPtr
OdRxObject * odQueryXImpl(const Class *pThis, const OdRxClass *pClass)
OdArray< OdRxObjectPtr > OdRxObjectPtrArray
FIRSTDLL_EXPORT void odrxUnregisterDestructorCallback()
void(* OdRxMemberCollectionConstructorPtr)(OdRxMemberCollectionBuilder &, void *)
void(* AppNameChangeFuncPtr)(const OdRxClass *classObj, OdString &newAppName, int saveVer)
FIRSTDLL_EXPORT void odrxRegisterDestructorCallback(const ODRXOBJECT_CALLBACK callbackFunc)
virtual OdPseudoConstructorType constructor()
virtual OdRxClass * myParent() const =0
virtual bool isDerivedFrom(const OdRxClass *pClass) const
virtual OdRxObjectPtr create() const =0
virtual OdRxOverruleIterator * getOverrule(OverrulingType t) const =0
virtual OdRxModule * module() const =0
virtual void setConstructor(OdPseudoConstructorType psuedoConstr)=0
virtual void setOverrule(OdRxOverruleIterator *pIt, OverrulingType t)=0
ODRX_DECLARE_MEMBERS(OdRxClass)
virtual OdRxObjectPtr getX(const OdRxClass *pProtocolClass)
virtual const OdString name() const =0
virtual OdUInt32 customFlags() const =0
virtual OdUInt32 proxyFlags() const =0
virtual OdRxObjectPtr delX(OdRxClass *pProtocolClass)
virtual OdDb::DwgVersion getClassVersion(OdDb::MaintReleaseVer *pMaintReleaseVer=0) const =0
virtual OdRxObjectPtr addX(OdRxClass *pProtocolClass, OdRxObject *pProtocolObject)
virtual const OdString appName() const =0
virtual const OdString dxfName() const =0
virtual AppNameChangeFuncPtr appNameCallbackPtr() const =0
static OdRxClass * desc()
virtual OdRxObject * x(const OdRxClass *pClass) const
virtual OdRxClass * isA() const
virtual bool isEqualTo(const OdRxObject *pOther) const
virtual void copyFrom(const OdRxObject *pSource)
virtual OdRxObjectPtr clone() const
virtual OdRxObject * queryX(const OdRxClass *pClass) const
virtual OdRx::Ordering comparedTo(const OdRxObject *pOther) const
virtual long numRefs() const
static OdRxObjectPtr cast(const OdRxObject *pointer)
bool isKindOf(const OdRxClass *pClass) const
OdRxObjectPtr(const OdBaseObjectPtr &pSource)
OdRxObjectPtr(const OdRxObject *pSource)
OdRxObject * operator->()
bool operator==(const OdRxObject *pObject) const
OdRxObjectPtr & operator=(const OdRxObjectPtr &source)
void attach(const OdRxObject *pObject)
OdRxObjectPtr(const OdRxObjectPtr &pSource)
bool operator!=(const OdRxObject *pObject) const
OdRxObjectPtr(const OdRxObject *pSource, OdRxObjMod)
const OdRxObject * get() const
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)
GLsizei GLsizei GLchar * source