00001 #ifndef _GEMFIRE_SHAREDBASE_HPP_
00002 #define _GEMFIRE_SHAREDBASE_HPP_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "gfcpp_globals.hpp"
00016
00020 namespace gemfire {
00021
00022
00029 class CPPCACHE_EXPORT SharedBase {
00030
00031 public:
00032
00034 inline SharedBase() :
00035 m_refCount(0)
00036 {
00037 }
00038
00040 void preserveSB() const;
00041
00046 void releaseSB() const;
00047
00049 inline int32_t refCount()
00050 {
00051 return m_refCount;
00052 }
00053
00054 protected:
00055
00056 inline SharedBase(bool noInit)
00057 {}
00058
00059 virtual ~SharedBase()
00060 {}
00061
00062
00063 private:
00064
00065 mutable volatile int32_t m_refCount;
00066
00067 void operator = (const SharedBase& rhs);
00068
00069 };
00070
00076 class CPPCACHE_EXPORT NullSharedBase: public SharedBase
00077 {
00078 public:
00079 static const NullSharedBase* const s_instancePtr;
00080
00081 private:
00082 NullSharedBase() { }
00083
00084 NullSharedBase(const NullSharedBase&);
00085 NullSharedBase& operator =(const NullSharedBase&);
00086
00087 friend class SharedBase;
00088 };
00089
00090 }
00091
00092 #define NULLPTR gemfire::NullSharedBase::s_instancePtr
00093
00094 #endif //#define _GEMFIRE_SHAREDBASE_HPP_