Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / performance-tests / Sequence_Latency / DSI / Roundtrip.cpp
blob489cb27b340cd2fd4ae9eb3d5f5f197101e26bcb
2 #include "TestC.h"
3 #include "tao/AnyTypeCode/TypeCode_Constants.h"
4 #include "tao/AnyTypeCode/NVList.h"
5 #include "tao/AnyTypeCode/SystemExceptionA.h"
6 #include "Roundtrip.h"
7 #include "tao/DynamicInterface/Server_Request.h"
9 Roundtrip::Roundtrip (CORBA::ORB_ptr orb)
10 : orb_ (CORBA::ORB::_duplicate (orb))
14 void
15 Roundtrip::invoke (CORBA::ServerRequest_ptr request)
17 if (ACE_OS::strcmp ("shutdown", request->operation ()) == 0)
19 this->orb_->shutdown (false);
21 return;
23 else if (ACE_OS::strcmp ("_is_a", request->operation ()) == 0)
25 CORBA::NVList_ptr list;
26 this->orb_->create_list (0, list);
28 CORBA::Any type_id;
29 type_id._tao_set_typecode (CORBA::_tc_string);
30 list->add_value ("type_id", type_id, CORBA::ARG_IN);
32 request->arguments (list);
34 CORBA::NamedValue_ptr nv = list->item (0);
36 const char *arg;
37 *(nv->value ()) >>= arg;
39 CORBA::Boolean type_matches = 0;
40 if (ACE_OS::strcmp (arg, "IDL:Test/Roundtrip:1.0") == 0
41 || ACE_OS::strcmp (arg, "IDL:omg.org/CORBA/Object:1.0") == 0
42 || ACE_OS::strcmp (arg, "") == 0)
43 type_matches = 1;
45 CORBA::Any result;
46 result <<= CORBA::Any::from_boolean (type_matches);
48 request->set_result (result);
50 return;
52 else if (ACE_OS::strcmp ("test_octet_method", request->operation ()) == 0)
54 CORBA::NVList_ptr list;
55 this->orb_->create_list (0, list);
57 // Set up the argument list
59 CORBA::Any octet_load;
60 octet_load._tao_set_typecode (Test::_tc_octet_load);
61 list->add_value ("octet_load", octet_load, CORBA::ARG_IN);
63 CORBA::Any send_time;
64 send_time._tao_set_typecode (CORBA::_tc_ulonglong);
65 list->add_value ("send_time", send_time, CORBA::ARG_IN);
67 request->arguments (list);
69 // Set up the return value
71 CORBA::NamedValue_ptr nv = list->item (1);
73 request->set_result (*(nv->value ()));
75 return;
77 else if (ACE_OS::strcmp ("test_long_method", request->operation ()) == 0)
79 CORBA::NVList_ptr list;
80 this->orb_->create_list (0, list);
82 // Set up the argument list
84 CORBA::Any long_load;
85 long_load._tao_set_typecode (Test::_tc_long_load);
86 list->add_value ("long_load", long_load, CORBA::ARG_IN);
88 CORBA::Any send_time;
89 send_time._tao_set_typecode (CORBA::_tc_ulonglong);
90 list->add_value ("send_time", send_time, CORBA::ARG_IN);
92 request->arguments (list);
94 // Set up the return value
96 CORBA::NamedValue_ptr nv = list->item (1);
98 request->set_result (*(nv->value ()));
100 return;
102 else if (ACE_OS::strcmp ("test_short_method", request->operation ()) == 0)
104 CORBA::NVList_ptr list;
105 this->orb_->create_list (0, list);
107 // Set up the argument list
109 CORBA::Any short_load;
110 short_load._tao_set_typecode (Test::_tc_short_load);
111 list->add_value ("short_load", short_load, CORBA::ARG_IN);
113 CORBA::Any send_time;
114 send_time._tao_set_typecode (CORBA::_tc_ulonglong);
115 list->add_value ("send_time", send_time, CORBA::ARG_IN);
117 request->arguments (list);
119 // Set up the return value
121 CORBA::NamedValue_ptr nv = list->item (1);
123 request->set_result (*(nv->value ()));
125 return;
127 else if (ACE_OS::strcmp ("test_char_method", request->operation ()) == 0)
129 CORBA::NVList_ptr list;
130 this->orb_->create_list (0, list);
132 // Set up the argument list
134 CORBA::Any char_load;
135 char_load._tao_set_typecode (Test::_tc_char_load);
136 list->add_value ("char_load", char_load, CORBA::ARG_IN);
138 CORBA::Any send_time;
139 send_time._tao_set_typecode (CORBA::_tc_ulonglong);
140 list->add_value ("send_time", send_time, CORBA::ARG_IN);
142 request->arguments (list);
144 // Set up the return value
146 CORBA::NamedValue_ptr nv = list->item (1);
148 request->set_result (*(nv->value ()));
150 return;
152 else if (ACE_OS::strcmp ("test_longlong_method", request->operation ()) == 0)
154 CORBA::NVList_ptr list;
155 this->orb_->create_list (0, list);
157 // Set up the argument list
159 CORBA::Any longlong_load;
160 longlong_load._tao_set_typecode (Test::_tc_longlong_load);
161 list->add_value ("longlong_load", longlong_load, CORBA::ARG_IN);
163 CORBA::Any send_time;
164 send_time._tao_set_typecode (CORBA::_tc_ulonglong);
165 list->add_value ("send_time", send_time, CORBA::ARG_IN);
167 request->arguments (list);
169 // Set up the return value
171 CORBA::NamedValue_ptr nv = list->item (1);
173 request->set_result (*(nv->value ()));
175 return;
177 else if (ACE_OS::strcmp ("test_double_method", request->operation ()) == 0)
179 CORBA::NVList_ptr list;
180 this->orb_->create_list (0, list);
182 // Set up the argument list
184 CORBA::Any double_load;
185 double_load._tao_set_typecode (Test::_tc_double_load);
186 list->add_value ("double_load", double_load, CORBA::ARG_IN);
188 CORBA::Any send_time;
189 send_time._tao_set_typecode (CORBA::_tc_ulonglong);
190 list->add_value ("send_time", send_time, CORBA::ARG_IN);
192 request->arguments (list);
194 // Set up the return value
196 CORBA::NamedValue_ptr nv = list->item (1);
198 request->set_result (*(nv->value ()));
200 return;
203 CORBA::Any bad_operation;
204 CORBA::BAD_OPERATION exception;
205 bad_operation <<= exception;
206 request->set_exception (bad_operation);
209 CORBA::RepositoryId
210 Roundtrip::_primary_interface (const PortableServer::ObjectId &,
211 PortableServer::POA_ptr)
213 return CORBA::string_dup ("IDL:Test/Roundtrip:1.0");