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