CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

own_ptr< X, P > Class Template Reference

#include <own_ptr.h>

List of all members.

Public Types

typedef X element_type

Public Member Functions

X * get () const
X & operator* () const
X * operator-> () const
template<class T , typename Q >
own_ptroperator= (const own_ptr< T, Q > &a)
own_ptroperator= (const own_ptr &a)
 own_ptr (const own_ptr &a)
 own_ptr (X *p=0)
template<class T , typename Q >
 own_ptr (const own_ptr< T, Q > &a)
X * release () const
void reset (X *p=0)
 ~own_ptr ()

Private Attributes

X * ptr

Detailed Description

template<class X, typename P = OwnerPolicy::Transfer>
class own_ptr< X, P >

a pointer which "owns" the pointed object

Definition at line 39 of file own_ptr.h.


Member Typedef Documentation

template<class X, typename P = OwnerPolicy::Transfer>
typedef X own_ptr< X, P >::element_type

Definition at line 43 of file own_ptr.h.


Constructor & Destructor Documentation

template<class X, typename P = OwnerPolicy::Transfer>
own_ptr< X, P >::own_ptr ( X *  p = 0) [inline, explicit]

Definition at line 45 of file own_ptr.h.

: ptr(p) {}
template<class X, typename P = OwnerPolicy::Transfer>
own_ptr< X, P >::own_ptr ( const own_ptr< X, P > &  a) [inline]

Definition at line 48 of file own_ptr.h.

: ptr(a.release()) {}
template<class X, typename P = OwnerPolicy::Transfer>
template<class T , typename Q >
own_ptr< X, P >::own_ptr ( const own_ptr< T, Q > &  a) [inline]

Definition at line 52 of file own_ptr.h.

    : ptr(a.release()) {}
template<class X, typename P = OwnerPolicy::Transfer>
own_ptr< X, P >::~own_ptr ( ) [inline]

Definition at line 75 of file own_ptr.h.

             {
    P::remove(ptr);
  }

Member Function Documentation

template<class X, typename P = OwnerPolicy::Transfer>
X* own_ptr< X, P >::get ( void  ) const [inline]
template<class X, typename P = OwnerPolicy::Transfer>
X& own_ptr< X, P >::operator* ( void  ) const [inline]

Definition at line 79 of file own_ptr.h.

{ return *ptr; }
template<class X, typename P = OwnerPolicy::Transfer>
X* own_ptr< X, P >::operator-> ( ) const [inline]

Definition at line 81 of file own_ptr.h.

{ return ptr; }
template<class X, typename P = OwnerPolicy::Transfer>
template<class T , typename Q >
own_ptr& own_ptr< X, P >::operator= ( const own_ptr< T, Q > &  a) [inline]

Definition at line 66 of file own_ptr.h.

                                                                            {
    if (a.get() != ptr) {
      P::remove(ptr);
      ptr = a.release();
    }
    return *this;
  }
template<class X, typename P = OwnerPolicy::Transfer>
own_ptr& own_ptr< X, P >::operator= ( const own_ptr< X, P > &  a) [inline]

Definition at line 56 of file own_ptr.h.

                                        {
    if (a.get() != ptr) {
      P::remove(ptr);
      ptr = a.release();
    }
    return *this;
  }
template<class X, typename P = OwnerPolicy::Transfer>
X* own_ptr< X, P >::release ( ) const [inline]

Definition at line 85 of file own_ptr.h.

Referenced by FileInPath::init(), and own_ptr< std::ifstream >::operator=().

                     { 
    return P::copy(const_cast<own_ptr<X,P>*>(this)->ptr);
  }
template<class X, typename P = OwnerPolicy::Transfer>
void own_ptr< X, P >::reset ( X *  p = 0) [inline]

Definition at line 90 of file own_ptr.h.

                       { 
    if (p != ptr) {
      P::remove(ptr);
      ptr = p;
    }
  }

Member Data Documentation

template<class X, typename P = OwnerPolicy::Transfer>
X* own_ptr< X, P >::ptr [private]