2 //=============================================================================
6 * This class implements a simple server for the
7 * Nested Upcalls - Triangle test.
9 * @author Michael Kircher
11 //=============================================================================
15 #include "tao/debug.h"
16 #include "ace/OS_NS_stdio.h"
18 Object_A_Server::Object_A_Server ()
19 : ior_output_file_ (0)
24 Object_A_Server::parse_args ()
26 ACE_Get_Opt
get_opts (argc_
, argv_
, ACE_TEXT("do:"));
29 while ((c
= get_opts ()) != -1)
32 case 'd': // debug flag.
35 case 'o': // output the IOR to a file.
36 this->ior_output_file_
= ACE_OS::fopen (get_opts
.opt_arg (), "w");
37 if (this->ior_output_file_
== 0)
38 ACE_ERROR_RETURN ((LM_ERROR
,
39 "Unable to open %s for writing: %p\n",
40 get_opts
.opt_arg ()), -1);
44 ACE_ERROR_RETURN ((LM_ERROR
,
47 " [-o] <ior_output_file>"
53 // Indicates successful parsing of command line.
58 Object_A_Server::init (int argc
,
61 // Call the init of TAO_ORB_Manager to create a child POA
62 // under the root POA.
63 this->orb_manager_
.init_child_poa (argc
,
71 // ~~ check for the return value here
73 CORBA::String_var str
=
74 this->orb_manager_
.activate_under_child_poa ("object_A",
77 if (this->ior_output_file_
)
79 ACE_OS::fprintf (this->ior_output_file_
,
82 ACE_OS::fclose (this->ior_output_file_
);
91 Object_A_Server::run ()
93 int r
= this->orb_manager_
.run ();
96 ACE_ERROR_RETURN ((LM_ERROR
,
97 "NestedUpCalls_Server::run"),
102 Object_A_Server::~Object_A_Server ()
107 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
109 Object_A_Server object_A_Server
;
111 ACE_DEBUG ((LM_DEBUG
,
112 "\n \t NestedUpCalls.Triangle_Test: Object A Server \n\n"));
117 object_A_Server
.init (argc
,argv
);
123 object_A_Server
.run ();
126 catch (const CORBA::SystemException
& sysex
)
128 sysex
._tao_print_exception ("System Exception");
131 catch (const CORBA::UserException
& userex
)
133 userex
._tao_print_exception ("User Exception");