Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

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 Methods

 TAO_PICurrent (TAO_ORB_Core *orb_core)
 Constructor. More...

PortableInterceptor::SlotId allocate_slot_id (void)
 Allocate a new SlotId. More...

PortableInterceptor::SlotId slot_count (void) const
 Number of slots allocated in the slot table. More...

TAO_PICurrent_Impltsc (void)
 Retrieve the PICurrent implementation from TSS, i.e. the thread scope current (TSC). More...

void check_validity (const PortableInterceptor::SlotId &id ACE_ENV_ARG_DECL)
 Verify the validity of the given SlotId. More...

PortableInterceptor::Current Methods
These are methods exposed by the PortableInterceptor::Current interface.

virtual CORBA::Anyget_slot (PortableInterceptor::SlotId id ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, PortableInterceptor::InvalidSlot)
 Retrieve information stored in the slot table at the given SlotId. More...

virtual void set_slot (PortableInterceptor::SlotId id, const CORBA::Any &data ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, PortableInterceptor::InvalidSlot)
 Set information in the slot table at the given SlotId. More...


Protected Methods

 ~TAO_PICurrent (void)
 Destructor. More...


Private Methods

 TAO_PICurrent (const TAO_PICurrent &)
void operator= (const TAO_PICurrent &)

Private Attributes

TAO_ORB_Coreorb_core_
 Pointer to the orb core. More...

PortableInterceptor::SlotId slot_count_
 The number of allocated slots. More...


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 61 of file PICurrent.h.


Constructor & Destructor Documentation

TAO_PICurrent::TAO_PICurrent TAO_ORB_Core   orb_core
 

Constructor.

Definition at line 23 of file PICurrent.cpp.

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

TAO_PICurrent::~TAO_PICurrent void    [protected]
 

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.

00030 {
00031 }

TAO_PICurrent::TAO_PICurrent const TAO_PICurrent &    [private]
 


Member Function Documentation

PortableInterceptor::SlotId TAO_PICurrent::allocate_slot_id void   
 

Allocate a new SlotId.

Definition at line 88 of file PICurrent.cpp.

References slot_count_.

00089 {
00090   // No need to acquire a lock.  This only gets called during ORB
00091   // initialization.  ORB initialization is already atomic.
00092   return this->slot_count_++;
00093 }

ACE_INLINE void TAO_PICurrent::check_validity const PortableInterceptor::SlotId &id    ACE_ENV_ARG_DECL
 

Verify the validity of the given SlotId.

Definition at line 12 of file PICurrent.inl.

References ACE_ENV_ARG_DECL, ACE_THROW, and slot_count_.

00014 {
00015   // No need to acquire a lock for this check.  At this point, these
00016   // attributes are read only.
00017   if (id >= this->slot_count_)
00018     ACE_THROW (PortableInterceptor::InvalidSlot ());
00019 }

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

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

Implements PortableInterceptor::Current.

Definition at line 34 of file PICurrent.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, and TAO_PICurrent_Impl::get_slot.

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

void TAO_PICurrent::operator= const TAO_PICurrent &    [private]
 

void TAO_PICurrent::set_slot PortableInterceptor::SlotId    id,
const CORBA::Any &data    ACE_ENV_ARG_DECL_WITH_DEFAULTS
throw (CORBA::SystemException, PortableInterceptor::InvalidSlot) [virtual]
 

Set information in the slot table at the given SlotId.

Implements PortableInterceptor::Current.

Definition at line 55 of file PICurrent.cpp.

References ACE_CHECK, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_THROW, TAO_PICurrent_Impl::copy, TAO_PICurrent_Impl::pi_peer, and TAO_PICurrent_Impl::set_slot.

00060 {
00061   this->check_validity (id ACE_ENV_ARG_PARAMETER);
00062   ACE_CHECK;
00063 
00064   TAO_PICurrent_Impl *impl = this->tsc ();
00065 
00066   if (impl == 0)
00067     {
00068       ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00069                                        CORBA::COMPLETED_NO));
00070     }
00071 
00072   // -------------------------------------------
00073   // CLIENT SIDE STUFF
00074   // -------------------------------------------
00075   // If the TSC was logically copied to the RSC, then deep copy the
00076   // contents of the TSC to the RSC before modifying the RSC.  The RSC
00077   // should not be altered by modifications to the TSC.
00078   TAO_PICurrent_Impl *rsc = impl->pi_peer ();
00079   if (rsc != 0)
00080     rsc->copy (*impl, 1);  // Deep copy
00081   // -------------------------------------------
00082 
00083   impl->set_slot (id, data ACE_ENV_ARG_PARAMETER);
00084   ACE_CHECK;
00085 }

ACE_INLINE PortableInterceptor::SlotId TAO_PICurrent::slot_count void    const
 

Number of slots allocated in the slot table.

Definition at line 6 of file PICurrent.inl.

References slot_count_.

Referenced by TAO_ClientRequestInfo_i::setup_picurrent, and TAO_PICurrent_Guard::TAO_PICurrent_Guard.

00007 {
00008   return this->slot_count_;
00009 }

TAO_PICurrent_Impl * TAO_PICurrent::tsc void   
 

Retrieve the PICurrent implementation from TSS, i.e. the thread scope current (TSC).

Definition at line 96 of file PICurrent.cpp.

References TAO_ORB_Core::get_tss_resources, orb_core_, and TAO_ORB_Core_TSS_Resources::pi_current_.

Referenced by TAO_ClientRequestInfo_i::setup_picurrent, and TAO_PICurrent_Guard::TAO_PICurrent_Guard.

00097 {
00098   TAO_ORB_Core_TSS_Resources *tss =
00099     this->orb_core_->get_tss_resources ();
00100 
00101   return &tss->pi_current_;
00102 }


Member Data Documentation

TAO_ORB_Core* TAO_PICurrent::orb_core_ [private]
 

Pointer to the orb core.

Definition at line 132 of file PICurrent.h.

Referenced by tsc.

PortableInterceptor::SlotId TAO_PICurrent::slot_count_ [private]
 

The number of allocated slots.

Definition at line 135 of file PICurrent.h.

Referenced by allocate_slot_id, check_validity, and slot_count.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:33:26 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002