diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
commit | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (patch) | |
tree | 197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl | |
parent | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (diff) | |
download | ATCD-3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl new file mode 100644 index 00000000000..4ab55e0b75f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable_Guard_T.inl @@ -0,0 +1,91 @@ +// -*- C++ -*- +// +// $Id$ + +#include "ace/Log_Msg.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class T> ACE_INLINE +TAO_Notify_Refcountable_Guard_T<T>::TAO_Notify_Refcountable_Guard_T (T *t) + : t_ (t) +{ + if ( this->t_ != static_cast< T* >( 0 ) ) this->t_->_incr_refcnt(); +} + +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_ != static_cast< 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_ != static_cast< T* >( 0 ) ) this->t_->_decr_refcnt(); +} + +template <class T> ACE_INLINE +T* +TAO_Notify_Refcountable_Guard_T<T>::get (void) const +{ + return this->t_; +} + +template <class T> ACE_INLINE +bool +TAO_Notify_Refcountable_Guard_T<T>::isSet (void) const +{ + return ( this->t_ != static_cast< T* >( 0 ) ); +} + + +template <class T> ACE_INLINE +T* +TAO_Notify_Refcountable_Guard_T<T>::operator-> (void) const +{ + ACE_ASSERT ( this->t_ != static_cast< T* >( 0 ) ); + return this->t_; +} + +template <class T> ACE_INLINE +T& +TAO_Notify_Refcountable_Guard_T<T>::operator* (void) const +{ + ACE_ASSERT ( this->t_ != static_cast< 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) +{ + reset( rhs.t_ ); + return *this; +} + + +template <class T> ACE_INLINE +void +TAO_Notify_Refcountable_Guard_T<T>::reset (T* t) +{ + if (this->t_ != t) + { + TAO_Notify_Refcountable_Guard_T<T> temp( t ); + swap( temp ); + } +} + +template <class T> ACE_INLINE +void +TAO_Notify_Refcountable_Guard_T<T>::swap( + TAO_Notify_Refcountable_Guard_T<T>& rhs ) +{ + T* temp = this->t_; + this->t_ = rhs.t_; + rhs.t_ = temp; +} + +TAO_END_VERSIONED_NAMESPACE_DECL |