00001
00002 #ifndef SCT_REFCOUNTSERVANTBASE_H
00003 #define SCT_REFCOUNTSERVANTBASE_H
00004
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "boost/thread.hpp"
00017
00018 namespace Sct {
00019
00020 class RefCountServantBase {
00021 public:
00022 virtual ~RefCountServantBase();
00023
00024 virtual void _sct_add_ref();
00025 virtual void _sct_remove_ref();
00026 virtual void performCountEqualsZeroAction()=0;
00027
00028 protected:
00029 inline RefCountServantBase() : pd_refCount(1) {}
00030 inline RefCountServantBase(const RefCountServantBase&) : pd_refCount(1) {}
00031 inline RefCountServantBase& operator = (const RefCountServantBase&)
00032 { return *this; }
00033
00034 private:
00035 int pd_refCount;
00036 boost::mutex m_mutex;
00037 };
00038
00039 };
00040
00041 #endif