24 #ifndef _ODRXOBJECT_INCLUDED_
25 #define _ODRXOBJECT_INCLUDED_ /
28 #if defined(_SW_VERSION) && !defined (XENON)
29 #define OdRxModule ds_OdRxModule
66 #if defined(_SW_VERSION) && !defined (XENON)
67 #define FX_STUB static void stub() {}
72 #define ODRX_DECLARE_MEMBERS_GENERIC(ClassType, ClassName)\
81 static OdSmartPtr<ClassName> cast(const OdRxObject* pObj) \
84 return OdSmartPtr<ClassName>(((ClassName*)pObj->queryX(ClassName::desc())), kOdRxObjAttach); \
85 return (ClassName*)0; \
88 static ClassType* g_pDesc; \
93 static ClassType* desc(); \
98 virtual ClassType* isA() const; \
102 virtual OdRxObject* queryX(const OdRxClass* protocolClass) const; \
106 static OdRxObjectPtr pseudoConstructor(); \
110 static OdSmartPtr<ClassName> createObject() \
111 { if (!desc()) throw OdError(eNotInitializedYet); return desc()->create(); } \
114 static void rxInit(); \
115 static void rxInit(AppNameChangeFuncPtr appNameChangeFunc); \
118 static void rxUninit()
131 #define ODRX_DECLARE_MEMBERS(ClassName)\
132 ODRX_DECLARE_MEMBERS_GENERIC(OdRxClass, ClassName)
140 #define EMPTY_CONSTR(ClassName)(ClassName*)0
152 #define NEWOBJ_CONSTR(ClassName) OdSmartPtr<ClassName>(new ClassName, kOdRxObjAttach)
154 #define ODRX_DEFINE_RTTI_MEMBERS_GENERIC(ClassType, ClassName, ParentClass) \
156 ClassType* ClassName::g_pDesc = 0; \
157 ClassType* ClassName::desc() { return g_pDesc; } \
158 ClassType* ClassName::isA() const { return g_pDesc; } \
160 OdRxObject* ClassName::queryX(const OdRxClass* pClass) const { \
161 return ::odQueryXImpl<ClassName, ParentClass>(this, pClass); \
170 #define ODRX_DEFINE_RTTI_MEMBERS(ClassName, ParentClass) \
171 ODRX_DEFINE_RTTI_MEMBERS_GENERIC(OdRxClass, ClassName, ParentClass)
173 #define ODRX_DEFINE_INIT_MEMBERS_GENERIC(ClassName, CREATE_CLASS_INSTANCE, CREATE_CLASS_INSTANCE2) \
176 void ClassName::rxInit() \
178 if (!ClassName::g_pDesc) { \
179 ClassName::g_pDesc = CREATE_CLASS_INSTANCE; \
181 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
182 throw OdError(eExtendedError); \
185 void ClassName::rxInit(AppNameChangeFuncPtr pAppNameChangeCallback) \
187 if (!ClassName::g_pDesc) { \
188 ClassName::g_pDesc = CREATE_CLASS_INSTANCE2; \
190 ODA_ASSERT(("Class ["#ClassName"] is already initialized.",0)); \
191 throw OdError(eExtendedError); \
196 void ClassName::rxUninit() \
198 if (ClassName::g_pDesc) { \
199 ::deleteOdRxClass(ClassName::g_pDesc); \
200 ClassName::g_pDesc = 0; \
202 ODA_ASSERT(("Class ["#ClassName"] is not initialized yet.",0)); \
203 throw OdError(eNotInitializedYet); \
215 #define ODRX_DEFINE_INIT_MEMBERS(ClassName, ParentClass, pseudoConsFn, DwgVer, \
216 MaintVer, nProxyFlags, szDWGClassName, \
217 szDxfName, szAppName, nCustomFlags) \
218 ODRX_DEFINE_INIT_MEMBERS_GENERIC( \
220 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
221 MaintVer, nProxyFlags, szDxfName, szAppName, NULL, nCustomFlags)), \
222 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
223 MaintVer, nProxyFlags, szDxfName, szAppName, pAppNameChangeCallback, nCustomFlags)))
232 #define ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE) \
234 OdRxObjectPtr ClassName::pseudoConstructor() { return OdRxObjectPtr(DOCREATE(ClassName)); }
242 #define ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,pseudoConsFn,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags) \
244 ODRX_DEFINE_RTTI_MEMBERS(ClassName,ParentClass) \
246 ODRX_DEFINE_INIT_MEMBERS(ClassName,ParentClass,pseudoConsFn, \
247 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags)
249 #define ODRX_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName)\
251 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
252 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,0) \
254 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
256 #define ODRX_DEFINE_MEMBERS_EX(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags)\
258 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
259 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags) \
261 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
264 #define ODRX_NO_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,szClassName) \
266 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,0,0,0,0,szClassName,OdString::kEmpty,OdString::kEmpty,0) \
268 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,EMPTY_CONSTR)
272 #define ODRX_NO_CONS_DEFINE_MEMBERS(ClassName,ParentClass) \
274 ODRX_NO_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,OD_T(#ClassName))
278 #define ODRX_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,szClassName,DOCREATE) \
280 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor,0,0,0,szClassName,OdString::kEmpty,OdString::kEmpty,0) \
282 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
286 #define ODRX_CONS_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE) \
288 ODRX_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,OD_T(#ClassName),DOCREATE)
292 #define ODRX_DXF_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer, nProxyFlags,DxfName,AppName) \
294 ODRX_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE, \
295 DwgVer,MaintVer,nProxyFlags,OD_T(#ClassName),OD_T(#DxfName),OD_T(#AppName))
299 #define ODRX_DXF_CONS_DEFINE_MEMBERS(ClassName,ParentClass,DwgVer,MaintVer,nProxyFlags,DxfName,AppName) \
301 ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
302 DwgVer,MaintVer,nProxyFlags,OD_T(#ClassName),OD_T(#DxfName),OD_T(#AppName),0) \
304 ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,NEWOBJ_CONSTR)
368 inline void internalAddRef();
502 { assign(
source);
return *
this; }
506 { assign(
source);
return *
this; }
510 { assign(
source.get());
return *
this; }
751 pRes.
attach(queryX(pClass));
822 void OdRxObjectPtr::internalAddRef()
853 class OdRxOverruleIterator;
1123 template <
class Class,
class Parent>
1128 if(pClass == Class::desc())
1135 pObj = Class::desc()->getX(pClass).detach();
1137 pObj = pThis->Parent::queryX(pClass);
1175 int nProxyFlags = 0,
1179 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