Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Skeleton_Inheritance / client.cpp
blob88470f91f658b7b34fef88bb033f5a25dad1c029
1 #include "idl_3C.h"
3 #include "ace/Get_Opt.h"
5 const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior");
7 int
8 parse_args (int argc, ACE_TCHAR *argv[])
10 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
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 '?':
21 default:
22 ACE_ERROR_RETURN ((LM_ERROR,
23 "usage: %s "
24 "-k <ior> "
25 "\n",
26 argv [0]),
27 -1);
29 // Indicates successful parsing of the command line
30 return 0;
33 int
34 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
36 try
38 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
40 if (parse_args (argc, argv) != 0)
41 return 1;
43 CORBA::Object_var tmp = orb->string_to_object(ior);
45 ::Skeleton_Inheritance::Interface_3_var if_3 =
46 ::Skeleton_Inheritance::Interface_3::_narrow(tmp.in ());
48 if (CORBA::is_nil (if_3.in ()))
50 ACE_ERROR_RETURN ((LM_DEBUG,
51 "Nil ::Skeleton_Inheritance::Interface_1 "
52 "reference <%s>\n",
53 ior),
54 1);
57 ACE_DEBUG ((LM_DEBUG, "Invoking operation 3\n"));
58 CORBA::String_var if_result_3 = if_3->operation_3 ();
59 ACE_DEBUG ((LM_DEBUG, "Invoking operation 2\n"));
60 CORBA::String_var if_result_2 = if_3->operation_2 ();
61 ACE_DEBUG ((LM_DEBUG, "Invoking operation 1\n"));
62 CORBA::String_var if_result_1 = if_3->operation_1 ();
64 ACE_DEBUG ((LM_DEBUG, "(%P|%t) - strings returned:\n\t<%C>\n\t<%C>\n\t<%C>\n",
65 if_result_1.in (),
66 if_result_2.in (),
67 if_result_3.in ()));
69 if (if_3->_is_a("no_name"))
71 ACE_ERROR ((LM_ERROR, "ERROR: no_name is known.\n"));
73 else
75 ACE_DEBUG ((LM_DEBUG, "OK: no_name is unknown.\n"));
77 const char * name = "IDL:Skeleton_Inheritance/Interface_1:1.0";
78 if (if_3->_is_a(name))
80 ACE_DEBUG ((LM_DEBUG, "OK: <%C> is known.\n",
81 name));
83 else
85 ACE_ERROR ((LM_ERROR, "ERROR: <%C> is unknown\n",
86 name));
89 if_3->shutdown ();
91 orb->destroy ();
93 catch (const CORBA::Exception& ex)
95 ex._tao_print_exception ("Exception caught:");
96 return 1;
99 return 0;