2 #include "tao/PI_Server/PICurrent_Guard.h"
4 #if TAO_HAS_INTERCEPTORS == 1
6 #include "tao/ORB_Core.h"
7 #include "tao/TAO_Server_Request.h"
8 #include "tao/PI/PICurrent.h"
9 #include "tao/PI/PICurrent_Impl.h"
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO::PICurrent_Guard::PICurrent_Guard (TAO_ServerRequest
&server_request
,
18 // This constructor is used on the server side.
20 // Retrieve the thread scope current (no TSS access incurred yet).
21 CORBA::Object_ptr pi_current_obj
=
22 server_request
.orb_core ()->pi_current ();
24 TAO::PICurrent
*pi_current
=
25 dynamic_cast <TAO::PICurrent
*> (pi_current_obj
);
27 // If the slot count is zero, there is nothing to copy. Prevent any
28 // copying (and hence TSS accesses) from occurring.
29 if (pi_current
!= 0 && pi_current
->slot_count () != 0)
31 // Retrieve the request scope current.
32 PICurrent_Impl
* rsc
= server_request
.rs_pi_current ();
34 // Retrieve the thread scope current.
35 PICurrent_Impl
* tsc
= pi_current
->tsc ();
40 // Occurs after receive_request() interception point and
48 // Occurs after receive_request_service_contexts()
49 // interception point.
56 TAO::PICurrent_Guard::~PICurrent_Guard ()
58 if (this->src_
!= 0 && this->dest_
!= 0
59 && this->src_
!= this->dest_
)
61 this->dest_
->take_lazy_copy (this->src_
);
65 TAO_END_VERSIONED_NAMESPACE_DECL
67 #endif /* TAO_HAS_INTERCEPTORS == 1 */