diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1998-04-16 03:33:43 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1998-04-16 03:33:43 +0000 |
commit | a5acba2769fb7e6f6f430f4f7795be42b370e9f7 (patch) | |
tree | d47ec17cbb5e98b5e8a75ede30daa3467acdb912 /TAO/TAO_IDL | |
parent | c7a1504baf6735e0161ebe79ceefa9f6ac439ada (diff) | |
download | ATCD-a5acba2769fb7e6f6f430f4f7795be42b370e9f7.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/TAO_IDL')
-rw-r--r-- | TAO/TAO_IDL/be/be_predefined_type.cpp | 19 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum.cpp | 42 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_exception.cpp | 52 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface.cpp | 55 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_sequence.cpp | 53 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_structure.cpp | 54 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union.cpp | 52 |
7 files changed, 323 insertions, 4 deletions
diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp index 7fa818da279..2dff03c0b72 100644 --- a/TAO/TAO_IDL/be/be_predefined_type.cpp +++ b/TAO/TAO_IDL/be/be_predefined_type.cpp @@ -1,3 +1,4 @@ +// $Id$ // ============================================================================ // // = LIBRARY @@ -103,6 +104,24 @@ be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t, I_FALSE), NULL)); } break; + case AST_PredefinedType::PT_longlong: + { + new_name->nconc (new UTL_ScopedName (new Identifier ("LongLong", 1, 0, + I_FALSE), NULL)); + } + break; + case AST_PredefinedType::PT_ulonglong: + { + new_name->nconc (new UTL_ScopedName (new Identifier ("ULongLong", 1, 0, + I_FALSE), NULL)); + } + break; + case AST_PredefinedType::PT_longdouble: + { + new_name->nconc (new UTL_ScopedName (new Identifier ("LongDouble", 1, 0, + I_FALSE), NULL)); + } + break; case AST_PredefinedType::PT_any: { new_name->nconc (new UTL_ScopedName (new Identifier ("Any", 1, 0, 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 () diff --git a/TAO/TAO_IDL/be/be_visitor_exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception.cpp index b57d4527a87..b0dfc14eada 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp @@ -183,6 +183,21 @@ int be_visitor_exception_ch::visit_exception (be_exception *node) os->decr_indent (); *os << "};" << be_nl; + // generate the Any <<= and >>= operators + os->indent (); + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, const " << node->local_name () + << " &); // copying version" << be_nl; + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, " << node->local_name () + << "); // noncopying version" << 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 ()) { @@ -395,6 +410,43 @@ int be_visitor_exception_cs::visit_exception (be_exception *node) os->decr_indent (); *os << "}\n\n"; + // Any <<= and >>= operators + os->indent (); + *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 () << ", &" + << "_tao_elem, 1, _tao_env);" << be_uidt_nl + << "}" << 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_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 0, _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 + << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" + << 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 (); // generate the typecode information here os->indent (); // start from current indentation level *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" << diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index 6dea0191d48..5d391f6766b 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -733,6 +733,21 @@ be_visitor_interface_ch::visit_interface (be_interface *node) os->gen_endif (); + // generate the Any <<= and >>= operators + os->indent (); + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, " << node->local_name () + << "_ptr); // copying version" << be_nl; + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, " << node->local_name () + << "_ptr *); // noncopying version" << be_nl; + if (node->is_nested ()) + *os << "friend "; + *os << "CORBA::Boolean operator>>= (const CORBA::Any &, " + << node->local_name () << "_ptr &);\n"; + // generate the typecode decl. If we are in the outermost scope, our typecode // decl is extern if (node->is_nested ()) @@ -966,6 +981,46 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "return \"" << node->repoID () << "\";" << be_uidt_nl << "}\n\n"; + // Any <<= and >>= operators + os->indent (); + *os << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << "_ptr _tao_elem) // copying" << 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 << "void operator<<= (CORBA::Any &_tao_any, " + << node->name () << "_ptr *_tao_elem) // non copying" << be_nl + << "{" << be_idt_nl + << "CORBA::Environment _tao_env;" << be_nl + << "_tao_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 0, _tao_env);" << be_uidt_nl + << "}" << 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_elem = " << node->name () << "::_nil ();" << 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 + << "CORBA::Object_ptr _tao_obj;" << be_nl + << "if (stream.decode (" << node->tc_name () + << ", &_tao_obj, 0, _tao_env)" << be_nl + << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl + << "{" << be_idt_nl + << "*_tao_elem = " << node->name () << "::_narrow (_tao_obj, _tao_env);" + << be_nl + << "CORBA::release (_tao_obj);" << be_nl + << "if (_tao_env.exception ()) return 0; // narrow failed" << be_uidt_nl + << "}" << be_uidt_nl + << "}\n\n"; + + os->indent (); // generate the typecode information here os->indent (); // start from current indentation level *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" << diff --git a/TAO/TAO_IDL/be/be_visitor_sequence.cpp b/TAO/TAO_IDL/be/be_visitor_sequence.cpp index 30c69532422..de4da91019b 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence.cpp @@ -209,6 +209,21 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node) *os << "typedef " << node->local_name () << " *" << node->local_name () << "_ptr;\n"; + // generate the Any <<= and >>= operators + os->indent (); + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, const " << node->local_name () + << " &); // copying version" << be_nl; + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, " << node->local_name () + << "); // noncopying version" << 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 ()) { @@ -1123,7 +1138,43 @@ int be_visitor_sequence_cs::visit_sequence (be_sequence *node) // destructor *os << node->name () << "::~" << node->local_name () << " (void) // dtor" << be_nl - << "{}" << be_nl << be_nl; + << "{}\n\n"; + + // Any <<= and >>= operators + os->indent (); + *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 () << ", &" + << "_tao_elem, 1, _tao_env);" << be_uidt_nl + << "}" << 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_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 0, _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 + << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" + << 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"; // generate the typecode information here os->indent (); // start from current indentation level diff --git a/TAO/TAO_IDL/be/be_visitor_structure.cpp b/TAO/TAO_IDL/be/be_visitor_structure.cpp index d0fd88b13e1..ae39d5d9e36 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure.cpp @@ -164,6 +164,21 @@ int be_visitor_structure_ch::visit_structure (be_structure *node) () << "_out;\n\n"; } + // generate the Any <<= and >>= operators + os->indent (); + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, const " << node->local_name () + << " &); // copying version" << be_nl; + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, " << node->local_name () + << "); // noncopying version" << 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 ()) { @@ -268,8 +283,45 @@ int be_visitor_structure_cs::visit_structure (be_structure *node) "codegen for typecode failed\n"), -1); } os->decr_indent (); - *os << "};" << be_nl; + *os << "};\n\n"; + // Any <<= and >>= operators + os->indent (); + *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 () << ", &" + << "_tao_elem, 1, _tao_env);" << be_uidt_nl + << "}" << 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_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 0, _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 + << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" + << 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_struct, sizeof (_oc_" << node->flatname () << "), (char *) &_oc_" << node->flatname () << diff --git a/TAO/TAO_IDL/be/be_visitor_union.cpp b/TAO/TAO_IDL/be/be_visitor_union.cpp index 7e3bd0f46e7..c7c804e2741 100644 --- a/TAO/TAO_IDL/be/be_visitor_union.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union.cpp @@ -224,6 +224,21 @@ int be_visitor_union_ch::visit_union (be_union *node) os->decr_indent (); *os << "}; // " << node->name () << "\n\n"; + // generate the Any <<= and >>= operators + os->indent (); + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, const " << node->local_name () + << " &); // copying version" << be_nl; + if (node->is_nested ()) + *os << "friend "; + *os << "void operator<<= (CORBA::Any &, " << node->local_name () + << "); // noncopying version" << 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 ()) { @@ -531,6 +546,43 @@ int be_visitor_union_cs::visit_union (be_union *node) os->decr_indent (); *os << "}\n\n"; + // Any <<= and >>= operators + os->indent (); + *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 () << ", &" + << "_tao_elem, 1, _tao_env);" << be_uidt_nl + << "}" << 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_any.replace (" << node->tc_name () << ", " + << "_tao_elem, 0, _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 + << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" + << 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 (); // generate the typecode information here os->indent (); // start from current indentation level *os << "static const CORBA::Long _oc_" << node->flatname () << "[] =" << |