00001 00002 #ifndef SCT_REFCOUNTSERVANTBASE_H 00003 #define SCT_REFCOUNTSERVANTBASE_H 00004 00008 00009 // the idea is that this is a replacement for 00010 // PortableServer::RefCountServantBase 00011 // (see omni-04-02-06/include/omniORB4/poa.h and 00012 // omni-04-02-06/src/lib/omniORB/orbcore/portableserver.cc) 00013 // except that it respects the _destroy() (rather than delete) 00014 // mechanism requested by ipc::Object. 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