aboutsummaryrefslogtreecommitdiff
path: root/lib/base
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2008-06-13 09:57:56 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2008-06-13 09:57:56 +0000
commit2e0270746af934180499931f95ed91c444c8233e (patch)
tree8a3347e3ba191a05067d2ad43b23c221d9cc9fff /lib/base
parent86470f194147f01561a0d371eb8eb8977eccaa93 (diff)
downloadenigma2-2e0270746af934180499931f95ed91c444c8233e.tar.gz
enigma2-2e0270746af934180499931f95ed91c444c8233e.zip
after DECLARE_REF now all is private.. not public
dont export AddRef, Release, ptrref and grabRef to python some cleanups
Diffstat (limited to 'lib/base')
-rw-r--r--lib/base/object.h33
-rw-r--r--lib/base/smartptr.h4
2 files changed, 22 insertions, 15 deletions
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; }
};