3 // ===================================================================
7 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
9 // ===================================================================
11 #ifndef TAO_PI_CURRENT_H
12 #define TAO_PI_CURRENT_H
14 #include /**/ "ace/pre.h"
16 #include "tao/PI/pi_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/orbconf.h"
24 #if TAO_HAS_INTERCEPTORS == 1
26 #include "tao/PI/PI_includeC.h"
28 #include "tao/LocalObject.h"
29 #include "ace/Array_Base.h"
32 # pragma warning(push)
33 # pragma warning(disable:4250)
36 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
38 /// Forward declarations.
48 * @brief Implementation of the PortableInterceptor::Current
51 * PortableInterceptor::Current is useful for passing data between
52 * request interceptors, in addition to passing data from an
53 * interceptor to the calling thread.
55 class TAO_PI_Export PICurrent
56 : public virtual PortableInterceptor::Current
,
57 public virtual ::CORBA::LocalObject
61 PICurrent (TAO_ORB_Core
&orb_core
);
64 * @name PortableInterceptor::Current Methods
66 * These are methods exposed by the PortableInterceptor::Current
70 /// Retrieve information stored in the slot table at the given
72 virtual CORBA::Any
*get_slot (PortableInterceptor::SlotId id
);
74 /// Set information in the slot table at the given SlotId.
75 virtual void set_slot (PortableInterceptor::SlotId identifier
,
76 const CORBA::Any
& data
);
79 virtual CORBA::ORB_ptr
_get_orb ();
81 /// Number of slots allocated in the slot table.
82 PortableInterceptor::SlotId
slot_count () const;
84 /// Retrieve the PICurrent implementation from TSS, i.e. the thread
85 /// scope current (TSC).
86 PICurrent_Impl
* tsc ();
88 /// Verify the validity of the given SlotId.
89 void check_validity (const PortableInterceptor::SlotId
&identifier
);
91 /// Initialize the PICurrent object.
92 void initialize (PortableInterceptor::SlotId sc
);
97 * Protected destructor to enforce the fact this class is reference
98 * counted, and should not be destroyed using delete() by anything
99 * other than the reference counting mechanism.
101 virtual ~PICurrent () = default;
104 PICurrent (const PICurrent
&) = delete;
105 void operator= (const PICurrent
&) = delete;
108 /// Reference to the orb core.
109 TAO_ORB_Core
&orb_core_
;
111 /// TSS slot assigned to PICurrent_Impl objects in the OrbCore.
112 /// Allocated by the orb_core_.add_tss_cleanup_func() when our
113 /// initialize() method is called.
116 /// The number of allocated PICurrent slots end user wants. (0 is
117 /// uninitialized or PICurrent is not used as no data is to be stored).
118 PortableInterceptor::SlotId slot_count_
;
122 TAO_END_VERSIONED_NAMESPACE_DECL
124 #if defined (__ACE_INLINE__)
125 # include "tao/PI/PICurrent.inl"
126 #endif /* __ACE_INLINE__ */
128 #if defined(_MSC_VER)
130 #endif /* _MSC_VER */
132 #endif /* TAO_HAS_INTERCEPTORS == 1 */
134 #include /**/ "ace/post.h"
136 #endif /* TAO_PI_CURRENT_H */