#include <PICurrent.h>
Inheritance diagram for TAO::PICurrent:
Public Member Functions | |
PICurrent (TAO_ORB_Core &orb_core) | |
Constructor. | |
virtual CORBA::ORB_ptr | _get_orb (void) |
PortableInterceptor::SlotId | slot_count (void) const |
Number of slots allocated in the slot table. | |
PICurrent_Impl * | tsc (void) |
void | check_validity (const PortableInterceptor::SlotId &identifier) |
Verify the validity of the given SlotId. | |
void | initialize (PortableInterceptor::SlotId sc) |
Initialize the PICurrent object. | |
PortableInterceptor::Current Methods | |
These are methods exposed by the PortableInterceptor::Current interface. | |
virtual CORBA::Any * | get_slot (PortableInterceptor::SlotId id) |
virtual void | set_slot (PortableInterceptor::SlotId identifier, const CORBA::Any &data) |
Set information in the slot table at the given SlotId. | |
Protected Member Functions | |
virtual | ~PICurrent (void) |
Destructor. | |
Private Member Functions | |
PICurrent (const PICurrent &) | |
void | operator= (const PICurrent &) |
Private Attributes | |
TAO_ORB_Core & | orb_core_ |
Reference to the orb core. | |
size_t | tss_slot_ |
PortableInterceptor::SlotId | slot_count_ |
PortableInterceptor::Current is useful for passing data between request interceptors, in addition to passing data from an interceptor to the calling thread.
Definition at line 57 of file PICurrent.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::PICurrent::PICurrent | ( | TAO_ORB_Core & | orb_core | ) |
Constructor.
Definition at line 22 of file PICurrent.cpp.
References PICurrent().
Referenced by PICurrent().
00023 : orb_core_ (orb_core), 00024 tss_slot_ (0), // Call initialize() before use. 00025 slot_count_ (0) // Call initialize() before use. 00026 { 00027 }
TAO::PICurrent::~PICurrent | ( | void | ) | [protected, virtual] |
Destructor.
Protected destructor to enforce the fact this class is reference counted, and should not be destroyed using delete() by anything other than the reference counting mechanism.
Definition at line 29 of file PICurrent.cpp.
References ~PICurrent().
Referenced by ~PICurrent().
TAO::PICurrent::PICurrent | ( | const PICurrent & | ) | [private] |
Prevent copying through the copy constructor and the assignment operator.
CORBA::ORB_ptr TAO::PICurrent::_get_orb | ( | void | ) | [virtual] |
Reimplemented from CORBA::LocalObject.
Definition at line 98 of file PICurrent.cpp.
References CORBA::ORB::_duplicate(), and _get_orb().
Referenced by _get_orb().
00099 { 00100 return CORBA::ORB::_duplicate (this->orb_core_.orb ()); 00101 }
void TAO::PICurrent::check_validity | ( | const PortableInterceptor::SlotId & | identifier | ) |
Verify the validity of the given SlotId.
Definition at line 83 of file PICurrent.cpp.
References check_validity(), CORBA::COMPLETED_NO, and CORBA::OMGVMCID.
Referenced by check_validity(), get_slot(), and set_slot().
00084 { 00085 // If the slot_count is zero, no initialization has been done (if there are 00086 // no slots, then the PICurrent_impl object is not created as there is no 00087 // data to copy). 00088 if (0 == this->slot_count_) 00089 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO); 00090 00091 // No need to acquire a lock for this check. At this point, these 00092 // attributes are read only. 00093 if (identifier >= this->slot_count_) 00094 throw PortableInterceptor::InvalidSlot (); 00095 }
CORBA::Any * TAO::PICurrent::get_slot | ( | PortableInterceptor::SlotId | id | ) | [virtual] |
Retrieve information stored in the slot table at the given SlotId.
Definition at line 34 of file PICurrent.cpp.
References check_validity(), TAO::PICurrent_Impl::get_slot(), get_slot(), and tsc().
Referenced by get_slot().
00035 { 00036 this->check_validity (identifier); 00037 00038 return this->tsc ()->get_slot (identifier); 00039 }
void TAO::PICurrent::initialize | ( | PortableInterceptor::SlotId | sc | ) |
Initialize the PICurrent object.
Definition at line 104 of file PICurrent.cpp.
References CORBA::SystemException::_tao_minor_code(), TAO_ORB_Core::add_tss_cleanup_func(), CleanUpPICurrent(), CORBA::COMPLETED_NO, initialize(), orb_core_, slot_count_, and TAO::VMCID.
Referenced by initialize().
00105 { 00106 // Only allow a single initialization; sc is the number of 00107 // allocated PICurrent data slots the end user wants. If 0 00108 // PICurrent is not used, as no data is to be stored. 00109 if ((0 == this->slot_count_) && (0 != sc)) 00110 { 00111 // NOTE: This function not only adds the cleanup function 00112 // but ALSO allocates the TSS slot PICurrent is to use. 00113 // It MUST be called BEFORE we attempt to get/set any 00114 // PICurrent slot data. 00115 if (0 != orb_core_.add_tss_cleanup_func (CleanUpPICurrent, this->tss_slot_)) 00116 throw ::CORBA::NO_MEMORY ( 00117 CORBA::SystemException::_tao_minor_code ( 00118 TAO::VMCID, 00119 ENOMEM), 00120 CORBA::COMPLETED_NO); 00121 00122 this->slot_count_ = sc; 00123 } 00124 }
void TAO::PICurrent::operator= | ( | const PICurrent & | ) | [private] |
Prevent copying through the copy constructor and the assignment operator.
void TAO::PICurrent::set_slot | ( | PortableInterceptor::SlotId | identifier, | |
const CORBA::Any & | data | |||
) | [virtual] |
Set information in the slot table at the given SlotId.
Definition at line 42 of file PICurrent.cpp.
References check_validity(), TAO::PICurrent_Impl::set_slot(), set_slot(), and tsc().
Referenced by set_slot().
00044 { 00045 this->check_validity (identifier); 00046 00047 this->tsc ()->set_slot (identifier, data); 00048 }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE PortableInterceptor::SlotId TAO::PICurrent::slot_count | ( | void | ) | const |
Number of slots allocated in the slot table.
Definition at line 8 of file PICurrent.inl.
References slot_count(), and slot_count_.
Referenced by slot_count().
00009 { 00010 return this->slot_count_; 00011 }
TAO::PICurrent_Impl * TAO::PICurrent::tsc | ( | void | ) |
Retrieve the PICurrent implementation from TSS, i.e. the thread scope current (TSC).
Definition at line 59 of file PICurrent.cpp.
References CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, CORBA::COMPLETED_NO, TAO_ORB_Core::get_tss_resource(), orb_core_, TAO_ORB_Core::set_tss_resource(), tsc(), and TAO::VMCID.
Referenced by get_slot(), set_slot(), and tsc().
00060 { 00061 TAO::PICurrent_Impl *impl = 00062 static_cast<TAO::PICurrent_Impl *> ( 00063 this->orb_core_.get_tss_resource (this->tss_slot_)); 00064 00065 // If this TSS has not yet been set-up, give it it's own PICurrent_Impl. 00066 if (0 == impl) 00067 { 00068 ACE_NEW_THROW_EX (impl, 00069 TAO::PICurrent_Impl, 00070 CORBA::NO_MEMORY ( 00071 CORBA::SystemException::_tao_minor_code ( 00072 TAO::VMCID, 00073 ENOMEM), 00074 CORBA::COMPLETED_NO)); 00075 00076 this->orb_core_.set_tss_resource (this->tss_slot_, impl); 00077 } 00078 00079 return impl; 00080 }
TAO_ORB_Core& TAO::PICurrent::orb_core_ [private] |
Reference to the orb core.
Reimplemented from CORBA::Object.
Definition at line 115 of file PICurrent.h.
Referenced by initialize(), and tsc().
PortableInterceptor::SlotId TAO::PICurrent::slot_count_ [private] |
The number of allocated PICurrent slots end user wants. (0 is uninitialized or PICurrent is not used as no data is to be stored).
Definition at line 124 of file PICurrent.h.
Referenced by initialize(), and slot_count().
size_t TAO::PICurrent::tss_slot_ [private] |
TSS slot assigned to PICurrent_Impl objects in the OrbCore. Allocated by the orb_core_.add_tss_cleanup_func() when our initialize() method is called.
Definition at line 120 of file PICurrent.h.