Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Cache_Growth_Test / client.cpp
blob20650ac0a36ae2e8c1ebd82630b164b9cd005d59
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
5 int do_shutdown = 0;
7 int
8 parse_args (int argc, ACE_TCHAR *argv[])
10 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:x"));
11 int c;
13 while ((c = get_opts ()) != -1)
14 switch (c)
16 case 'k':
17 ior = get_opts.opt_arg ();
18 break;
20 case 'x':
21 do_shutdown = 1;
22 break;
24 case '?':
25 default:
26 ACE_ERROR_RETURN ((LM_ERROR,
27 "usage: %s "
28 "-k <ior> "
29 "-x <do_shutdown>"
30 "\n",
31 argv [0]),
32 -1);
34 // Indicates successful parsing of the command line
35 return 0;
38 int
39 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
41 try
43 CORBA::ORB_var orb =
44 CORBA::ORB_init (argc, argv);
46 if (parse_args (argc, argv) != 0)
47 return 1;
49 CORBA::Object_var tmp =
50 orb->string_to_object(ior);
52 Test::Hello_var hello =
53 Test::Hello::_narrow(tmp.in ());
55 if (CORBA::is_nil (hello.in ()))
57 ACE_ERROR_RETURN ((LM_DEBUG,
58 "Nil Test::Hello reference <%s>\n",
59 ior),
60 1);
63 CORBA::String_var the_string =
64 hello->get_string ();
66 ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
67 the_string.in ()));
69 if (do_shutdown)
71 hello->shutdown ();
74 orb->destroy ();
76 catch (const CORBA::Exception& ex)
78 ex._tao_print_exception ("Exception caught:");
79 return 1;
82 return 0;