Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / DevGuideExamples / AMH_AMI / middle_i.cpp
blobd73572dff9aaaf93a295c1ef21608aa49f1e7c3b
1 #include "amh_ami_pch.h"
2 /* -*- C++ -*- */
4 // ****** Code generated by the The ACE ORB (TAO) IDL Compiler *******
5 // TAO and the TAO IDL Compiler have been developed by the Center for
6 // Distributed Object Computing at Washington University, St. Louis.
7 //
8 // Information about TAO is available at:
9 // http://www.dre.vanderbilt.edu/~schmidt/TAO.html
11 #include "middle_i.h"
12 #include "inner_cb.h"
14 #include <iostream>
15 // Implementation skeleton constructor
16 Asynch_Middle_i::Asynch_Middle_i (PortableServer::POA_ptr poa,
17 Inner_ptr inner)
18 : poa_ (PortableServer::POA::_duplicate(poa)),
19 inner_ (Inner::_duplicate(inner))
23 void
24 Asynch_Middle_i::get_the_answer (AMH_MiddleResponseHandler_ptr _tao_rh,
25 const char * question)
27 // The callback handler servant instance holds on to a reference to the
28 // AMH response handler. That way, it can forward the reply back to the
29 // originial client after getting the reply from the inner server.
30 PortableServer::ServantBase_var servant = new Inner_callback_i(this->poa_.in(),
31 _tao_rh);
32 PortableServer::ObjectId_var objid =
33 this->poa_->activate_object(servant.in());
34 CORBA::Object_var obj = this->poa_->id_to_reference (objid.in());
36 AMI_InnerHandler_var cb = AMI_InnerHandler::_narrow(obj.in());
38 // forward the request on to the inner server, with the callback handler
39 // reference.
40 this->inner_->sendc_answer (cb.in(),question);
42 // nothing else to do. Our client will block until the callback handler
43 // forwards the reply.
47 //------------------------------------------------------------------------
49 // Implementation skeleton constructor
50 Middle_i::Middle_i (Inner_ptr inner)
51 : inner_ (Inner::_duplicate(inner))
55 char *
56 Middle_i::get_the_answer ( const char * question )
58 return inner_->answer (question);