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");
9 #if defined (ACE_OPENVMS)
10 // need this to circumvent link error on OpenVMS
11 // has to do with interference in template instantiations
12 // because multiple executables are build in one directory
13 // reuising eachothers object files.
14 ACE_Time_Value dum
= ACE_Time_Value::zero
;
18 parse_args (int argc
, ACE_TCHAR
*argv
[]);
21 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
28 CORBA::ORB_init (argc
, argv
);
30 CORBA::Object_var object
=
31 orb
->resolve_initial_references ("PolicyCurrent");
33 CORBA::PolicyCurrent_var policy_current
=
34 CORBA::PolicyCurrent::_narrow (object
.in ());
36 if (CORBA::is_nil (policy_current
.in ()))
38 ACE_ERROR ((LM_ERROR
, "ERROR: Nil policy current\n"));
41 CORBA::Any scope_as_any
;
42 scope_as_any
<<= Messaging::SYNC_WITH_SERVER
;
44 CORBA::PolicyList
policies(1); policies
.length (1);
46 orb
->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE
,
49 policy_current
->set_policy_overrides (policies
, CORBA::ADD_OVERRIDE
);
51 policies
[0]->destroy ();
53 if (parse_args (argc
, argv
) != 0)
56 CORBA::Object_var tmp
=
57 orb
->string_to_object(ior
);
60 Test::Peer::_narrow(tmp
.in ());
62 if (CORBA::is_nil (peer
.in ()))
64 ACE_ERROR_RETURN ((LM_DEBUG
,
65 "Nil Test::Peer reference <%s>\n",
75 /* Warning with TRU 64 builds
76 ACE_DEBUG ((LM_DEBUG, "(%P|%t) scavenger - event loop finished\n"));
81 catch (const CORBA::Exception
& ex
)
83 ex
._tao_print_exception ("Exception caught:");
91 parse_args (int argc
, ACE_TCHAR
*argv
[])
93 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
96 while ((c
= get_opts ()) != -1)
100 ior
= get_opts
.opt_arg ();
105 ACE_ERROR_RETURN ((LM_ERROR
,
112 // Indicates successful parsing of the command line