00001 // -*- C++ -*- 00002 // 00003 // PICurrent_Impl.inl,v 1.5 2006/06/26 09:24:20 sma Exp 00004 00005 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 ACE_INLINE 00008 TAO::PICurrent_Impl::PICurrent_Impl () 00009 : slot_table_ (), 00010 lazy_copy_ (0), 00011 impending_change_callback_ (0) 00012 { 00013 } 00014 00015 ACE_INLINE 00016 TAO::PICurrent_Impl::~PICurrent_Impl () 00017 { 00018 // Break any existing ties that another PICurrent has with our table 00019 // since our table will no longer exist once this destructor completes. 00020 if (0 != this->impending_change_callback_) 00021 this->impending_change_callback_->convert_from_lazy_to_real_copy (); 00022 00023 // If we have logically copied another table, ensure it is told about our 00024 // demise so that it will not call our non-existant 00025 // convert_from_lazy_to_real_copy() when it changes/destructs. 00026 if (0 != this->lazy_copy_) 00027 this->lazy_copy_->set_callback_for_impending_change (0); 00028 } 00029 00030 ACE_INLINE void 00031 TAO::PICurrent_Impl::convert_from_lazy_to_real_copy () 00032 { 00033 // Make sure we take a physical copy of the existing logical 00034 // copy of the table before it disappears/changes. 00035 if (0 != this->lazy_copy_) 00036 { 00037 this->slot_table_ = this->lazy_copy_->current_slot_table (); 00038 00039 // Must tell the old copied PICurrent_Impl that we no 00040 // longer want to be told when/if it is going to be 00041 // changed or destroyed. 00042 this->lazy_copy_->set_callback_for_impending_change (0); 00043 this->lazy_copy_ = 0; 00044 } 00045 } 00046 00047 ACE_INLINE void 00048 TAO::PICurrent_Impl::set_callback_for_impending_change (TAO::PICurrent_Impl *p) 00049 { 00050 this->impending_change_callback_ = (this == p) ? 0 : p; 00051 } 00052 00053 ACE_INLINE TAO::PICurrent_Impl::Table & 00054 TAO::PICurrent_Impl::current_slot_table () 00055 { 00056 return (0 == this->lazy_copy_) ? 00057 this->slot_table_ : 00058 this->lazy_copy_->current_slot_table (); 00059 } 00060 00061 TAO_END_VERSIONED_NAMESPACE_DECL