00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file PICurrent.h 00006 * 00007 * PICurrent.h,v 1.6 2006/06/26 09:24:20 sma Exp 00008 * 00009 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00010 */ 00011 // =================================================================== 00012 00013 #ifndef TAO_PI_CURRENT_H 00014 #define TAO_PI_CURRENT_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/PI/pi_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/orbconf.h" 00025 00026 #if TAO_HAS_INTERCEPTORS == 1 00027 00028 #include "tao/PI/PICurrentC.h" 00029 00030 #include "tao/LocalObject.h" 00031 #include "ace/Array_Base.h" 00032 00033 #if defined(_MSC_VER) 00034 # pragma warning(push) 00035 # pragma warning(disable:4250) 00036 #endif /* _MSC_VER */ 00037 00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00039 00040 /// Forward declarations. 00041 class TAO_ORB_Core; 00042 00043 namespace TAO 00044 { 00045 class PICurrent_Impl; 00046 00047 /** 00048 * @class PICurrent 00049 * 00050 * @brief Implementation of the PortableInterceptor::Current 00051 * interface. 00052 * 00053 * PortableInterceptor::Current is useful for passing data between 00054 * request interceptors, in addition to passing data from an 00055 * interceptor to the calling thread. 00056 */ 00057 class TAO_PI_Export PICurrent 00058 : public virtual PortableInterceptor::Current, 00059 public virtual TAO_Local_RefCounted_Object 00060 { 00061 public: 00062 00063 /// Constructor. 00064 PICurrent (TAO_ORB_Core &orb_core); 00065 00066 /** 00067 * @name PortableInterceptor::Current Methods 00068 * 00069 * These are methods exposed by the PortableInterceptor::Current 00070 * interface. 00071 */ 00072 //@{ 00073 /// Retrieve information stored in the slot table at the given 00074 /// SlotId. 00075 virtual CORBA::Any *get_slot (PortableInterceptor::SlotId id 00076 ACE_ENV_ARG_DECL_WITH_DEFAULTS) 00077 ACE_THROW_SPEC ((CORBA::SystemException, 00078 PortableInterceptor::InvalidSlot)); 00079 00080 /// Set information in the slot table at the given SlotId. 00081 virtual void set_slot (PortableInterceptor::SlotId identifier, 00082 const CORBA::Any & data 00083 ACE_ENV_ARG_DECL_WITH_DEFAULTS) 00084 ACE_THROW_SPEC ((CORBA::SystemException, 00085 PortableInterceptor::InvalidSlot)); 00086 //@} 00087 00088 virtual CORBA::ORB_ptr _get_orb ( 00089 ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS 00090 ); 00091 00092 /// Number of slots allocated in the slot table. 00093 PortableInterceptor::SlotId slot_count (void) const; 00094 00095 /// Retrieve the PICurrent implementation from TSS, i.e. the thread 00096 /// scope current (TSC). 00097 PICurrent_Impl * tsc (void); 00098 00099 /// Verify the validity of the given SlotId. 00100 void check_validity (const PortableInterceptor::SlotId &identifier 00101 ACE_ENV_ARG_DECL); 00102 00103 /// Initialize the PICurrent object. 00104 int initialize (PortableInterceptor::SlotId sc ACE_ENV_ARG_DECL); 00105 00106 protected: 00107 00108 /// Destructor 00109 /** 00110 * Protected destructor to enforce the fact this class is reference 00111 * counted, and should not be destroyed using delete() by anything 00112 * other than the reference counting mechanism. 00113 */ 00114 virtual ~PICurrent (void); 00115 00116 private: 00117 00118 /// Prevent copying through the copy constructor and the assignment 00119 /// operator. 00120 //@{ 00121 PICurrent (const PICurrent &); 00122 void operator= (const PICurrent &); 00123 //@} 00124 00125 private: 00126 /// Reference to the orb core. 00127 TAO_ORB_Core &orb_core_; 00128 00129 /// TSS slot assigned to this object. 00130 size_t tss_slot_; 00131 00132 /// The number of allocated slots. 00133 PortableInterceptor::SlotId slot_count_; 00134 00135 }; 00136 } 00137 00138 TAO_END_VERSIONED_NAMESPACE_DECL 00139 00140 #if defined (__ACE_INLINE__) 00141 # include "tao/PI/PICurrent.inl" 00142 #endif /* __ACE_INLINE__ */ 00143 00144 #if defined(_MSC_VER) 00145 #pragma warning(pop) 00146 #endif /* _MSC_VER */ 00147 00148 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00149 00150 #include /**/ "ace/post.h" 00151 00152 #endif /* TAO_PI_CURRENT_H */