Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Bug_3524_Regression / test_i.cpp
blobefff623384fea93df8b75e49c219c38f5e0d0e64
1 // -*- C++ -*-
2 #include "test_i.h"
3 #include <memory>
5 A_i::A_i (CORBA::ORB_ptr orb,
6 CORBA::ValueFactoryBase *vtp_factory)
7 : orb_ (CORBA::ORB::_duplicate (orb))
8 , vtp_factory_ (vtp_factory)
12 char *
13 A_i::method (::Test::A::FailOn where,
14 const char *,
15 ::CORBA::String_out arg2,
16 char *&arg3)
18 CORBA::String_var res;
19 switch (where)
21 case ::Test::A::ARG1:
22 // must be never reached.
23 break;
24 case ::Test::A::ARG2:
25 arg2 = CORBA::string_dup (::Test::FailStr);
26 break;
27 case ::Test::A::ARG3:
28 CORBA::string_free (arg3);
29 arg3 = CORBA::string_dup (::Test::FailStr);
30 break;
31 case ::Test::A::RETN:
32 res = CORBA::string_dup (::Test::FailStr);
33 break;
35 return res._retn ();
38 char *
39 A_i::method_s (::Test::A::FailOn where,
40 const char *,
41 ::CORBA::String_out arg2,
42 char *&arg3)
44 CORBA::String_var res;
45 switch (where)
47 case ::Test::A::ARG1:
48 // must be never reached.
49 break;
50 case ::Test::A::ARG2:
51 arg2 = CORBA::string_dup (::Test::FailStr);
52 break;
53 case ::Test::A::ARG3:
54 CORBA::string_free (arg3);
55 arg3 = CORBA::string_dup (::Test::FailStr);
56 break;
57 case ::Test::A::RETN:
58 res = CORBA::string_dup (::Test::FailStr);
59 break;
61 return res._retn ();
64 ::Test::seq_bd_str *
65 A_i::seq_method (::Test::A::FailOn where,
66 const ::Test::seq_bd_str &,
67 ::Test::seq_bd_str_out arg2,
68 ::Test::seq_bd_str & arg3)
70 ::Test::seq_bd_str *arg2_val = 0;
71 ACE_NEW_THROW_EX (arg2_val,
72 ::Test::seq_bd_str,
73 CORBA::NO_MEMORY ());
74 arg2 = arg2_val;
76 ::Test::seq_bd_str *res_val = 0;
77 ACE_NEW_THROW_EX (res_val,
78 ::Test::seq_bd_str,
79 CORBA::NO_MEMORY ());
80 ::Test::seq_bd_str_var res = res_val;
82 switch (where)
84 case ::Test::A::ARG1:
85 // must be never reached.
86 break;
87 case ::Test::A::ARG2:
88 arg2_val->length (1);
89 (*arg2_val)[0] = CORBA::string_dup (::Test::FailStr);
90 break;
91 case ::Test::A::ARG3:
92 arg3.length (1);
93 arg3[0] = CORBA::string_dup (::Test::FailStr);
94 break;
95 case ::Test::A::RETN:
96 res->length (1);
97 (*res_val)[0] = CORBA::string_dup (::Test::FailStr);
98 break;
100 return res._retn ();
103 ::Test::seq_bds_str *
104 A_i::seq_method_s (::Test::A::FailOn where,
105 const ::Test::seq_bds_str &,
106 ::Test::seq_bds_str_out arg2,
107 ::Test::seq_bds_str & arg3)
109 ::Test::seq_bds_str *arg2_val = 0;
110 ACE_NEW_THROW_EX (arg2_val,
111 ::Test::seq_bds_str,
112 CORBA::NO_MEMORY ());
113 arg2 = arg2_val;
115 ::Test::seq_bds_str *res_val = 0;
116 ACE_NEW_THROW_EX (res_val,
117 ::Test::seq_bds_str,
118 CORBA::NO_MEMORY ());
119 ::Test::seq_bds_str_var res = res_val;
120 res->length (1);
122 switch (where)
124 case ::Test::A::ARG1:
125 // must be never reached.
126 break;
127 case ::Test::A::ARG2:
128 arg2_val->length (1);
129 (*arg2_val)[0] = CORBA::string_dup (::Test::FailStr);
130 break;
131 case ::Test::A::ARG3:
132 arg3.length (1);
133 arg3[0] = CORBA::string_dup (::Test::FailStr);
134 break;
135 case ::Test::A::RETN:
136 (*res_val)[0] = CORBA::string_dup (::Test::FailStr);
137 break;
139 return res._retn ();
142 ::Test::arr_bd_str_slice *
143 A_i::arr_method (::Test::A::FailOn where,
144 const ::Test::arr_bd_str,
145 ::Test::arr_bd_str_out arg2,
146 ::Test::arr_bd_str arg3)
148 arg2 = ::Test::arr_bd_str_alloc ();
150 ::Test::arr_bd_str_slice *res =
151 ::Test::arr_bd_str_alloc ();
152 std::unique_ptr< ::Test::arr_bd_str_slice> safe (res);
154 switch (where)
156 case ::Test::A::ARG1:
157 // must be never reached.
158 break;
159 case ::Test::A::ARG2:
161 ::Test::arr_bd_str_slice *& arg2_slice = arg2;
162 arg2_slice[0] = CORBA::string_dup (::Test::FailStr);
164 break;
165 case ::Test::A::ARG3:
166 arg3[0] = CORBA::string_dup (::Test::FailStr);
167 break;
168 case ::Test::A::RETN:
169 res[0] = CORBA::string_dup (::Test::FailStr);
170 break;
173 safe.release ();
174 return res;
177 ::Test::arr_bds_str_slice *
178 A_i::arr_method_s (::Test::A::FailOn where,
179 const ::Test::arr_bds_str,
180 ::Test::arr_bds_str_out arg2,
181 ::Test::arr_bds_str arg3)
183 arg2 = ::Test::arr_bds_str_alloc ();
185 ::Test::arr_bds_str_slice *res =
186 ::Test::arr_bds_str_alloc ();
187 std::unique_ptr< ::Test::arr_bds_str_slice > safe (res);
189 switch (where)
191 case ::Test::A::ARG1:
192 // must be never reached.
193 break;
194 case ::Test::A::ARG2:
196 ::Test::arr_bds_str_slice *& arg2_slice = arg2;
197 arg2_slice[0] = CORBA::string_dup (::Test::FailStr);
199 break;
200 case ::Test::A::ARG3:
201 arg3[0] = CORBA::string_dup (::Test::FailStr);
202 break;
203 case ::Test::A::RETN:
204 res[0] = CORBA::string_dup (::Test::FailStr);
205 break;
208 safe.release ();
209 return res;
212 ::Test::sct *
213 A_i::sct_method (::Test::A::FailOn where,
214 const ::Test::sct &,
215 ::Test::sct_out arg2,
216 ::Test::sct & arg3)
218 ::Test::sct *arg2_val = 0;
219 ACE_NEW_THROW_EX (arg2_val,
220 ::Test::sct,
221 CORBA::NO_MEMORY ());
222 arg2 = arg2_val;
224 ::Test::sct *res_val = 0;
225 ACE_NEW_THROW_EX (res_val,
226 ::Test::sct,
227 CORBA::NO_MEMORY ());
228 ::Test::sct_var res = res_val;
230 switch (where)
232 case ::Test::A::ARG1:
233 // must be never reached.
234 break;
235 case ::Test::A::ARG2:
236 arg2_val->b = CORBA::string_dup (::Test::FailStr);
237 arg2_val->c = CORBA::string_dup (::Test::FailStr);
238 break;
239 case ::Test::A::ARG3:
240 arg3.b = CORBA::string_dup (::Test::FailStr);
241 arg3.c = CORBA::string_dup (::Test::FailStr);
242 break;
243 case ::Test::A::RETN:
244 res->b = CORBA::string_dup (::Test::FailStr);
245 res->c = CORBA::string_dup (::Test::FailStr);
246 break;
248 return res._retn ();
251 ::Test::unn *
252 A_i::unn_method (::Test::A::FailOn where,
253 const ::Test::unn &,
254 ::Test::unn_out arg2,
255 ::Test::unn & arg3)
257 ::Test::unn *arg2_val = 0;
258 ACE_NEW_THROW_EX (arg2_val,
259 ::Test::unn,
260 CORBA::NO_MEMORY ());
261 arg2 = arg2_val;
263 ::Test::unn *res_val = 0;
264 ACE_NEW_THROW_EX (res_val,
265 ::Test::unn,
266 CORBA::NO_MEMORY ());
267 ::Test::unn_var res = res_val;
269 switch (where)
271 case ::Test::A::ARG1:
272 // must be never reached.
273 break;
274 case ::Test::A::ARG2:
275 arg2->b (CORBA::string_dup (::Test::FailStr));
276 arg2->c (CORBA::string_dup (::Test::FailStr));
277 break;
278 case ::Test::A::ARG3:
279 arg3.b (CORBA::string_dup (::Test::FailStr));
280 arg3.c (CORBA::string_dup (::Test::FailStr));
281 break;
282 case ::Test::A::RETN:
283 res->b (CORBA::string_dup (::Test::FailStr));
284 res->c (CORBA::string_dup (::Test::FailStr));
285 break;
287 return res._retn ();
290 ::Test::val_bd_str *
291 A_i::vbx_method (::Test::A::FailOn where,
292 ::Test::val_bd_str *,
293 ::Test::val_bd_str_out arg2,
294 ::Test::val_bd_str *& arg3)
296 ::Test::val_bd_str_var res;
297 switch (where)
299 case ::Test::A::ARG1:
300 // must be never reached.
301 break;
302 case ::Test::A::ARG2:
304 ::Test::val_bd_str *arg2_val = 0;
305 ACE_NEW_THROW_EX (arg2_val,
306 ::Test::val_bd_str,
307 CORBA::NO_MEMORY ());
308 arg2 = arg2_val;
309 *arg2 = CORBA::string_dup (::Test::FailStr);
311 break;
312 case ::Test::A::ARG3:
314 ::Test::val_bd_str_var arg3_cleaner = arg3;
315 ::Test::val_bd_str *arg3_val = 0;
316 ACE_NEW_THROW_EX (arg3_val,
317 ::Test::val_bd_str,
318 CORBA::NO_MEMORY ());
319 arg3 = arg3_val;
320 *arg3 = CORBA::string_dup (::Test::FailStr);
322 break;
323 case ::Test::A::RETN:
325 ::Test::val_bd_str *res_val = 0;
326 ACE_NEW_THROW_EX (res_val,
327 ::Test::val_bd_str,
328 CORBA::NO_MEMORY ());
329 res = res_val;
330 *res_val = CORBA::string_dup (::Test::FailStr);
332 break;
334 return res._retn ();
337 ::Test::val_bds_str *
338 A_i::vbx_method_s (::Test::A::FailOn where,
339 ::Test::val_bds_str *,
340 ::Test::val_bds_str_out arg2,
341 ::Test::val_bds_str *& arg3)
343 ::Test::val_bds_str_var res;
344 switch (where)
346 case ::Test::A::ARG1:
347 // must be never reached.
348 break;
349 case ::Test::A::ARG2:
351 ::Test::val_bds_str *arg2_val = 0;
352 ACE_NEW_THROW_EX (arg2_val,
353 ::Test::val_bds_str,
354 CORBA::NO_MEMORY ());
355 arg2 = arg2_val;
356 *arg2 = CORBA::string_dup (::Test::FailStr);
358 break;
359 case ::Test::A::ARG3:
361 ::Test::val_bds_str_var arg3_cleaner = arg3;
362 ::Test::val_bds_str *arg3_val = 0;
363 ACE_NEW_THROW_EX (arg3_val,
364 ::Test::val_bds_str,
365 CORBA::NO_MEMORY ());
366 arg3 = arg3_val;
367 *arg3 = CORBA::string_dup (::Test::FailStr);
369 break;
370 case ::Test::A::RETN:
372 ::Test::val_bds_str *res_val = 0;
373 ACE_NEW_THROW_EX (res_val,
374 ::Test::val_bds_str,
375 CORBA::NO_MEMORY ());
376 res = res_val;
377 *res_val = CORBA::string_dup (::Test::FailStr);
379 break;
381 return res._retn ();
384 ::Test::vtp *
385 A_i::vtp_method (::Test::A::FailOn where,
386 ::Test::vtp *,
387 ::Test::vtp_out arg2,
388 ::Test::vtp *& arg3)
390 ::Test::vtp *res = 0;
391 switch (where)
393 case ::Test::A::ARG1:
394 // must be never reached.
395 break;
396 case ::Test::A::ARG2:
398 CORBA::ValueBase_var arg2_base =
399 this->vtp_factory_->create_for_unmarshal ();
400 arg2 = ::Test::vtp::_downcast (arg2_base.in ());
401 arg2->b (CORBA::string_dup (::Test::FailStr));
402 arg2->c (CORBA::string_dup (::Test::FailStr));
403 arg2_base._retn ();
405 break;
406 case ::Test::A::ARG3:
408 ::Test::vtp_var arg3_cleaner = arg3;
409 CORBA::ValueBase_var arg3_base =
410 this->vtp_factory_->create_for_unmarshal ();
411 arg3 = ::Test::vtp::_downcast (arg3_base.in ());
412 arg3->b (CORBA::string_dup (::Test::FailStr));
413 arg3->c (CORBA::string_dup (::Test::FailStr));
414 arg3_base._retn ();
416 break;
417 case ::Test::A::RETN:
419 CORBA::ValueBase_var res_base =
420 this->vtp_factory_->create_for_unmarshal ();
421 res = ::Test::vtp::_downcast (res_base.in ());
422 res->b (CORBA::string_dup (::Test::FailStr));
423 res->c (CORBA::string_dup (::Test::FailStr));
424 res_base._retn ();
426 break;
428 return res;
431 void
432 A_i::exc_method (::Test::string_field f)
434 switch (f)
436 case ::Test::PLAIN:
437 // not really tested.
438 break;
439 case ::Test::BOUNDED:
440 throw ::Test::exc (0,
441 ::Test::FailStr,
443 break;
444 case ::Test::TYPEDEFED:
445 throw ::Test::exc (0,
447 ::Test::FailStr);
448 break;
452 void
453 A_i::shutdown ()
455 this->orb_->shutdown (false);