00001
00002
00003
00004 #include "tao/PortableServer/POA_Current.h"
00005 #include "tao/PortableServer/POA_Current_Impl.h"
00006
00007
00008 #include "tao/TSS_Resources.h"
00009
00010 ACE_RCSID (PortableServer,
00011 POA_Current,
00012 "POA_Current.cpp,v 1.7 2006/03/10 07:19:13 jtc Exp")
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 (ACE_ENV_SINGLE_ARG_DECL)
00022 ACE_THROW_SPEC ((CORBA::SystemException,
00023 PortableServer::Current::NoContext))
00024 {
00025 POA_Current_Impl *impl = this->implementation ();
00026
00027 if (impl == 0)
00028 ACE_THROW_RETURN (PortableServer::Current::NoContext (),
00029 0);
00030 return impl->get_POA ();
00031 }
00032
00033 PortableServer::ObjectId *
00034 POA_Current::get_object_id (ACE_ENV_SINGLE_ARG_DECL)
00035 ACE_THROW_SPEC ((CORBA::SystemException,
00036 PortableServer::Current::NoContext))
00037 {
00038 POA_Current_Impl *impl = this->implementation ();
00039
00040 if (impl == 0)
00041 ACE_THROW_RETURN (PortableServer::Current::NoContext (),
00042 0);
00043 return impl->get_object_id ();
00044 }
00045
00046 PortableServer::Servant
00047 POA_Current::get_servant (ACE_ENV_SINGLE_ARG_DECL)
00048 ACE_THROW_SPEC ((CORBA::SystemException,
00049 PortableServer::Current::NoContext))
00050 {
00051 POA_Current_Impl *impl = this->implementation ();
00052
00053 if (impl == 0)
00054 ACE_THROW_RETURN (PortableServer::Current::NoContext (),
00055 0);
00056 return impl->get_servant ();
00057 }
00058
00059 CORBA::Object_ptr
00060 POA_Current::get_reference (ACE_ENV_SINGLE_ARG_DECL)
00061 ACE_THROW_SPEC ((CORBA::SystemException,
00062 PortableServer::Current::NoContext))
00063 {
00064 POA_Current_Impl *impl = this->implementation ();
00065
00066 if (impl == 0)
00067 ACE_THROW_RETURN (PortableServer::Current::NoContext (),
00068 0);
00069 return impl->get_reference ();
00070 }
00071
00072 POA_Current_Impl *
00073 POA_Current::implementation (void)
00074 {
00075 return static_cast <POA_Current_Impl *>
00076 (TAO_TSS_Resources::instance ()->poa_current_impl_);
00077 }
00078
00079 POA_Current_Impl *
00080 POA_Current::implementation (POA_Current_Impl *new_current)
00081 {
00082 TAO_TSS_Resources *tss =
00083 TAO_TSS_Resources::instance ();
00084
00085 POA_Current_Impl *old =
00086 static_cast <POA_Current_Impl *>
00087 (tss->poa_current_impl_);
00088 tss->poa_current_impl_ = new_current;
00089 return old;
00090 }
00091 }
00092 }
00093
00094 TAO_END_VERSIONED_NAMESPACE_DECL