Implementation of the PortableInterceptor::Current interface. More...
#include <PICurrent.h>
Public Member Functions | |
PICurrent (TAO_ORB_Core &orb_core) | |
Constructor. | |
virtual CORBA::ORB_ptr | _get_orb (void) |
Determine if we are of the type specified by the "logical_type_id". | |
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 | |
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_ |
Implementation of the PortableInterceptor::Current interface.
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::PICurrent::PICurrent | ( | TAO_ORB_Core & | orb_core | ) |
Constructor.
Definition at line 20 of file PICurrent.cpp.
: orb_core_ (orb_core), tss_slot_ (0), // Call initialize() before use. slot_count_ (0) // Call initialize() before use. { }
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 27 of file PICurrent.cpp.
{ }
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] |
Determine if we are of the type specified by the "logical_type_id".
Reimplemented from CORBA::LocalObject.
Definition at line 96 of file PICurrent.cpp.
{ return CORBA::ORB::_duplicate (this->orb_core_.orb ()); }
void TAO::PICurrent::check_validity | ( | const PortableInterceptor::SlotId & | identifier | ) |
Verify the validity of the given SlotId.
Definition at line 81 of file PICurrent.cpp.
{ // If the slot_count is zero, no initialization has been done (if there are // no slots, then the PICurrent_impl object is not created as there is no // data to copy). if (0 == this->slot_count_) throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO); // No need to acquire a lock for this check. At this point, these // attributes are read only. if (identifier >= this->slot_count_) throw PortableInterceptor::InvalidSlot (); }
CORBA::Any * TAO::PICurrent::get_slot | ( | PortableInterceptor::SlotId | id | ) | [virtual] |
Retrieve information stored in the slot table at the given SlotId.
Definition at line 32 of file PICurrent.cpp.
{ this->check_validity (identifier); return this->tsc ()->get_slot (identifier); }
void TAO::PICurrent::initialize | ( | PortableInterceptor::SlotId | sc | ) |
Initialize the PICurrent object.
Definition at line 102 of file PICurrent.cpp.
{ // Only allow a single initialization; sc is the number of // allocated PICurrent data slots the end user wants. If 0 // PICurrent is not used, as no data is to be stored. if ((0 == this->slot_count_) && (0 != sc)) { // NOTE: This function not only adds the cleanup function // but ALSO allocates the TSS slot PICurrent is to use. // It MUST be called BEFORE we attempt to get/set any // PICurrent slot data. if (0 != orb_core_.add_tss_cleanup_func (CleanUpPICurrent, this->tss_slot_)) throw ::CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO); this->slot_count_ = sc; } }
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 40 of file PICurrent.cpp.
{ this->check_validity (identifier); this->tsc ()->set_slot (identifier, data); }
PortableInterceptor::SlotId TAO::PICurrent::slot_count | ( | void | ) | const |
Number of slots allocated in the slot table.
Definition at line 8 of file PICurrent.inl.
{ return this->slot_count_; }
TAO::PICurrent_Impl * TAO::PICurrent::tsc | ( | void | ) |
Retrieve the PICurrent implementation from TSS, i.e. the thread scope current (TSC).
Definition at line 57 of file PICurrent.cpp.
{ TAO::PICurrent_Impl *impl = static_cast<TAO::PICurrent_Impl *> ( this->orb_core_.get_tss_resource (this->tss_slot_)); // If this TSS has not yet been set-up, give it it's own PICurrent_Impl. if (0 == impl) { ACE_NEW_THROW_EX (impl, TAO::PICurrent_Impl (&this->orb_core_, this->tss_slot_), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); this->orb_core_.set_tss_resource (this->tss_slot_, impl); } return impl; }
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.
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.
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.