1 // -- PortableServer Include --
2 #include "tao/PortableServer/Object_Adapter.h"
3 #include "tao/PortableServer/POA_Current_Impl.h"
4 #include "tao/PortableServer/Root_POA.h"
6 #include "tao/TSS_Resources.h"
8 #if !defined (__ACE_INLINE__)
9 # include "tao/PortableServer/POA_Current_Impl.inl"
10 #endif /* __ACE_INLINE__ */
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
16 namespace Portable_Server
18 POA_Current_Impl::POA_Current_Impl ()
19 : object_id_ (TAO_POA_OBJECT_ID_BUF_SIZE
, 0, object_id_buf_
),
22 priority_ (TAO_INVALID_PRIORITY
),
23 previous_current_impl_ (0),
29 POA_Current_Impl::setup (::TAO_Root_POA
*p
, const TAO::ObjectKey
&key
)
31 // Remember information about this upcall.
33 this->object_key_
= &key
;
35 // Set the current context and remember the old one.
36 this->tss_resources_
= TAO_TSS_Resources::instance ();
38 this->previous_current_impl_
=
39 static_cast <POA_Current_Impl
*>
40 (this->tss_resources_
->poa_current_impl_
);
41 this->tss_resources_
->poa_current_impl_
= this;
44 this->setup_done_
= true;
48 POA_Current_Impl::previous () const
50 return this->previous_current_impl_
;
54 POA_Current_Impl::teardown ()
56 if (this->setup_done_
)
58 // Reset the old context.
59 this->tss_resources_
->poa_current_impl_
= this->previous_current_impl_
;
63 PortableServer::POA_ptr
64 POA_Current_Impl::get_POA ()
66 return PortableServer::POA::_duplicate (this->poa_
);
69 PortableServer::ObjectId
*
70 POA_Current_Impl::get_object_id ()
72 PortableServer::ObjectId
*objid
= 0;
74 // Create a new one and pass it back
75 ACE_NEW_RETURN (objid
,
76 PortableServer::ObjectId (this->object_id_
),
82 POA_Current_Impl::get_reference ()
84 return this->poa_
->id_to_reference (this->object_id_
);
87 PortableServer::Servant
88 POA_Current_Impl::get_servant ()
90 return this->servant_
;
94 POA_Current_Impl::orb_core () const
97 return this->poa_
->orb_core ();
102 TAO_END_VERSIONED_NAMESPACE_DECL