nemo::IntrusiveCowSupport< T, CA > Class Template Reference

Generic utility class for "copy-on-write" (COW) data types. More...

#include <IntrusiveCowSupport.h>

List of all members.

Public Member Functions

 IntrusiveCowSupport (T *t)
 IntrusiveCowSupport (const IntrusiveCowSupport< T, CA > &p)
IntrusiveCowSupportoperator= (const IntrusiveCowSupport< T, CA > &rhs)
virtual ~IntrusiveCowSupport ()
const T * operator-> () const
void detach ()

Detailed Description

template<class T, class CA = CopyAllocator<T>>
class nemo::IntrusiveCowSupport< T, CA >

Generic utility class for "copy-on-write" (COW) data types.

Altough it has pointer semantics, this class is NOT a full blown, automatic COW pointer. Rather it can be used in some class C, that supports COW, internally.

The class C is responsible for calling the detach() function before C makes any change in the data T. detach() will then automatically create a data copy of T is more than one reference point to that data.

There are several requirements on the type T:

  • T must be copy-constructable.
  • There must be an operation void intrusive_ptr_add_ref(T*)
  • There must be an operation void intrusive_ptr_release(T*)
  • There must be an operation bool unique(T*) The easiest way to achieve the last three requirments is to let T inherit from nemo::IntrusiveCounted<T>.

C is furthermore responsible for not assigning null-pointers to IntrusiveCowSupport.

The second type argument CA can be used to customize the data-copy procedure that is used in the detach routine. See CopyAllocator.

Definition at line 52 of file IntrusiveCowSupport.h.


Constructor & Destructor Documentation

template<class T, class CA = CopyAllocator<T>>
nemo::IntrusiveCowSupport< T, CA >::IntrusiveCowSupport ( T *  t  )  [inline]

Definition at line 58 of file IntrusiveCowSupport.h.

template<class T, class CA = CopyAllocator<T>>
nemo::IntrusiveCowSupport< T, CA >::IntrusiveCowSupport ( const IntrusiveCowSupport< T, CA > &  p  )  [inline]

Definition at line 66 of file IntrusiveCowSupport.h.

template<class T, class CA = CopyAllocator<T>>
virtual nemo::IntrusiveCowSupport< T, CA >::~IntrusiveCowSupport (  )  [inline, virtual]

Definition at line 88 of file IntrusiveCowSupport.h.


Member Function Documentation

template<class T, class CA = CopyAllocator<T>>
void nemo::IntrusiveCowSupport< T, CA >::detach (  )  [inline]

Definition at line 102 of file IntrusiveCowSupport.h.

template<class T, class CA = CopyAllocator<T>>
const T* nemo::IntrusiveCowSupport< T, CA >::operator-> (  )  const [inline]

Definition at line 98 of file IntrusiveCowSupport.h.

template<class T, class CA = CopyAllocator<T>>
IntrusiveCowSupport& nemo::IntrusiveCowSupport< T, CA >::operator= ( const IntrusiveCowSupport< T, CA > &  rhs  )  [inline]

Definition at line 74 of file IntrusiveCowSupport.h.


The documentation for this class was generated from the following file:
Generated on Mon Feb 25 12:49:59 2013 for NemoMath by  doxygen 1.6.3