summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1998-10-21 16:32:33 +0000
committergokhale <asgokhale@users.noreply.github.com>1998-10-21 16:32:33 +0000
commitb7c5c3d9027d6d89338973c73bb85c4c369445d5 (patch)
tree2dcc0659fcd3ba941d6a95be071d4eb9f6c78a7d /TAO/TAO_IDL/be
parente9423a6913659328dbda97aab8272aef92802741 (diff)
downloadATCD-b7c5c3d9027d6d89338973c73bb85c4c369445d5.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/TAO_IDL/be')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp45
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp40
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp50
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp48
10 files changed, 193 insertions, 95 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp
index c1517048953..f501b42fc78 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/any_op_cs.cpp
@@ -83,17 +83,16 @@ be_visitor_array_any_op_cs::visit_array (be_array *node)
<< "TAO_CHECK_ENV;" << be_nl
<< "if (_tao_any.any_owns_data ())" << be_nl
<< "{" << be_idt_nl
- << node->name () << "_slice *&_tao_elem_ptr = _tao_elem.out ();" << be_nl
- << "_tao_elem_ptr = " << node->name () << "_alloc ();" << be_nl
- << "if (!_tao_elem_ptr) return 0;" << be_nl
+ << "_tao_elem.out () = " << node->name () << "_alloc ();" << be_nl
+ << "if (!_tao_elem.in ()) return 0;" << be_nl
<< "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
<< be_nl
<< "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem_ptr, 0, TAO_TRY_ENV)" << be_nl
+ << ", _tao_elem.inout (), 0, TAO_TRY_ENV)" << be_nl
<< " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
<< "{" << be_idt_nl
<< "((CORBA::Any *)&_tao_any)->replace ("
- << node->tc_name () << ", _tao_elem_ptr, 1, TAO_TRY_ENV);" << be_nl
+ << node->tc_name () << ", _tao_elem.inout (), 1, TAO_TRY_ENV);" << be_nl
<< "return 1;" << be_uidt_nl
<< "}" << be_nl
<< "TAO_CHECK_ENV;" << be_uidt_nl
@@ -110,8 +109,7 @@ be_visitor_array_any_op_cs::visit_array (be_array *node)
<< node->name () << "_free (_tao_elem._retn ());" << be_nl
<< "return 0;" << be_uidt_nl
<< "}" << be_nl
- << "TAO_ENDTRY;" << be_nl
- << "return 0;" << be_uidt_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n\n";
node->cli_stub_any_op_gen (1);
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp
index 0434e60667f..ca687b3a81a 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp
@@ -91,8 +91,7 @@ be_visitor_enum_any_op_cs::visit_enum (be_enum *node)
<< "TAO_CHECK_ENV;" << be_uidt_nl
<< "}" << be_nl
<< "TAO_CATCHANY {}" << be_nl
- << "TAO_ENDTRY;" << be_nl
- << "return 0;" << be_uidt_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n\n";
node->cli_stub_any_op_gen (1);
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
index e3a1e857e10..79b62977e59 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
@@ -56,26 +56,44 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node)
*os << "void operator<<= (CORBA::Any &_tao_any, const "
<< node->name () << " &_tao_elem) // copying" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", new "
- << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl
+ << node->name () << " *_tao_any_val = new " << node->name ()
+ << " (_tao_elem);" << be_nl
+ << "if (!_tao_any_val) return;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
+ << "_tao_any.replace (" << node->tc_name () << ", _tao_any_val, "
+ << "1, TAO_TRY_ENV);" << be_nl
+ << "TAO_CHECK_ENV;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY " << be_nl
+ << "{" << be_idt_nl
+ << "delete _tao_any_val;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n" << be_nl;
*os << "void operator<<= (CORBA::Any &_tao_any, "
<< node->name () << " *_tao_elem) // non copying" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl
+ << "_tao_elem, 1, TAO_TRY_ENV); // consume it" << be_nl
+ << "TAO_CHECK_ENV;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY {}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n" << be_nl;
*os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
<< node->name () << " *&_tao_elem)" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl
<< "if (!type->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
+ << ", TAO_TRY_ENV)) return 0; // not equal" << be_nl
+ << "TAO_CHECK_ENV;" << be_nl
<< "if (_tao_any.any_owns_data ())" << be_nl
<< "{" << be_idt_nl
<< "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
@@ -83,12 +101,13 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node)
<< "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
<< be_nl
<< "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem, 0, _tao_env)" << be_nl
+ << ", _tao_elem, 0, TAO_TRY_ENV)" << be_nl
<< " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
<< "{" << be_idt_nl
<< "((CORBA::Any *)&_tao_any)->replace ("
- << node->tc_name () << ", _tao_elem, 1, _tao_env);" << be_nl
- << " return 1;" << be_uidt_nl
+ << node->tc_name () << ", _tao_elem, 1, TAO_TRY_ENV);" << be_nl
+ << "TAO_CHECK_ENV;" << be_nl
+ << "return 1;" << be_uidt_nl
<< "}" << be_nl
<< "else" << be_nl // decode failed
<< "{" << be_idt_nl
@@ -101,8 +120,14 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node)
<< "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
<< be_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "}" << be_nl
+ << "TAO_CATCHANY" << be_nl
+ << "{" << be_idt_nl
+ << "delete _tao_elem;" << be_nl
<< "return 0;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp
index ab7055faf79..293faaa0236 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp
@@ -50,6 +50,21 @@ be_visitor_exception_cdr_op_cs::visit_exception (be_exception *node)
TAO_OutStream *os = this->ctx_->stream ();
+ // First generate code for our children. The reason we do this first is
+ // because the inlined code for our children must be available before we use
+ // it in our parent
+
+ // set the substate as generating code for the types defined in our scope
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cdr_op_cs"
+ "::visit_exception - "
+ "codegen for scope failed\n"), -1);
+ }
+
// set the sub state as generating code for the output operator
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
*os << "ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
@@ -134,17 +149,6 @@ be_visitor_exception_cdr_op_cs::visit_exception (be_exception *node)
<< "return 0;" << be_uidt << be_uidt_nl
<< "}\n\n";
- // set the substate as generating code for the types defined in our scope
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // all we have to do is to visit the scope and generate code
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_cdr_op_cs"
- "::visit_exception - "
- "codegen for scope failed\n"), -1);
- }
-
node->cli_stub_cdr_op_gen (1);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
index 0fb0e6da5f2..37856b19987 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
@@ -57,42 +57,56 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node)
*os << "void operator<<= (CORBA::Any &_tao_any, "
<< node->name () << "_ptr _tao_elem)" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
<< "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "ACE_NEW (_tao_obj_ptr, CORBA::Object_ptr);" << be_nl
<< "*_tao_obj_ptr = " << node->name ()
<< "::_duplicate (_tao_elem);" << be_nl
<< "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_obj_ptr, 1, _tao_env);" << be_uidt_nl
+ << "_tao_obj_ptr, 1, TAO_TRY_ENV);" << be_nl
+ << "TAO_CHECK_ENV;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY" << be_nl
+ << "{" << be_idt_nl
+ << "delete _tao_obj_ptr;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n" << be_nl;
*os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
<< node->name () << "_ptr &_tao_elem)" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "_tao_elem = " << node->name () << "::_nil ();" << be_nl
<< "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl
<< "if (!type->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
+ << ", TAO_TRY_ENV)) return 0; // not equal" << be_nl
+ << "TAO_CHECK_ENV;" << be_nl
<< "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
<< be_nl
- << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl
- << "ACE_NEW_RETURN (_tao_obj_ptr, CORBA::Object_ptr, 0);" << be_nl
+ << "CORBA::Object_var _tao_obj_var;" << be_nl
<< "if (stream.decode (" << node->tc_name ()
- << ", _tao_obj_ptr, 0, _tao_env)" << be_nl
+ << ", &_tao_obj_var.out (), 0, TAO_TRY_ENV)" << be_nl
<< " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
<< "{" << be_idt_nl
<< "_tao_elem = " << node->name ()
- << "::_narrow (*_tao_obj_ptr, _tao_env);" << be_nl
- << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl
- << "CORBA::release (*_tao_obj_ptr);" << be_nl
- << "*_tao_obj_ptr = _tao_elem;" << be_nl
+ << "::_narrow (_tao_obj_var.in (), TAO_TRY_ENV);" << be_nl
+ << "TAO_CHECK_ENV;" << be_nl
+ << "_tao_obj_var = _tao_elem;" << be_nl
<< "((CORBA::Any *)&_tao_any)->replace ("
- << node->tc_name () << ", _tao_obj_ptr, 1, _tao_env);" << be_nl
- << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl
+ << node->tc_name () << ", &_tao_obj_var.inout (), 1, TAO_TRY_ENV);" << be_nl
+ << "TAO_CHECK_ENV;" << be_nl
<< "return 1;" << be_uidt_nl
<< "}" << be_nl
<< "return 0; // failure" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY" << be_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n\n";
*os << "#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)" << be_idt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
index 8dbda7af1fe..da8d5106050 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
@@ -50,6 +50,21 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
+ // First generate code for our children. The reason we do this first is
+ // because the inlined code for our children must be available before we use
+ // it in our parent
+
+ // set the substate as generating code for the types defined in our scope
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cdr_op_cs"
+ "::visit_interface - "
+ "codegen for scope failed\n"), -1);
+ }
+
// set the sub state as generating code for the output operator
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
*os << "ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
@@ -110,17 +125,6 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
<< "return 0;" << be_uidt_nl;
*os << "}\n\n";
- // set the substate as generating code for the types defined in our scope
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // all we have to do is to visit the scope and generate code
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface_cdr_op_cs"
- "::visit_interface - "
- "codegen for scope failed\n"), -1);
- }
-
node->cli_stub_cdr_op_gen (1);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp
index 7664480dd73..f6264263d61 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp
@@ -57,27 +57,45 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node)
<< "const " << node->name () << " &_tao_elem" << be_uidt_nl
<< ") // copying" << be_uidt_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
+ << node->name () << " *_tao_any_val = new " << node->name ()
+ << " (_tao_elem);" << be_nl
+ << "if (!_tao_any_val) return;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "_tao_any.replace (" << node->tc_name () << ", new "
- << node->name () << "(_tao_elem), 1, _tao_env);"
- << " // copy the value" << be_uidt_nl
+ << node->name () << "(_tao_elem), 1, TAO_TRY_ENV);"
+ << " // copy the value" << be_nl
+ << "TAO_CHECK_ENV; " << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY" << be_nl
+ << "{" << be_idt_nl
+ << "delete _tao_any_val;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n" << be_nl;
*os << "void operator<<= (CORBA::Any &_tao_any, "
<< node->name () << " *_tao_elem) // non copying" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 0, _tao_env);" << be_uidt_nl
+ << "_tao_elem, 0, TAO_TRY_ENV);" << be_nl
+ << "TAO_CHECK_ENV;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY {}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n" << be_nl;
*os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
<< node->name () << " *&_tao_elem)" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl
<< "if (!type->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
+ << ", TAO_TRY_ENV)) return 0; // not equal" << be_nl
+ << "TAO_CHECK_ENV;" << be_nl
<< "if (_tao_any.any_owns_data ())" << be_nl
<< "{" << be_idt_nl
<< "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
@@ -85,20 +103,20 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node)
<< "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
<< be_nl
<< "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem, 0, _tao_env)" << be_nl
+ << ", _tao_elem, 0, TAO_TRY_ENV)" << be_nl
<< " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
<< "{" << be_idt_nl
<< "((CORBA::Any *)&_tao_any)->replace ("
- << node->tc_name () << ", _tao_elem, 1, _tao_env);"
+ << node->tc_name () << ", _tao_elem, 1, TAO_TRY_ENV);"
<< be_nl
- << " return 1;" << be_uidt_nl
+ << "TAO_CHECK_ENV;" << be_nl
+ << "return 1;" << be_uidt_nl
<< "}" << be_nl
<< "else" << be_nl // decode failed
<< "{" << be_idt_nl
<< "delete _tao_elem;" << be_nl
<< "return 0;" << be_uidt_nl
- << "}" << be_nl
- << "return 0;" <<be_uidt_nl
+ << "}" << be_uidt_nl
<< "}" << be_nl
<< "else" << be_nl // else any does not own the data
<< "{" << be_idt_nl
@@ -106,9 +124,15 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node)
<< be_nl
<< "return 1;" << be_uidt_nl
<< "}" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY" << be_nl
+ << "{" << be_idt_nl
+ << "delete _tao_elem;" << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n\n";
-
node->cli_stub_any_op_gen (1);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp
index 28eff7fed0d..4d262d1de85 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp
@@ -87,7 +87,6 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node)
*os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
<< node->name () << " *&_tao_elem)" << be_nl
<< "{" << be_idt_nl
- << "_tao_elem = 0;" << be_nl
<< "TAO_TRY" << be_nl
<< "{" << be_idt_nl
<< "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl
@@ -107,9 +106,13 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node)
<< "((CORBA::Any *)&_tao_any)->replace ("
<< node->tc_name () << ", _tao_elem, 1, TAO_TRY_ENV);" << be_nl
<< "TAO_CHECK_ENV;" << be_nl
- << " return 1;" << be_uidt_nl
+ << "return 1;" << be_uidt_nl
<< "}" << be_nl
- << "TAO_CHECK_ENV;" << be_uidt_nl
+ << "else" << be_nl
+ << "{" << be_idt_nl
+ << "delete _tao_elem;" << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "}" << be_nl
<< "else" << be_nl // else any does not own the data
<< "{" << be_idt_nl
@@ -123,8 +126,7 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node)
<< "delete _tao_elem;" << be_nl
<< "return 0; " << be_uidt_nl
<< "}" << be_nl
- << "TAO_ENDTRY;" << be_nl
- << "return 0;" << be_uidt_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp
index 3c03ee6483e..2d85939bde7 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp
@@ -50,6 +50,21 @@ be_visitor_structure_cdr_op_cs::visit_structure (be_structure *node)
TAO_OutStream *os = this->ctx_->stream ();
+ // First generate code for our children. The reason we do this first is
+ // because the inlined code for our children must be available before we use
+ // it in our parent
+
+ // set the substate as generating code for the types defined in our scope
+ this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_cdr_op_cs"
+ "::visit_structure - "
+ "codegen for scope failed\n"), -1);
+ }
+
// set the sub state as generating code for the output operator
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
*os << "ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
@@ -94,17 +109,6 @@ be_visitor_structure_cdr_op_cs::visit_structure (be_structure *node)
<< "return 0;" << be_uidt_nl << be_uidt_nl
<< "}\n\n";
- // set the substate as generating code for the types defined in our scope
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
- // all we have to do is to visit the scope and generate code
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_structure_cdr_op_cs"
- "::visit_structure - "
- "codegen for scope failed\n"), -1);
- }
-
node->cli_stub_cdr_op_gen (1);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
index 0ec7a3d4ddf..06ce1e02e17 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
@@ -55,26 +55,43 @@ be_visitor_union_any_op_cs::visit_union (be_union *node)
*os << "void operator<<= (CORBA::Any &_tao_any, const "
<< node->name () << " &_tao_elem) // copying" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", new "
- << node->name () << "(_tao_elem), 1, _tao_env);" << be_uidt_nl
+ << node->name () << " *_any_val;" << be_nl
+ << "ACE_NEW (_any_val, " << node->name () << " (_tao_elem));" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
+ << "_tao_any.replace (" << node->tc_name ()
+ << ", _any_val, 1, TAO_TRY_ENV);" << " // copy the value" << be_nl
+ << "TAO_CHECK_ENV;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY" << be_nl
+ << "{" << be_idt_nl
+ << "delete _any_val;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n" << be_nl;
*os << "void operator<<= (CORBA::Any &_tao_any, "
<< node->name () << " *_tao_elem) // non copying" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 1, _tao_env); // consume it" << be_uidt_nl
+ << "_tao_elem, 1, TAO_TRY_ENV); // consume it" << be_nl
+ << "TAO_CHECK_ENV;" << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_CATCHANY {}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n" << be_nl;
*os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
<< node->name () << " *&_tao_elem)" << be_nl
<< "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
+ << "TAO_TRY" << be_nl
+ << "{" << be_idt_nl
<< "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl
<< "if (!type->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
+ << ", TAO_TRY_ENV)) return 0; // not equal" << be_nl
+ << "TAO_CHECK_ENV;" << be_nl
<< "if (_tao_any.any_owns_data ())" << be_nl
<< "{" << be_idt_nl
<< "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
@@ -82,14 +99,15 @@ be_visitor_union_any_op_cs::visit_union (be_union *node)
<< "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
<< be_nl
<< "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem, 0, _tao_env)" << be_nl
+ << ", _tao_elem, 0, TAO_TRY_ENV)" << be_nl
<< " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
<< "{" << be_idt_nl
<< "((CORBA::Any *)&_tao_any)->replace ("
- << node->tc_name () << ", _tao_elem, 1, _tao_env);" << be_nl
- << " return 1;" << be_uidt_nl
+ << node->tc_name () << ", _tao_elem, 1, TAO_TRY_ENV);" << be_nl
+ << "TAO_CHECK_ENV;" << be_nl
+ << "return 1;" << be_uidt_nl
<< "}" << be_nl
- << "else" << be_nl // decode failed
+ << "else" << be_nl
<< "{" << be_idt_nl
<< "delete _tao_elem;" << be_nl
<< "return 0;" << be_uidt_nl
@@ -100,8 +118,14 @@ be_visitor_union_any_op_cs::visit_union (be_union *node)
<< "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
<< be_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "}" << be_nl
- << "return 0;" << be_uidt_nl
+ << "TAO_CATCHANY" << be_nl
+ << "{" << be_idt_nl
+ << "delete _tao_elem;" << be_nl
+ << "return 0; " << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_ENDTRY;" << be_uidt_nl
<< "}\n\n";