Refcountable_Guard_T.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Refcountable_Guard_T.inl,v 1.6 2005/11/14 22:03:49 ossama Exp
00004 
00005 #include "ace/Log_Msg.h"
00006 
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008 
00009 template <class T> ACE_INLINE
00010 TAO_Notify_Refcountable_Guard_T<T>::TAO_Notify_Refcountable_Guard_T (T *t)
00011   : t_ (t)
00012 {
00013   if ( this->t_ != static_cast< T* >( 0 ) ) this->t_->_incr_refcnt();
00014 }
00015 
00016 template <class T> ACE_INLINE
00017 TAO_Notify_Refcountable_Guard_T<T>::TAO_Notify_Refcountable_Guard_T (const TAO_Notify_Refcountable_Guard_T<T> &rhs)
00018   : t_ (rhs.t_)
00019 {
00020   if ( this->t_ != static_cast< T* >( 0 ) ) this->t_->_incr_refcnt();
00021 }
00022 
00023 template <class T> ACE_INLINE
00024 TAO_Notify_Refcountable_Guard_T<T>::~TAO_Notify_Refcountable_Guard_T ()
00025 {
00026   if ( this->t_ != static_cast< T* >( 0 ) ) this->t_->_decr_refcnt();
00027 }
00028 
00029 template <class T> ACE_INLINE
00030 T*
00031 TAO_Notify_Refcountable_Guard_T<T>::get (void) const
00032 {
00033   return this->t_;
00034 }
00035 
00036 template <class T> ACE_INLINE
00037 bool
00038 TAO_Notify_Refcountable_Guard_T<T>::isSet (void) const
00039 {
00040   return ( this->t_ != static_cast< T* >( 0 ) );
00041 }
00042 
00043 
00044 template <class T> ACE_INLINE
00045 T*
00046 TAO_Notify_Refcountable_Guard_T<T>::operator-> (void) const
00047 {
00048   ACE_ASSERT ( this->t_ != static_cast< T* >( 0 ) );
00049   return this->t_;
00050 }
00051 
00052 template <class T> ACE_INLINE
00053 T&
00054 TAO_Notify_Refcountable_Guard_T<T>::operator* (void) const
00055 {
00056   ACE_ASSERT ( this->t_ != static_cast< T* >( 0 ) );
00057   return *this->t_;
00058 }
00059 
00060 template <class T> ACE_INLINE
00061 TAO_Notify_Refcountable_Guard_T<T> &
00062 TAO_Notify_Refcountable_Guard_T<T>::operator = (
00063   const TAO_Notify_Refcountable_Guard_T<T> & rhs)
00064 {
00065   reset( rhs.t_ );
00066   return *this;
00067 }
00068 
00069 
00070 template <class T> ACE_INLINE
00071 void
00072 TAO_Notify_Refcountable_Guard_T<T>::reset (T* t)
00073 {
00074   if (this->t_ != t)
00075   {
00076     TAO_Notify_Refcountable_Guard_T<T> temp( t );
00077     swap( temp );
00078   }
00079 }
00080 
00081 template <class T> ACE_INLINE
00082 void
00083 TAO_Notify_Refcountable_Guard_T<T>::swap(
00084   TAO_Notify_Refcountable_Guard_T<T>& rhs )
00085 {
00086   T* temp = this->t_;
00087   this->t_ = rhs.t_;
00088   rhs.t_ = temp;
00089 }
00090 
00091 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 13:24:15 2006 for TAO_CosNotification by doxygen 1.3.6