Use =default for skeleton copy constructor
[ACE_TAO.git] / TAO / tests / Bug_1670_Regression / client.cpp
bloba42f03ce93b2b0bb2441984ac15ea92352941274
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 CORBA::Long result;
64 result = cobject->op1 ();
65 if (result != 1)
67 ACE_ERROR_RETURN ((LM_ERROR,
68 "Result not 1\n"),
69 1);
72 result = cobject->op2 ();
73 if (result != 2)
75 ACE_ERROR_RETURN ((LM_ERROR,
76 "Result not 2\n"),
77 1);
80 result = cobject->op3 ();
81 if (result != 3)
83 ACE_ERROR_RETURN ((LM_ERROR,
84 "Result not 3\n"),
85 1);
88 result = cobject->op4 ();
89 if (result != 4)
91 ACE_ERROR_RETURN ((LM_ERROR,
92 "Result not 4\n"),
93 1);
96 Foo::Bar::B_var bobject =
97 Foo::Bar::B::_narrow (object.in ());
99 if (CORBA::is_nil (bobject.in ()))
101 ACE_ERROR_RETURN ((LM_ERROR,
102 "Cannot narrow Foo::Bar::B object <%s>\n",
103 ior),
107 result = bobject->op3 ();
108 if (result != 3)
110 ACE_ERROR_RETURN ((LM_ERROR,
111 "Result not 3\n"),
115 Foo::Bar::A_var aobject =
116 Foo::Bar::A::_narrow (object.in ());
118 if (CORBA::is_nil (aobject.in ()))
120 ACE_ERROR_RETURN ((LM_ERROR,
121 "Cannot narrow Foo::Bar::A object <%s>\n",
122 ior),
126 result = aobject->op1 ();
127 if (result != 1)
129 ACE_ERROR_RETURN ((LM_ERROR,
130 "Result not 1\n"),
134 result = aobject->op2 ();
135 if (result != 2)
137 ACE_ERROR_RETURN ((LM_ERROR,
138 "Result not 2\n"),
142 cobject->shutdown ();
144 orb->destroy ();
146 catch (const CORBA::Exception& ex)
148 ex._tao_print_exception ("");
149 return 1;
152 return 0;