00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file PICurrent_Guard.h 00006 * 00007 * $Id: PICurrent_Guard.h 73264 2006-06-26 09:26:36Z sma $ 00008 * 00009 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00010 */ 00011 // =================================================================== 00012 00013 #ifndef TAO_PI_CURRENT_GUARD_H 00014 #define TAO_PI_CURRENT_GUARD_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/PI_Server/pi_server_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/orbconf.h" 00025 00026 #if TAO_HAS_INTERCEPTORS == 1 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 /// Forward declarations. 00031 class TAO_ServerRequest; 00032 00033 namespace TAO 00034 { 00035 class PICurrent_Impl; 00036 00037 /** 00038 * @class PICurrent_Guard 00039 * 00040 * @brief Class used to make copying between request scope current 00041 * and thread scope current exception-safe. 00042 * 00043 * Since copies between the request scope current and thread scope 00044 * current must also occur if an exception is thrown, e.g. made 00045 * available to the send_exception() interception points, the 00046 * "guard" idiom is used to make this action exception-safe. 00047 * 00048 * @note This Guard class is only used on the server side. 00049 */ 00050 class PICurrent_Guard 00051 { 00052 public: 00053 00054 /// Constructor 00055 /** 00056 * This constructor sets up this guard to copy the data held in a 00057 * given PICurrent when transitioning from that PICurrent's scope 00058 * to another scope (e.g. request scope to thread scope transition 00059 * immediately following receive_request_service_contexts() on 00060 * server side). 00061 * 00062 * @param tsc_to_rsc true when copying TSC slot table to RSC slot 00063 * table, i.e. after target operation 00064 * completes. 00065 */ 00066 PICurrent_Guard (TAO_ServerRequest &server_request, 00067 bool tsc_to_rsc); 00068 00069 /// Destructor 00070 /** 00071 * The destructor copies (a logical copy whenever possible) data 00072 * held in a given PICurrent when transitioning from one PICurrent 00073 * scope to another immediately before any ending interception 00074 * points are invoked, and after the starting and intermediate (if 00075 * any) interception points are invoked. 00076 */ 00077 ~PICurrent_Guard (void); 00078 00079 private: 00080 00081 /// The PICurrent implementation whose slot table will be copied. 00082 PICurrent_Impl *src_; 00083 00084 /// The PICurrent implementation whose slot table will be filled 00085 /// with the contents of another PICurrent's slot table. 00086 PICurrent_Impl *dest_; 00087 }; 00088 } 00089 00090 TAO_END_VERSIONED_NAMESPACE_DECL 00091 00092 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00093 00094 #include /**/ "ace/post.h" 00095 00096 #endif /* TAO_PI_CURRENT_GUARD_H */