diff options
Diffstat (limited to 'TAO/examples/POA/Generic_Servant/client.cpp')
-rw-r--r-- | TAO/examples/POA/Generic_Servant/client.cpp | 89 |
1 files changed, 30 insertions, 59 deletions
diff --git a/TAO/examples/POA/Generic_Servant/client.cpp b/TAO/examples/POA/Generic_Servant/client.cpp index d1f9c2296a5..6f5d2b8650e 100644 --- a/TAO/examples/POA/Generic_Servant/client.cpp +++ b/TAO/examples/POA/Generic_Servant/client.cpp @@ -28,13 +28,11 @@ static char *IOR_file = 0; static int iterations = 1; static int oneway = 0; static int shutdown_server = 0; -static CORBA::ULong timeout = 5; -static int timed_operations = 0; static int parse_args (int argc, char **argv) { - ACE_Get_Opt get_opts (argc, argv, "f:k:i:T:otx"); + ACE_Get_Opt get_opts (argc, argv, "f:k:i:ox"); int c; while ((c = get_opts ()) != -1) @@ -52,18 +50,10 @@ parse_args (int argc, char **argv) oneway = 1; break; - case 't': - timed_operations = 1; - break; - case 'i': iterations = ::atoi (get_opts.optarg); break; - case 'T': - timeout = ACE_static_cast (CORBA::ULong, ::atoi (get_opts.optarg)); - break; - case 'x': shutdown_server = 1; break; @@ -75,8 +65,6 @@ parse_args (int argc, char **argv) "-k IOR " "-f IOR file " "-o oneway " - "-t timed operations " - "-T timeout for timed operations " "\n", argv [0]), -1); @@ -154,22 +142,17 @@ read_IOR_from_file (void) int main (int argc, char **argv) { - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY + TAO_TRY { // Initialize the ORB - CORBA::ORB_var orb = CORBA::ORB_init (argc, - argv, - 0, - ACE_TRY_ENV); - ACE_TRY_CHECK; - + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, TAO_TRY_ENV); + TAO_CHECK_ENV; + // Initialize options based on command-line arguments. int parse_args_result = parse_args (argc, argv); if (parse_args_result != 0) return parse_args_result; - + if (IOR == 0) { int result = read_IOR_from_file (); @@ -178,84 +161,72 @@ main (int argc, char **argv) } // Get an object reference from the argument string. - CORBA::Object_var object = orb->string_to_object (IOR, - ACE_TRY_ENV); - ACE_TRY_CHECK; + CORBA::Object_var object = orb->string_to_object (IOR, TAO_TRY_ENV); + TAO_CHECK_ENV; // Try to narrow the object reference to a Foo reference. - Foo_var foo = Foo::_narrow (object.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; - + Foo_var foo = Foo::_narrow (object.in (), TAO_TRY_ENV); + TAO_CHECK_ENV; + CORBA::String_var ior = - orb->object_to_string (foo.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; + orb->object_to_string (foo.in (), TAO_TRY_ENV); + TAO_CHECK_ENV; ACE_DEBUG ((LM_DEBUG, "\nConnecting to: %s\n\n", ior.in ())); - + ACE_Profile_Timer timer; ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time; - + // We start an ACE_Profile_Timer here... timer.start (); - + CORBA::Long result = 0; int i = 0; - + for (i = 0; i < iterations; i++) { if (oneway) { // Invoke the simply_doit() method of the foo reference. - foo->simply_doit (ACE_TRY_ENV); - ACE_TRY_CHECK; - } - else if (timed_operations) - { - // Invoke the timed_operation() method of the foo reference. - foo->timed_operation (timeout, - ACE_TRY_ENV); - ACE_TRY_CHECK; + foo->simply_doit (TAO_TRY_ENV); + TAO_CHECK_ENV; } else { // Invoke the doit() method of the foo reference. - result = foo->doit (ACE_TRY_ENV); - ACE_TRY_CHECK; + result = foo->doit (TAO_TRY_ENV); + TAO_CHECK_ENV; } } // stop the timer. timer.stop (); timer.elapsed_time (elapsed_time); - + // compute average time. print_stats (elapsed_time, i); - + if (shutdown_server) { - foo->shutdown (ACE_TRY_ENV); - ACE_TRY_CHECK; + foo->shutdown (TAO_TRY_ENV); + TAO_CHECK_ENV; } // Print the result of doit () method of the foo reference. ACE_DEBUG ((LM_DEBUG, "The result of doit is %d\n", result)); - + ACE_TIMEPROBE_PRINT; - + ACE_OS::free (IOR); } - ACE_CATCHANY + TAO_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"Error!"); - return -1; + TAO_TRY_ENV.print_exception ("Error!"); } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); + TAO_ENDTRY; return 0; } |