6 #include <lib/python/swig.h>
8 inline void ptrAssert(void *p) { if (!p) *(unsigned long*)0=0; }
16 T &operator*() { return *ptr; }
41 ePtr &operator=(ePtr<T> &c)
57 T* grabRef() { if (!ptr) return 0; ptr->AddRef(); return ptr; }
58 T* &ptrref() { assert(!ptr); return ptr; }
59 T* operator->() const { ptrAssert(ptr); return ptr; }
60 operator T*() const { return this->ptr; }
62 operator bool() const { return !!this->ptr; }
72 T &operator*() { return *ptr; }
84 eUsePtr(const eUsePtr &c)
93 eUsePtr &operator=(T *c)
109 eUsePtr &operator=(eUsePtr<T> &c)
134 T* grabRef() { if (!ptr) return 0; ptr->AddRef(); ptr->AddUse(); return ptr; }
135 T* &ptrref() { assert(!ptr); return ptr; }
136 T* operator->() const { ptrAssert(ptr); return ptr; }
137 operator T*() const { return this->ptr; }
144 class eMutablePtr: public ePtr<T>
146 /* read doc/iObject about the ePtrHelper */
152 inline ePtrHelper(T1 *obj): m_obj(obj)
160 inline T1* operator->() { return m_obj; }
165 eMutablePtr(): ePtr<T>(0)
169 eMutablePtr(T *c): ePtr<T>(c)
173 eMutablePtr(const eMutablePtr &c): ePtr<T>(c)
177 eMutablePtr &operator=(T *c)
179 ePtr<T>::operator=(c);
184 ePtrHelper<T> operator->() { ptrAssert(ptr); return ePtrHelper<T>(ptr); }
186 /* for const objects, we don't need the helper, as they can't */
187 /* be changed outside the program flow. at least this is */
188 /* what the compiler assumes, so in case you're using const */
189 /* eMutablePtrs note that they have to be const. */
190 const T* operator->() const { ptrAssert(ptr); return ptr; }