Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tao / PI_Server / PICurrent_Guard.h
blob3f26e0f8604e79d7cc38a4bf5c49f4ae2f3478d9
1 // -*- C++ -*-
3 // ===================================================================
4 /**
5 * @file PICurrent_Guard.h
7 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
8 */
9 // ===================================================================
11 #ifndef TAO_PI_CURRENT_GUARD_H
12 #define TAO_PI_CURRENT_GUARD_H
14 #include /**/ "ace/pre.h"
16 #include "tao/PI_Server/pi_server_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/orbconf.h"
24 #if TAO_HAS_INTERCEPTORS == 1
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
28 /// Forward declarations.
29 class TAO_ServerRequest;
31 namespace TAO
33 class PICurrent_Impl;
35 /**
36 * @class PICurrent_Guard
38 * @brief Class used to make copying between request scope current
39 * and thread scope current exception-safe.
41 * Since copies between the request scope current and thread scope
42 * current must also occur if an exception is thrown, e.g. made
43 * available to the send_exception() interception points, the
44 * "guard" idiom is used to make this action exception-safe.
46 * @note This Guard class is only used on the server side.
48 class PICurrent_Guard
50 public:
51 /// Constructor
52 /**
53 * This constructor sets up this guard to copy the data held in a
54 * given PICurrent when transitioning from that PICurrent's scope
55 * to another scope (e.g. request scope to thread scope transition
56 * immediately following receive_request_service_contexts() on
57 * server side).
59 * @param tsc_to_rsc true when copying TSC slot table to RSC slot
60 * table, i.e. after target operation
61 * completes.
63 PICurrent_Guard (TAO_ServerRequest &server_request,
64 bool tsc_to_rsc);
66 /// Destructor
67 /**
68 * The destructor copies (a logical copy whenever possible) data
69 * held in a given PICurrent when transitioning from one PICurrent
70 * scope to another immediately before any ending interception
71 * points are invoked, and after the starting and intermediate (if
72 * any) interception points are invoked.
74 ~PICurrent_Guard ();
76 private:
77 /// The PICurrent implementation whose slot table will be copied.
78 PICurrent_Impl *src_;
80 /// The PICurrent implementation whose slot table will be filled
81 /// with the contents of another PICurrent's slot table.
82 PICurrent_Impl *dest_;
86 TAO_END_VERSIONED_NAMESPACE_DECL
88 #endif /* TAO_HAS_INTERCEPTORS == 1 */
90 #include /**/ "ace/post.h"
92 #endif /* TAO_PI_CURRENT_GUARD_H */