GemStone::GemFire::Cache::Generic::Internal::SBWrap< NTYPE > Class Template Reference


Detailed Description

template<typename NTYPE>
class GemStone::GemFire::Cache::Generic::Internal::SBWrap< NTYPE >

Internal class to wrap native object pointers that derive from SharedBase; NTYPE is the native class.

This is a convenience template class to wrap native class objects that derive from SharedBase. The native class objects can be of two kinds -- one that derive from SharedBase and are handled using smart pointers, and the second that do not derive from SharedBase. For the first category we have to invoke preserveSB() and releaseSB() on the native object during construction and dispose/finalization of the wrapped object.

All the managed wrapper classes that wrap corresponding native classes deriving from SharedBase should derive from this class.

IMPORTANT: Direct assignment of m_nativeptr has been disabled, rather the classes deriving from this should use SBWrap.SetPtr or SBWrap._SetNativePtr

This class is intentionally not thread-safe.

Public Member Functions

 !SBWrap ()
 ~SBWrap ()

Protected Member Functions

void _SetNativePtr (NTYPE *nativeptr)
void AssignPtr (NTYPE *nativeptr)
void InternalCleanup ()
void SetPtr (NTYPE *nativeptr)


Constructor & Destructor Documentation

template<typename NTYPE>
GemStone::GemFire::Cache::Generic::Internal::SBWrap< NTYPE >::~SBWrap (  )  [inline]

The dispose function.

template<typename NTYPE>
GemStone::GemFire::Cache::Generic::Internal::SBWrap< NTYPE >::!SBWrap (  )  [inline]

The finalizer, for the case dispose is not called.


Member Function Documentation

template<typename NTYPE>
void GemStone::GemFire::Cache::Generic::Internal::SBWrap< NTYPE >::_SetNativePtr ( NTYPE *  nativeptr  )  [inline, protected]

Set the native pointer to the new object without doing a preserveSB(). DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING.

template<typename NTYPE>
void GemStone::GemFire::Cache::Generic::Internal::SBWrap< NTYPE >::AssignPtr ( NTYPE *  nativeptr  )  [inline, protected]

Used to assign the native pointer to a new object.

Note the order of preserveSB() and releaseSB(). This handles the corner case when m_nativeptr is same as nativeptr.

template<typename NTYPE>
void GemStone::GemFire::Cache::Generic::Internal::SBWrap< NTYPE >::InternalCleanup (  )  [inline, protected]

Internal cleanup function invoked by dispose/finalizer.

template<typename NTYPE>
void GemStone::GemFire::Cache::Generic::Internal::SBWrap< NTYPE >::SetPtr ( NTYPE *  nativeptr  )  [inline, protected]

Used to set the native pointer to a new object. This should only be used when you know that the underlying object is NULL.


GemFire C++ Cache .NET API Documentation