EC_Lifetime_Utils.i

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // EC_Lifetime_Utils.i,v 1.2 2005/11/10 06:47:23 ossama Exp
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     ACE_DECLARE_NEW_CORBA_ENV;
00031     ACE_TRY
00032     {
00033       this->deactivate_ = 0;
00034       this->poa_->deactivate_object (id_ ACE_ENV_ARG_PARAMETER);
00035       ACE_TRY_CHECK;
00036     }
00037     ACE_CATCHANY
00038     {
00039       // The deactivation can throw...
00040     }
00041     ACE_ENDTRY;
00042   }
00043 }
00044 
00045 ACE_INLINE
00046 TAO_EC_Object_Deactivator::~TAO_EC_Object_Deactivator (void)
00047 {
00048   this->deactivate ();
00049 }
00050 
00051 ACE_INLINE PortableServer::POA_var
00052 TAO_EC_Object_Deactivator::poa (void) const
00053 {
00054   return this->poa_;
00055 }
00056 
00057 ACE_INLINE void
00058 TAO_EC_Object_Deactivator::allow_deactivation (void)
00059 {
00060   this->deactivate_ = 1;
00061 }
00062 
00063 ACE_INLINE void
00064 TAO_EC_Object_Deactivator::disallow_deactivation (void)
00065 {
00066   this->deactivate_ = 0;
00067 }
00068 
00069 ACE_INLINE void
00070 TAO_EC_Object_Deactivator::set_values (PortableServer::POA_ptr poa,
00071                                        PortableServer::ObjectId const & id)
00072 {
00073   this->poa_ = PortableServer::POA::_duplicate (poa);
00074   this->id_ = id;
00075   this->deactivate_ = 1;
00076 }
00077 
00078 ACE_INLINE void
00079 TAO_EC_Object_Deactivator::set_values (TAO_EC_Object_Deactivator & deactivator)
00080 {
00081   if (this == &deactivator)
00082     return;
00083 
00084   this->poa_ = deactivator.poa_._retn ();
00085   this->id_ = deactivator.id_;
00086   this->deactivate_ = deactivator.deactivate_;
00087   deactivator.deactivate_ = 0;
00088 }
00089 
00090 // ****************************************************************
00091 
00092 ACE_INLINE
00093 TAO_EC_Deactivated_Object::TAO_EC_Deactivated_Object (void)
00094   : deactivator_ ()
00095 {
00096 }
00097 
00098 ACE_INLINE
00099 TAO_EC_Deactivated_Object::~TAO_EC_Deactivated_Object (void)
00100 {
00101   // Prevent automatic deactivation in deactivator's destructor.
00102   this->deactivator_.disallow_deactivation ();
00103 }
00104 
00105 ACE_INLINE void
00106 TAO_EC_Deactivated_Object::set_deactivator (
00107                               TAO_EC_Object_Deactivator & deactivator)
00108 {
00109   this->deactivator_.set_values (deactivator);
00110 }
00111 
00112 // ****************************************************************
00113 
00114 ACE_INLINE
00115 TAO_EC_ORB_Holder::TAO_EC_ORB_Holder (void)
00116   : orb_ ()
00117 {
00118 }
00119 
00120 ACE_INLINE
00121 TAO_EC_ORB_Holder::~TAO_EC_ORB_Holder (void)
00122 {
00123   if (!CORBA::is_nil (this->orb_.in ()))
00124   {
00125     ACE_DECLARE_NEW_CORBA_ENV;
00126     ACE_TRY
00127       {
00128         this->orb_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
00129         ACE_TRY_CHECK;
00130       }
00131     ACE_CATCHANY
00132       {
00133         // Ignore.
00134       }
00135     ACE_ENDTRY;
00136   }
00137 }
00138 
00139 ACE_INLINE void
00140 TAO_EC_ORB_Holder::init (CORBA::ORB_var orb_var)
00141 {
00142   this->orb_ = orb_var;
00143 }
00144 
00145 // ****************************************************************
00146 
00147 ACE_INLINE
00148 TAO_EC_Event_Channel_Holder::TAO_EC_Event_Channel_Holder (void)
00149   : ec_ ()
00150 {
00151 }
00152 
00153 ACE_INLINE
00154 TAO_EC_Event_Channel_Holder::~TAO_EC_Event_Channel_Holder (void)
00155 {
00156   if (!CORBA::is_nil (this->ec_.in ()))
00157   {
00158     ACE_DECLARE_NEW_CORBA_ENV;
00159     ACE_TRY
00160       {
00161         this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
00162         ACE_TRY_CHECK;
00163       }
00164     ACE_CATCHANY
00165       {
00166         // Ignore.
00167       }
00168     ACE_ENDTRY;
00169   }
00170 }
00171 
00172 ACE_INLINE void
00173 TAO_EC_Event_Channel_Holder::init (
00174                     RtecEventChannelAdmin::EventChannel_var ec_var)
00175 {
00176   this->ec_ = ec_var;
00177 }
00178 
00179 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 13:11:08 2006 for TAO_RTEvent by doxygen 1.3.6