CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
own_ptr< X, P > Class Template Reference

#include <own_ptr.h>

Public Types

typedef X element_type
 

Public Member Functions

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

Private Attributes

Xptr
 

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)
inlineexplicit

Definition at line 45 of file own_ptr.h.

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.

48 : ptr(a.release()) {}
X * release() const
Definition: own_ptr.h:85
X * ptr
Definition: own_ptr.h:41
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.

53  : ptr(a.release()) {}
X * release() const
Definition: own_ptr.h:85
X * ptr
Definition: own_ptr.h:41
template<class X, typename P = OwnerPolicy::Transfer>
own_ptr< X, P >::~own_ptr ( )
inline

Definition at line 75 of file own_ptr.h.

75  {
76  P::remove(ptr);
77  }
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:209
X * ptr
Definition: own_ptr.h:41

Member Function Documentation

template<class X, typename P = OwnerPolicy::Transfer>
X* own_ptr< X, P >::get ( ) 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.

79 { return *ptr; }
X * ptr
Definition: own_ptr.h:41
template<class X, typename P = OwnerPolicy::Transfer>
X* own_ptr< X, P >::operator-> ( ) const
inline

Definition at line 81 of file own_ptr.h.

81 { return ptr; }
X * ptr
Definition: own_ptr.h:41
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.

56  {
57  if (a.get() != ptr) {
58  P::remove(ptr);
59  ptr = a.release();
60  }
61  return *this;
62  }
X * get() const
Definition: own_ptr.h:83
X * release() const
Definition: own_ptr.h:85
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:209
X * ptr
Definition: own_ptr.h:41
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.

66  {
67  if (a.get() != ptr) {
68  P::remove(ptr);
69  ptr = a.release();
70  }
71  return *this;
72  }
X * get() const
Definition: own_ptr.h:83
X * release() const
Definition: own_ptr.h:85
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:209
X * ptr
Definition: own_ptr.h:41
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 >::own_ptr().

85  {
86  return P::copy(const_cast<own_ptr<X,P>*>(this)->ptr);
87  }
X * ptr
Definition: own_ptr.h:41
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.

90  {
91  if (p != ptr) {
92  P::remove(ptr);
93  ptr = p;
94  }
95  }
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:209
X * ptr
Definition: own_ptr.h:41

Member Data Documentation

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

Definition at line 41 of file own_ptr.h.