diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_enum.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_enum.cpp b/TAO/TAO_IDL/be/be_visitor_enum.cpp index 08692251985..809e8dee3de 100644 --- a/TAO/TAO_IDL/be/be_visitor_enum.cpp +++ b/TAO/TAO_IDL/be/be_visitor_enum.cpp @@ -66,6 +66,17 @@ be_visitor_enum_ch::visit_enum (be_enum *node) *os << "typedef " << node->local_name () << " &" << node->local_name () << "_out;\n"; + // generate the Any <<= and >>= operators + os->indent (); + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, " << node->local_name () + << ");" << be_nl; + if (node->is_nested ()) + *os << "friend "; + *os << "CORBA::Boolean operator>>= (const CORBA::Any &, " + << node->local_name () << " &);\n"; + // Generate the typecode decl if (node->is_nested ()) { @@ -144,8 +155,35 @@ be_visitor_enum_cs::visit_enum (be_enum *node) ), -1); } os->decr_indent (); - *os << "};" << be_nl; - + *os << "};\n"; + + // Any <<= and >>= operators + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << " _tao_elem)" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", &" + << "_tao_elem, 1, _tao_env);" << be_uidt_nl + << "}" << 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 + << "if (!_tao_any.type ()->equal (" << node->tc_name () + << ", _tao_env)) return 0; // not equal" << be_nl + << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" + << be_nl + << "if (stream.decode (" << node->tc_name () + << ", &_tao_elem, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << " return 1;" << be_nl + << "else" << be_nl + << " return 0;" << be_uidt_nl + << "}\n\n"; + + os->indent (); *os << "static CORBA::TypeCode _tc__tc_" << node->flatname () << " (CORBA::tk_enum, sizeof (_oc_" << node->flatname () << "), (char *) &_oc_" << node->flatname () |