diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-12-08 16:48:57 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-12-08 16:48:57 +0000 |
commit | 913824e5e462f44dda679324c416776b05cecabb (patch) | |
tree | 4d767e709120fce9a4814791c485359993cc94c8 /ace/Auto_Ptr.i | |
parent | dd0e127683088e889b58a523e9be7c847db33f84 (diff) | |
download | ATCD-913824e5e462f44dda679324c416776b05cecabb.tar.gz |
ChangeLogTag:Fri Dec 8 10:34:32 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
Diffstat (limited to 'ace/Auto_Ptr.i')
-rw-r--r-- | ace/Auto_Ptr.i | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/ace/Auto_Ptr.i b/ace/Auto_Ptr.i index 85f54bfc834..2dca307b97a 100644 --- a/ace/Auto_Ptr.i +++ b/ace/Auto_Ptr.i @@ -3,8 +3,6 @@ // Auto_Ptr.i -#include "Synch_T.h" - template<class X> ACE_INLINE ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> &rhs) : p_ (rhs.release ()) @@ -144,165 +142,3 @@ ACE_Auto_Array_Ptr<X>::operator->() const return this->get (); } -template <class X, class ACE_LOCK> ACE_INLINE ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> * -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::create (X *p) -{ - // Yes set ref count to zero. - return new ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> (p); -} - -template <class X, class ACE_LOCK> ACE_INLINE ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> * -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::attach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>*& rep) -{ - ACE_ASSERT (rep != 0); - - ACE_GUARD_RETURN (ACE_LOCK, guard, rep->lock_, rep); - - ++rep->ref_count_; - - return rep; -} - -template <class X, class ACE_LOCK> ACE_INLINE void -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::detach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>*& rep) -{ - ACE_ASSERT (rep != 0); - - ACE_GUARD (ACE_LOCK, guard, rep->lock_); - - if (rep->ref_count_-- == 0) - // We do not need the lock when deleting the representation. - // There should be no side effects from deleting rep and we don - // not want to release a deleted mutex. - delete rep; -} - -template <class X, class ACE_LOCK> ACE_INLINE void -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::assign (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>*& rep, ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>* new_rep) -{ - ACE_ASSERT (rep != 0); - ACE_ASSERT (new_rep != 0); - - ACE_GUARD (ACE_LOCK, guard, rep->lock_); - - ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *old = rep; - rep = new_rep; - - // detached old last for exception safety - if(old->ref_count_-- == 0) - // We do not need the lock when deleting the representation. - // There should be no side effects from deleting rep and we don - // not want to release a deleted mutex. - delete old; -} - -template <class X, class ACE_LOCK> ACE_INLINE -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::ACE_Refcounted_Auto_Ptr_Rep (X *p) - : ptr_ (p), - ref_count_ (0) -{ -} - -template <class X, class ACE_LOCK> ACE_INLINE -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::~ACE_Refcounted_Auto_Ptr_Rep (void) -{ -} - -template<class X, class ACE_LOCK> ACE_INLINE X * -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::release (void) -{ - ACE_GUARD_RETURN (ACE_LOCK, guard, this->lock_, 0); - - return this->ptr_.release (); -} - -template<class X, class ACE_LOCK> ACE_INLINE void -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::reset (X *p) -{ - ACE_GUARD (ACE_LOCK, guard, this->lock_); - - this->ptr_.reset (p); -} - -template <class X, class ACE_LOCK> X * -ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::get (void) -{ - ACE_GUARD_RETURN (ACE_LOCK, guard, this->lock_, 0); - - return this->ptr_.get (); -} - -template <class X, class ACE_LOCK> -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::ACE_Refcounted_Auto_Ptr (X *p) - : rep_ (AUTO_REFCOUNTED_PTR_REP::create (p)) -{ -} - -template <class X, class ACE_LOCK> -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) - : rep_ (AUTO_REFCOUNTED_PTR_REP::attach (((ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &) r).rep_)) -{ -} - -template <class X, class ACE_LOCK> -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::~ACE_Refcounted_Auto_Ptr (void) -{ - AUTO_REFCOUNTED_PTR_REP::detach (rep_); -} - -template <class X, class ACE_LOCK> int -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator== (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) const -{ - return r.rep_ == this->rep_; -} - -template <class X, class ACE_LOCK> int -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator!= (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r) const -{ - return r.rep_ != this->rep_; -} - -template <class X, class ACE_LOCK> X * -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator-> (void) const -{ - return this->rep_->get(); -} - -template<class X, class ACE_LOCK> ACE_INLINE X & -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator *() const -{ - return *this->rep_->get (); -} - -template <class X, class ACE_LOCK> X* -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::get (void) -{ - // We return the ACE_Future_rep. - return this->rep_->get (); -} - -template<class X, class ACE_LOCK> ACE_INLINE X * -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::release (void) -{ - return this->rep_->release (); -} - -template<class X, class ACE_LOCK> ACE_INLINE void -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::reset (X *p) -{ - this->rep_->reset (p); -} - -template <class X, class ACE_LOCK> void -ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator = (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &rhs) -{ - // assignment: - // - // bind <this> to the same <ACE_Refcounted_Auto_Ptr_Rep> as <r>. - - // This will work if &r == this, by first increasing the ref count - ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r = (ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &) rhs; - AUTO_REFCOUNTED_PTR_REP::assign (this->rep_, - AUTO_REFCOUNTED_PTR_REP::attach (r.rep_)); -} - |