1 #include "ace/Get_Opt.h"
2 #include "Controller.h"
4 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
7 parse_args (int argc
, ACE_TCHAR
*argv
[])
9 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
12 while ((c
= get_opts ()) != -1)
16 ior
= get_opts
.opt_arg ();
20 ACE_ERROR_RETURN ((LM_ERROR
,
27 // Indicates successful parsing of the command line
32 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
37 CORBA::ORB_init (argc
, argv
);
39 CORBA::Object_var object
=
40 orb
->resolve_initial_references("RootPOA");
42 if (CORBA::is_nil (object
.in ()))
43 ACE_ERROR_RETURN ((LM_ERROR
,
44 " (%P|%t) Unable to initialize the POA.\n"),
47 PortableServer::POA_var root_poa
=
48 PortableServer::POA::_narrow (object
.in ());
50 PortableServer::POAManager_var poa_manager
=
51 root_poa
->the_POAManager ();
53 if (parse_args (argc
, argv
) != 0)
56 Controller controller_impl
;
58 PortableServer::ObjectId_var id
=
59 root_poa
->activate_object (&controller_impl
);
61 CORBA::Object_var object_act
= root_poa
->id_to_reference (id
.in ());
63 Test::Controller_var controller
=
64 Test::Controller::_narrow (object_act
.in ());
66 object
= orb
->string_to_object (ior
);
68 Test::Manager_var manager
=
69 Test::Manager::_narrow (object
.in ());
71 if (CORBA::is_nil (manager
.in ()))
72 ACE_ERROR_RETURN ((LM_ERROR
,
77 poa_manager
->activate ();
79 const CORBA::Short worker_count
= 10;
80 manager
->start_workers (worker_count
,
84 controller_impl
.dump_results ();
88 root_poa
->destroy (true, true);
92 catch (const CORBA::Exception
& ex
)
94 ex
._tao_print_exception ("Exception caught:");