summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp
index 14000e5f1e9..cfdca57943c 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp
@@ -390,24 +390,30 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
-1);
}
+ AST_PredefinedType::PredefinedType pt = node->pt ();
+
// Check what is the code generations substate. Are we generating code for
// the in/out operators for our parent or for us?
switch (this->ctx_->sub_state ())
{
case TAO_CodeGen::TAO_CDR_INPUT:
+ if (pt == AST_PredefinedType::PT_object)
+ {
+ char *local_name = node->local_name ()->get_string ();
+
+ *os << "CORBA::Object_var _tao_union_tmp;" << be_nl;
+
+ *os << "result = strm >> _tao_union_tmp.out ();" << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());";
- if (node->pt () == AST_PredefinedType::PT_pseudo)
+ }
+ else if (pt == AST_PredefinedType::PT_pseudo)
{
char *local_name = node->local_name ()->get_string ();
- if (!ACE_OS::strcmp (local_name, "TypeCode"))
- {
- *os << "CORBA::TypeCode_var _tao_union_tmp;" << be_nl;
- }
- else if (!ACE_OS::strcmp (local_name, "Object"))
- {
- *os << "CORBA::Object_var _tao_union_tmp;" << be_nl;
- }
+ *os << "CORBA::TypeCode_var _tao_union_tmp;" << be_nl;
//@@TODO - case for ValueBase.
@@ -417,7 +423,7 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
<< "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());";
}
- else if (node->pt () == AST_PredefinedType::PT_char)
+ else if (pt == AST_PredefinedType::PT_char)
{
*os << "CORBA::Char _tao_union_tmp;" << be_nl
<< "CORBA::Any::to_char _tao_union_helper "
@@ -428,7 +434,7 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
<< "_tao_union." << f->local_name ()
<< " (_tao_union_tmp);";
}
- else if (node->pt () == AST_PredefinedType::PT_wchar)
+ else if (pt == AST_PredefinedType::PT_wchar)
{
*os << "CORBA::WChar _tao_union_tmp;" << be_nl
<< "CORBA::Any::to_wchar _tao_union_helper "
@@ -439,7 +445,7 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
<< "_tao_union." << f->local_name ()
<< " (_tao_union_tmp);";
}
- else if (node->pt () == AST_PredefinedType::PT_octet)
+ else if (pt == AST_PredefinedType::PT_octet)
{
*os << "CORBA::Octet _tao_union_tmp;" << be_nl
<< "CORBA::Any::to_octet _tao_union_helper "
@@ -450,7 +456,7 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
<< "_tao_union." << f->local_name ()
<< " (_tao_union_tmp);";
}
- else if (node->pt () == AST_PredefinedType::PT_boolean)
+ else if (pt == AST_PredefinedType::PT_boolean)
{
*os << "CORBA::Boolean _tao_union_tmp;" << be_nl
<< "CORBA::Any::to_boolean _tao_union_helper "
@@ -481,26 +487,27 @@ be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *no
*os << "result = ";
- if (node->pt () == AST_PredefinedType::PT_pseudo)
+ if (pt == AST_PredefinedType::PT_pseudo
+ || pt == AST_PredefinedType::PT_object)
{
*os << "strm << _tao_union." << f->local_name () << " ();";
}
- else if (node->pt () == AST_PredefinedType::PT_char)
+ else if (pt == AST_PredefinedType::PT_char)
{
*os << "strm << CORBA::Any::from_char (_tao_union."
<< f->local_name () << " ());";
}
- else if (node->pt () == AST_PredefinedType::PT_wchar)
+ else if (pt == AST_PredefinedType::PT_wchar)
{
*os << "strm << CORBA::Any::from_wchar (_tao_union."
<< f->local_name () << " ());";
}
- else if (node->pt () == AST_PredefinedType::PT_octet)
+ else if (pt == AST_PredefinedType::PT_octet)
{
*os << "strm << CORBA::Any::from_octet (_tao_union."
<< f->local_name () << " ());";
}
- else if (node->pt () == AST_PredefinedType::PT_boolean)
+ else if (pt == AST_PredefinedType::PT_boolean)
{
*os << "strm << CORBA::Any::from_boolean (_tao_union."
<< f->local_name () << " ());";