3 Test_impl::Test_impl (CORBA::ORB_ptr orb
)
4 : orb_ (CORBA::ORB::_duplicate (orb
))
8 //***************************************************************************
9 // Rotate characters in string, last character becomes the first and
10 // all others are shifted to the right.
11 //***************************************************************************
12 void rotate_string(char *s
)
17 l
= ACE_OS::strlen(s
);
21 ACE_OS::memmove(&s
[1], &s
[0], l
-1);
28 Test_impl::basic_op1 (VBlong
* p1
, VBlong
*& p2
, VBlong_out p3
)
31 VBlong (p2
->_value()*5),
34 p2
->_value (p2
->_value() * 3);
37 ACE_NEW_RETURN (retval
,
38 VBlong (p1
->_value()*3),
45 Test_impl::basic_op2 (vb_basic::M_VBlong
* p1
,
46 vb_basic::M_VBlong
*& p2
,
47 vb_basic::M_VBlong_out p3
)
50 vb_basic::M_VBlong (p2
->_value()*5),
53 p2
->_value (p2
->_value() * 3);
55 vb_basic::M_VBlong
*retval
= 0;
56 ACE_NEW_RETURN (retval
,
57 vb_basic::M_VBlong (p1
->_value()*3),
64 Test_impl::basic_op3 (::CORBA::Long p1
, ::CORBA::Long
& p2
,
76 Test_impl::string_op1 (::VBstring
* p1
,
80 rotate_string (p2
->_boxed_inout ());
83 VBstring (p2
->_value ()),
86 rotate_string (p1
->_boxed_inout ());
89 ACE_NEW_RETURN (retval
,
90 VBstring (p1
->_value ()),
97 Test_impl::string_op2 (const char * p1
,
103 p3
= CORBA::string_alloc (ACE_OS::strlen(p2
));
104 ACE_OS::strcpy (p3
, p2
);
106 rotate_string ((char *) p1
);
109 return_string
= CORBA::string_alloc (ACE_OS::strlen(p1
));
110 ACE_OS::strcpy (return_string
, p1
);
112 return return_string
;
116 Test_impl::seq_op1 (::VBseqlong
* p1
,
124 for (i
=0; i
<p3
->_value().length(); i
++)
129 for (i
=0; i
<p2
->_value().length(); i
++)
134 VBseqlong
*retval
= 0;
135 ACE_NEW_RETURN (retval
,
143 Test_impl::seq_op2 (const ::TDseqlong
& p1
,
150 for (i
=0; i
<p3
->length(); i
++)
155 for (i
=0; i
<p2
.length(); i
++)
162 Test_impl::struct_op1 (::VBfixed_struct1
* p1
,
163 ::VBfixed_struct1
*& p2
,
164 ::VBfixed_struct1_out p3
)
167 VBfixed_struct1 (p2
->_value()),
169 // transform p3 values
171 p3
->abstruct().s1
= (p3
->abstruct()).s1
* 5;
172 p3
->abstruct().s2
= (p3
->abstruct()).s2
* 5;
174 // transform p2 values
176 p2
->abstruct().s1
= (p2
->abstruct()).s1
* 3;
177 p2
->abstruct().s2
= (p2
->abstruct()).s2
* 3;
179 VBfixed_struct1
*retval
= 0;
180 ACE_NEW_RETURN (retval
,
181 VBfixed_struct1 (p1
->_value()),
188 Test_impl::struct_op2 (const ::Fixed_Struct1
& p1
,
189 ::Fixed_Struct1
& p2
,
190 ::Fixed_Struct1_out p3
)
199 ::VBvariable_struct1
*
200 Test_impl::struct_op3 (::VBvariable_struct1
* p1
,
201 ::VBvariable_struct1
*& p2
,
202 ::VBvariable_struct1_out p3
)
204 // transform p2 values
206 rotate_string ((CORBA::Char
*)p2
->str());
209 VBvariable_struct1 (p2
->_value()),
212 VBvariable_struct1
*retval
= 0;
213 ACE_NEW_RETURN (retval
,
214 VBvariable_struct1 (p1
->_value()),
222 Test_impl::struct_op4 (const ::Variable_Struct1
& p1
,
223 ::Variable_Struct1
& p2
,
224 ::Variable_Struct1_out p3
)
232 rotate_string ((CORBA::Char
*)p2
.str
.in());
237 Test_impl::array_op1 (::VBlongarray
* p1
,
239 ::VBlongarray_out p3
)
241 long array_len
= sizeof(LongArray
) / sizeof(CORBA::Long
);
243 for (long i
=0; i
<array_len
; i
++)
252 VBlongarray
*retval
= 0;
253 ACE_NEW_RETURN (retval
,
261 Test_impl::array_op2 (const ::LongArray p1
,
265 long array_len
= sizeof(LongArray
) / sizeof(CORBA::Long
);
268 for (i
=0; i
<array_len
; i
++)
273 for (i
=0; i
<array_len
; i
++)
281 Test_impl::array_op3 (::VBstringarray
* p1
,
282 ::VBstringarray
*& p2
,
283 ::VBstringarray_out p3
)
285 long array_len
= sizeof( ::StringArray
) / sizeof( StringArray_slice
);
288 for (long i
=0; i
<array_len
; i
++)
290 p
= (CORBA::Char
*)((*p2
)[i
]).in();
298 VBstringarray
*retval
= 0;
299 ACE_NEW_RETURN (retval
,
307 Test_impl::array_op4 (const ::StringArray p1
,
309 ::StringArray_out p3
)
311 long array_len
= sizeof( ::StringArray
) / sizeof( StringArray_slice
);
315 for (i
=0; i
<array_len
; i
++)
317 p
= (CORBA::Char
*)(p2
[i
]).in();
321 StringArray_slice
*sa
= StringArray_alloc ();
323 for (i
=0; i
<array_len
; i
++)
334 Test_impl::union_op1 (::VBfixed_union1
* p1
,
335 ::VBfixed_union1
*& p2
,
336 ::VBfixed_union1_out p3
)
338 CORBA::Long longValue
;
339 CORBA::Short shortValue
;
343 VBfixed_union1
*rv
= 0;
348 // Set output and return values
352 longValue
= p1
->m1 () * 3;
357 shortValue
= p1
->m2 () * 3;
363 // Set new "inout" parameter value
367 p2
->m1 (p2
->m1 () * 3);
370 p2
->m2 (p2
->m2 () * 3);
378 Test_impl::union_op2 (const ::Fixed_Union1
& p1
,
380 ::Fixed_Union1_out p3
)
384 // Set new "inout" parameter value
388 p2
.m1 (p2
.m1 () * 3);
391 p2
.m2 (p2
.m2 () * 3);
396 ::VBvariable_union1
*
397 Test_impl::union_op3 (::VBvariable_union1
* p1
,
398 ::VBvariable_union1
*& p2
,
399 ::VBvariable_union1_out p3
)
401 CORBA::Long longValue
;
402 CORBA::String_var stringValue
;
404 VBvariable_union1 (),
406 VBvariable_union1
*rv
= 0;
408 VBvariable_union1 (),
412 // Set output and return values
416 longValue
= p1
->m1 ();
421 stringValue
= p1
->m2 ();
422 p3
->m2 (stringValue
);
423 rv
->m2 (stringValue
);
427 // Set new "inout" parameter value
431 p2
->m1 (p2
->m1 () * 3);
434 stringValue
= p2
->m2 ();
435 rotate_string (stringValue
);
436 p2
->m2 (stringValue
);
444 Test_impl::union_op4 (const ::Variable_Union1
& p1
,
445 ::Variable_Union1
& p2
,
446 ::Variable_Union1_out p3
)
448 CORBA::String_var stringValue
;
450 // Return value of "in" parameter to "out" parameter
464 // Set new "inout" parameter value
468 p2
.m1 (p2
.m1 () * 3);
471 stringValue
= p2
.m2 ();
472 rotate_string (stringValue
);
480 Test_impl::shutdown (void)
482 this->orb_
->shutdown (0);