00001 // -*- C++ -*- 00002 // 00003 // $Id: EC_Lifetime_Utils.inl 76626 2007-01-26 13:50:03Z elliott_c $ 00004 00005 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 ACE_INLINE 00008 TAO_EC_Object_Deactivator::TAO_EC_Object_Deactivator (void) 00009 : poa_ () 00010 , id_ () 00011 , deactivate_ (0) 00012 { 00013 } 00014 00015 ACE_INLINE 00016 TAO_EC_Object_Deactivator::TAO_EC_Object_Deactivator ( 00017 PortableServer::POA_ptr poa, 00018 PortableServer::ObjectId const & id) 00019 : poa_ (PortableServer::POA::_duplicate (poa)) 00020 , id_ (id) 00021 , deactivate_ (1) 00022 { 00023 } 00024 00025 ACE_INLINE void 00026 TAO_EC_Object_Deactivator::deactivate (void) 00027 { 00028 if (this->deactivate_ && !CORBA::is_nil (this->poa_.in ())) 00029 { 00030 try 00031 { 00032 this->deactivate_ = 0; 00033 this->poa_->deactivate_object (id_); 00034 } 00035 catch (const CORBA::Exception&) 00036 { 00037 // The deactivation can throw... 00038 } 00039 } 00040 } 00041 00042 ACE_INLINE 00043 TAO_EC_Object_Deactivator::~TAO_EC_Object_Deactivator (void) 00044 { 00045 this->deactivate (); 00046 } 00047 00048 ACE_INLINE PortableServer::POA_var 00049 TAO_EC_Object_Deactivator::poa (void) const 00050 { 00051 return this->poa_; 00052 } 00053 00054 ACE_INLINE void 00055 TAO_EC_Object_Deactivator::allow_deactivation (void) 00056 { 00057 this->deactivate_ = 1; 00058 } 00059 00060 ACE_INLINE void 00061 TAO_EC_Object_Deactivator::disallow_deactivation (void) 00062 { 00063 this->deactivate_ = 0; 00064 } 00065 00066 ACE_INLINE void 00067 TAO_EC_Object_Deactivator::set_values (PortableServer::POA_ptr poa, 00068 PortableServer::ObjectId const & id) 00069 { 00070 this->poa_ = PortableServer::POA::_duplicate (poa); 00071 this->id_ = id; 00072 this->deactivate_ = 1; 00073 } 00074 00075 ACE_INLINE void 00076 TAO_EC_Object_Deactivator::set_values (TAO_EC_Object_Deactivator & deactivator) 00077 { 00078 if (this == &deactivator) 00079 return; 00080 00081 this->poa_ = deactivator.poa_._retn (); 00082 this->id_ = deactivator.id_; 00083 this->deactivate_ = deactivator.deactivate_; 00084 deactivator.deactivate_ = 0; 00085 } 00086 00087 // **************************************************************** 00088 00089 ACE_INLINE 00090 TAO_EC_Deactivated_Object::TAO_EC_Deactivated_Object (void) 00091 : deactivator_ () 00092 { 00093 } 00094 00095 ACE_INLINE 00096 TAO_EC_Deactivated_Object::~TAO_EC_Deactivated_Object (void) 00097 { 00098 // Prevent automatic deactivation in deactivator's destructor. 00099 this->deactivator_.disallow_deactivation (); 00100 } 00101 00102 ACE_INLINE void 00103 TAO_EC_Deactivated_Object::set_deactivator ( 00104 TAO_EC_Object_Deactivator & deactivator) 00105 { 00106 this->deactivator_.set_values (deactivator); 00107 } 00108 00109 // **************************************************************** 00110 00111 ACE_INLINE 00112 TAO_EC_ORB_Holder::TAO_EC_ORB_Holder (void) 00113 : orb_ () 00114 { 00115 } 00116 00117 ACE_INLINE 00118 TAO_EC_ORB_Holder::~TAO_EC_ORB_Holder (void) 00119 { 00120 if (!CORBA::is_nil (this->orb_.in ())) 00121 { 00122 try 00123 { 00124 this->orb_->destroy (); 00125 } 00126 catch (const CORBA::Exception&) 00127 { 00128 // Ignore. 00129 } 00130 } 00131 } 00132 00133 ACE_INLINE void 00134 TAO_EC_ORB_Holder::init (CORBA::ORB_var orb_var) 00135 { 00136 this->orb_ = orb_var; 00137 } 00138 00139 // **************************************************************** 00140 00141 ACE_INLINE 00142 TAO_EC_Event_Channel_Holder::TAO_EC_Event_Channel_Holder (void) 00143 : ec_ () 00144 { 00145 } 00146 00147 ACE_INLINE 00148 TAO_EC_Event_Channel_Holder::~TAO_EC_Event_Channel_Holder (void) 00149 { 00150 if (!CORBA::is_nil (this->ec_.in ())) 00151 { 00152 try 00153 { 00154 this->ec_->destroy (); 00155 } 00156 catch (const CORBA::Exception&) 00157 { 00158 // Ignore. 00159 } 00160 } 00161 } 00162 00163 ACE_INLINE void 00164 TAO_EC_Event_Channel_Holder::init ( 00165 RtecEventChannelAdmin::EventChannel_var ec_var) 00166 { 00167 this->ec_ = ec_var; 00168 } 00169 00170 TAO_END_VERSIONED_NAMESPACE_DECL