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; }
61 T* operator->() const { ptrAssert(ptr); return ptr; }
62 operator T*() const { return this->ptr; }
64 operator bool() const { return !!this->ptr; }
74 T &operator*() { return *ptr; }
86 eUsePtr(const eUsePtr &c)
95 eUsePtr &operator=(T *c)
111 eUsePtr &operator=(eUsePtr<T> &c)
137 T* grabRef() { if (!ptr) return 0; ptr->AddRef(); ptr->AddUse(); return ptr; }
138 T* &ptrref() { assert(!ptr); return ptr; }
140 T* operator->() const { ptrAssert(ptr); return ptr; }
141 operator T*() const { return this->ptr; }
148 class eMutablePtr: public ePtr<T>
150 /* read doc/iObject about the ePtrHelper */
156 inline ePtrHelper(T1 *obj): m_obj(obj)
164 inline T1* operator->() { return m_obj; }
169 eMutablePtr(): ePtr<T>(0)
173 eMutablePtr(T *c): ePtr<T>(c)
177 eMutablePtr(const eMutablePtr &c): ePtr<T>(c)
181 eMutablePtr &operator=(T *c)
183 ePtr<T>::operator=(c);
188 ePtrHelper<T> operator->() { ptrAssert(ptr); return ePtrHelper<T>(ptr); }
190 /* for const objects, we don't need the helper, as they can't */
191 /* be changed outside the program flow. at least this is */
192 /* what the compiler assumes, so in case you're using const */
193 /* eMutablePtrs note that they have to be const. */
194 const T* operator->() const { ptrAssert(ptr); return ptr; }