00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Server_Request.h 00006 * 00007 * $Id: Server_Request.h 78631 2007-06-28 13:49:10Z johnnyw $ 00008 * 00009 * Header file for CORBA's Dynamic Server Skeleton Interface's 00010 * "Server Request" type. 00011 * 00012 * 00013 * @author Copyright 1994-1995 by Sun Microsystems 00014 * @author Inc. and Chris Cleeland. Modifications by Aniruddha Gokhale based on CORBAv2.2 Feb 98 00015 */ 00016 //============================================================================= 00017 00018 00019 #ifndef TAO_CORBA_SERVER_REQUEST_H 00020 #define TAO_CORBA_SERVER_REQUEST_H 00021 00022 #include /**/ "ace/pre.h" 00023 00024 #include "tao/DynamicInterface/Context.h" 00025 00026 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00027 # pragma once 00028 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00029 00030 // To force execution of the static constructor 00031 // that registers the dynamic service object. 00032 #include "tao/DynamicInterface/Dynamic_Adapter_Impl.h" 00033 00034 #include "tao/TAO_Server_Request.h" 00035 #include "tao/CDR.h" 00036 #include "ace/Atomic_Op.h" 00037 00038 #if defined (TAO_EXPORT_MACRO) 00039 #undef TAO_EXPORT_MACRO 00040 #endif 00041 #define TAO_EXPORT_MACRO TAO_DynamicInterface_Export 00042 00043 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00044 00045 namespace CORBA 00046 { 00047 class ServerRequest; 00048 typedef ServerRequest *ServerRequest_ptr; 00049 00050 TAO_NAMESPACE_INLINE_FUNCTION void release (ServerRequest_ptr); 00051 TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ServerRequest_ptr); 00052 00053 typedef TAO_Pseudo_Var_T<ServerRequest> ServerRequest_var; 00054 typedef TAO_Pseudo_Out_T<ServerRequest> ServerRequest_out; 00055 00056 /** 00057 * @class ServerRequest 00058 * 00059 * @brief Class representing the CORBA ServerRequest pseudo-object. 00060 * 00061 * Instantiated by the POA for DSI requests and passed up 00062 * to the application. Contains a reference to the instance 00063 * of TAO_ServerRequest that is passed up to the POA from 00064 * the ORB. 00065 */ 00066 class TAO_DynamicInterface_Export ServerRequest 00067 { 00068 public: 00069 /// Constructor. 00070 ServerRequest (TAO_ServerRequest &orb_server_request); 00071 00072 /// Destructor. 00073 ~ServerRequest (void); 00074 00075 /// Implementation uses this to provide the ORB with the operation's 00076 /// parameter list ... on return, their values are available; the 00077 /// list fed in has typecodes and (perhap) memory assigned. 00078 void arguments (CORBA::NVList_ptr &list); 00079 00080 /// Implementation uses this to provide the operation result 00081 /// ... illegal if exception() was called or params() was not called. 00082 /// 00083 /// XXX Implementation should be able to assume response has been 00084 /// sent when this returns, and reclaim memory it allocated. 00085 void set_result (const CORBA::Any &value); 00086 00087 /// Implementation uses this to provide the exception value which is 00088 /// the only result of this particular invocation. 00089 /// 00090 /// XXX Implementation should be able to assume response has been 00091 /// sent when this returns, and reclaim memory it allocated. 00092 void set_exception (const CORBA::Any &value); 00093 00094 // = Get various universal call attributes. 00095 00096 // e.g., who made the call, the target of the call, what ORB and OA 00097 // that target object uses. 00098 // 00099 // NOTE: none of these report exceptions; unavailability of any of 00100 // this stuff is a catastrophic error since this is all part of the 00101 // basic CORBA Object Model. 00102 00103 /// Marshal outgoing parameters. 00104 void dsi_marshal (void); 00105 00106 /// Accessor for the Context member. 00107 CORBA::Context_ptr ctx (void) const; 00108 00109 /// Mutator for the Context member. 00110 void ctx (CORBA::Context_ptr); 00111 00112 /// Get the operation name. 00113 const char *operation (void) const; 00114 00115 // Pseudo object methods. 00116 static ServerRequest_ptr _duplicate (ServerRequest_ptr); 00117 static ServerRequest_ptr _nil (void); 00118 00119 // = Reference counting. 00120 CORBA::ULong _incr_refcnt (void); 00121 CORBA::ULong _decr_refcnt (void); 00122 00123 /// Set the lazy evaluation flag. 00124 void _tao_lazy_evaluation (bool lazy_evaluation); 00125 00126 /// Get the byte order of the incoming CDR stream. 00127 int _tao_incoming_byte_order (void) const; 00128 00129 /// Set the byte order of the outgoing CDR stream. 00130 void _tao_reply_byte_order (int byte_order); 00131 00132 /// Return a reference to the underlying TAO_ServerRequest object. 00133 TAO_ServerRequest & _tao_server_request (void); 00134 00135 /// Returns a user exception through a TAO gateway without 00136 /// knowing its type. 00137 void gateway_exception_reply (ACE_CString &raw_exception); 00138 00139 /// Useful for template programming. 00140 typedef CORBA::ServerRequest_ptr _ptr_type; 00141 typedef CORBA::ServerRequest_var _var_type; 00142 typedef CORBA::ServerRequest_out _out_type; 00143 00144 private: 00145 /// If zero then the NVList is evaluated ASAP. 00146 bool lazy_evaluation_; 00147 00148 /// Context associated with this request. 00149 CORBA::Context_ptr ctx_; 00150 00151 /// Incoming parameters. 00152 CORBA::NVList_ptr params_; 00153 00154 /// Return value. 00155 CORBA::Any_ptr retval_; 00156 00157 /// Any exception which might be raised. 00158 CORBA::Any_ptr exception_; 00159 00160 /// Reference counting. 00161 ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_; 00162 00163 /// Request from the ORB. 00164 TAO_ServerRequest &orb_server_request_; 00165 00166 /// Have we sent a user exception obtained from a gateway? 00167 bool sent_gateway_exception_; 00168 }; 00169 } // End CORBA namespace 00170 00171 TAO_END_VERSIONED_NAMESPACE_DECL 00172 00173 #if defined (__ACE_INLINE__) 00174 # include "tao/DynamicInterface/Server_Request.inl" 00175 #endif /* __ACE_INLINE__ */ 00176 00177 #include /**/ "ace/post.h" 00178 00179 #endif /* TAO_CORBA_SERVER_REQUEST_H */