2 #include "tao/AnyTypeCode/TypeCode_Constants.h"
3 #include "tao/AnyTypeCode/NVList.h"
4 #include "tao/AnyTypeCode/SystemExceptionA.h"
5 #include "tao/DynamicInterface/Server_Request.h"
7 Roundtrip::Roundtrip (CORBA::ORB_ptr orb
)
8 : orb_ (CORBA::ORB::_duplicate (orb
))
13 Roundtrip::invoke (CORBA::ServerRequest_ptr request
)
15 if (ACE_OS::strcmp ("shutdown", request
->operation ()) == 0)
17 this->orb_
->shutdown (false);
22 else if (ACE_OS::strcmp ("_is_a", request
->operation ()) == 0)
24 CORBA::NVList_ptr list
;
25 this->orb_
->create_list (0, list
);
28 type_id
._tao_set_typecode (CORBA::_tc_string
);
29 list
->add_value ("type_id", type_id
, CORBA::ARG_IN
);
31 request
->arguments (list
);
33 CORBA::NamedValue_ptr nv
= list
->item (0);
36 *(nv
->value ()) >>= arg
;
38 CORBA::Boolean type_matches
= 0;
39 if (ACE_OS::strcmp (arg
, "IDL:Test/Roundtrip:1.0") == 0
40 || ACE_OS::strcmp (arg
, "IDL:omg.org/CORBA/Object:1.0") == 0
41 || ACE_OS::strcmp (arg
, "") == 0)
45 result
<<= CORBA::Any::from_boolean (type_matches
);
47 request
->set_result (result
);
52 else if (ACE_OS::strcmp ("test_method", request
->operation ()) == 0)
54 CORBA::NVList_ptr list
;
55 this->orb_
->create_list (0, list
);
58 send_time
._tao_set_typecode (CORBA::_tc_ulonglong
);
59 list
->add_value ("send_time", send_time
, CORBA::ARG_IN
);
61 request
->arguments (list
);
63 CORBA::NamedValue_ptr nv
= list
->item (0);
65 request
->set_result (*(nv
->value ()));
70 CORBA::Any bad_operation
;
71 CORBA::BAD_OPERATION exception
;
72 bad_operation
<<= exception
;
73 request
->set_exception (bad_operation
);
77 Roundtrip::_primary_interface (const PortableServer::ObjectId
&,
78 PortableServer::POA_ptr
)
80 return CORBA::string_dup ("IDL:Test/Roundtrip:1.0");