TAO::PICurrent Class Reference

Implementation of the PortableInterceptor::Current interface. More...

#include <PICurrent.h>

Inheritance diagram for TAO::PICurrent:

Inheritance graph
[legend]
Collaboration diagram for TAO::PICurrent:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PICurrent (TAO_ORB_Core &orb_core)
 Constructor.

virtual CORBA::ORB_ptr _get_orb ()
PortableInterceptor::SlotId slot_count (void) const
 Number of slots allocated in the slot table.

PICurrent_Impltsc (void)
void check_validity (const PortableInterceptor::SlotId &identifier)
 Verify the validity of the given SlotId.

int 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) throw (CORBA::SystemException, PortableInterceptor::InvalidSlot)
virtual void set_slot (PortableInterceptor::SlotId identifier, const CORBA::Any &data) throw (CORBA::SystemException, PortableInterceptor::InvalidSlot)
 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_Coreorb_core_
 Reference to the orb core.

size_t tss_slot_
 TSS slot assigned to this object.

PortableInterceptor::SlotId slot_count_
 The number of allocated slots.


Detailed Description

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.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::PICurrent::PICurrent TAO_ORB_Core orb_core  ) 
 

Constructor.

Definition at line 23 of file PICurrent.cpp.

00024   : orb_core_ (orb_core),
00025     tss_slot_ (0),
00026     slot_count_ (0)
00027 {
00028 }

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 30 of file PICurrent.cpp.

00031 {
00032 }

TAO::PICurrent::PICurrent const PICurrent  )  [private]
 

Prevent copying through the copy constructor and the assignment operator.


Member Function Documentation

CORBA::ORB_ptr TAO::PICurrent::_get_orb  )  [virtual]
 

Reimplemented from CORBA::LocalObject.

Definition at line 94 of file PICurrent.cpp.

References CORBA::ORB::_duplicate().

00095 {
00096   return CORBA::ORB::_duplicate (this->orb_core_.orb ());
00097 }

void TAO::PICurrent::check_validity const PortableInterceptor::SlotId identifier  ) 
 

Verify the validity of the given SlotId.

Definition at line 84 of file PICurrent.cpp.

References ACE_THROW.

00086 {
00087   // No need to acquire a lock for this check.  At this point, these
00088   // attributes are read only.
00089   if (identifier >= this->slot_count_)
00090     ACE_THROW (PortableInterceptor::InvalidSlot ());
00091 }

CORBA::Any * TAO::PICurrent::get_slot PortableInterceptor::SlotId  id  )  throw (CORBA::SystemException, PortableInterceptor::InvalidSlot) [virtual]
 

Retrieve information stored in the slot table at the given SlotId.

Definition at line 35 of file PICurrent.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, and TAO::PICurrent_Impl::get_slot().

00039 {
00040   this->check_validity (identifier ACE_ENV_ARG_PARAMETER);
00041   ACE_CHECK_RETURN (0);
00042 
00043   PICurrent_Impl *impl = this->tsc ();
00044 
00045   if (impl == 0)
00046     ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00047                                             CORBA::COMPLETED_NO),
00048                       0);
00049 
00050   return impl->get_slot (identifier ACE_ENV_ARG_PARAMETER);
00051 }

int TAO::PICurrent::initialize PortableInterceptor::SlotId  sc  ) 
 

Initialize the PICurrent object.

Definition at line 100 of file PICurrent.cpp.

References ACE_NEW_RETURN, TAO_ORB_Core::add_tss_cleanup_func(), TAO_ORB_Core::set_tss_resource(), tsc(), and tss_slot_.

Referenced by TAO::ORBInitializer_Registry::post_init().

00102 {
00103   this->slot_count_ = sc;
00104 
00105   if (this->tsc () == 0 && tss_slot_ == 0)
00106     {
00107       TAO::PICurrent_Impl *impl = 0;
00108       ACE_NEW_RETURN (impl,
00109                       TAO::PICurrent_Impl,
00110                       0);
00111 
00112       const int result = this->orb_core_.add_tss_cleanup_func (0,
00113                                                                tss_slot_);
00114 
00115       if (result != 0)
00116         return result;
00117 
00118       this->orb_core_.set_tss_resource (tss_slot_, impl);
00119     }
00120 
00121   return 0;
00122 }

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
throw (CORBA::SystemException, PortableInterceptor::InvalidSlot) [virtual]
 

Set information in the slot table at the given SlotId.

Definition at line 54 of file PICurrent.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_THROW, and TAO::PICurrent_Impl::set_slot().

00059 {
00060   this->check_validity (identifier ACE_ENV_ARG_PARAMETER);
00061   ACE_CHECK;
00062 
00063   PICurrent_Impl *impl = this->tsc ();
00064 
00065   if (impl == 0)
00066     ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00067                                      CORBA::COMPLETED_NO));
00068 
00069   impl->set_slot (identifier, data ACE_ENV_ARG_PARAMETER);
00070   ACE_CHECK;
00071 }

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.

Referenced by TAO_ClientRequestInfo::setup_picurrent().

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 74 of file PICurrent.cpp.

References TAO_ORB_Core::get_tss_resource().

Referenced by initialize(), and TAO_ClientRequestInfo::setup_picurrent().

00075 {
00076   TAO::PICurrent_Impl *impl =
00077     static_cast<TAO::PICurrent_Impl *> (
00078       this->orb_core_.get_tss_resource (this->tss_slot_));
00079 
00080   return impl;
00081 }


Member Data Documentation

TAO_ORB_Core& TAO::PICurrent::orb_core_ [private]
 

Reference to the orb core.

Reimplemented from CORBA::Object.

Definition at line 127 of file PICurrent.h.

PortableInterceptor::SlotId TAO::PICurrent::slot_count_ [private]
 

The number of allocated slots.

Definition at line 133 of file PICurrent.h.

size_t TAO::PICurrent::tss_slot_ [private]
 

TSS slot assigned to this object.

Definition at line 130 of file PICurrent.h.

Referenced by initialize().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:52:53 2006 for TAO_PI by doxygen 1.3.6