Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / ObjRefTemplate / ORT_Adapter_Impl.cpp
blobecdfb1afed641e297512cc2934b2081b5046b7c0
1 #include "tao/ObjRefTemplate/ORT_Adapter_Impl.h"
2 #include "tao/PortableServer/Root_POA.h"
3 #include "tao/CORBA_String.h"
4 #include "tao/ORB_Constants.h"
5 #include "tao/CORBA_methods.h"
7 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
9 char *
10 TAO::ORT_Adapter_Impl::tao_server_id ()
12 // No need to duplicate, the ort_template_ method has to do the duplicate
13 return this->ort_template_->server_id ();
16 char *
17 TAO::ORT_Adapter_Impl::tao_orb_id ()
19 // No need to duplicate, the ort_template_ method has to do the duplicate
20 return this->ort_template_->orb_id ();
23 PortableInterceptor::AdapterName *
24 TAO::ORT_Adapter_Impl::tao_adapter_name ()
26 // No need to duplicate, the ort_template_ method has to do the duplicate
27 return this->ort_template_->adapter_name ();
30 CORBA::Object_ptr
31 TAO::ORT_Adapter_Impl::make_object (const char *repo_id,
32 const PortableInterceptor::ObjectId &id)
34 return this->ort_factory_->make_object (repo_id, id);
37 PortableInterceptor::ObjectReferenceTemplate *
38 TAO::ORT_Adapter_Impl::get_adapter_template ()
40 CORBA::add_ref (this->ort_template_.in ());
42 return this->ort_template_;
45 PortableInterceptor::ObjectReferenceFactory *
46 TAO::ORT_Adapter_Impl::get_obj_ref_factory ()
48 CORBA::add_ref (this->ort_factory_.in ());
50 return this->ort_factory_;
53 int
54 TAO::ORT_Adapter_Impl::set_obj_ref_factory (
55 PortableInterceptor::ObjectReferenceFactory *cf)
57 this->ort_factory_ = cf;
59 CORBA::add_ref (this->ort_factory_.in ());
61 return 0;
64 void
65 TAO::ORT_Adapter_Impl::release (
66 PortableInterceptor::ObjectReferenceTemplate * t)
68 CORBA::remove_ref (t);
71 int
72 TAO::ORT_Adapter_Impl::activate (
73 const char *server_id,
74 const char *orb_id,
75 PortableInterceptor::AdapterName *adapter_name,
76 PortableServer::POA_ptr poa)
78 // No need to lock here, there is one instance for each POA and
79 // when the POA creates and actives an ORT_Adapter it will lock
80 // itself. Create an ObjectReferenceTemplate for this POA.
82 ObjectReferenceTemplate * t = 0;
83 ACE_NEW_THROW_EX (t,
84 ObjectReferenceTemplate (server_id,
85 orb_id,
86 adapter_name,
87 poa),
88 CORBA::NO_MEMORY ());
90 this->ort_template_ = t;
92 // Must increase ref count since this->ort_factory_ will
93 // decrease it upon destruction.
94 CORBA::add_ref (t);
95 this->ort_factory_ = t;
97 return 0;
100 TAO_END_VERSIONED_NAMESPACE_DECL