2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
7 parse_args (int argc
, ACE_TCHAR
*argv
[])
9 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
12 while ((c
= get_opts ()) != -1)
16 ior
= get_opts
.opt_arg ();
21 ACE_ERROR_RETURN ((LM_ERROR
,
28 // Indicates successful parsing of the command line
32 void get_stringList2(Test::Hello_var hello
);
35 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
40 CORBA::ORB_init (argc
, argv
);
42 if (parse_args (argc
, argv
) != 0)
45 CORBA::Object_var tmp
=
46 orb
->string_to_object(ior
);
48 Test::Hello_var hello
=
49 Test::Hello::_narrow(tmp
.in ());
51 if (CORBA::is_nil (hello
.in ()))
53 ACE_ERROR_RETURN ((LM_DEBUG
,
54 "Nil Test::Hello reference <%s>\n",
59 ACE_DEBUG ((LM_DEBUG
, "\n(%P|%t) - get_stringList\n"));
61 Test::StringList_var seq
=
62 hello
->get_stringList ();
64 for (CORBA::ULong i
= 0; i
<seq
->length(); i
++)
66 CORBA::String_var the_string
= CORBA::string_dup ((*seq
)[i
]);
67 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
71 ACE_DEBUG ((LM_DEBUG
, "\n(%P|%t) - get_stringList2 with initialization\n"));
73 Test::StringList_var seq2
;
74 hello
->get_stringList2(true, seq2
.out());
76 for (CORBA::ULong i
= 0; i
<seq2
->length(); i
++)
78 CORBA::String_var the_string
= seq2
.in()[i
].in();
79 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
83 ACE_DEBUG ((LM_DEBUG
, "\n(%P|%t) - get_stringList2 without initialization\n"));
85 get_stringList2(hello
);
87 ACE_DEBUG ((LM_DEBUG
, "\n(%P|%t) - mod_stringList\n"));
89 hello
->mod_stringList(seq
.inout());
91 for (CORBA::ULong i
= 0; i
<seq
->length(); i
++)
93 CORBA::String_var the_string
= CORBA::string_dup ((*seq
)[i
]);
94 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
102 catch (const CORBA::Exception
& ex
)
104 ex
._tao_print_exception ("Exception caught:");
111 void get_stringList2(Test::Hello_var hello
)
113 Test::StringList_var seq2
;
117 // Shutdown the ORB and block until the shutdown is complete.
118 hello
->get_stringList2(false, seq2
.out());
120 for (CORBA::ULong i
= 0; i
<seq2
->length(); i
++)
122 CORBA::String_var the_string
= seq2
.in()[i
].in ();
123 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
127 catch (const CORBA::BAD_PARAM
& )
129 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - caught expected exception BAD_PARAM\n"));
131 catch (const CORBA::Exception
& ex
)
133 ex
._tao_print_exception ("get_stringList2");