00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_FW_Server_Request_Wrapper.h 00006 * 00007 * $Id: CSD_FW_Server_Request_Wrapper.h 76551 2007-01-24 13:42:44Z johnnyw $ 00008 * 00009 * @author Tim Bradley <bradley_t@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_CSD_FW_SERVER_REQUEST_WRAPPER_H 00014 #define TAO_CSD_FW_SERVER_REQUEST_WRAPPER_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CSD_Framework/CSD_FW_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/TAO_Server_Request.h" 00025 #include "tao/operation_details.h" 00026 #include "tao/PortableServer/Servant_Base.h" 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 namespace TAO 00031 { 00032 namespace CSD 00033 { 00034 00035 /** 00036 * @class FW_Server_Request_Wrapper 00037 * 00038 * @brief Wrapper around a TAO_Server_Request that will be cloned 00039 * at the proper time. 00040 * 00041 * This CSD Framework class is used to provide an interface to a 00042 * TAO_ServerRequest object such that it can be used for CSD strategies 00043 * that need to clone TAO_Server_Requests (ie, so that they may be 00044 * placed on a queue to be dispatched by another thread). 00045 * 00046 * There are several purposes for this class, with the main thing being 00047 * that the TAO_ServerRequest object is not used directly by the 00048 * CSD Strategies since it is, after all, an internal TAO class that was 00049 * never meant to be exposed. Future changes to TAO's internal design 00050 * may cause disruption in the TAO_ServerRequest class. These changes 00051 * would only need to be accounted for here in this 00052 * FW_Server_Request_Wrapper class' implementation, and all CSD 00053 * Strategies will work again. It's a maintenance issue. 00054 * 00055 * @note: The CSD namespace is inside of TAO namespace in current 00056 * implementation. This can be changed but, at least for now, it's 00057 * already been delivered to some customs, we leave it as-is. If it 00058 * needs to change, we will make this change. 00059 */ 00060 class TAO_CSD_FW_Export FW_Server_Request_Wrapper 00061 { 00062 public: 00063 00064 /// Constructor. 00065 FW_Server_Request_Wrapper(TAO_ServerRequest& server_request); 00066 00067 /// Destructor. 00068 ~FW_Server_Request_Wrapper(); 00069 00070 /// Perform the clone operation. 00071 void clone(); 00072 00073 /// Dispatch the request to the servant. 00074 void dispatch(PortableServer::Servant servant); 00075 00076 /// Cancel the request. 00077 void cancel(); 00078 00079 00080 private: 00081 00082 /// Create a deep copy of the request_ object. 00083 /// The other clone methods are used to support the TAO_ServerRequest clone. 00084 TAO_ServerRequest* clone (TAO_ServerRequest*& from); 00085 00086 /// Clone an input cdr stream. 00087 TAO_InputCDR* clone (TAO_InputCDR*& from); 00088 00089 /// Create a deep copy of a TAO_Operation_Details object and marshall 00090 /// the arguments into a TAO_InputCDR stream. The cloned TAO_Operation_Details 00091 /// object is created without any arguments. This would help the skeleton 00092 /// code to determine whether the arguments are in the operation_details_ 00093 /// object or should be demarshalled from the incoming_ stream in the request_ 00094 /// object. 00095 bool clone (TAO_Operation_Details const *& from, 00096 TAO_Operation_Details const *& to, 00097 TAO_InputCDR* & cdr); 00098 00099 /// Clone the TAO_Tagged_Profile object. 00100 void clone (TAO_Tagged_Profile& from, TAO_Tagged_Profile& to); 00101 00102 /// Clone the TAO_Service_Context object. 00103 void clone (TAO_Service_Context& from, TAO_Service_Context& to); 00104 00105 /// Create a TAO_OutputCDR stream initialized with a heap allocated 00106 /// buffer. 00107 TAO_OutputCDR* create_new_output_cdr (); 00108 00109 /// A flag that indicates that the TAO_ServerRequest object 00110 /// is already cloned. 00111 bool is_clone_; 00112 00113 /// Pointer to the underlying TAO_ServerRequest object. 00114 TAO_ServerRequest* request_; 00115 }; 00116 00117 } 00118 } 00119 00120 TAO_END_VERSIONED_NAMESPACE_DECL 00121 00122 #if defined (__ACE_INLINE__) 00123 # include "tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.inl" 00124 #endif /* __ACE_INLINE__ */ 00125 00126 #include /**/ "ace/post.h" 00127 00128 #endif /* TAO_CSD_FW_SERVER_REQUEST_WRAPPER_H */