Server_Request.h

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

Generated on Thu Nov 9 13:04:21 2006 for TAO_DynamicInterface by doxygen 1.3.6