POA_Current_Impl.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    POA_Current_Impl.h
00006  *
00007  *  POA_Current_Impl.h,v 1.9 2006/03/10 07:19:13 jtc Exp
00008  *
00009  *  @author Irfan Pyarali
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_POA_CURRENT_IMPL_H
00014 #define TAO_POA_CURRENT_IMPL_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/PortableServer/portableserver_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "tao/PortableServer/PS_ForwardC.h"
00025 
00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 namespace TAO
00029 {
00030   namespace Portable_Server
00031   {
00032     class Non_Servant_Upcall;
00033     class Servant_Upcall;
00034   }
00035 
00036   class ObjectKey;
00037 }
00038 
00039 class TAO_TSS_Resources;
00040 
00041 namespace TAO
00042 {
00043   namespace Portable_Server
00044   {
00045     /**
00046      * @class POA_Current_Impl
00047      *
00048      * @brief Implementation of the PortableServer::Current object.
00049      *
00050      * Objects of this class hold state information regarding the
00051      * current POA invocation.  Savvy readers will notice that this
00052      * contains substantially more methods than the POA spec shows;
00053      * they exist because the ORB either (a) needs them or (b) finds
00054      * them useful for implementing a more efficient ORB.
00055      * The intent is that instances of this class are held in
00056      * Thread-Specific Storage so that upcalls can get context
00057      * information regarding their invocation.  The POA itself must
00058      * insure that all <set_*> operations are performed in the
00059      * execution thread so that the proper <TAO_POA_Current> pointer
00060      * is obtained from TSS.
00061      */
00062     class TAO_PortableServer_Export POA_Current_Impl
00063     {
00064     public:
00065       friend class ::TAO_Root_POA;
00066 
00067       /// Return pointer to the invoking POA.  Raises the
00068       /// <CORBA::NoContext> exception.
00069       PortableServer::POA_ptr get_POA (void);
00070 
00071       /**
00072        * Return pointer to the object id through which this was invoked.
00073        * This may be necessary in cases where a <Servant> is serving under
00074        * the guise of multiple object ids.
00075        */
00076       PortableServer::ObjectId *get_object_id (void);
00077 
00078       /**
00079        * Returns a reference to the servant that hosts the object in whose
00080        * context it is called.
00081        */
00082       PortableServer::Servant get_servant (void);
00083 
00084       /**
00085        * This operation returns a locally manufactured reference to the object
00086        * in the context of which it is called.
00087        */
00088       CORBA::Object_ptr get_reference (void);
00089 
00090       /// Set the POA implementation.
00091       void poa (::TAO_Root_POA *);
00092 
00093       /// Get the POA implemantation
00094       ::TAO_Root_POA *poa (void) const;
00095 
00096       /// ORB Core for this current.
00097       TAO_ORB_Core &orb_core (void) const;
00098 
00099       /// Set the object ID.
00100       void object_id (const PortableServer::ObjectId &id);
00101 
00102       /// Get the object ID.
00103       const PortableServer::ObjectId &object_id (void) const;
00104 
00105       /// Just replace the object id smartly
00106       void replace_object_id (const PortableServer::ObjectId &system_id);
00107 
00108       /// Set the object key.
00109       void object_key (const TAO::ObjectKey &key);
00110 
00111       /// Get the object key.
00112       const TAO::ObjectKey &object_key (void) const;
00113 
00114       /// Set the servant for the current upcall.
00115       void servant (PortableServer::Servant servant);
00116 
00117       /// Get the servant for the current upcall.
00118       PortableServer::Servant servant (void) const;
00119 
00120       /// Set the priority for the current upcall.
00121       void priority (CORBA::Short priority);
00122 
00123       /// Get the priority for the current upcall.
00124       CORBA::Short priority (void) const;
00125 
00126       /// Convenience constructor combining construction & initialization.
00127       POA_Current_Impl (void);
00128 
00129       /// Return the previous current implementation.
00130       POA_Current_Impl *previous (void) const;
00131 
00132       /// Teardown the current for this request.
00133       void teardown (void);
00134 
00135       /// Setup the current.
00136       void setup (::TAO_Root_POA *impl,
00137                   const TAO::ObjectKey &key);
00138 
00139     private:
00140 
00141       // = Hidden because we don't allow these
00142       POA_Current_Impl (const POA_Current_Impl &);
00143       void operator= (const POA_Current_Impl &);
00144 
00145     protected:
00146       /// The POA implementation invoking an upcall
00147       ::TAO_Root_POA *poa_;
00148 
00149       /**
00150        * The object ID of the current context.  This is the user id and
00151        * not the id the goes into the IOR.  Note also that unlike the
00152        * <object_key>, this field is stored by value.
00153        */
00154       PortableServer::ObjectId object_id_;
00155 
00156       /// The object key of the current context.
00157       const TAO::ObjectKey *object_key_;
00158 
00159       /// The servant for the current upcall.
00160       PortableServer::Servant servant_;
00161 
00162       /// The priority for the current upcall.
00163       CORBA::Short priority_;
00164 
00165       /// Current previous from <this>.
00166       POA_Current_Impl *previous_current_impl_;
00167 
00168       /// Is setup complete?
00169       int setup_done_;
00170 
00171       /// Pointer to tss resources.
00172       TAO_TSS_Resources *tss_resources_;
00173 
00174     };
00175   }
00176 }
00177 
00178 TAO_END_VERSIONED_NAMESPACE_DECL
00179 
00180 #if defined (__ACE_INLINE__)
00181 # include "tao/PortableServer/POA_Current_Impl.inl"
00182 #endif /* __ACE_INLINE__ */
00183 
00184 #include /**/ "ace/post.h"
00185 
00186 #endif /* TAO_POA_CURRENT_IMPL_H */

Generated on Thu Nov 9 12:40:40 2006 for TAO_PortableServer by doxygen 1.3.6