4 * @author Carlos O'Ryan <coryan@atdesk.com>
8 #include "ace/Get_Opt.h"
10 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
13 parse_args (int argc
, ACE_TCHAR
*argv
[])
15 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
18 while ((c
= get_opts ()) != -1)
22 ior
= get_opts
.opt_arg ();
27 ACE_ERROR_RETURN ((LM_ERROR
,
34 // Indicates successful parsing of the command line
39 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
44 CORBA::ORB_init (argc
, argv
);
46 if (parse_args (argc
, argv
) != 0)
49 CORBA::Object_var object
=
50 orb
->string_to_object (ior
);
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",
64 result
= cobject
->op1 ();
67 ACE_ERROR_RETURN ((LM_ERROR
,
72 result
= cobject
->op2 ();
75 ACE_ERROR_RETURN ((LM_ERROR
,
80 result
= cobject
->op3 ();
83 ACE_ERROR_RETURN ((LM_ERROR
,
88 result
= cobject
->op4 ();
91 ACE_ERROR_RETURN ((LM_ERROR
,
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",
107 result
= bobject
->op3 ();
110 ACE_ERROR_RETURN ((LM_ERROR
,
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",
126 result
= aobject
->op1 ();
129 ACE_ERROR_RETURN ((LM_ERROR
,
134 result
= aobject
->op2 ();
137 ACE_ERROR_RETURN ((LM_ERROR
,
142 cobject
->shutdown ();
146 catch (const CORBA::Exception
& ex
)
148 ex
._tao_print_exception ("");