00001
00006
00007 #ifndef _H_GEN_SHARED
00008 #define _H_GEN_SHARED
00009
00010
00021
00022 class GEN_Shared {
00023 public:
00027 GEN_Shared() : m_refCount(1) {}
00028
00033 inline virtual int getRef() const;
00034
00039 inline virtual int incRef();
00040
00046 inline virtual int decRef();
00047
00048 protected:
00053 virtual ~GEN_Shared() {};
00054
00055
00056 protected:
00058 int m_refCount;
00059 };
00060
00061
00062 inline int GEN_Shared::getRef() const
00063 {
00064 return m_refCount;
00065 }
00066
00067 inline int GEN_Shared::incRef()
00068 {
00069 return ++m_refCount;
00070 }
00071
00072 inline int GEN_Shared::decRef()
00073 {
00074 if (--m_refCount == 0) {
00075 delete this;
00076 }
00077 return m_refCount;
00078 }
00079
00080
00081 #endif // _H_GEN_SHARED