1 #include "Server_Task.h"
2 #include "Client_Task.h"
3 #include "ace/Get_Opt.h"
4 #include "ace/Argv_Type_Converter.h"
5 #include "ace/SString.h"
6 #include "ace/Manual_Event.h"
8 const ACE_TCHAR
*output
= ACE_TEXT("test.ior");
9 const ACE_TCHAR
*input
= ACE_TEXT("file://test.ior");
10 CORBA::Boolean exception_occurred
= false;
11 ACE_CString server_orb
;
12 ACE_CString client_orb
;
15 parse_args (int argc
, ACE_TCHAR
*argv
[])
17 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:o:td:"));
20 while ((c
= get_opts ()) != -1)
24 output
= get_opts
.opt_arg ();
27 input
= get_opts
.opt_arg ();
30 // no exception expected
31 exception_occurred
= false;
35 exception_occurred
= true;
39 // This is a hack but that is okay!
42 // Indicates successful parsing of the command line
47 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
55 ACE_Argv_Type_Converter
satc (argc
, argv
);
57 CORBA::ORB_init (satc
.get_argc (),
58 satc
.get_TCHAR_argv (),
62 Server_Task
server_task (output
,
65 ACE_Thread_Manager::instance ());
67 if (server_task
.activate (THR_NEW_LWP
| THR_JOINABLE
,
71 ACE_ERROR ((LM_ERROR
, "Error activating server task\n"));
74 // Wait for the server thread to do some processing
76 ACE_Argv_Type_Converter
catc (argc
, argv
);
78 CORBA::ORB_init (catc
.get_argc (),
79 catc
.get_TCHAR_argv (),
82 Client_Task
client_task (input
,
84 ACE_Thread_Manager::instance (),
87 if (client_task
.activate (THR_NEW_LWP
| THR_JOINABLE
,
91 ACE_ERROR ((LM_ERROR
, "Error activating client task\n"));
94 // Wait for the client and server to finish
95 ACE_Thread_Manager::instance ()->wait ();
97 // Now that all threads have completed we can destroy the ORB
99 if (server_orb
!= client_orb
)
104 catch (const CORBA::Exception
&)
106 // Ignore exceptions..