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 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 virtual ~SharedBase()
00057 {}
00058
00059
00060 private:
00061
00062 volatile int32_t m_refCount;
00063
00064 void operator = (const SharedBase& rhs);
00065
00066 };
00067
00073 class CPPCACHE_EXPORT NullSharedBase: public SharedBase
00074 {
00075 public:
00076 static const NullSharedBase* s_instancePtr;
00077
00078 private:
00079 NullSharedBase() { }
00080
00081 NullSharedBase(const NullSharedBase&);
00082 NullSharedBase& operator =(const NullSharedBase&);
00083
00084 friend class SharedBase;
00085 };
00086
00087 }
00088
00089 #define NULLPTR gemfire::NullSharedBase::s_instancePtr
00090
00091 #endif //#define _GEMFIRE_SHAREDBASE_HPP_