Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / PI / PICurrent.h
blobd832921457c5298cc96a0da04b3aa13a737ca39d
1 // -*- C++ -*-
3 // ===================================================================
4 /**
5 * @file PICurrent.h
7 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
8 */
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)
19 # 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"
31 #if defined(_MSC_VER)
32 # pragma warning(push)
33 # pragma warning(disable:4250)
34 #endif /* _MSC_VER */
36 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
38 /// Forward declarations.
39 class TAO_ORB_Core;
41 namespace TAO
43 class PICurrent_Impl;
45 /**
46 * @class PICurrent
48 * @brief Implementation of the PortableInterceptor::Current
49 * interface.
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
59 public:
60 /// Constructor.
61 PICurrent (TAO_ORB_Core &orb_core);
63 /**
64 * @name PortableInterceptor::Current Methods
66 * These are methods exposed by the PortableInterceptor::Current
67 * interface.
69 //@{
70 /// Retrieve information stored in the slot table at the given
71 /// SlotId.
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);
77 //@}
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);
94 protected:
95 /// Destructor
96 /**
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;
103 private:
104 PICurrent (const PICurrent &) = delete;
105 void operator= (const PICurrent &) = delete;
107 private:
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.
114 size_t tss_slot_;
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)
129 #pragma warning(pop)
130 #endif /* _MSC_VER */
132 #endif /* TAO_HAS_INTERCEPTORS == 1 */
134 #include /**/ "ace/post.h"
136 #endif /* TAO_PI_CURRENT_H */