3 #include "ace/Get_Opt.h"
4 #include "ace/Log_Msg.h"
12 ClientApp::~ClientApp()
18 ClientApp::run (int argc
, ACE_TCHAR
* argv
[])
21 = CORBA::ORB_init (argc
, argv
);
23 // Parse the command-line args for this application.
24 // * Raises -1 if problems are encountered.
25 // * Returns 1 if the usage statement was explicitly requested.
26 // * Returns 0 otherwise.
27 int result
= this->parse_args (argc
, argv
);
34 = orb
->string_to_object(this->ior_
.c_str());
36 if (CORBA::is_nil(obj
.in()))
39 "(%P|%t) Failed to convert IOR string to obj ref.\n"));
40 throw TestException();
43 Foo_var foo
= Foo::_narrow(obj
.in());
45 if (CORBA::is_nil(foo
.in()))
48 "(%P|%t) Failed to narrow obj ref to Foo interface.\n"));
49 throw TestException();
52 for (CORBA::Long i
= 1; i
<= 100; i
++)
56 CORBA::Long value
= foo
->op3();
59 "(%P|%t) ===> Value retrieved from op3() == %d\n",
62 for (CORBA::Long j
= 1; j
<= 5; j
++)
64 foo
->op4(495 + (i
* 5) + j
);
71 catch (const FooException
& )
74 "(%P|%t) ===> Caught FooException - as expected.\n"));
79 "(%P|%t) ===> Tell server that we are done().\n"));
84 "(%P|%t) ===> Back from done().\n"));
91 ClientApp::parse_args(int argc
, ACE_TCHAR
* argv
[])
93 this->exe_name_
= argv
[0];
95 ACE_Get_Opt
get_opts(argc
, argv
, ACE_TEXT("i:"));
99 while ((c
= get_opts()) != -1)
104 this->ior_
= get_opts
.opt_arg();
108 this->usage_statement();
112 this->usage_statement();
122 ClientApp::usage_statement()
125 "Usage: %s [options]\n\n"
129 this->exe_name_
.c_str()));