Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / DynamicInterface / Server_Request.h
blobe55ba8d9df11dd426384534519038db8851a6cca
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Server_Request.h
7 * Header file for CORBA's Dynamic Server Skeleton Interface's
8 * "Server Request" type.
10 * @author Copyright 1994-1995 by Sun Microsystems
11 * @author Inc. and Chris Cleeland. Modifications by Aniruddha Gokhale based on CORBAv2.2 Feb 98
13 //=============================================================================
15 #ifndef TAO_CORBA_SERVER_REQUEST_H
16 #define TAO_CORBA_SERVER_REQUEST_H
18 #include /**/ "ace/pre.h"
20 #include "tao/DynamicInterface/Context.h"
22 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 # pragma once
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 // To force execution of the static constructor
27 // that registers the dynamic service object.
28 #include "tao/DynamicInterface/Dynamic_Adapter_Impl.h"
30 #include "tao/TAO_Server_Request.h"
31 #include "tao/CDR.h"
32 #include <atomic>
34 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
36 namespace CORBA
38 class ServerRequest;
39 typedef ServerRequest *ServerRequest_ptr;
41 typedef TAO_Pseudo_Var_T<ServerRequest> ServerRequest_var;
42 typedef TAO_Pseudo_Out_T<ServerRequest> ServerRequest_out;
44 /**
45 * @class ServerRequest
47 * @brief Class representing the CORBA ServerRequest pseudo-object.
49 * Instantiated by the POA for DSI requests and passed up
50 * to the application. Contains a reference to the instance
51 * of TAO_ServerRequest that is passed up to the POA from
52 * the ORB.
54 class TAO_DynamicInterface_Export ServerRequest
56 public:
57 /// Constructor.
58 ServerRequest (TAO_ServerRequest &orb_server_request);
60 /// Destructor.
61 ~ServerRequest ();
63 /// Implementation uses this to provide the ORB with the operation's
64 /// parameter list ... on return, their values are available; the
65 /// list fed in has typecodes and (perhap) memory assigned.
66 void arguments (CORBA::NVList_ptr &list);
68 /// Implementation uses this to provide the operation result
69 /// ... illegal if exception() was called or params() was not called.
70 ///
71 /// XXX Implementation should be able to assume response has been
72 /// sent when this returns, and reclaim memory it allocated.
73 void set_result (const CORBA::Any &value);
75 /// Implementation uses this to provide the exception value which is
76 /// the only result of this particular invocation.
77 ///
78 /// XXX Implementation should be able to assume response has been
79 /// sent when this returns, and reclaim memory it allocated.
80 void set_exception (const CORBA::Any &value);
82 // = Get various universal call attributes.
84 // e.g., who made the call, the target of the call, what ORB and OA
85 // that target object uses.
87 // NOTE: none of these report exceptions; unavailability of any of
88 // this stuff is a catastrophic error since this is all part of the
89 // basic CORBA Object Model.
91 /// Marshal outgoing parameters.
92 void dsi_marshal ();
94 /// Accessor for the Context member.
95 CORBA::Context_ptr ctx () const;
97 /// Mutator for the Context member.
98 void ctx (CORBA::Context_ptr);
100 /// Get the operation name.
101 const char *operation () const;
103 // Pseudo object methods.
104 static ServerRequest_ptr _duplicate (ServerRequest_ptr);
105 static ServerRequest_ptr _nil ();
107 // = Reference counting.
108 CORBA::ULong _incr_refcount ();
109 CORBA::ULong _decr_refcount ();
111 /// Set the lazy evaluation flag.
112 void _tao_lazy_evaluation (bool lazy_evaluation);
114 /// Get the byte order of the incoming CDR stream.
115 int _tao_incoming_byte_order () const;
117 /// Set the byte order of the outgoing CDR stream.
118 void _tao_reply_byte_order (int byte_order);
120 /// Return a reference to the underlying TAO_ServerRequest object.
121 TAO_ServerRequest & _tao_server_request ();
123 /// Returns a user exception through a TAO gateway without
124 /// knowing its type.
125 void gateway_exception_reply (ACE_CString &raw_exception);
127 /// Useful for template programming.
128 typedef CORBA::ServerRequest_ptr _ptr_type;
129 typedef CORBA::ServerRequest_var _var_type;
130 typedef CORBA::ServerRequest_out _out_type;
132 private:
133 /// If zero then the NVList is evaluated ASAP.
134 bool lazy_evaluation_;
136 /// Context associated with this request.
137 CORBA::Context_ptr ctx_;
139 /// Incoming parameters.
140 CORBA::NVList_ptr params_;
142 /// Return value.
143 CORBA::Any_ptr retval_;
145 /// Any exception which might be raised.
146 CORBA::Any_ptr exception_;
148 /// Reference counting.
149 std::atomic<uint32_t> refcount_;
151 /// Request from the ORB.
152 TAO_ServerRequest &orb_server_request_;
154 /// Have we sent a user exception obtained from a gateway?
155 bool sent_gateway_exception_;
157 } // End CORBA namespace
159 TAO_END_VERSIONED_NAMESPACE_DECL
161 #if defined (__ACE_INLINE__)
162 # include "tao/DynamicInterface/Server_Request.inl"
163 #endif /* __ACE_INLINE__ */
165 #include /**/ "ace/post.h"
167 #endif /* TAO_CORBA_SERVER_REQUEST_H */