Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / performance-tests / RTEvent / lib / Implicit_Deactivator.cpp
blob8078e62b128abf3420d5462d69cf82637b688a2b
1 /**
2 * @file Implicit_Deactivator.cpp
4 * @author Carlos O'Ryan <coryan@uci.edu>
5 */
7 #include "Implicit_Deactivator.h"
8 #include "tao/PortableServer/Servant_Base.h"
9 #include "tao/Environment.h"
11 #include <algorithm>
13 #if !defined(__ACE_INLINE__)
14 #include "Implicit_Deactivator.inl"
15 #endif /* __ACE_INLINE__ */
17 Implicit_Deactivator::Implicit_Deactivator (PortableServer::Servant servant)
19 this->poa_ =
20 servant->_default_POA ();
22 this->id_ =
23 this->poa_->servant_to_id (servant);
26 Implicit_Deactivator::Implicit_Deactivator (Implicit_Deactivator &rhs)
27 : poa_ (rhs.poa_)
28 , id_ (rhs.id_)
30 rhs.release ();
33 Implicit_Deactivator&
34 Implicit_Deactivator::operator= (Implicit_Deactivator &rhs)
36 Implicit_Deactivator tmp (rhs);
37 // @@ This seems bogus, there should be a more efficient way to swap
38 // vars
39 std::swap (this->poa_, tmp.poa_);
40 std::swap (this->id_, tmp.id_);
41 return *this;
44 Implicit_Deactivator::~Implicit_Deactivator ()
46 if (this->id_.ptr () == 0)
47 return;
49 try
51 this->poa_->deactivate_object (this->id_.in ());
53 catch (const CORBA::Exception&)
55 // @@ TODO This event should be logged. Cannot throw because that
56 // would make it impossible to use this class effectively.
57 // Read Servant_var.cpp for more details.
61 Implicit_Deactivator&
62 Implicit_Deactivator::operator= (PortableServer::Servant servant)
64 Implicit_Deactivator tmp (servant);
65 // @@ This seems bogus, there should be a more efficient way to swap
66 // vars
67 std::swap (this->poa_, tmp.poa_);
68 std::swap (this->id_, tmp.id_);
69 return *this;