summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-16 02:55:13 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-16 02:55:13 +0000
commitfb51d8ca854a8c39e1903c50ab516d6d58d25768 (patch)
tree9f0717bde4f91d8172407beba36f2393eb5bf032
parent5c53a2063a4ed90054e5bf6c35e16d07499bee7d (diff)
downloadATCD-fb51d8ca854a8c39e1903c50ab516d6d58d25768.tar.gz
Added check and CORBA_Any::from_* construction for generation of
CDR insertion operators similarly to the change made for the generated extraction operators listed in a recent commit. MSVC didn't mind, but SunOS/egcs complained.
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp53
1 files changed, 34 insertions, 19 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
index 4f336f069fa..a8a2fbe44b7 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
@@ -68,9 +68,33 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
<< "TAO_OutputCDR &strm," << be_nl
<< "const " << node->name () << " &_tao_union" << be_uidt_nl
<< ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (!(strm << _tao_union._d ()))" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ switch (node->udisc_type ())
+ {
+ case AST_Expression::EV_bool:
+ *os << "CORBA_Any::from_boolean tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+ break;
+
+ case AST_Expression::EV_char:
+ *os << "CORBA_Any::from_char tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+ break;
+
+ case AST_Expression::EV_wchar:
+ *os << "CORBA_Any::from_wchar tmp (_tao_union._d ());" << be_nl
+ << "if ( !(strm << tmp) )" << be_idt_nl;
+ break;
+
+ default:
+ *os << "if ( !(strm << _tao_union._d ()) )" << be_idt_nl;
+ break;
+ }
+
+ *os << "{" << be_idt_nl
<< "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "CORBA::Boolean result = 0;" << be_nl
<< "switch (_tao_union._d ())" << be_nl
<< "{" << be_idt_nl;
@@ -105,37 +129,28 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
{
case AST_Expression::EV_bool:
*os << "CORBA_Any::to_boolean tmp (_tao_discriminant);" << be_nl
- << "if ( !(strm >> tmp) )" << be_idt_nl
- << "{" << be_idt_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl;
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
break;
case AST_Expression::EV_char:
*os << "CORBA_Any::to_char tmp (_tao_discriminant);" << be_nl
- << "if ( !(strm >> tmp) )" << be_idt_nl
- << "{" << be_idt_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl;
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
break;
case AST_Expression::EV_wchar:
*os << "CORBA_Any::to_wchar tmp (_tao_discriminant);" << be_nl
- << "if ( !(strm >> tmp) )" << be_idt_nl
- << "{" << be_idt_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl;
+ << "if ( !(strm >> tmp) )" << be_idt_nl;
break;
default:
- *os << "if ( !(strm >> _tao_discriminant) )" << be_idt_nl
- << "{" << be_idt_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl;
+ *os << "if ( !(strm >> _tao_discriminant) )" << be_idt_nl;
break;
}
- *os << "CORBA::Boolean result = 0;" << be_nl
+ *os << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "CORBA::Boolean result = 0;" << be_nl
<< "switch (_tao_discriminant)" << be_nl
<< "{" << be_idt_nl;