Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Auto_Ptr.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: Auto_Ptr.i,v 1.1.1.3 2001/12/04 14:32:59 chad Exp $
00003 
00004 // Auto_Ptr.i
00005 
00006 template<class X> ACE_INLINE
00007 ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> &rhs)
00008   : p_ (rhs.release ())
00009 {
00010   ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr");
00011 }
00012 
00013 template<class X> ACE_INLINE X *
00014 ACE_Auto_Basic_Ptr<X>::get (void) const
00015 {
00016   ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::get");
00017   return this->p_;
00018 }
00019 
00020 template<class X> ACE_INLINE X *
00021 ACE_Auto_Basic_Ptr<X>::release (void)
00022 {
00023   ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::release");
00024   X *old = this->p_;
00025   this->p_ = 0;
00026   return old;
00027 }
00028 
00029 template<class X> ACE_INLINE void
00030 ACE_Auto_Basic_Ptr<X>::reset (X *p)
00031 {
00032   ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::reset");
00033   if (this->get () != p)
00034     delete this->get ();
00035   this->p_ = p;
00036 }
00037 
00038 template<class X> ACE_INLINE ACE_Auto_Basic_Ptr<X> &
00039 ACE_Auto_Basic_Ptr<X>::operator= (ACE_Auto_Basic_Ptr<X> &rhs)
00040 {
00041   ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::operator=");
00042   if (this != &rhs)
00043     {
00044       this->reset (rhs.release ());
00045     }
00046   return *this;
00047 }
00048 
00049 template<class X> ACE_INLINE
00050 ACE_Auto_Basic_Ptr<X>::~ACE_Auto_Basic_Ptr (void)
00051 {
00052   ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::~ACE_Auto_Basic_Ptr");
00053   delete this->get ();
00054 }
00055 
00056 template<class X> ACE_INLINE X &
00057 ACE_Auto_Basic_Ptr<X>::operator *() const
00058 {
00059   ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::operator *()");
00060   return *this->get ();
00061 }
00062 
00063 #if defined (ACE_LACKS_AUTO_PTR) || \
00064     !defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \
00065              (ACE_HAS_STANDARD_CPP_LIBRARY == 0)
00066 
00067 template<class X> ACE_INLINE X *
00068 auto_ptr<X>::operator-> () const
00069 {
00070   ACE_TRACE ("auto_ptr<X>::operator->");
00071   return this->get ();
00072 }
00073 
00074 #endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
00075 
00076 template<class X> ACE_INLINE X *
00077 ACE_Auto_Basic_Array_Ptr<X>::get (void) const
00078 {
00079   ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::get");
00080   return this->p_;
00081 }
00082 
00083 template<class X> ACE_INLINE X *
00084 ACE_Auto_Basic_Array_Ptr<X>::release (void)
00085 {
00086   ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::release");
00087   X *old = this->p_;
00088   this->p_ = 0;
00089   return old;
00090 }
00091 
00092 template<class X> ACE_INLINE void
00093 ACE_Auto_Basic_Array_Ptr<X>::reset (X *p)
00094 {
00095   ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::reset");
00096   if (this->get () != p)
00097     delete [] this->get ();
00098   this->p_ = p;
00099 }
00100 
00101 template<class X> ACE_INLINE
00102 ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> &rhs)
00103   : p_ (rhs.release ())
00104 {
00105   ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr");
00106 }
00107 
00108 template<class X> ACE_INLINE ACE_Auto_Basic_Array_Ptr<X> &
00109 ACE_Auto_Basic_Array_Ptr<X>::operator= (ACE_Auto_Basic_Array_Ptr<X> &rhs)
00110 {
00111   ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::operator=");
00112   if (this != &rhs)
00113     {
00114       this->reset (rhs.release ());
00115     }
00116   return *this;
00117 }
00118 
00119 template<class X> ACE_INLINE
00120 ACE_Auto_Basic_Array_Ptr<X>::~ACE_Auto_Basic_Array_Ptr (void)
00121 {
00122   ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::~ACE_Auto_Basic_Array_Ptr");
00123   delete [] this->get ();
00124 }
00125 
00126 template<class X> ACE_INLINE X &
00127 ACE_Auto_Basic_Array_Ptr<X>::operator *() const
00128 {
00129   return *this->get ();
00130 }
00131 
00132 template<class X> ACE_INLINE X &
00133 ACE_Auto_Basic_Array_Ptr<X>::operator[](int i) const
00134 {
00135   X *array = this->get ();
00136   return array[i];
00137 }
00138 
00139 template<class X> ACE_INLINE X *
00140 ACE_Auto_Array_Ptr<X>::operator->() const
00141 {
00142   return this->get ();
00143 }
00144 

Generated on Mon Jun 16 11:19:12 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002