Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Smart_Proxies / On_Demand / client.cpp
blob5d0b05d1dfa165a11f59c8aee2ffcd421d9d98b1
2 //=============================================================================
3 /**
4 * @file client.cpp
6 * This is the client program that tests TAO's Smart Proxy extension.
8 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
9 */
10 //=============================================================================
13 #define ACE_BUILD_SVC_DLL
14 #include "ace/Get_Opt.h"
15 #include "testC.h"
16 #include "ace/OS_NS_string.h"
18 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
20 int
21 parse_args (int argc, ACE_TCHAR *argv[])
23 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("i:"));
24 int c;
26 while ((c = get_opts ()) != -1)
27 switch (c)
29 case 'i':
30 ior = get_opts.opt_arg ();
31 break;
32 case '?':
33 default:
34 ACE_ERROR_RETURN ((LM_ERROR,
35 "usage: %s "
36 "-i "
37 "\n",
38 argv [0]),
39 -1);
41 return 0;
44 int
45 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
47 try
49 CORBA::ORB_var orb =
50 CORBA::ORB_init (argc,
51 argv);
53 if (parse_args (argc, argv) != 0)
54 return 1;
56 CORBA::Object_var object =
57 orb->string_to_object (ior);
59 // To use the smart proxy just enter it as a svc.conf
60 // entry.
62 Test_var server =
63 Test::_narrow (object.in ());
65 if (CORBA::is_nil (server.in ()))
66 ACE_ERROR_RETURN ((LM_ERROR,
67 "Object reference <%s> is nil.\n",
68 ior),
69 1);
71 server->method (0);
73 server->shutdown ();
75 orb->destroy ();
77 catch (const CORBA::Exception& ex)
79 ex._tao_print_exception ("Client-side exception:");
80 return 1;
83 return 0;