1 #include "PP_Test_Server.h"
2 #include "tao/TAO_Internal.h"
4 #include "ace/OS_NS_stdio.h"
6 PP_Test_Server::PP_Test_Server (void)
12 PP_Test_Server::parse_args (void)
14 ACE_Get_Opt
get_opts (argc_
, argv_
, ACE_TEXT("do:"));
17 while ((c
= get_opts ()) != -1)
20 case 'd': // debug flag.
23 case 'o': // output the IOR to a file.
24 this->ior_output_file_
= ACE_OS::fopen (get_opts
.opt_arg (), "w");
25 if (this->ior_output_file_
== 0)
26 ACE_ERROR_RETURN ((LM_ERROR
,
27 "Unable to open %s for writing: %p\n",
33 ACE_ERROR_RETURN ((LM_ERROR
,
36 " [-o] <ior_output_file>"
42 // Indicates successful parsing of command line.
47 PP_Test_Server::init (int argc
,
50 // Call the init of <TAO_ORB_Manager> to initialize the ORB and
51 // create a child POA under the root POA.
52 if (this->orb_manager_
.init_child_poa (argc
,
55 ACE_ERROR_RETURN ((LM_ERROR
,
62 if (this->parse_args () == -1)
63 ACE_ERROR_RETURN ((LM_ERROR
,
68 CORBA::ORB_var orb
= this->orb_manager_
.orb ();
70 // Now create the implementations
71 this->factory_impl_
= new Pluggable_Test_Factory_i (orb
.in ());
74 this->orb_manager_
.activate_under_child_poa ("factory",
79 this->factory_id_
.in ()));
81 if (this->ior_output_file_
)
83 ACE_OS::fprintf (this->ior_output_file_
,
85 this->factory_id_
.in ());
87 ACE_OS::fclose (this->ior_output_file_
);
94 PP_Test_Server::run ()
96 int result
= this->orb_manager_
.run ();
100 ACE_ERROR_RETURN ((LM_ERROR
,
101 "PP_Test_Server::run"),
106 PP_Test_Server::~PP_Test_Server (void)
108 if (this->factory_id_
.in ())
109 this->orb_manager_
.deactivate_under_child_poa (this->factory_id_
.in ());
111 delete this->factory_impl_
;