summaryrefslogtreecommitdiff
path: root/TAO/tests/Param_Test/objref_struct.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/Param_Test/objref_struct.cpp')
-rw-r--r--TAO/tests/Param_Test/objref_struct.cpp261
1 files changed, 91 insertions, 170 deletions
diff --git a/TAO/tests/Param_Test/objref_struct.cpp b/TAO/tests/Param_Test/objref_struct.cpp
index c8298fad079..03d1b6e0c05 100644
--- a/TAO/tests/Param_Test/objref_struct.cpp
+++ b/TAO/tests/Param_Test/objref_struct.cpp
@@ -56,35 +56,20 @@ Test_Objref_Struct::dii_req_invoke (CORBA::Request *req,
int
Test_Objref_Struct::init_parameters (Param_Test_ptr objref,
- CORBA::Environment &ACE_TRY_ENV)
+ CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- Generator *gen = GENERATOR::instance (); // value generator
+ Generator *gen = GENERATOR::instance (); // value generator
- // set the length of the sequence
- this->in_.x = gen->gen_long ();
+ // set the length of the sequence
+ this->in_.x = gen->gen_long ();
+ this->in_.y = objref->make_coffee (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return -1;
+ Coffee::Desc d;
+ d.name = gen->gen_string ();
+ this->in_.y->description (d, ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return -1;
- this->in_.y = objref->make_coffee (ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- Coffee::Desc d;
- d.name = gen->gen_string ();
-
- this->in_.y->description (d,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- return 0;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Test_Objref_Struct::init_parameters\n");
-
- }
- ACE_ENDTRY;
- return -1;
+ return 0;
}
int
@@ -100,26 +85,12 @@ int
Test_Objref_Struct::run_sii_test (Param_Test_ptr objref,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- Param_Test::Objref_Struct_out out (this->out_.out ());
-
- this->ret_ = objref->test_objref_struct (this->in_,
- this->inout_.inout (),
- out,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- return 0;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Test_Objref_Struct::run_sii_test\n");
-
- }
- ACE_ENDTRY;
- return -1;
+ Param_Test::Objref_Struct_out out (this->out_.out ());
+ this->ret_ = objref->test_objref_struct (this->in_,
+ this->inout_.inout (),
+ out,
+ ACE_TRY_ENV);
+ return (ACE_TRY_ENV.exception () ? -1:0);
}
int
@@ -127,59 +98,39 @@ Test_Objref_Struct::add_args (CORBA::NVList_ptr param_list,
CORBA::NVList_ptr retval,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- CORBA::Any in_arg (Param_Test::_tc_Objref_Struct,
- &this->in_,
- 0);
-
- CORBA::Any inout_arg (Param_Test::_tc_Objref_Struct,
- &this->inout_.inout (), // .out () causes crash
- 0);
-
- CORBA::Any out_arg (Param_Test::_tc_Objref_Struct,
- &this->out_.inout (),
- 0);
-
- // add parameters
- param_list->add_value ("s1",
- in_arg,
- CORBA::ARG_IN,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- param_list->add_value ("s2",
- inout_arg,
- CORBA::ARG_INOUT,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- param_list->add_value ("s3",
- out_arg,
- CORBA::ARG_OUT,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- // add return value
- CORBA::NamedValue *item = retval->item (0,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- item->value ()->replace (Param_Test::_tc_Objref_Struct,
- &this->ret_.inout (), // see above
- 0, // does not own
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- return 0;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Test_Objref_Struct::add_args\n");
-
- }
- ACE_ENDTRY;
+ CORBA::Any in_arg (Param_Test::_tc_Objref_Struct,
+ &this->in_,
+ 0);
+
+ CORBA::Any inout_arg (Param_Test::_tc_Objref_Struct,
+ &this->inout_.inout (), // .out () causes crash
+ 0);
+
+ CORBA::Any out_arg (Param_Test::_tc_Objref_Struct,
+ &this->out_.inout (),
+ 0);
+
+ // add parameters
+ param_list->add_value ("s1",
+ in_arg,
+ CORBA::ARG_IN,
+ ACE_TRY_ENV);
+
+ param_list->add_value ("s2",
+ inout_arg,
+ CORBA::ARG_INOUT,
+ ACE_TRY_ENV);
+
+ param_list->add_value ("s3",
+ out_arg,
+ CORBA::ARG_OUT,
+ ACE_TRY_ENV);
+
+ // add return value
+ retval->item (0, ACE_TRY_ENV)->value ()->replace (Param_Test::_tc_Objref_Struct,
+ &this->ret_.inout (), // see above
+ 0, // does not own
+ ACE_TRY_ENV);
return 0;
}
@@ -192,47 +143,29 @@ Test_Objref_Struct::check_validity (void)
|| this->in_.x != this->ret_->x)
return 0;
- ACE_DECLARE_NEW_CORBA_ENV;
-
- ACE_TRY
- {
- if (CORBA::is_nil (this->in_.y.in ())
- || CORBA::is_nil (this->out_->y.in ())
- || CORBA::is_nil (this->ret_->y.in ())
- | CORBA::is_nil (this->inout_->y.in ()) )
- {
- return 0;
- }
+ // CORBA::Environment env;
+ ACE_DECLARE_NEW_CORBA_ENV;
+ if (CORBA::is_nil (this->in_.y.in ())
+ || CORBA::is_nil (this->out_->y.in ())
+ || CORBA::is_nil (this->ret_->y.in ())
+ || CORBA::is_nil (this->inout_->y.in ()) )
+ return 0;
- Coffee::Desc_var s_in = this->in_.y->description (ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- Coffee::Desc_var s_out = this->out_->y->description (ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- Coffee::Desc_var s_inout = this->inout_->y->description (ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- Coffee::Desc_var s_ret = this->ret_->y->description (ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- if (ACE_OS::strcmp (s_in->name, s_out->name) != 0
- || ACE_OS::strcmp (s_in->name, s_inout->name) != 0
- || ACE_OS::strcmp (s_in->name, s_ret->name) != 0 )
- {
- return 0;
- }
-
- return 1;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Test_Objref_Struct::check_validity\n");
+ Coffee::Desc_var s_in = this->in_.y->description (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return 0;
+ Coffee::Desc_var s_out = this->out_->y->description (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return 0;
+ Coffee::Desc_var s_inout = this->inout_->y->description (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return 0;
+ Coffee::Desc_var s_ret = this->ret_->y->description (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return 0;
+
+ if (ACE_OS::strcmp (s_in->name, s_out->name) != 0
+ || ACE_OS::strcmp (s_in->name, s_inout->name) != 0
+ || ACE_OS::strcmp (s_in->name, s_ret->name) != 0 )
+ return 0;
- }
- ACE_ENDTRY;
- return 0;
+ return 1;
}
CORBA::Boolean
@@ -255,39 +188,27 @@ Test_Objref_Struct::print_values (void)
this->out_->x,
this->ret_->x ));
- ACE_DECLARE_NEW_CORBA_ENV;
-
- ACE_TRY
- {
-
- Coffee::Desc_var s_in = this->in_.y->description (ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ //CORBA::Environment env;
- Coffee::Desc_var s_out = this->out_->y->description (ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ ACE_DECLARE_NEW_CORBA_ENV;
- Coffee::Desc_var s_inout = this->inout_->y->description (ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ Coffee::Desc_var s_in = this->in_.y->description (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return;
+ Coffee::Desc_var s_out = this->out_->y->description (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return;
+ Coffee::Desc_var s_inout = this->inout_->y->description (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return;
+ Coffee::Desc_var s_ret = this->ret_->y->description (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0) return;
- Coffee::Desc_var s_ret = this->ret_->y->description (ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- ACE_DEBUG ((LM_DEBUG,
- "\n*=*=*=*=*=*=*=*=*=*=\n"
- "in_ name = %s\n"
- "inout_ name = %s\n"
- "out_ name = %s\n"
- "ret_ name = %s\n",
- s_in->name.in (),
- s_inout->name.in (),
- s_out->name.in (),
- s_ret->name.in () ));
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Test_Objref_Struct::print_values\n");
- }
- ACE_ENDTRY;
- ACE_CHECK;
+ ACE_DEBUG ((LM_DEBUG,
+ "\n*=*=*=*=*=*=*=*=*=*=\n"
+ "in_ name = %s\n"
+ "inout_ name = %s\n"
+ "out_ name = %s\n"
+ "ret_ name = %s\n",
+ s_in->name.in (),
+ s_inout->name.in (),
+ s_out->name.in (),
+ s_ret->name.in () ));
}