00001 #include "tao/PI_Server/PICurrent_Guard.h"
00002
00003 #if TAO_HAS_INTERCEPTORS == 1
00004
00005
00006 ACE_RCSID (PortableServer,
00007 PICurrent_Guard,
00008 "PICurrent_Guard.cpp,v 1.6 2006/06/26 09:24:20 sma Exp")
00009
00010
00011 #include "tao/ORB_Core.h"
00012 #include "tao/TAO_Server_Request.h"
00013 #include "tao/PI/PICurrent.h"
00014 #include "tao/PI/PICurrent_Impl.h"
00015
00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00017
00018 TAO::PICurrent_Guard::PICurrent_Guard (TAO_ServerRequest &server_request,
00019 bool tsc_to_rsc)
00020 : src_ (0),
00021 dest_ (0)
00022 {
00023
00024
00025
00026 CORBA::Object_ptr pi_current_obj =
00027 server_request.orb_core ()->pi_current ();
00028
00029 TAO::PICurrent *pi_current =
00030 dynamic_cast <TAO::PICurrent*> (pi_current_obj);
00031
00032
00033
00034 if (pi_current != 0 && pi_current->slot_count () != 0)
00035 {
00036
00037 PICurrent_Impl * rsc = server_request.rs_pi_current ();
00038
00039
00040 PICurrent_Impl * tsc = pi_current->tsc ();
00041
00042 if (tsc_to_rsc)
00043 {
00044
00045
00046
00047 this->src_ = tsc;
00048 this->dest_ = rsc;
00049 }
00050 else
00051 {
00052
00053
00054
00055 this->src_ = rsc;
00056 this->dest_ = tsc;
00057 }
00058 }
00059 }
00060
00061 TAO::PICurrent_Guard::~PICurrent_Guard (void)
00062 {
00063 if (this->src_ != 0 && this->dest_ != 0
00064 && this->src_ != this->dest_)
00065 {
00066 this->dest_->take_lazy_copy (this->src_);
00067 }
00068 }
00069
00070 TAO_END_VERSIONED_NAMESPACE_DECL
00071
00072 #endif