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)
58 T* grabRef() { if (!ptr) return 0; ptr->AddRef(); return ptr; }
59 T* &ptrref() { ASSERT(!ptr); return ptr; }
60 operator bool() const { return !!this->ptr; }
62 T* operator->() const { ptrAssert(ptr); return ptr; }
63 operator T*() const { return this->ptr; }
73 T &operator*() { return *ptr; }
85 eUsePtr(const eUsePtr &c)
94 eUsePtr &operator=(T *c)
110 eUsePtr &operator=(eUsePtr<T> &c)
136 T* grabRef() { if (!ptr) return 0; ptr->AddRef(); ptr->AddUse(); return ptr; }
137 T* &ptrref() { ASSERT(!ptr); return ptr; }
139 T* operator->() const { ptrAssert(ptr); return ptr; }
140 operator T*() const { return this->ptr; }
147 class eMutablePtr: public ePtr<T>
149 /* read doc/iObject about the ePtrHelper */
155 inline ePtrHelper(T1 *obj): m_obj(obj)
163 inline T1* operator->() { return m_obj; }
168 eMutablePtr(): ePtr<T>(0)
172 eMutablePtr(T *c): ePtr<T>(c)
176 eMutablePtr(const eMutablePtr &c): ePtr<T>(c)
180 eMutablePtr &operator=(T *c)
182 ePtr<T>::operator=(c);
187 ePtrHelper<T> operator->() { ptrAssert(ptr); return ePtrHelper<T>(ptr); }
189 /* for const objects, we don't need the helper, as they can't */
190 /* be changed outside the program flow. at least this is */
191 /* what the compiler assumes, so in case you're using const */
192 /* eMutablePtrs note that they have to be const. */
193 const T* operator->() const { ptrAssert(ptr); return ptr; }