#include <PICurrent_Impl.h>
Collaboration diagram for TAO::PICurrent_Impl:

Public Member Functions | |
| PICurrent_Impl (void) | |
| Constructor. | |
| ~PICurrent_Impl (void) | |
| Destructor. | |
| CORBA::Any * | get_slot (PortableInterceptor::SlotId identifier) |
| void | set_slot (PortableInterceptor::SlotId identifier, const CORBA::Any &data) |
| Set information in the slot table at the given SlotId. | |
| void | take_lazy_copy (PICurrent_Impl *p) |
| Logically/Lazy (shallow) copy the given object's slot table. | |
Private Types | |
| typedef ACE_Array_Base< CORBA::Any > | Table |
| Typedef for the underyling "slot table.". | |
Private Member Functions | |
| void | convert_from_lazy_to_real_copy () |
| void | set_callback_for_impending_change (PICurrent_Impl *p) |
| Table & | current_slot_table () |
| PICurrent_Impl (const PICurrent_Impl &) | |
| void | operator= (const PICurrent_Impl &) |
Private Attributes | |
| Table | slot_table_ |
| Array of CORBA::Anys that is the underlying "slot table.". | |
| PICurrent_Impl * | lazy_copy_ |
| PICurrent_Impl * | impending_change_callback_ |
This class implements both the "request scope current" and the "thread scope current" objects as required by Portable Interceptors.
Definition at line 50 of file PICurrent_Impl.h.
|
|
Typedef for the underyling "slot table.".
Definition at line 83 of file PICurrent_Impl.h. |
|
|
Constructor.
Definition at line 8 of file PICurrent_Impl.inl.
00009 : slot_table_ (), 00010 lazy_copy_ (0), 00011 impending_change_callback_ (0) 00012 { 00013 } |
|
|
Destructor.
Definition at line 16 of file PICurrent_Impl.inl. References convert_from_lazy_to_real_copy(), impending_change_callback_, lazy_copy_, and set_callback_for_impending_change().
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 }
|
|
|
Prevent copying through the copy constructor and the assignment operator. |
|
|
Force this object to convert from a logical (referenced) copy, to a physical (or deep, actual) copy. Definition at line 31 of file PICurrent_Impl.inl. References current_slot_table(), lazy_copy_, set_callback_for_impending_change(), and slot_table_. Referenced by set_slot(), take_lazy_copy(), and ~PICurrent_Impl().
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 }
|
|
|
Definition at line 54 of file PICurrent_Impl.inl. References lazy_copy_, and slot_table_. Referenced by convert_from_lazy_to_real_copy(), get_slot(), and take_lazy_copy().
00055 {
00056 return (0 == this->lazy_copy_) ?
00057 this->slot_table_ :
00058 this->lazy_copy_->current_slot_table ();
00059 }
|
|
|
Retrieve information stored in the slot table at the given SlotId. Definition at line 22 of file PICurrent_Impl.cpp. References ACE_DEBUG, ACE_NEW_THROW_EX, ACE_TEXT, current_slot_table(), lazy_copy_, LM_DEBUG, slot_table_, and TAO_debug_level. Referenced by TAO::PICurrent::get_slot(), and TAO_ClientRequestInfo::get_slot().
00023 {
00024 // No need to check validity of SlotId. It is validated before this
00025 // method is invoked.
00026
00027 // The active slot table should never be a lazy copy of itself!
00028 if ( (0 != this->lazy_copy_)
00029 && (&this->lazy_copy_->current_slot_table () == &this->slot_table_))
00030 {
00031 if (TAO_debug_level > 0)
00032 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) Lazy copy of self detected at %N,%l\n")));
00033 throw ::CORBA::INTERNAL ();
00034 }
00035
00036 // Get the slot table that is currently active
00037 PICurrent_Impl::Table & table = this->current_slot_table ();
00038 CORBA::Any * any = 0;
00039
00040 if (identifier < table.size ())
00041 {
00042 ACE_NEW_THROW_EX (any,
00043 CORBA::Any (table[identifier]), // Make a copy.
00044 CORBA::NO_MEMORY (
00045 CORBA::SystemException::_tao_minor_code (
00046 0,
00047 ENOMEM),
00048 CORBA::COMPLETED_NO));
00049 }
00050 else
00051 {
00052 // In accordance with the Portable Interceptor specification,
00053 // return an Any with a TCKind of tk_null. A default
00054 // constructed Any has that TCKind.
00055 ACE_NEW_THROW_EX (any,
00056 CORBA::Any,
00057 CORBA::NO_MEMORY (
00058 CORBA::SystemException::_tao_minor_code (
00059 0,
00060 ENOMEM),
00061 CORBA::COMPLETED_NO));
00062 }
00063
00064 return any;
00065 }
|
|
|
Prevent copying through the copy constructor and the assignment operator. |
|
|
Set the callback PICurrent_Impl object that will be notified of this object's impending destruction or change. Set to 0 to clear. (NOTE Only handles a SINGLE object at at time, does NOT warn previous callback that this has been changed.) Definition at line 48 of file PICurrent_Impl.inl. References impending_change_callback_. Referenced by convert_from_lazy_to_real_copy(), take_lazy_copy(), and ~PICurrent_Impl().
00049 {
00050 this->impending_change_callback_ = (this == p) ? 0 : p;
00051 }
|
|
||||||||||||
|
Set information in the slot table at the given SlotId.
Definition at line 68 of file PICurrent_Impl.cpp. References convert_from_lazy_to_real_copy(), impending_change_callback_, and slot_table_. Referenced by TAO::PICurrent::set_slot().
00070 {
00071 // No need to check validity of SlotId. It is validated before this
00072 // method is invoked.
00073
00074 // Break any existing ties that another PICurrent has with our table
00075 // since our table is changing.
00076 if (0 != this->impending_change_callback_)
00077 this->impending_change_callback_->convert_from_lazy_to_real_copy ();
00078
00079 // Ensure that we have a real physical copy of the table before
00080 // making any changes to it.
00081 this->convert_from_lazy_to_real_copy ();
00082
00083 // If the slot table array isn't large enough, then increase its
00084 // size. We're guaranteed not to exceed the number of allocated
00085 // slots for the reason stated above.
00086 if (identifier >= this->slot_table_.size ()
00087 && this->slot_table_.size (identifier + 1) != 0)
00088 throw ::CORBA::INTERNAL ();
00089
00090 this->slot_table_[identifier] = CORBA::Any (data);
00091 }
|
|
|
Logically/Lazy (shallow) copy the given object's slot table.
Definition at line 94 of file PICurrent_Impl.cpp. References convert_from_lazy_to_real_copy(), current_slot_table(), impending_change_callback_, lazy_copy_, and set_callback_for_impending_change(). Referenced by TAO_ClientRequestInfo::setup_picurrent().
00096 {
00097 // Check that we are being told to actually change which table we are
00098 // copying from. (If it is the same as before OR it would ultimately be
00099 // the same table, we are already correctly setup and we do nothing.)
00100 if ( (p != this->lazy_copy_)
00101 && ((0 == p) || (&p->current_slot_table () != &this->current_slot_table ()))
00102 )
00103 {
00104 // Break any existing ties that another PICurrent has with our table
00105 // since our table is changing.
00106 if (0 != this->impending_change_callback_)
00107 this->impending_change_callback_->convert_from_lazy_to_real_copy ();
00108
00109 // If we have previously logically copied another table, ensure it is
00110 // told that we are no longer interested in it so that it will not
00111 // call our conver_from_lazy_to_real_copy() when it changes/destructs.
00112 if (0 != this->lazy_copy_)
00113 this->lazy_copy_->set_callback_for_impending_change (0);
00114
00115 // Are we being asked to copy ourself (or nothing)
00116 if ((0 == p) || (this == p))
00117 {
00118 this->lazy_copy_ = 0; // Use our own physical slot_table_
00119 }
00120 else
00121 {
00122 this->lazy_copy_ = p;
00123
00124 // Must tell the newly copied PICurrent_Impl that we want to
00125 // be told when/if it is going to be changed or destroyed.
00126 this->lazy_copy_->set_callback_for_impending_change (this);
00127 }
00128 }
00129 }
|
|
|
PICurrent_Impl object that will be notified of this object's impending destruction or change to its slot_table_. This is the PICurrent_Impl that has access to our slot_table_ via its lazy_copy_ pointer. As necessary this allows that object's convert_from_lazy_to_real_copy() to be called. Definition at line 113 of file PICurrent_Impl.h. Referenced by set_callback_for_impending_change(), set_slot(), take_lazy_copy(), and ~PICurrent_Impl(). |
|
|
Access to logical copy from a PICurrent_Impl in another scope, i.e. either the request scope or the thread scope. Definition at line 106 of file PICurrent_Impl.h. Referenced by convert_from_lazy_to_real_copy(), current_slot_table(), get_slot(), take_lazy_copy(), and ~PICurrent_Impl(). |
|
|
Array of CORBA::Anys that is the underlying "slot table.".
Definition at line 102 of file PICurrent_Impl.h. Referenced by convert_from_lazy_to_real_copy(), current_slot_table(), get_slot(), and set_slot(). |
1.3.6