summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-08-22 01:59:24 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-08-22 01:59:24 +0000
commit4c372220787621b3620c3e80373297995a2274d0 (patch)
tree0b874217da978ff71542db6a4ca87da4e79bc5b6
parenta5eb53e73c47454dc1dee71201812f41ac520ae2 (diff)
downloadATCD-4c372220787621b3620c3e80373297995a2274d0.tar.gz
*** empty log message ***
-rw-r--r--ace/Auto_Ptr.cpp25
-rw-r--r--ace/Auto_Ptr.h33
-rw-r--r--ace/Auto_Ptr.i99
3 files changed, 55 insertions, 102 deletions
diff --git a/ace/Auto_Ptr.cpp b/ace/Auto_Ptr.cpp
index e6f5ef69a03..6f082595f81 100644
--- a/ace/Auto_Ptr.cpp
+++ b/ace/Auto_Ptr.cpp
@@ -11,9 +11,6 @@
#include "ace/Auto_Ptr.i"
#endif /* __ACE_INLINE__ */
-#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \
- (ACE_HAS_STANDARD_CPP_LIBRARY == 0)
-
ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Ptr)
template<class X> void
@@ -22,18 +19,6 @@ ACE_Auto_Basic_Ptr<X>::dump (void) const
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::dump");
}
-template<class X> void
-ACE_Auto_Basic_Ptr<X>::remove (X *& x)
-{
- ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::remove");
-
- X *tp = x;
- x = 0;
- delete tp;
-}
-
-#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
-
ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Array_Ptr)
template<class X> void
@@ -42,14 +27,4 @@ ACE_Auto_Basic_Array_Ptr<X>::dump (void) const
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::dump");
}
-template<class X> void
-ACE_Auto_Basic_Array_Ptr<X>::remove (X *& x)
-{
- ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::remove");
-
- X *tp = x;
- x = 0;
- delete [] tp;
-}
-
#endif /* ACE_AUTO_PTR_C */
diff --git a/ace/Auto_Ptr.h b/ace/Auto_Ptr.h
index 4ef59eaa916..56a1d0c85cc 100644
--- a/ace/Auto_Ptr.h
+++ b/ace/Auto_Ptr.h
@@ -29,18 +29,15 @@ class ACE_Auto_Basic_Ptr
{
public:
// = Initialization and termination methods
- ACE_Auto_Basic_Ptr (X *p = 0);
- ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> &ap);
+ /* explicit */ ACE_Auto_Basic_Ptr (X *p = 0);
+ ACE_Auto_Basic_Ptr (const ACE_Auto_Basic_Ptr<X> &ap);
+ ACE_Auto_Basic_Ptr<X> &operator= (const ACE_Auto_Basic_Ptr<X> &rhs);
~ACE_Auto_Basic_Ptr (void);
- void operator= (ACE_Auto_Basic_Ptr<X> &rhs);
// = Accessor methods.
X &operator *() const;
X *get (void) const;
- X *release (void);
- X *reset (X *p);
-
- static void remove (X* &x);
+ X *release (void) const;
void dump (void) const;
// Dump the state of an object.
@@ -68,7 +65,7 @@ class auto_ptr : public ACE_Auto_Basic_Ptr <X>
{
public:
// = Initialization and termination methods
- auto_ptr (X *p = 0);
+ /* explicit */ auto_ptr (X *p = 0);
X *operator-> () const;
};
@@ -84,20 +81,16 @@ class ACE_Auto_Basic_Array_Ptr
{
public:
// = Initialization and termination methods.
- ACE_Auto_Basic_Array_Ptr (X *p = 0);
- ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> &ap);
+ /* explicit */ ACE_Auto_Basic_Array_Ptr (X *p = 0);
+ ACE_Auto_Basic_Array_Ptr (const ACE_Auto_Basic_Array_Ptr<X> &ap);
+ ACE_Auto_Basic_Array_Ptr<X> &operator= (const ACE_Auto_Basic_Array_Ptr<X> &rhs);
~ACE_Auto_Basic_Array_Ptr (void);
- void operator= (ACE_Auto_Basic_Array_Ptr<X> &rhs);
-
+
// = Accessor methods.
- X &operator* ();
- X &operator[] (int i);
- X operator[] (int i) const;
+ X &operator* () const;
+ X &operator[] (int i) const;
X *get (void) const;
- X *release (void);
- X *reset (X *p);
-
- static void remove (X *&x);
+ X *release (void) const;
void dump (void) const;
// Dump the state of an object.
@@ -117,7 +110,7 @@ class ACE_Auto_Array_Ptr : public ACE_Auto_Basic_Array_Ptr<X>
{
public:
// = Initialization and termination methods.
- ACE_Auto_Array_Ptr (X *p = 0);
+ /* explicit */ ACE_Auto_Array_Ptr (X *p = 0);
X *operator-> () const;
};
diff --git a/ace/Auto_Ptr.i b/ace/Auto_Ptr.i
index 2d333dd3d41..31369e77e94 100644
--- a/ace/Auto_Ptr.i
+++ b/ace/Auto_Ptr.i
@@ -3,20 +3,6 @@
// Auto_Ptr.i
-#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \
- (ACE_HAS_STANDARD_CPP_LIBRARY == 0)
-
-template<class X> ACE_INLINE void
-ACE_Auto_Basic_Ptr<X>::operator= (ACE_Auto_Basic_Ptr<X> &rhs)
-{
- ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::operator=");
- if (this != &rhs)
- {
- ACE_Auto_Basic_Ptr<X>::remove (p_);
- p_ = rhs.release ();
- }
-}
-
template<class X> ACE_INLINE
ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr (X *p)
: p_ (p)
@@ -25,12 +11,24 @@ ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr (X *p)
}
template<class X> ACE_INLINE
-ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> &ap)
+ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr (const ACE_Auto_Basic_Ptr<X> &ap)
: p_ (ap.release ())
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr");
}
+template<class X> ACE_INLINE ACE_Auto_Basic_Ptr<X> &
+ACE_Auto_Basic_Ptr<X>::operator= (const ACE_Auto_Basic_Ptr<X> &rhs)
+{
+ ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::operator=");
+ if (this != &rhs)
+ {
+ delete this->p_;
+ this->p_ = rhs.release ();
+ }
+ return *this;
+}
+
template<class X> ACE_INLINE
ACE_Auto_Basic_Ptr<X>::~ACE_Auto_Basic_Ptr (void)
{
@@ -41,6 +39,7 @@ ACE_Auto_Basic_Ptr<X>::~ACE_Auto_Basic_Ptr (void)
template<class X> ACE_INLINE X &
ACE_Auto_Basic_Ptr<X>::operator *() const
{
+ ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::operator *()");
return *p_;
}
@@ -52,26 +51,23 @@ ACE_Auto_Basic_Ptr<X>::get (void) const
}
template<class X> ACE_INLINE X *
-ACE_Auto_Basic_Ptr<X>::release (void)
+ACE_Auto_Basic_Ptr<X>::release (void) const
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::release");
- return this->reset (0);
+ X *old = this->p_;
+ ACE_Auto_Basic_Ptr<X> *fake_this = (ACE_Auto_Basic_Ptr<X> *) this;
+ fake_this->p_ = 0;
+ return old;
}
-template<class X> ACE_INLINE X *
-ACE_Auto_Basic_Ptr<X>::reset (X *p)
-{
- ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::reset");
- X *tp = p_;
- p_ = p;
- return tp;
-}
+#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \
+ (ACE_HAS_STANDARD_CPP_LIBRARY == 0)
template<class X> ACE_INLINE
auto_ptr<X>::auto_ptr (X *p)
: ACE_Auto_Basic_Ptr<X> (p)
{
- ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr");
+ ACE_TRACE ("auto_ptr<X>::auto_ptr");
}
template<class X> ACE_INLINE X *
@@ -91,12 +87,24 @@ ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr (X *p)
}
template<class X> ACE_INLINE
-ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> &ap)
+ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr (const ACE_Auto_Basic_Array_Ptr<X> &ap)
: p_ (ap.release ())
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr");
}
+template<class X> ACE_INLINE ACE_Auto_Basic_Array_Ptr<X> &
+ACE_Auto_Basic_Array_Ptr<X>::operator= (const ACE_Auto_Basic_Array_Ptr<X> &rhs)
+{
+ ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::operator=");
+ if (this != &rhs)
+ {
+ delete [] this->p_;
+ this->p_ = rhs.release ();
+ }
+ return *this;
+}
+
template<class X> ACE_INLINE
ACE_Auto_Basic_Array_Ptr<X>::~ACE_Auto_Basic_Array_Ptr (void)
{
@@ -105,19 +113,13 @@ ACE_Auto_Basic_Array_Ptr<X>::~ACE_Auto_Basic_Array_Ptr (void)
}
template<class X> ACE_INLINE X &
-ACE_Auto_Basic_Array_Ptr<X>::operator*()
+ACE_Auto_Basic_Array_Ptr<X>::operator *() const
{
return *p_;
}
template<class X> ACE_INLINE X &
-ACE_Auto_Basic_Array_Ptr<X>::operator[](int i)
-{
- return p_[i];
-}
-
-template<class X> ACE_INLINE X
-ACE_Auto_Basic_Array_Ptr<X>::operator[](int i) const
+ACE_Auto_Basic_Array_Ptr<X>::operator[](int i) const
{
return p_[i];
}
@@ -130,30 +132,13 @@ ACE_Auto_Basic_Array_Ptr<X>::get (void) const
}
template<class X> ACE_INLINE X *
-ACE_Auto_Basic_Array_Ptr<X>::release (void)
+ACE_Auto_Basic_Array_Ptr<X>::release (void) const
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::release");
- return this->reset (0);
-}
-
-template<class X> ACE_INLINE X *
-ACE_Auto_Basic_Array_Ptr<X>::reset (X *p)
-{
- ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::reset");
- X *tp = p_;
- p_ = p;
- return tp;
-}
-
-template<class X> ACE_INLINE void
-ACE_Auto_Basic_Array_Ptr<X>::operator= (ACE_Auto_Basic_Array_Ptr<X> &rhs)
-{
- ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::operator=");
- if (this != &rhs)
- {
- ACE_Auto_Basic_Array_Ptr<X>::remove (p_);
- p_ = rhs.release ();
- }
+ X *old = this->p_;
+ ACE_Auto_Basic_Array_Ptr<X> *fake_this = (ACE_Auto_Basic_Array_Ptr<X> *) this;
+ fake_this->p_ = 0;
+ return old;
}
template<class X> ACE_INLINE