00001 // $Id: POA_Current.cpp 76995 2007-02-11 12:51:42Z johnnyw $ 00002 00003 // -- PortableServer Include -- 00004 #include "tao/PortableServer/POA_Current.h" 00005 #include "tao/PortableServer/POA_Current_Impl.h" 00006 00007 // -- TAO Include -- 00008 #include "tao/TSS_Resources.h" 00009 00010 ACE_RCSID (PortableServer, 00011 POA_Current, 00012 "$Id: POA_Current.cpp 76995 2007-02-11 12:51:42Z johnnyw $") 00013 00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 namespace TAO 00017 { 00018 namespace Portable_Server 00019 { 00020 PortableServer::POA_ptr 00021 POA_Current::get_POA (void) 00022 { 00023 POA_Current_Impl *impl = this->implementation (); 00024 00025 if (impl == 0) 00026 throw PortableServer::Current::NoContext (); 00027 return impl->get_POA (); 00028 } 00029 00030 PortableServer::ObjectId * 00031 POA_Current::get_object_id (void) 00032 { 00033 POA_Current_Impl *impl = this->implementation (); 00034 00035 if (impl == 0) 00036 throw PortableServer::Current::NoContext (); 00037 return impl->get_object_id (); 00038 } 00039 00040 PortableServer::Servant 00041 POA_Current::get_servant (void) 00042 { 00043 POA_Current_Impl *impl = this->implementation (); 00044 00045 if (impl == 0) 00046 throw PortableServer::Current::NoContext (); 00047 return impl->get_servant (); 00048 } 00049 00050 CORBA::Object_ptr 00051 POA_Current::get_reference (void) 00052 { 00053 POA_Current_Impl *impl = this->implementation (); 00054 00055 if (impl == 0) 00056 throw PortableServer::Current::NoContext (); 00057 return impl->get_reference (); 00058 } 00059 00060 POA_Current_Impl * 00061 POA_Current::implementation (void) 00062 { 00063 return static_cast <POA_Current_Impl *> 00064 (TAO_TSS_Resources::instance ()->poa_current_impl_); 00065 } 00066 00067 POA_Current_Impl * 00068 POA_Current::implementation (POA_Current_Impl *new_current) 00069 { 00070 TAO_TSS_Resources *tss = TAO_TSS_Resources::instance (); 00071 00072 POA_Current_Impl *old = 00073 static_cast <POA_Current_Impl *> 00074 (tss->poa_current_impl_); 00075 tss->poa_current_impl_ = new_current; 00076 return old; 00077 } 00078 } 00079 } 00080 00081 TAO_END_VERSIONED_NAMESPACE_DECL