CFx SDK Documentation
2020SP3
|
Go to the documentation of this file.
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
1185 #endif //_ODRXOBJECT_INCLUDED_
virtual OdRxOverruleIterator * getOverrule(OverrulingType t) const =0
virtual void setConstructor(OdPseudoConstructorType psuedoConstr)=0
virtual const OdString appName() const =0
const OdRxObject * get() const
OdRxObjectPtr(const OdRxObject *pSource, OdRxObjMod)
virtual OdRx::Ordering comparedTo(const OdRxObject *pOther) const
GLsizei GLsizei GLchar * source
OdRxObjectPtr(const OdRxObjectPtr &pSource)
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)
void(* AppNameChangeFuncPtr)(const OdRxClass *classObj, OdString &newAppName, int saveVer)
virtual const OdString dxfName() const =0
virtual OdRxClass * myParent() const =0
FIRSTDLL_EXPORT void deleteOdRxClass(OdRxClass *pClass)
virtual OdUInt32 customFlags() const =0
virtual AppNameChangeFuncPtr appNameCallbackPtr() const =0
virtual OdRxClass * isA() const
void attach(const OdRxObject *pObject)
virtual OdRxObjectPtr clone() const
OdArray< OdRxObjectPtr > OdRxObjectPtrArray
virtual OdRxObject * x(const OdRxClass *pClass) const
virtual OdDb::DwgVersion getClassVersion(OdDb::MaintReleaseVer *pMaintReleaseVer=0) const =0
virtual OdPseudoConstructorType constructor()
virtual OdRxObject * queryX(const OdRxClass *pClass) const
OdRxObject * operator->()
virtual const OdString name() const =0
bool isKindOf(const OdRxClass *pClass) const
FIRSTDLL_EXPORT void odrxRegisterDestructorCallback(const ODRXOBJECT_CALLBACK callbackFunc)
virtual OdRxObjectPtr addX(OdRxClass *pProtocolClass, OdRxObject *pProtocolObject)
void(* ODRXOBJECT_CALLBACK)(const OdRxObject *)
virtual bool isDerivedFrom(const OdRxClass *pClass) const
FIRSTDLL_EXPORT OdRxObjectPtr odrxCreateObject(const OdString &sClassName)
static OdRxObjectPtr cast(const OdRxObject *pointer)
virtual void setOverrule(OdRxOverruleIterator *pIt, OverrulingType t)=0
virtual long numRefs() const
virtual OdRxObjectPtr getX(const OdRxClass *pProtocolClass)
virtual OdRxModule * module() const =0
OdRxObject * odQueryXImpl(const Class *pThis, const OdRxClass *pClass)
FIRSTDLL_EXPORT void odrxUnregisterDestructorCallback()
virtual OdUInt32 proxyFlags() const =0
virtual OdRxObjectPtr delX(OdRxClass *pProtocolClass)
virtual OdRxObjectPtr create() const =0
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
bool operator!=(const OdRxObject *pObject) const
OdRxObjectPtr & operator=(const OdRxObjectPtr &source)
void(* OdRxMemberCollectionConstructorPtr)(OdRxMemberCollectionBuilder &, void *)
virtual void copyFrom(const OdRxObject *pSource)
bool operator==(const OdRxObject *pObject) const
OdRxObjectPtr(const OdRxObject *pSource)
OdRxObjectPtr(const OdBaseObjectPtr &pSource)
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)
ODRX_DECLARE_MEMBERS(OdRxClass)
static OdRxClass * desc()
OdSmartPtr< OdRxClass > OdRxClassPtr
virtual bool isEqualTo(const OdRxObject *pOther) const
OdRxObjectPtr(* OdPseudoConstructorType)()