CFx SDK Documentation
2020SP3
|
Go to the documentation of this file.
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)
100 throw OdError(eNotThatKindOfClass);
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); }
333 #endif //_ODSMARTCLSIDPTR_INCLUDED_
static const OdRxClass * classId()
void attach(OdRxObject *pObject)
OdClsIdSmartPtr(const T *pObject)
OdClsIdSmartPtr(const OdRxObjectPtr &pObject)
OdClsIdSmartPtr & operator=(const OdClsIdSmartPtr &pObject)
OdClsIdSmartPtr(OdRxObject *pObject, OdRxObjMod)
bool operator!=(const OdClsIdSmartPtr &ptr) const
virtual OdRxObject * queryX(const OdRxClass *pClass) const
OdClsIdSmartPtr(const T *pObject, OdRxObjMod)
OdClsIdSmartPtr(const OdRxObject *pObject)
OdClsIdSmartPtr(const OdBaseObjectPtr &pObject)
bool operator==(const void *p) const
OdClsIdSmartPtr(const OdClsIdSmartPtr &pObject)
bool operator==(const OdClsIdSmartPtr &ptr) const
static OdClsIdSmartPtr cast(const OdRxObject *pObject)
void attach(const T *pObject)
bool operator!=(const void *p) const