UT_IntrusivePtr< T > Class Template Reference

Wrapper around boost::intrusive_ptr. More...

#include <UT_IntrusivePtr.h>

List of all members.

Public Member Functions

 UT_IntrusivePtr (T *p=0)


Detailed Description

template<class T>
class UT_IntrusivePtr< T >

Wrapper around boost::intrusive_ptr.

An intrusive pointer assumes that the referenced object implements reference counting on itself. The reference counting is implemented using the methods intrusive_ptr_add_ref() and intrusive_ptr_release() For example:

     class Foo {
     public:
         Foo() : myCount(0) {}
        ~Foo() {}
         void        incref()
                     {
                         myCount.add(1);
                     }
         void        decref()
                     {
                         if (myCount.add(-1) == 0)
                             delete this;
                     }
         SYS_AtomicInt32     myCount;
     };
     static inline void intrusive_ptr_add_ref(Foo *o) { o->incref(); }
     static inline void intrusive_ptr_release(Foo *o) { o->decref(); }

     typedef UT_IntrusivePtr<Foo>   FooHandle;
See also:
UT_SharedPointer

Definition at line 52 of file UT_IntrusivePtr.h.


Constructor & Destructor Documentation

template<class T >
UT_IntrusivePtr< T >::UT_IntrusivePtr ( T *  p = 0  )  [inline]

Definition at line 55 of file UT_IntrusivePtr.h.


The documentation for this class was generated from the following file:

Generated on Mon Jan 28 00:49:03 2013 for HDK by  doxygen 1.5.9