summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1998-04-16 03:33:43 +0000
committergokhale <asgokhale@users.noreply.github.com>1998-04-16 03:33:43 +0000
commita5acba2769fb7e6f6f430f4f7795be42b370e9f7 (patch)
treed47ec17cbb5e98b5e8a75ede30daa3467acdb912
parentc7a1504baf6735e0161ebe79ceefa9f6ac439ada (diff)
downloadATCD-a5acba2769fb7e6f6f430f4f7795be42b370e9f7.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c10
-rw-r--r--TAO/TAO_IDL/be/be_predefined_type.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface.cpp55
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union.cpp52
8 files changed, 333 insertions, 4 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 5c59c952836..95e25fec3b3 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,13 @@
+Wed Apr 15 22:29:29 1998 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu>
+
+ * TAO_IDL/be/{be_visitor_structure, be_visitor_union,
+ be_visitor_enum, be_visitor_sequence, be_visitor_interface,
+ be_visitor_exception}.cpp: Added code to generate the <<= and >>=
+ operators for CORBA::Any.
+
+ * TAO_IDL/be/be_predefined_type.cpp: Added cases for LongLong,
+ ULongLOng, and LongDouble which were missing.
+
Wed Apr 15 20:20:58 1998 Michael Kircher <mk1@cs.wustl.edu>
* orbsvcs/tests/Simulator/DOVEBrowser/PushConsumer{Factory}.java.JDK1.2
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 () << "[] =" <<