diff options
Diffstat (limited to 'TAO/examples/POA/TIE/client.cpp')
-rw-r--r-- | TAO/examples/POA/TIE/client.cpp | 124 |
1 files changed, 54 insertions, 70 deletions
diff --git a/TAO/examples/POA/TIE/client.cpp b/TAO/examples/POA/TIE/client.cpp index 3306844d5d4..ca780b649ac 100644 --- a/TAO/examples/POA/TIE/client.cpp +++ b/TAO/examples/POA/TIE/client.cpp @@ -34,22 +34,22 @@ parse_args (int argc, char **argv) switch (c) { case 'a': - IOR[1] = ACE_OS::strdup (get_opts.optarg); + IOR[1] = get_opts.optarg; break; case 'b': - IOR[2] = ACE_OS::strdup (get_opts.optarg); + IOR[2] = get_opts.optarg; break; case 'c': - IOR[3] = ACE_OS::strdup (get_opts.optarg); + IOR[3] = get_opts.optarg; break; case 'd': - IOR[4] = ACE_OS::strdup (get_opts.optarg); + IOR[4] = get_opts.optarg; break; case 'e': - IOR[5] = ACE_OS::strdup (get_opts.optarg); + IOR[5] = get_opts.optarg; break; case 'f': - IOR[6] = ACE_OS::strdup (get_opts.optarg); + IOR[6] = get_opts.optarg; break; case 'i': iterations = ::atoi (get_opts.optarg); @@ -110,30 +110,28 @@ class Test public: static void run (CORBA::ORB_ptr orb, char *IOR, - CORBA::Environment &ACE_TRY_ENV) + CORBA::Environment &env) { if (IOR != 0) { // Get an object reference from the argument string. - CORBA::Object_var object = orb->string_to_object (IOR, ACE_TRY_ENV); - ACE_CHECK; + CORBA::Object_var object = orb->string_to_object (IOR, env); - /*if (env.exception () != 0) + if (env.exception () != 0) { env.print_exception ("CORBA::ORB::string_to_object"); return; } - */ + // Try to narrow the object reference to a reference. - T_var foo = T::_narrow (object.in (), ACE_TRY_ENV); - ACE_CHECK; + T_var foo = T::_narrow (object.in (), env); - /*if (env.exception () != 0) + if (env.exception () != 0) { env.print_exception ("_narrow"); return; } - */ + ACE_Profile_Timer timer; ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time; @@ -142,11 +140,10 @@ public: CORBA::Long result = 0; int i = 0; - for (i = 0; i < iterations ; i++) + for (i = 0; i < iterations && env.exception () == 0; i++) { // Invoke the doit() method on the reference. - result = foo->doit (ACE_TRY_ENV); - ACE_CHECK; + result = foo->doit (env); } // stop the timer. @@ -156,12 +153,12 @@ public: // compute average time. print_stats (elapsed_time, i); - /*if (env.exception () != 0) + if (env.exception () != 0) { env.print_exception ("doit"); return; } - */ + // Print the result of doit () method on the reference. ACE_DEBUG ((LM_DEBUG, "%d\n", @@ -173,60 +170,47 @@ public: int main (int argc, char **argv) { - //CORBA::Environment env; + CORBA::Environment env; - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + // Initialize the ORB + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, env); + if (env.exception () != 0) { - // Initialize the ORB - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV); - ACE_TRY_CHECK; - - // Initialize options based on command-line arguments. - int parse_args_result = parse_args (argc, argv); - if (parse_args_result != 0) - return parse_args_result; - - int i = 1; - - Test<A, A_var>::run (orb.in (), - IOR[i++], - ACE_TRY_ENV); - ACE_TRY_CHECK; - - Test<Outer::B, Outer::B_var>::run (orb.in (), - IOR[i++], - ACE_TRY_ENV); - ACE_TRY_CHECK; - - Test<Outer::Inner::C, Outer::Inner::C_var>::run (orb.in (), - IOR[i++], - ACE_TRY_ENV); - ACE_TRY_CHECK; - - Test<A, A_var>::run (orb.in (), - IOR[i++], - ACE_TRY_ENV); - ACE_TRY_CHECK; - - Test<Outer::B, Outer::B_var>::run (orb.in (), - IOR[i++], - ACE_TRY_ENV); - ACE_TRY_CHECK; - - Test<Outer::Inner::C, Outer::Inner::C_var>::run (orb.in (), - IOR[i++], - ACE_TRY_ENV); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception Caught in main"); + env.print_exception ("CORBA::ORB_init"); return -1; } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); + + // Initialize options based on command-line arguments. + int parse_args_result = parse_args (argc, argv); + if (parse_args_result != 0) + return parse_args_result; + + int i = 1; + + Test<A, A_var>::run (orb.in (), + IOR[i++], + env); + + Test<Outer::B, Outer::B_var>::run (orb.in (), + IOR[i++], + env); + + Test<Outer::Inner::C, Outer::Inner::C_var>::run (orb.in (), + IOR[i++], + env); + + Test<A, A_var>::run (orb.in (), + IOR[i++], + env); + + Test<Outer::B, Outer::B_var>::run (orb.in (), + IOR[i++], + env); + + Test<Outer::Inner::C, Outer::Inner::C_var>::run (orb.in (), + IOR[i++], + env); + return 0; } |