27 #ifndef _ODSMARTCLSIDPTR_INCLUDED_
28 #define _ODSMARTCLSIDPTR_INCLUDED_
35 #define ODRX_DEFINE_CLSID_RETRIEVER(Class) \
36 class OdRxClsIdHolderFor_##Class\
39 static inline const OdRxClass* classId()\
41 OdRxClass* pClass = static_cast<OdRxClass*>(::odrxClassDictionary()->getAt(OD_T(#Class)).get());\
43 throw OdError(eNotInitializedYet);\
48 #define ODRX_DEFINE_CLSID_SMARTPTR(Class) \
49 ODRX_DEFINE_CLSID_RETRIEVER(Class);\
50 typedef OdClsIdSmartPtr<OdRxClsIdHolderFor_##Class, Class> Class##ClsIdPtr
64 inline void internalAddRef() {
if(
m_pObject) {
static_cast<T*
>(
m_pObject)->addRef(); } }
77 inline void assign(
const T* pObject)
92 inline void internalQueryX(
const OdRxObject* pObject)
107 internalQueryX(pObject);
116 bool operator !()
const {
ODA_FAIL();
return false; }
121 operator bool()
const {
ODA_FAIL();
return false; }
126 operator bool() {
ODA_FAIL();
return false; }
152 return ClsIdRetriever::classId();
157 internalQueryX(pObject);
164 m_pObject =
const_cast<T*
>(
static_cast<const T*
>(pObject.
get()));
176 pRes.
attach(
static_cast<T*
>(pObject->
queryX(ClsIdRetriever::classId())));
207 internalQueryX(pObject);
253 { assign(pObject);
return *
this; }
256 { assign(pObject.
get());
return *
this; }
259 { assign(pObject);
return *
this; }
269 inline const T*
get()
const {
return const_cast<T*
>(
static_cast<const T*
>(
m_pObject)); }
300 inline operator T*()
const {
return static_cast<T*
>(
m_pObject); }
311 inline operator T*() {
return static_cast<T*
>(
m_pObject); }
319 inline operator const T*()
const {
return static_cast<const T*
>(
m_pObject); }
OdClsIdSmartPtr(OdRxObject *pObject, OdRxObjMod)
OdClsIdSmartPtr(const T *pObject, OdRxObjMod)
static OdClsIdSmartPtr cast(const OdRxObject *pObject)
bool operator==(const void *p) const
OdClsIdSmartPtr(const OdRxObjectPtr &pObject)
OdClsIdSmartPtr(const OdClsIdSmartPtr &pObject)
OdClsIdSmartPtr(const OdRxObject *pObject)
void attach(OdRxObject *pObject)
OdClsIdSmartPtr(const T *pObject)
bool operator!=(const OdClsIdSmartPtr &ptr) const
void attach(const T *pObject)
OdClsIdSmartPtr & operator=(const OdClsIdSmartPtr &pObject)
bool operator!=(const void *p) const
bool operator==(const OdClsIdSmartPtr &ptr) const
static const OdRxClass * classId()
OdClsIdSmartPtr(const OdBaseObjectPtr &pObject)
virtual OdRxObject * queryX(const OdRxClass *pClass) const