Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / examples / ORT / Object_Factory_i.cpp
blob867dc575e8563117f931d830c0baabd49cc904fe
1 #include "Object_Factory_i.h"
2 #include "tao/PortableServer/Root_POA.h"
4 Object_Factory_i::Object_Factory_i (CORBA::ORB_ptr orb,
5 PortableServer::POA_ptr gateway_poa)
6 : orb_ (CORBA::ORB::_duplicate (orb)),
7 gateway_poa_ (gateway_poa)
9 /// Constructor
13 CORBA::Object_ptr
14 Object_Factory_i::create_object (const char *interface_repository_id,
15 CORBA::Object_ptr gatewayed_object)
17 CORBA::String_var stringified_object =
18 this->orb_->object_to_string (gatewayed_object);
20 const PortableServer::ObjectId_var id =
21 PortableServer::string_to_ObjectId (stringified_object.in ());
23 const PortableInterceptor::ObjectId *obj_id =
24 reinterpret_cast<const PortableInterceptor::ObjectId *> (&id.in ());
25 ACE_UNUSED_ARG(obj_id);
26 ACE_UNUSED_ARG(interface_repository_id);
28 TAO_POA *poa = dynamic_cast <TAO_POA *> (this->gateway_poa_);
30 PortableInterceptor::ObjectReferenceTemplate *ort_template =
31 poa->get_adapter_template();
33 TAO_ObjectReferenceTemplate *ort =
34 dynamic_cast <TAO_ObjectReferenceTemplate *> (ort_template);
36 CORBA::Object_ptr object_ptr =
37 ort->make_object (interface_repository_id,
38 *obj_id);
41 return CORBA::Object::_nil();