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) \
157void 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); \
166void 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); \
177void 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, pMemberCreate, pUserData)\
199 ODRX_DEFINE_INIT_MEMBERS_GENERIC( \
201 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
202 MaintVer, nProxyFlags, szDxfName, szAppName, NULL, nCustomFlags, pMemberCreate, pUserData)), \
203 (::newOdRxClass(szDWGClassName, ParentClass::desc(), pseudoConsFn, DwgVer, \
204 MaintVer, nProxyFlags, szDxfName, szAppName, pAppNameChangeCallback, nCustomFlags, pMemberCreate, pUserData)))
213#define ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE) \
215OdRxObjectPtr ClassName::pseudoConstructor() { return OdRxObjectPtr(DOCREATE(ClassName)); }
223#define ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,pseudoConsFn,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags) \
225ODRX_DEFINE_RTTI_MEMBERS(ClassName,ParentClass) \
227ODRX_DEFINE_INIT_MEMBERS(ClassName,ParentClass,pseudoConsFn, \
228 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags,0,0)
230#define ODRX_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName)\
232ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
233 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,0) \
235ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
237#define ODRX_DEFINE_MEMBERS_EX(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags)\
239ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
240 DwgVer,MaintVer,nProxyFlags,szDWGClassName,szDxfName,szAppName,nCustomFlags) \
242ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
245#define ODRX_NO_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,szClassName) \
247ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,0,0,0,0,szClassName,OdString::kEmpty,OdString::kEmpty,0) \
249ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,EMPTY_CONSTR)
253#define ODRX_NO_CONS_DEFINE_MEMBERS(ClassName,ParentClass) \
255ODRX_NO_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,OD_T(#ClassName))
259#define ODRX_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,szClassName,DOCREATE) \
261ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor,0,0,0,szClassName,OdString::kEmpty,OdString::kEmpty,0) \
263ODRX_DEFINE_PSEUDOCONSTRUCTOR(ClassName,DOCREATE)
267#define ODRX_CONS_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE) \
269ODRX_CONS_DEFINE_MEMBERS_ALTNAME(ClassName,ParentClass,OD_T(#ClassName),DOCREATE)
273#define ODRX_DXF_DEFINE_MEMBERS(ClassName,ParentClass,DOCREATE,DwgVer,MaintVer, nProxyFlags,DxfName,AppName) \
275ODRX_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) \
282ODRX_DEFINE_MEMBERS2(ClassName,ParentClass,ClassName::pseudoConstructor, \
283 DwgVer,MaintVer,nProxyFlags,OD_T(#ClassName),OD_T(#DxfName),OD_T(#AppName),0) \
285ODRX_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; }
728 bool isKindOf(
const OdRxClass* pClass)
const;
797void OdRxObjectPtr::internalAddRef()
828class OdRxOverruleIterator;
1107 if (
isA() &&
isA()->isDerivedFrom( pClass ) )
1114 return ( !pRes.
isNull() );
1118template <
class Class,
class Parent>
1124 if(pClass == Class::desc())
1131 pObj = Class::desc()->getX(pClass).detach();
1133 pObj = pThis->Parent::queryX(pClass);
1171 int nProxyFlags = 0,
1175 int nCustomFlags = 0,
FIRSTDLL_EXPORT OdRxObjectPtr odrxCreateObject(const OdString &sClassName)
OdRxObjectPtr(* OdPseudoConstructorType)()
FIRSTDLL_EXPORT void deleteOdRxClass(OdRxClass *pClass)
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, OdRxMemberCollectionConstructorPtr memberConstruct=0, void *userData=0)
void(* ODRXOBJECT_CALLBACK)(const OdRxObject *)
OdSmartPtr< OdRxClass > OdRxClassPtr
OdArray< OdRxObjectPtr > OdRxObjectPtrArray
FIRSTDLL_EXPORT void odrxUnregisterDestructorCallback()
OdRxObject * odQueryXImpl(const Class *pThis, const OdRxClass *pClass)
void(* OdRxMemberCollectionConstructorPtr)(OdRxMemberCollectionBuilder &, void *)
void(* AppNameChangeFuncPtr)(const OdRxClass *classObj, OdString &newAppName, int saveVer)
FIRSTDLL_EXPORT void odrxRegisterDestructorCallback(const ODRXOBJECT_CALLBACK callbackFunc)
OdRxModule * module() const
OdRxClass(OdRxClassImpl *)
OdRxObjectPtr getX(const OdRxClass *pProtocolClass)
OdRxAttributeCollection & attributes()
void setConstructor(OdPseudoConstructorType psuedoConstr)
virtual bool isDerivedFrom(const OdRxClass *pClass) const
const OdString appName() const
ODRX_DECLARE_MEMBERS(OdRxClass)
OdUInt32 customFlags() const
OdUInt32 proxyFlags() const
OdPseudoConstructorType constructor()
OdDb::DwgVersion getClassVersion(OdDb::MaintReleaseVer *pMaintReleaseVer=0) const
virtual OdRxObjectPtr create() const
AppNameChangeFuncPtr appNameCallbackPtr() const
OdRxObjectPtr delX(OdRxClass *pProtocolClass)
const OdString name() const
OdRxObjectPtr addX(OdRxClass *pProtocolClass, OdRxObject *pProtocolObject)
OdRxMemberCollection * members() const
const OdRxAttributeCollection & attributes() const
OdRxClass * myParent() const
const OdString dxfName() const
virtual OdRxObject * queryX(const OdRxClass *pClass) const
virtual bool isEqualTo(const OdRxObject *pOther) const
virtual void copyFrom(const OdRxObject *pSource)
virtual OdRxObjectPtr clone() const
virtual OdRxObject * x(const OdRxClass *pClass) const
virtual OdRx::Ordering comparedTo(const OdRxObject *pOther) const
virtual OdRxClass * isA() const
static OdRxClass * desc()
virtual long numRefs() const
static OdRxObjectPtr cast(const OdRxObject *pointer)
bool isKindOf(const OdRxClass *pClass) const
OdRxObjectPtr(const OdBaseObjectPtr &pSource)
OdRxObject * operator->()
OdRxObjectPtr(const OdRxObject *pSource)
OdRxObjectPtr & operator=(const OdRxObjectPtr &source)
const OdRxObject * get() const
bool operator==(const OdRxObject *pObject) const
void attach(const OdRxObject *pObject)
OdRxObjectPtr(const OdRxObjectPtr &pSource)
bool operator!=(const OdRxObject *pObject) const
OdRxObjectPtr(const OdRxObject *pSource, OdRxObjMod)
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)
GLsizei GLsizei GLchar * source