From 2e0270746af934180499931f95ed91c444c8233e Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Fri, 13 Jun 2008 09:57:56 +0000 Subject: after DECLARE_REF now all is private.. not public dont export AddRef, Release, ptrref and grabRef to python some cleanups --- lib/base/object.h | 33 ++++++++++++++++++--------------- lib/base/smartptr.h | 4 ++++ 2 files changed, 22 insertions(+), 15 deletions(-) (limited to 'lib/base') diff --git a/lib/base/object.h b/lib/base/object.h index 1723a885..f0e0e9a5 100644 --- a/lib/base/object.h +++ b/lib/base/object.h @@ -18,9 +18,15 @@ private: void operator=(const iObject &); protected: virtual ~iObject() { } +#ifdef SWIG + virtual void AddRef()=0; + virtual void Release()=0; +#endif public: +#ifndef SWIG virtual void AddRef()=0; virtual void Release()=0; +#endif }; #ifndef SWIG @@ -43,10 +49,10 @@ public: #if defined(OBJECT_DEBUG) extern int object_total_remaining; #define DECLARE_REF(x) \ - private:oRefCount ref; \ - eSingleLock ref_lock; \ public: void AddRef(); \ - void Release(); + void Release(); \ + private:oRefCount ref; \ + eSingleLock ref_lock; #define DEFINE_REF(c) \ void c::AddRef() \ { \ @@ -68,9 +74,9 @@ public: } #elif defined(__mips__) #define DECLARE_REF(x) \ - private: oRefCount ref; \ public: void AddRef(); \ - void Release(); + void Release(); \ + private: oRefCount ref; #define DEFINE_REF(c) \ void c::AddRef() \ { \ @@ -108,9 +114,9 @@ public: } #elif defined(__ppc__) || defined(__powerpc__) #define DECLARE_REF(x) \ - private: oRefCount ref; \ public: void AddRef(); \ - void Release(); + void Release(); \ + private: oRefCount ref; #define DEFINE_REF(c) \ void c::AddRef() \ { \ @@ -142,9 +148,9 @@ public: } #elif defined(__i386__) || defined(__x86_64__) #define DECLARE_REF(x) \ - private: oRefCount ref; \ public: void AddRef(); \ - void Release(); + void Release(); \ + private: oRefCount ref; #define DEFINE_REF(c) \ void c::AddRef() \ { \ @@ -165,10 +171,10 @@ public: #else #warning use non optimized implementation of refcounting. #define DECLARE_REF(x) \ - private:oRefCount ref; \ - eSingleLock ref_lock; \ public: void AddRef(); \ - void Release(); + void Release(); \ + private:oRefCount ref; \ + eSingleLock ref_lock; #define DEFINE_REF(c) \ void c::AddRef() \ { \ @@ -190,9 +196,6 @@ public: private: \ void AddRef(); \ void Release(); - class Object - { - }; #endif // SWIG #endif // __base_object_h diff --git a/lib/base/smartptr.h b/lib/base/smartptr.h index 6c3dbc2f..782ff48e 100644 --- a/lib/base/smartptr.h +++ b/lib/base/smartptr.h @@ -54,8 +54,10 @@ public: ptr->Release(); } +#ifndef SWIG T* grabRef() { if (!ptr) return 0; ptr->AddRef(); return ptr; } T* &ptrref() { assert(!ptr); return ptr; } +#endif T* operator->() const { ptrAssert(ptr); return ptr; } operator T*() const { return this->ptr; } @@ -131,8 +133,10 @@ public: } } +#ifndef SWIG T* grabRef() { if (!ptr) return 0; ptr->AddRef(); ptr->AddUse(); return ptr; } T* &ptrref() { assert(!ptr); return ptr; } +#endif T* operator->() const { ptrAssert(ptr); return ptr; } operator T*() const { return this->ptr; } }; -- cgit v1.2.3