3 #include "ace/Get_Opt.h"
4 #include "ace/OS_NS_stdio.h"
5 #include "ace/High_Res_Timer.h"
7 void parse_args(int argc
, ACE_TCHAR
* argv
[]);
8 void write_ior_to_file(char const * ior
);
11 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
13 // Fetching the high res timer's global scale factor ensures that it
14 // is calibrated (if necessary on this platform) at the beginning of
15 // the test. While the timer would otherwise be calibrated on first
16 // use, this introduces delay in the middle of the test's execution.
17 // This leads to failures due to timing assumptions (timeouts, etc.)
18 // within the test itself.
19 (void) ACE_High_Res_Timer::global_scale_factor();
23 CORBA::ORB_var orb
= initialize_orb_and_poa(argc
, argv
);
25 parse_args(argc
, argv
);
27 test_i
servant (orb
.in());
28 CORBA::String_var ior
=
29 servant
.create_and_activate_server();
31 write_ior_to_file(ior
.in());
45 const ACE_TCHAR
*ior_output_file
= ACE_TEXT("test.ior");
49 parse_args(int argc
, ACE_TCHAR
* argv
[])
51 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("o:"));
54 while ((c
= get_opts ()) != -1)
59 ior_output_file
= get_opts
.opt_arg ();
64 throw "Usage: server [-o iorfile]\n";
69 void write_ior_to_file(char const * ior
)
71 if (ior_output_file
== 0)
76 FILE *output_file
= ACE_OS::fopen (ior_output_file
, "w");
79 throw "Cannot open output file to write the IOR";
82 ACE_OS::fprintf (output_file
, "%s", ior
);
83 ACE_OS::fclose (output_file
);