00001 // $Id: Servant_var.cpp 76995 2007-02-11 12:51:42Z johnnyw $ 00002 00003 #ifndef TAO_PORTABLESERVER_SERVANT_VAR_CPP 00004 #define TAO_PORTABLESERVER_SERVANT_VAR_CPP 00005 00006 #include "tao/PortableServer/Servant_var.h" 00007 00008 #if !defined (__ACE_INLINE__) 00009 # include "tao/PortableServer/Servant_var.inl" 00010 #endif /* __ACE_INLINE__ */ 00011 00012 #include "tao/Exception.h" 00013 00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 template <class T> 00017 T * 00018 PortableServer::Servant_var<T>::_duplicate (T * p) 00019 { 00020 try 00021 { 00022 if (p != 0) 00023 { 00024 p->_add_ref (); 00025 } 00026 } 00027 catch (...) 00028 { 00029 throw; 00030 } 00031 00032 return p; 00033 } 00034 00035 template <class T> 00036 PortableServer::Servant_var<T>::~Servant_var (void) /* throw () */ 00037 { 00038 // Unfortunately, there is no throw spec on _remove_ref, so we 00039 // can't assume that it will not throw. If it does, then we are in 00040 // trouble. In any event, we can't let the exception escape our 00041 // destructor. 00042 try 00043 { 00044 if (this->ptr_ != 0) 00045 { 00046 this->ptr_->_remove_ref (); 00047 } 00048 } 00049 catch (...) 00050 { 00051 // Forget the exception.. 00052 } 00053 } 00054 00055 TAO_END_VERSIONED_NAMESPACE_DECL 00056 00057 #endif /* TAO_PORTABLESERVER_SERVANT_VAR_CPP */