Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / tests / Bug_1568_Regression / client.cpp
bloba9029217e0684c81e4887084a51faf274decc3cd
1 /**
2 * @file client.cpp
4 * @author Carlos O'Ryan <coryan@atdesk.com>
5 */
6 #include "TestC.h"
8 #include "ace/Get_Opt.h"
10 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
12 int
13 parse_args (int argc, ACE_TCHAR *argv[])
15 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
16 int c;
18 while ((c = get_opts ()) != -1)
19 switch (c)
21 case 'k':
22 ior = get_opts.opt_arg ();
23 break;
25 case '?':
26 default:
27 ACE_ERROR_RETURN ((LM_ERROR,
28 "usage: %s "
29 "-k <ior> "
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 object =
50 orb->string_to_object (ior);
52 Baz::C_var cobject =
53 Baz::C::_narrow (object.in ());
55 if (CORBA::is_nil (cobject.in ()))
57 ACE_ERROR_RETURN ((LM_ERROR,
58 "Cannot narrow Baz::C object <%s>\n",
59 ior),
60 1);
63 cobject->op1 ();
64 cobject->op2 ();
65 cobject->op3 ();
66 cobject->op4 ();
67 cobject->shutdown ();
69 catch (const CORBA::Exception& ex)
71 ex._tao_print_exception ("");
72 return 1;
75 return 0;