diff options
Diffstat (limited to 'ace/Auto_Ptr.i')
-rw-r--r-- | ace/Auto_Ptr.i | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/ace/Auto_Ptr.i b/ace/Auto_Ptr.i new file mode 100644 index 00000000000..f0209505c17 --- /dev/null +++ b/ace/Auto_Ptr.i @@ -0,0 +1,151 @@ +/* -*- C++ -*- */ +// $Id$ + +// Auto_Ptr.i + +template<class X> ACE_INLINE void +auto_ptr<X>::operator= (auto_ptr<X> &rhs) +{ + ACE_TRACE ("auto_ptr<X>::operator="); + if (this != &rhs) + { + auto_ptr<X>::remove (p_); + p_ = rhs.release (); + } +} + +template<class X> ACE_INLINE +auto_ptr<X>::auto_ptr (X *p) + : p_ (p) +{ + ACE_TRACE ("auto_ptr<X>::auto_ptr"); +} + +template<class X> ACE_INLINE +auto_ptr<X>::auto_ptr (auto_ptr<X> &ap) + : p_ (ap.release ()) +{ + ACE_TRACE ("auto_ptr<X>::auto_ptr"); +} + +template<class X> ACE_INLINE +auto_ptr<X>::~auto_ptr (void) +{ + ACE_TRACE ("auto_ptr<X>::~auto_ptr"); + delete p_; +} + +template<class X> ACE_INLINE X & +auto_ptr<X>::operator *() const +{ + return *p_; +} + +template<class X> ACE_INLINE X * +auto_ptr<X>::operator-> () const +{ + ACE_TRACE ("auto_ptr<X>::operator->"); + return p_; +} + +template<class X> ACE_INLINE X * +auto_ptr<X>::get (void) const +{ + ACE_TRACE ("auto_ptr<X>::get"); + return p_; +} + +template<class X> ACE_INLINE X * +auto_ptr<X>::release (void) +{ + ACE_TRACE ("auto_ptr<X>::release"); + return this->reset (0); +} + +template<class X> ACE_INLINE X * +auto_ptr<X>::reset (X *p) +{ + ACE_TRACE ("auto_ptr<X>::reset"); + X *tp = p_; + p_ = p; + return tp; +} + +template<class X> ACE_INLINE +auto_array_ptr<X>::auto_array_ptr (X *p) + : p_ (p) +{ + ACE_TRACE ("auto_array_ptr<X>::auto_array_ptr"); +} + +template<class X> ACE_INLINE +auto_array_ptr<X>::auto_array_ptr (auto_array_ptr<X> &ap) + : p_ (ap.release ()) +{ + ACE_TRACE ("auto_array_ptr<X>::auto_array_ptr"); +} + +template<class X> ACE_INLINE +auto_array_ptr<X>::~auto_array_ptr (void) +{ + ACE_TRACE ("auto_array_ptr<X>::~auto_array_ptr"); + delete [] p_; +} + +template<class X> ACE_INLINE X & +auto_array_ptr<X>::operator*() +{ + return *p_; +} + +template<class X> ACE_INLINE X * +auto_array_ptr<X>::operator->() +{ + return p_; +} + +template<class X> ACE_INLINE X & +auto_array_ptr<X>::operator[](int i) +{ + return p_[i]; +} + +template<class X> ACE_INLINE X +auto_array_ptr<X>::operator[](int i) const +{ + return p_[i]; +} + +template<class X> ACE_INLINE X * +auto_array_ptr<X>::get (void) const +{ + ACE_TRACE ("auto_array_ptr<X>::get"); + return p_; +} + +template<class X> ACE_INLINE X * +auto_array_ptr<X>::release (void) +{ + ACE_TRACE ("auto_array_ptr<X>::release"); + return this->reset (0); +} + +template<class X> ACE_INLINE X * +auto_array_ptr<X>::reset (X *p) +{ + ACE_TRACE ("auto_array_ptr<X>::reset"); + X *tp = p_; + p_ = p; + return tp; +} + +template<class X> ACE_INLINE void +auto_array_ptr<X>::operator= (auto_array_ptr<X> &rhs) +{ + ACE_TRACE ("auto_array_ptr<X>::operator="); + if (this != &rhs) + { + auto_array_ptr<X>::remove (p_); + p_ = rhs.release (); + } +} |