Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
ICPointerHolder< T > Class Template Reference

#include <icptrholder.h>

List of all members.

Public Member Functions

 ICPointerHolder ()
 ICPointerHolder (T *p)
 ICPointerHolder (const ICPointerHolder &ip)
 ~ICPointerHolder ()
ICPointerHolderoperator= (T *p)
ICPointerHolderoperator= (ICPointerHolder &p)
int operator!= (T *p)
int operator== (T *p)
 operator T * () const
Toperator-> () const
Toperator* ()

Private Member Functions

void release ()

Private Attributes

Tptr

Detailed Description

template<class T>
class ICPointerHolder< T >

Definition at line 31 of file icptrholder.h.


Constructor & Destructor Documentation

template<class T >
ICPointerHolder< T >::ICPointerHolder ( ) [inline]

Definition at line 33 of file icptrholder.h.

{ ptr = NULL; }
template<class T >
ICPointerHolder< T >::ICPointerHolder ( T p) [inline]

Definition at line 34 of file icptrholder.h.

{ ptr = p; }
template<class T >
ICPointerHolder< T >::ICPointerHolder ( const ICPointerHolder< T > &  ip) [inline]

Definition at line 37 of file icptrholder.h.

                                               {
        ptr = ip.ptr;

        // We need to transfer ownership of ptr to this object by setting
        // ip's ptr to null. Otherwise, ptr will de deleted twice.
        // const ugliness requires us to do the const_cast.
        ICPointerHolder *ipp = const_cast<ICPointerHolder*>(&ip);
        ipp->ptr = NULL;
    };
template<class T >
ICPointerHolder< T >::~ICPointerHolder ( ) [inline]

Definition at line 47 of file icptrholder.h.

                      {
        release();
    }

Here is the call graph for this function:


Member Function Documentation

template<class T >
ICPointerHolder< T >::operator T * ( ) const [inline]

Definition at line 67 of file icptrholder.h.

                        {
        return ptr;
    }
template<class T >
int ICPointerHolder< T >::operator!= ( T p) [inline]

Definition at line 64 of file icptrholder.h.

{return (ptr != p);}
template<class T >
T& ICPointerHolder< T >::operator* ( ) [inline]

Definition at line 76 of file icptrholder.h.

                   {
        assert(ptr);
        return *ptr;
    }
template<class T >
T* ICPointerHolder< T >::operator-> ( ) const [inline]

Definition at line 71 of file icptrholder.h.

                          {
        assert(ptr);
        return ptr;
    }
template<class T >
ICPointerHolder& ICPointerHolder< T >::operator= ( T p) [inline]

Definition at line 51 of file icptrholder.h.

                                     {
        this->release();
        ptr = p;
        return *this;
    }

Here is the call graph for this function:

template<class T >
ICPointerHolder& ICPointerHolder< T >::operator= ( ICPointerHolder< T > &  p) [inline]

Definition at line 57 of file icptrholder.h.

                                                   {
        this->release();
        ptr = p.ptr;            // this transfer ownership of the pointer
        p.ptr = NULL;           // set it to null so the pointer won't get delete twice.
        return *this;
    }

Here is the call graph for this function:

template<class T >
int ICPointerHolder< T >::operator== ( T p) [inline]

Definition at line 65 of file icptrholder.h.

{return (ptr == p);}
template<class T >
void ICPointerHolder< T >::release ( ) [inline, private]

Definition at line 82 of file icptrholder.h.

                    {
        if (ptr != NULL) {
            ptr->detach();
            delete ptr;
            ptr = NULL;
        }
    }

Here is the caller graph for this function:


Member Data Documentation

template<class T >
T* ICPointerHolder< T >::ptr [private]

Definition at line 90 of file icptrholder.h.


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