Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / PortableServer / Servant_var.cpp
blobe89515b1e9f22c91a6e524024ca6a67c318fb6e8
1 #ifndef TAO_PORTABLESERVER_SERVANT_VAR_CPP
2 #define TAO_PORTABLESERVER_SERVANT_VAR_CPP
4 #include "tao/PortableServer/Servant_var.h"
6 #if !defined (__ACE_INLINE__)
7 # include "tao/PortableServer/Servant_var.inl"
8 #endif /* __ACE_INLINE__ */
10 #include "tao/Exception.h"
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 template <class T>
15 T *
16 PortableServer::Servant_var<T>::_duplicate (T * p)
18 try
20 if (p != 0)
22 p->_add_ref ();
25 catch (...)
27 throw;
30 return p;
33 template <class T>
34 PortableServer::Servant_var<T>::~Servant_var () /* noexcept */
36 // Unfortunately, there is no throw spec on _remove_ref, so we
37 // can't assume that it will not throw. If it does, then we are in
38 // trouble. In any event, we can't let the exception escape our
39 // destructor.
40 try
42 if (this->ptr_ != 0)
44 this->ptr_->_remove_ref ();
47 catch (...)
49 // Forget the exception..
53 TAO_END_VERSIONED_NAMESPACE_DECL
55 #endif /* TAO_PORTABLESERVER_SERVANT_VAR_CPP */