summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-10-20 16:41:53 +0000
committerwilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-10-20 16:41:53 +0000
commit4acb0f58c9a7bedb2086544f280590e6e36fb170 (patch)
treead6e9d4e54d51c8219fc2c29f66017f815a4a378
parent3be9a18e65c1881adcbc6117a694105192ba69f8 (diff)
downloadATCD-4acb0f58c9a7bedb2086544f280590e6e36fb170.tar.gz
ChangeLogTag: Wed Oct 20 11:38:11 2004 Dale Wilson <wilson_d@ociweb.com>
-rw-r--r--TAO/ChangeLog_pnotify6
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.h10
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl33
3 files changed, 48 insertions, 1 deletions
diff --git a/TAO/ChangeLog_pnotify b/TAO/ChangeLog_pnotify
index 6583ba3a56d..b350b03ef87 100644
--- a/TAO/ChangeLog_pnotify
+++ b/TAO/ChangeLog_pnotify
@@ -1,3 +1,9 @@
+Wed Oct 20 11:38:11 2004 Dale Wilson <wilson_d@ociweb.com>
+
+ * orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.h:
+ * orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl:
+ Add copy constructor and operator =.
+
Tue Oct 19 10:43:28 2004 Dale Wilson <wilson_d@ociweb.com>
* orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_T.h:
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.h b/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.h
index 1354378dc62..77d1e2a5db1 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.h
+++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.h
@@ -33,6 +33,9 @@ public:
/// Constuctor
TAO_Notify_Refcountable_Guard_T (T* t = 0);
+ /// Copy constructor
+ TAO_Notify_Refcountable_Guard_T (const TAO_Notify_Refcountable_Guard_T<T> & rhs);
+
/// Destructor
~TAO_Notify_Refcountable_Guard_T ();
@@ -44,6 +47,13 @@ public:
T &operator *() const;
+ TAO_Notify_Refcountable_Guard_T<T> & operator = (
+ const TAO_Notify_Refcountable_Guard_T<T> & rhs);
+
+private:
+ /// helper for exception safeness
+ /// @throws nothing
+ void swap (TAO_Notify_Refcountable_Guard_T & rhs);
private:
T* t_;
};
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl
index 2dedf719c60..21f9b81ce7d 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl
+++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl
@@ -11,6 +11,16 @@ TAO_Notify_Refcountable_Guard_T<T>::TAO_Notify_Refcountable_Guard_T (T *t)
}
template <class T> ACE_INLINE
+TAO_Notify_Refcountable_Guard_T<T>::TAO_Notify_Refcountable_Guard_T (const TAO_Notify_Refcountable_Guard_T<T> &rhs)
+ : t_ (rhs.t_)
+{
+ if (this->t_ != 0)
+ {
+ this->t_->_incr_refcnt ();
+ }
+}
+
+template <class T> ACE_INLINE
TAO_Notify_Refcountable_Guard_T<T>::~TAO_Notify_Refcountable_Guard_T ()
{
if (this->t_ != 0)
@@ -32,9 +42,30 @@ TAO_Notify_Refcountable_Guard_T<T>::operator-> (void) const
return this->t_;
}
-template <class T> ACE_INLINE T&
+template <class T> ACE_INLINE
+T&
TAO_Notify_Refcountable_Guard_T<T>::operator *(void) const
{
ACE_ASSERT (this->t_ != 0);
return *this->t_;
}
+
+template <class T> ACE_INLINE
+TAO_Notify_Refcountable_Guard_T<T> &
+TAO_Notify_Refcountable_Guard_T<T>::operator = (
+ const TAO_Notify_Refcountable_Guard_T<T> & rhs)
+{
+ // note exception safe assignment. see Sutter's "Exceptional C++"
+ swap (TAO_Notify_Refcountable_Guard_T<T> (rhs.t_));
+ return *this;
+}
+
+
+template <class T> ACE_INLINE
+void
+TAO_Notify_Refcountable_Guard_T<T>::swap (TAO_Notify_Refcountable_Guard_T & rhs)
+{
+ T* pt = rhs.t_;
+ rhs.t_ = this->t_;
+ this->t_ = rhs.t_;
+}