blob: eede6b8f2fe6a99abdcfc950e8bdf7e23c87ea69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/**
* @file Implicit_Deactivator.cpp
*
* $Id$
*
* @author Carlos O'Ryan <coryan@uci.edu>
*/
#include "Implicit_Deactivator.h"
#include "tao/PortableServer/Servant_Base.h"
#include "tao/Environment.h"
#include "ace/Swap.h"
#if !defined(__ACE_INLINE__)
#include "Implicit_Deactivator.inl"
#endif /* __ACE_INLINE__ */
Implicit_Deactivator::Implicit_Deactivator (PortableServer::Servant servant)
{
this->poa_ =
servant->_default_POA ();
this->id_ =
this->poa_->servant_to_id (servant);
}
Implicit_Deactivator::Implicit_Deactivator (Implicit_Deactivator &rhs)
: poa_ (rhs.poa_)
, id_ (rhs.id_)
{
rhs.release ();
}
Implicit_Deactivator&
Implicit_Deactivator::operator= (Implicit_Deactivator &rhs)
{
Implicit_Deactivator tmp (rhs);
// @@ This seems bogus, there should be a more efficient way to swap
// vars
ACE_Swap<PortableServer::POA_var>::swap (this->poa_, tmp.poa_);
ACE_Swap<PortableServer::ObjectId_var>::swap (this->id_, tmp.id_);
return *this;
}
Implicit_Deactivator::~Implicit_Deactivator ()
{
if (this->id_.ptr () == 0)
return;
try{
this->poa_->deactivate_object (this->id_.in ());
} catch (const CORBA::Exception&) {
// @@ TODO This event should be logged. Cannot throw because that
// would make it impossible to use this class effectively.
// Read Servant_var.cpp for more details.
}
}
Implicit_Deactivator&
Implicit_Deactivator::operator= (PortableServer::Servant servant)
{
Implicit_Deactivator tmp (servant);
// @@ This seems bogus, there should be a more efficient way to swap
// vars
ACE_Swap<PortableServer::POA_var>::swap (this->poa_, tmp.poa_);
ACE_Swap<PortableServer::ObjectId_var>::swap (this->id_, tmp.id_);
return *this;
}
|