2 #include "tao/Messaging/Messaging.h"
3 #include "tao/AnyTypeCode/Any.h"
4 #include "tao/ORB_Core.h"
5 #include "ace/Get_Opt.h"
7 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
10 parse_args (int argc
, ACE_TCHAR
*argv
[]);
13 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
20 CORBA::ORB_init (argc
, argv
);
22 CORBA::Object_var object
=
23 orb
->resolve_initial_references ("PolicyCurrent");
25 CORBA::PolicyCurrent_var policy_current
=
26 CORBA::PolicyCurrent::_narrow (object
.in ());
28 if (CORBA::is_nil (policy_current
.in ()))
30 ACE_ERROR ((LM_ERROR
, "ERROR: Nil policy current\n"));
33 CORBA::Any scope_as_any
;
34 scope_as_any
<<= Messaging::SYNC_WITH_SERVER
;
36 CORBA::PolicyList
policies(1); policies
.length (1);
38 orb
->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE
,
41 policy_current
->set_policy_overrides (policies
, CORBA::ADD_OVERRIDE
);
43 policies
[0]->destroy ();
45 if (parse_args (argc
, argv
) != 0)
48 CORBA::Object_var tmp
=
49 orb
->string_to_object(ior
);
52 Test::Peer::_narrow(tmp
.in ());
54 if (CORBA::is_nil (peer
.in ()))
56 ACE_ERROR_RETURN ((LM_DEBUG
,
57 "Nil Test::Peer reference <%s>\n",
67 /* Warning with TRU 64 builds
68 ACE_DEBUG ((LM_DEBUG, "(%P|%t) scavenger - event loop finished\n"));
73 catch (const CORBA::Exception
& ex
)
75 ex
._tao_print_exception ("Exception caught:");
83 parse_args (int argc
, ACE_TCHAR
*argv
[])
85 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
88 while ((c
= get_opts ()) != -1)
92 ior
= get_opts
.opt_arg ();
97 ACE_ERROR_RETURN ((LM_ERROR
,
104 // Indicates successful parsing of the command line