Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / CSD_Strategy_Tests / TP_Test_Static / ClientApp.cpp
blob55a40bae54eca3e806d2a0b57994301bd5fe35bd
1 #include "ClientApp.h"
2 #include "Foo_A_ClientEngine.h"
3 #include "AppHelper.h"
4 #include "TestAppExceptionC.h"
5 #include "ace/Get_Opt.h"
6 #include "ace/Log_Msg.h"
7 // To force static load the service.
8 #include "tao/PI/PI.h"
9 #include "tao/CSD_ThreadPool/CSD_ThreadPool.h"
11 ClientApp::ClientApp()
12 : TestAppBase("TP_Test_1_Client"),
13 ior_ (ACE_TEXT("file://test.ior"))
18 ClientApp::~ClientApp()
23 int
24 ClientApp::run_i(int argc, ACE_TCHAR* argv[])
26 // Initialize the ORB before parsing our own args.
27 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
29 // Parse the command-line args for this application.
30 // * Returns -1 if problems are encountered.
31 // * Returns 1 if the usage statement was explicitly requested.
32 // * Returns 0 otherwise.
33 int result = this->parse_args(argc, argv);
34 if (result != 0)
36 return result;
38 // Convert the IOR string to a Foo_A object reference.
39 Foo_A_var foo = RefHelper<Foo_A>::string_to_ref(orb.in(),
40 this->ior_.c_str());
42 // Create the appropriate client "engine" object.
43 Foo_A_ClientEngine engine(foo.in());
45 // Execute the client algorithm
46 result = engine.execute() ? 0 : -1;
48 return result;
52 int
53 ClientApp::parse_args(int argc, ACE_TCHAR* argv[])
55 ACE_Get_Opt get_opts(argc, argv, ACE_TEXT("k:"));
57 int c;
59 while ((c = get_opts()) != -1)
61 switch (c)
63 case 'k':
64 this->ior_ = get_opts.opt_arg();
65 break;
67 case '?':
68 ACE_DEBUG((LM_DEBUG,
69 "(%P|%t) usage: %s -k <ior_string>\n",
70 argv[0]));
71 return 1;
73 default:
74 ACE_ERROR((LM_ERROR,
75 "(%P|%t) usage: %s -k <ior_string>\n",
76 argv[0]));
77 return -1;
81 return 0;