3 //=============================================================================
5 * @file POA_Current_Impl.h
7 * @author Irfan Pyarali
9 //=============================================================================
11 #ifndef TAO_POA_CURRENT_IMPL_H
12 #define TAO_POA_CURRENT_IMPL_H
14 #include /**/ "ace/pre.h"
16 #include "tao/PortableServer/portableserver_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/PortableServer/PS_ForwardC.h"
24 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
26 #ifndef TAO_POA_OBJECT_ID_BUF_SIZE
27 #define TAO_POA_OBJECT_ID_BUF_SIZE 512
28 #endif /* TAO_POA_OBJECT_ID_BUF_SIZE */
32 namespace Portable_Server
34 class Non_Servant_Upcall
;
41 class TAO_TSS_Resources
;
45 namespace Portable_Server
48 * @class POA_Current_Impl
50 * @brief Implementation of the PortableServer::Current object.
52 * Objects of this class hold state information regarding the
53 * current POA invocation. Savvy readers will notice that this
54 * contains substantially more methods than the POA spec shows;
55 * they exist because the ORB either (a) needs them or (b) finds
56 * them useful for implementing a more efficient ORB.
57 * The intent is that instances of this class are held in
58 * Thread-Specific Storage so that upcalls can get context
59 * information regarding their invocation. The POA itself must
60 * insure that all <set_*> operations are performed in the
61 * execution thread so that the proper <TAO_POA_Current> pointer
62 * is obtained from TSS.
64 class TAO_PortableServer_Export POA_Current_Impl
67 friend class ::TAO_Root_POA
;
69 /// Return pointer to the invoking POA. Raises the
70 /// CORBA::NoContext exception.
71 PortableServer::POA_ptr
get_POA ();
74 * Return pointer to the object id through which this was invoked.
75 * This may be necessary in cases where a <Servant> is serving under
76 * the guise of multiple object ids.
78 PortableServer::ObjectId
*get_object_id ();
81 * Returns a reference to the servant that hosts the object in whose
82 * context it is called.
84 PortableServer::Servant
get_servant ();
87 * This operation returns a locally manufactured reference to the object
88 * in the context of which it is called.
90 CORBA::Object_ptr
get_reference ();
92 /// Set the POA implementation.
93 void poa (::TAO_Root_POA
*);
95 /// Get the POA implemantation
96 ::TAO_Root_POA
*poa () const;
98 /// ORB Core for this current.
99 TAO_ORB_Core
&orb_core () const;
101 /// Set the object ID.
102 void object_id (const PortableServer::ObjectId
&id
);
104 /// Get the object ID.
105 const PortableServer::ObjectId
&object_id () const;
107 /// Just replace the object id smartly
108 void replace_object_id (const PortableServer::ObjectId
&system_id
);
110 /// Set the object key.
111 void object_key (const TAO::ObjectKey
&key
);
113 /// Get the object key.
114 const TAO::ObjectKey
&object_key () const;
116 /// Set the servant for the current upcall.
117 void servant (PortableServer::Servant servant
);
119 /// Get the servant for the current upcall.
120 PortableServer::Servant
servant () const;
122 /// Set the priority for the current upcall.
123 void priority (CORBA::Short priority
);
125 /// Get the priority for the current upcall.
126 CORBA::Short
priority () const;
128 /// Convenience constructor combining construction & initialization.
131 /// Return the previous current implementation.
132 POA_Current_Impl
*previous () const;
134 /// Teardown the current for this request.
137 /// Setup the current.
138 void setup (::TAO_Root_POA
*impl
, const TAO::ObjectKey
&key
);
141 // = Hidden because we don't allow these
142 POA_Current_Impl (const POA_Current_Impl
&);
143 void operator= (const POA_Current_Impl
&);
146 /// The POA implementation invoking an upcall
147 ::TAO_Root_POA
*poa_
{};
149 /// In order to avoid memory allocations, we will populate
150 /// the object id with this buffer.
151 CORBA::Octet object_id_buf_
[TAO_POA_OBJECT_ID_BUF_SIZE
];
154 * The object ID of the current context. This is the user id and
155 * not the id the goes into the IOR. Note also that unlike the
156 * @c object_key, this field is stored by value.
158 PortableServer::ObjectId object_id_
;
160 /// The object key of the current context.
161 const TAO::ObjectKey
*object_key_
;
163 /// The servant for the current upcall.
164 PortableServer::Servant servant_
;
166 /// The priority for the current upcall.
167 CORBA::Short priority_
;
169 /// Current previous from <this>.
170 POA_Current_Impl
*previous_current_impl_
;
172 /// Is setup complete?
175 /// Pointer to tss resources.
176 TAO_TSS_Resources
*tss_resources_
;
181 TAO_END_VERSIONED_NAMESPACE_DECL
183 #if defined (__ACE_INLINE__)
184 # include "tao/PortableServer/POA_Current_Impl.inl"
185 #endif /* __ACE_INLINE__ */
187 #include /**/ "ace/post.h"
189 #endif /* TAO_POA_CURRENT_IMPL_H */