Use a variable on the stack to not have a temporary in the call
[ACE_TAO.git] / TAO / performance-tests / Latency / DSI / Roundtrip.cpp
blob6fa219f821c2fe005b997679b64c7f6517deb5e6
1 #include "Roundtrip.h"
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))
12 void
13 Roundtrip::invoke (CORBA::ServerRequest_ptr request)
15 if (ACE_OS::strcmp ("shutdown", request->operation ()) == 0)
17 this->orb_->shutdown (false);
19 return;
22 else if (ACE_OS::strcmp ("_is_a", request->operation ()) == 0)
24 CORBA::NVList_ptr list;
25 this->orb_->create_list (0, list);
27 CORBA::Any type_id;
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);
35 const char *arg;
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)
42 type_matches = 1;
44 CORBA::Any result;
45 result <<= CORBA::Any::from_boolean (type_matches);
47 request->set_result (result);
49 return;
52 else if (ACE_OS::strcmp ("test_method", request->operation ()) == 0)
54 CORBA::NVList_ptr list;
55 this->orb_->create_list (0, list);
57 CORBA::Any send_time;
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 ()));
67 return;
70 CORBA::Any bad_operation;
71 CORBA::BAD_OPERATION exception;
72 bad_operation <<= exception;
73 request->set_exception (bad_operation);
76 CORBA::RepositoryId
77 Roundtrip::_primary_interface (const PortableServer::ObjectId &,
78 PortableServer::POA_ptr)
80 return CORBA::string_dup ("IDL:Test/Roundtrip:1.0");