00001
00002
00003
00004 #include "tao/PortableServer/Object_Adapter.h"
00005 #include "tao/PortableServer/POA_Current_Impl.h"
00006 #include "tao/PortableServer/Root_POA.h"
00007
00008 #include "tao/TSS_Resources.h"
00009
00010 #if !defined (__ACE_INLINE__)
00011 # include "tao/PortableServer/POA_Current_Impl.inl"
00012 #endif
00013
00014 ACE_RCSID (PortableServer,
00015 POA_Current_IMpl,
00016 "POA_Current_Impl.cpp,v 1.10 2006/03/10 07:19:13 jtc Exp")
00017
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 namespace TAO
00021 {
00022 namespace Portable_Server
00023 {
00024 POA_Current_Impl::POA_Current_Impl (void)
00025 : poa_ (0),
00026 object_id_ (),
00027 object_key_ (0),
00028 servant_ (0),
00029 priority_ (TAO_INVALID_PRIORITY),
00030 previous_current_impl_ (0),
00031 setup_done_ (0)
00032 {
00033 }
00034
00035 void
00036 POA_Current_Impl::setup (::TAO_Root_POA *p,
00037 const TAO::ObjectKey &key)
00038 {
00039
00040 this->poa_ = p;
00041 this->object_key_ = &key;
00042
00043
00044 this->tss_resources_ = TAO_TSS_Resources::instance ();
00045
00046 this->previous_current_impl_ =
00047 static_cast <POA_Current_Impl *>
00048 (this->tss_resources_->poa_current_impl_);
00049 this->tss_resources_->poa_current_impl_ = this;
00050
00051
00052 this->setup_done_ = 1;
00053 }
00054
00055 POA_Current_Impl *
00056 POA_Current_Impl::previous (void) const
00057 {
00058 return this->previous_current_impl_;
00059 }
00060
00061 void
00062 POA_Current_Impl::teardown (void)
00063 {
00064 if (this->setup_done_)
00065 {
00066
00067 this->tss_resources_->poa_current_impl_ = this->previous_current_impl_;
00068 }
00069 }
00070
00071 PortableServer::POA_ptr
00072 POA_Current_Impl::get_POA (void)
00073 {
00074 return PortableServer::POA::_duplicate (this->poa_);
00075 }
00076
00077 PortableServer::ObjectId *
00078 POA_Current_Impl::get_object_id (void)
00079 {
00080 PortableServer::ObjectId *objid = 0;
00081
00082
00083 ACE_NEW_RETURN (objid,
00084 PortableServer::ObjectId (this->object_id_),
00085 0);
00086 return objid;
00087 }
00088
00089 CORBA::Object_ptr
00090 POA_Current_Impl::get_reference (void)
00091 {
00092 return this->poa_->id_to_reference (this->object_id_);
00093 }
00094
00095 PortableServer::Servant
00096 POA_Current_Impl::get_servant (void)
00097 {
00098 return this->servant_;
00099 }
00100
00101 TAO_ORB_Core &
00102 POA_Current_Impl::orb_core (void) const
00103
00104 {
00105 return this->poa_->orb_core ();
00106 }
00107 }
00108 }
00109
00110 TAO_END_VERSIONED_NAMESPACE_DECL