summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-06-20 23:49:58 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-06-20 23:49:58 +0000
commit95541cd0451c305955c08363b340c9c0bae9143e (patch)
tree1a28d2753f8f21c9ce839e913f8c1b9bd1e75d44
parent9352bfdaa5b1c6f55d1f1dc94209a91ce9028855 (diff)
downloadATCD-95541cd0451c305955c08363b340c9c0bae9143e.tar.gz
Thu Jun 20 18:48:28 2002 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r--TAO/TAO_IDL/ast/ast_decl.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp67
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp135
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp159
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp531
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp90
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp60
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp25
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp285
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp438
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp114
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp68
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_access_cs.cpp481
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp140
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp251
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp58
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp6
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/array.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_access_cs.h80
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h6
41 files changed, 1829 insertions, 1455 deletions
diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp
index 3bb4c54ff1f..8ab302549a5 100644
--- a/TAO/TAO_IDL/ast/ast_decl.cpp
+++ b/TAO/TAO_IDL/ast/ast_decl.cpp
@@ -1103,6 +1103,11 @@ AST_Decl::compute_name (const char *prefix,
void
AST_Decl::set_name (UTL_ScopedName *n)
{
+ if (this->pd_name == n)
+ {
+ return;
+ }
+
if (this->pd_name != 0)
{
this->pd_name->destroy ();
diff --git a/TAO/TAO_IDL/be/be_visitor_array.cpp b/TAO/TAO_IDL/be/be_visitor_array.cpp
index 3bbde0a37fa..5b425c96a6e 100644
--- a/TAO/TAO_IDL/be/be_visitor_array.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array.cpp
@@ -26,6 +26,8 @@
#include "be_string.h"
#include "be_interface.h"
#include "be_interface_fwd.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
#include "be_structure.h"
#include "be_union.h"
#include "be_sequence.h"
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array.cpp b/TAO/TAO_IDL/be/be_visitor_array/array.cpp
index 541b5a0bbc1..96bf2fcb913 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array.cpp
@@ -103,6 +103,60 @@ be_visitor_array::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_array::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_ARRAY_CH)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ }
+ else
+ {
+ *os << bt->name () << "_var";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_array::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_ARRAY_CH)
+ {
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var");
+ }
+ else
+ {
+ *os << bt->name () << "_var";
+ }
+
+ return 0;
+}
+
+int
be_visitor_array::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
index 99bafc854f1..45bdd476e8d 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
@@ -197,6 +197,18 @@ be_visitor_array_cdr_op_ci::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_array_cdr_op_ci::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_array_cdr_op_ci::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
be_visitor_array_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -583,6 +595,8 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
case AST_Decl::NT_wstring:
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
*os << ".out ()";
break;
case AST_Decl::NT_pre_defined:
@@ -656,6 +670,8 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
case AST_Decl::NT_wstring:
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
*os << ".in ()";
break;
case AST_Decl::NT_pre_defined:
diff --git a/TAO/TAO_IDL/be/be_visitor_exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception.cpp
index 45f5377a01e..872abd3895f 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp
@@ -24,6 +24,8 @@
#include "be_enum.h"
#include "be_interface.h"
#include "be_interface_fwd.h"
+#include "be_valuetype.h"
+#include "be_valuetype_fwd.h"
#include "be_array.h"
#include "be_predefined_type.h"
#include "be_string.h"
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp
index 58e7c9ae69a..d326559dc93 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp
@@ -67,10 +67,17 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
-1);
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// set the sub state as generating code for the output operator
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
- *os << "ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
- << "const " << node->name () << " &_tao_aggregate)" << be_nl
+
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
// do we have any members?
if (node->nmembers () > 0)
@@ -80,10 +87,10 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
field_decl.visit_scope (node);
// some members
- *os << "// first marshal the repository ID" << be_nl
- << "if (strm << _tao_aggregate._rep_id ())" << be_nl
+ *os << "// First marshal the repository ID." << be_nl
+ << "if (strm << _tao_aggregate._rep_id ())" << be_idt_nl
<< "{" << be_idt_nl
- << "// now marshal the members (if any)" << be_nl
+ << "// Now marshal the members (if any)." << be_nl
<< "if (" << be_idt_nl;
if (this->visit_scope (node) == -1)
@@ -95,41 +102,55 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
-1);
}
- *os << be_uidt_nl << ")"
+ *os << be_uidt_nl << " )"
<< be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt_nl
- << "}" << be_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt_nl;
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
}
else
{
// No members.
- *os << "// first marshal the repository ID" << be_nl
+ *os << "// First marshal the repository ID." << be_nl
<< "if (strm << _tao_aggregate._rep_id ())" << be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt_nl;
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
}
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
// Set the substate as generating code for the input operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
- *os << "ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &";
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &";
if (node->nmembers () > 0)
{
- *os << "strm,"
- << node->name () << " &_tao_aggregate)" << be_nl;
+ *os << "strm," << be_nl
+ << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl;
}
else
{
- *os << ","
- << node->name () << "&)" << be_nl;
+ *os << "," << be_nl
+ << node->name () << "&" << be_uidt_nl
+ << ")" << be_uidt_nl;
}
*os << "{" << be_idt_nl;
@@ -148,7 +169,7 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
field_decl.visit_scope (node);
// Some members.
- *os << "// now marshal the members" << be_nl
+ *os << "// Demarshal the members." << be_nl
<< "if (" << be_idt_nl;
if (this->visit_scope (node) == -1)
@@ -159,18 +180,22 @@ be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node)
"codegen for scope failed\n"),
-1);
}
- *os << be_uidt_nl << ")"
+ *os << be_uidt_nl << " )"
<< be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt << be_uidt_nl;
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl;
}
else
{
*os << "return 1;" << be_uidt_nl;
}
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
node->cli_inline_cdr_op_gen (1);
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp
index 3ef2190e657..314fdec7bbe 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp
@@ -95,7 +95,7 @@ be_visitor_exception_ctor_assign::visit_array (be_array *node)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (ACE_OS::strcmp (bd->flat_name (), node->flat_name ()) != 0)
{
@@ -112,13 +112,13 @@ be_visitor_exception_ctor_assign::visit_array (be_array *node)
{
// Constructor from member args.
*os << "_copy (this->" << bd->local_name ()
- << ", _tao_" << bd->local_name () << ");\n";
+ << ", _tao_" << bd->local_name () << ");";
}
else
{
// Copy constructor and assignment operator.
*os << "_copy (this->" << bd->local_name ()
- << ", _tao_excp." << bd->local_name () << ");\n";
+ << ", _tao_excp." << bd->local_name () << ");";
}
return 0;
@@ -130,17 +130,17 @@ be_visitor_exception_ctor_assign::visit_enum (be_enum *)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_"
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
return 0;
@@ -152,17 +152,17 @@ be_visitor_exception_ctor_assign::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = " << node->name ()
- << "::_duplicate (_tao_" << bd->local_name () << ");\n";
+ << "::_duplicate (_tao_" << bd->local_name () << ");";
}
else
{
*os << "this->" << bd->local_name () << " = " << node->name ()
- << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());\n";
+ << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());";
}
return 0;
@@ -175,21 +175,90 @@ int be_visitor_exception_ctor_assign::visit_interface_fwd (
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = " << node->name ()
- << "::_duplicate (_tao_" << bd->local_name () << ");\n";
+ << "::_duplicate (_tao_" << bd->local_name () << ");";
}
else
{
*os << "this->" << bd->local_name () << " = " << node->name ()
- << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());\n";
+ << "::_duplicate (_tao_excp." << bd->local_name () << ".in ());";
}
return 0;
}
+int
+be_visitor_exception_ctor_assign::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "CORBA::add_ref (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "_tao_" << bd->local_name () << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << "this->" << bd->local_name () << " = _tao_"
+ << bd->local_name () << ";";
+ }
+ else
+ {
+ *os << "CORBA::add_ref (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "_tao_excp." << bd->local_name () << ".in ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ".in ();";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor_assign::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_decl *bd = this->ctx_->node ();
+
+ *os << be_nl;
+
+ if (this->ctx_->exception ()) // Special constructor.
+ {
+ *os << "CORBA::add_ref (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "_tao_" << bd->local_name () << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << "this->" << bd->local_name () << " = _tao_"
+ << bd->local_name () << ";";
+ }
+ else
+ {
+ *os << "CORBA::add_ref (" << be_idt << be_idt_nl
+ << "ACE_const_cast (" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << "_tao_excp." << bd->local_name () << ".in ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+ *os << "this->" << bd->local_name () << " = _tao_excp."
+ << bd->local_name () << ".in ();";
+ }
+
+ return 0;
+}
+
int be_visitor_exception_ctor_assign::visit_predefined_type (
be_predefined_type *node
)
@@ -198,7 +267,7 @@ int be_visitor_exception_ctor_assign::visit_predefined_type (
be_decl *bd = this->ctx_->node ();
AST_PredefinedType::PredefinedType pt = node->pt ();
- os->indent ();
+ *os << be_nl;
// Check if the type is an any.
if (pt == AST_PredefinedType::PT_any)
@@ -206,12 +275,12 @@ int be_visitor_exception_ctor_assign::visit_predefined_type (
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_"
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
}
else if (pt == AST_PredefinedType::PT_pseudo
@@ -221,13 +290,13 @@ int be_visitor_exception_ctor_assign::visit_predefined_type (
{
*os << "this->" << bd->local_name () << " = "
<< node->name () << "::_duplicate (_tao_"
- << bd->local_name () << ");\n";
+ << bd->local_name () << ");";
}
else
{
*os << "this->" << bd->local_name () << " = "
<< node->name () << "::_duplicate (_tao_excp."
- << bd->local_name () << ".in ());\n";
+ << bd->local_name () << ".in ());";
}
}
else // Simple predefined types.
@@ -235,12 +304,12 @@ int be_visitor_exception_ctor_assign::visit_predefined_type (
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_"
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
}
@@ -252,17 +321,17 @@ int be_visitor_exception_ctor_assign::visit_sequence (be_sequence *)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
- << ";\n";
+ << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
return 0;
@@ -273,7 +342,7 @@ int be_visitor_exception_ctor_assign::visit_string (be_string *node)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
@@ -281,13 +350,13 @@ int be_visitor_exception_ctor_assign::visit_string (be_string *node)
{
*os << "this->" << bd->local_name ()
<< " = CORBA::string_dup (_tao_"
- << bd->local_name () << ");\n";
+ << bd->local_name () << ");";
}
else
{
*os << "this->" << bd->local_name ()
<< " = CORBA::wstring_dup (_tao_"
- << bd->local_name () << ");\n";
+ << bd->local_name () << ");";
}
}
else
@@ -296,13 +365,13 @@ int be_visitor_exception_ctor_assign::visit_string (be_string *node)
{
*os << "this->" << bd->local_name ()
<< " = CORBA::string_dup (_tao_excp."
- << bd->local_name () << ".in ());\n";
+ << bd->local_name () << ".in ());";
}
else
{
*os << "this->" << bd->local_name ()
<< " = CORBA::wstring_dup (_tao_excp."
- << bd->local_name () << ".in ());\n";
+ << bd->local_name () << ".in ());";
}
}
@@ -314,17 +383,17 @@ int be_visitor_exception_ctor_assign::visit_structure (be_structure *)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
- << ";\n";
+ << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
return 0;
@@ -335,17 +404,17 @@ int be_visitor_exception_ctor_assign::visit_union (be_union *)
TAO_OutStream *os = this->ctx_->stream ();
be_decl *bd = this->ctx_->node ();
- os->indent ();
+ *os << be_nl;
if (this->ctx_->exception ()) // Special constructor.
{
*os << "this->" << bd->local_name () << " = _tao_" << bd->local_name ()
- << ";\n";
+ << ";";
}
else
{
*os << "this->" << bd->local_name () << " = _tao_excp."
- << bd->local_name () << ";\n";
+ << bd->local_name () << ";";
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
index 3dbfc3d711e..dc806464c9a 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
@@ -41,104 +41,107 @@ be_visitor_exception_ch::~be_visitor_exception_ch (void)
// Visit the Exception node and its scope.
int be_visitor_exception_ch::visit_exception (be_exception *node)
{
- TAO_OutStream *os = 0;
-
- if (!node->cli_hdr_gen () && !node->imported ())
+ if (node->cli_hdr_gen () || node->imported ())
{
- os = this->ctx_->stream ();
+ return 0;
+ }
- os->gen_ifdef_macro (node->flat_name ());
+ TAO_OutStream *os = this->ctx_->stream ();
- *os << "class " << be_global->stub_export_macro ()
- << " " << node->local_name ()
- << " : public CORBA::UserException" << be_nl;
- *os << "{" << be_nl
- << "public:" << be_idt_nl;
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
- // Generate code for field members.
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_ch::"
- "visit_exception - "
- "codegen for scope failed\n"), -1);
- }
+ os->gen_ifdef_macro (node->flat_name ());
- *os << be_nl;
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ()
+ << " : public CORBA::UserException" << be_nl;
+ *os << "{" << be_nl
+ << "public:" << be_idt_nl;
- // Constructors and destructor.
- *os << node->local_name () << " (void);" << be_nl
- << node->local_name () << " (const " << node->local_name ()
- << " &);" << be_nl
- << "~" << node->local_name () << " (void);\n" << be_nl;
+ // Generate code for field members.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_ch::"
+ "visit_exception - "
+ "codegen for scope failed\n"),
+ -1);
+ }
- // Assignment operator.
- *os << node->local_name () << " &operator= (const "
- << node->local_name () << " &);\n" << be_nl;
+ *os << be_nl;
- *os << "static void _tao_any_destructor (void*);\n" << be_nl;
+ // Constructors and destructor.
+ *os << node->local_name () << " (void);" << be_nl
+ << node->local_name () << " (const " << node->local_name ()
+ << " &);" << be_nl
+ << "~" << node->local_name () << " (void);\n" << be_nl;
- *os << "static " << node->local_name ()
- << " *_downcast (CORBA::Exception *);" << be_nl;
+ // Assignment operator.
+ *os << node->local_name () << " &operator= (const "
+ << node->local_name () << " &);\n" << be_nl;
- *os << "static CORBA::Exception *_alloc (void);\n" << be_nl;
+ *os << "static void _tao_any_destructor (void*);\n" << be_nl;
- *os << "virtual CORBA::Exception *"
- << "_tao_duplicate (void) const;\n" << be_nl
- << "virtual void _raise (void);\n" << be_nl
- << "virtual void _tao_encode (" << be_idt << be_idt_nl
- << "TAO_OutputCDR &" << be_nl
- << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
- << ") const;" << be_uidt_nl << be_nl
- << "virtual void _tao_decode (" << be_idt << be_idt_nl
- << "TAO_InputCDR &" << be_nl
- << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl;
+ *os << "static " << node->local_name ()
+ << " *_downcast (CORBA::Exception *);" << be_nl;
- // Generate constructor that takes each member as a parameter. We need a
- // new state. Such a constructor exists if we have members.
- if (node->member_count () > 0)
- {
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CH);
- be_visitor_exception_ctor visitor (&ctx);
-
- if (node->accept (&visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception::"
- "visit_exception - "
- "codegen for ctor failed\n"),
- -1);
- }
- }
+ *os << "static CORBA::Exception *_alloc (void);\n" << be_nl;
+
+ *os << "virtual CORBA::Exception *"
+ << "_tao_duplicate (void) const;\n" << be_nl
+ << "virtual void _raise (void);\n" << be_nl
+ << "virtual void _tao_encode (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &" << be_nl
+ << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ") const;" << be_uidt_nl << be_nl
+ << "virtual void _tao_decode (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &" << be_nl
+ << "ACE_ENV_ARG_DECL_NOT_USED" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+
+ // Generate constructor that takes each member as a parameter. We need a
+ // new state. Such a constructor exists if we have members.
+ if (node->member_count () > 0)
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CH);
+ be_visitor_exception_ctor visitor (&ctx);
- if (be_global->tc_support ())
+ if (node->accept (&visitor) == -1)
{
- *os << be_nl <<"virtual CORBA::TypeCode_ptr _type (void) const;";
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_exception - "
+ "codegen for ctor failed\n"),
+ -1);
}
+ }
+
+ if (be_global->tc_support ())
+ {
+ *os << be_nl <<"virtual CORBA::TypeCode_ptr _type (void) const;";
+ }
- *os << be_uidt_nl << "};\n\n";
+ *os << be_uidt_nl << "};" << be_nl << be_nl;
- if (be_global->tc_support ())
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
+ be_visitor_typecode_decl visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
- be_visitor_typecode_decl visitor (&ctx);
-
- if (node->accept (&visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_ch::"
- "visit_exception - "
- "TypeCode declaration failed\n"),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_ch::"
+ "visit_exception - "
+ "TypeCode declaration failed\n"),
+ -1);
}
-
- os->gen_endif ();
- node->cli_hdr_gen (1);
}
+ os->gen_endif ();
+ node->cli_hdr_gen (1);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
index 59abb6dfc2c..c5f6edf3d66 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
@@ -41,92 +41,65 @@ be_visitor_exception_cs::~be_visitor_exception_cs (void)
// Visit the Exception_Cs node and its scope.
int be_visitor_exception_cs::visit_exception (be_exception *node)
{
- if (!node->cli_stub_gen () && !node->imported ())
+ if (node->cli_stub_gen () || node->imported ())
{
- TAO_OutStream *os = this->ctx_->stream ();
-
- os->indent ();
-
- // Generate stub code required of any anonymous types of members.
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception::"
- "visit_exception -"
- "code for stub failed\n"),
- -1);
- }
-
- *os << "// TAO_IDL - Generated from " << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
-
- // Default constructor.
- *os << "// Default constructor." << be_nl;
- *os << node->name () << "::" << node->local_name ()
- << " (void)" << be_idt_nl;
- *os << ": CORBA_UserException (" << be_idt << be_idt << be_idt_nl
- << "\"" << node->repoID () << "\"," << be_nl
- << "\"" << node->local_name () << "\"" << be_uidt_nl
- << ")" << be_uidt << be_uidt << be_uidt_nl;
- *os << "{" << be_nl;
- *os << "}" << be_nl << be_nl;
-
- // Destructor.
- *os << "// Destructor - all members are of self managing types."
- << be_nl;
- *os << node->name () << "::~" << node->local_name ()
- << " (void)" << be_nl;
- *os << "{" << be_nl;
- *os << "}" << be_nl << be_nl;
-
- // Copy constructor.
- *os << "// Copy constructor." << be_nl;
- *os << node->name () << "::" << node->local_name () << " (const ::"
- << node->name () << " &_tao_excp)" << be_idt_nl;
- *os << ": CORBA_UserException (" << be_idt << be_idt << be_idt_nl
- << "_tao_excp._rep_id ()," << be_nl
- << "_tao_excp._name ()" << be_uidt_nl
- << ")" << be_uidt << be_uidt << be_uidt_nl;
- *os << "{\n";
-
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
-
- if (node->nmembers () > 0)
- {
- *os << be_idt;
-
- // Assign each individual member.
- be_visitor_exception_ctor_assign visitor (&ctx);
-
- if (node->accept (&visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_cs::"
- "visit_exception -"
- "codegen for scope failed\n"),
- -1);
- }
+ return 0;
+ }
- *os << be_uidt;
+ TAO_OutStream *os = this->ctx_->stream ();
- os->decr_indent ();
- }
+ os->indent ();
- *os << "}" << be_nl << be_nl;
+ // Generate stub code required of any anonymous types of members.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_exception -"
+ "code for stub failed\n"),
+ -1);
+ }
- // Assignment operator.
- *os << "// Assignment operator." << be_nl;
- *os << node->name () << "&" << be_nl;
- *os << node->name () << "::operator= (const ::"
- << node->name () << " &_tao_excp)" << be_nl
- << "{" << be_idt_nl
- << "this->CORBA_UserException::operator= "
- << "(_tao_excp);\n";
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Default constructor.
+ *os << "// Default constructor." << be_nl;
+ *os << node->name () << "::" << node->local_name ()
+ << " (void)" << be_idt_nl;
+ *os << ": CORBA_UserException (" << be_idt << be_idt << be_idt_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->local_name () << "\"" << be_uidt_nl
+ << ")" << be_uidt << be_uidt << be_uidt_nl;
+ *os << "{" << be_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Destructor.
+ *os << "// Destructor - all members are of self managing types."
+ << be_nl;
+ *os << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl;
+ *os << "{" << be_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Copy constructor.
+ *os << "// Copy constructor." << be_nl;
+ *os << node->name () << "::" << node->local_name () << " (const ::"
+ << node->name () << " &_tao_excp)" << be_idt_nl;
+ *os << ": CORBA_UserException (" << be_idt << be_idt << be_idt_nl
+ << "_tao_excp._rep_id ()," << be_nl
+ << "_tao_excp._name ()" << be_uidt_nl
+ << ")" << be_uidt << be_uidt << be_uidt_nl;
+ *os << "{";
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
+
+ if (node->nmembers () > 0)
+ {
+ *os << be_idt;
// Assign each individual member.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
be_visitor_exception_ctor_assign visitor (&ctx);
if (node->accept (&visitor) == -1)
@@ -137,230 +110,250 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
"codegen for scope failed\n"),
-1);
}
+ }
- os->indent ();
+ *os << be_uidt_nl
+ << "}" << be_nl << be_nl;
- *os << "return *this;" << be_uidt_nl
- << "}" << be_nl << be_nl;
+ // Assignment operator.
+ *os << "// Assignment operator." << be_nl;
+ *os << node->name () << "&" << be_nl;
+ *os << node->name () << "::operator= (const ::"
+ << node->name () << " &_tao_excp)" << be_nl
+ << "{" << be_idt_nl
+ << "this->CORBA_UserException::operator= "
+ << "(_tao_excp);";
- *os << "void "
- << node->name ()
- << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ // Assign each individual member.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
+ be_visitor_exception_ctor_assign visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cs::"
+ "visit_exception -"
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << "void "
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "{" << be_idt_nl
+ << node->local_name () << " *tmp = ACE_static_cast ("
+ << node->local_name () << "*, _tao_void_pointer);" << be_nl
+ << "delete tmp;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << node->name () << " *" << be_nl;
+ *os << node->name () << "::_downcast (CORBA::Exception *exc)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "if (!ACE_OS::strcmp (\"" << node->repoID ()
+ << "\", exc->_rep_id ()))" << be_idt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return ACE_dynamic_cast (" << node->local_name ()
+ << " *, exc);" << be_uidt_nl;
+ *os << "}" << be_uidt_nl;
+ *os << "else" << be_idt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return 0;" << be_uidt_nl;
+ *os << "}" << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Generate the _alloc method.
+ *os << "CORBA::Exception *" << node->name ()
+ << "::_alloc (void)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "CORBA::Exception *retval = 0;" << be_nl
+ << "ACE_NEW_RETURN (retval, ::" << node->name ()
+ << ", 0);" << be_nl
+ << "return retval;" << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ *os << "CORBA::Exception *" << be_nl
+ << node->name () << "::_tao_duplicate (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Exception *result;" << be_nl
+ << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "result," << be_nl
+ << "::" << node->name () << " (*this)," << be_nl
+ << "0" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "return result;" << be_uidt_nl
+ << "}\n" << be_nl;
+
+ *os << "void " << node->name () << "::_raise ()" << be_nl
+ << "{" << be_idt_nl
+ << "TAO_RAISE (*this);" << be_uidt_nl
+ << "}\n" << be_nl;
+
+ *os << "void " << node->name ()
+ << "::_tao_encode (" << be_idt << be_idt_nl;
+
+ if (!node->is_local ())
+ {
+ *os << "TAO_OutputCDR &cdr" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ") const" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (cdr << *this)" << be_idt_nl
<< "{" << be_idt_nl
- << node->local_name () << " *tmp = ACE_static_cast ("
- << node->local_name () << "*, _tao_void_pointer);" << be_nl
- << "delete tmp;" << be_uidt_nl
- << "}" << be_nl << be_nl;
+ << "return;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ if (be_global->use_raw_throw ())
+ {
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
+ }
- *os << node->name () << " *" << be_nl;
- *os << node->name () << "::_downcast (CORBA::Exception *exc)" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "if (!ACE_OS::strcmp (\"" << node->repoID ()
- << "\", exc->_rep_id ()))" << be_idt_nl;
- *os << "{" << be_idt_nl;
- *os << "return ACE_dynamic_cast (" << node->local_name ()
- << " *, exc);" << be_uidt_nl;
- *os << "}" << be_uidt_nl;
- *os << "else" << be_idt_nl;
- *os << "{" << be_idt_nl;
- *os << "return 0;" << be_uidt_nl;
- *os << "}" << be_uidt << be_uidt_nl;
*os << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "TAO_OutputCDR &" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ") const" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (be_global->use_raw_throw ())
+ {
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
+ }
- // Generate the _alloc method.
- *os << "CORBA::Exception *" << node->name ()
- << "::_alloc (void)" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "CORBA::Exception *retval = 0;" << be_nl
- << "ACE_NEW_RETURN (retval, ::" << node->name ()
- << ", 0);" << be_nl
- << "return retval;" << be_uidt_nl;
*os << "}" << be_nl << be_nl;
+ }
- *os << "CORBA::Exception *" << be_nl
- << node->name () << "::_tao_duplicate (void) const" << be_nl
+ *os << "void " << node->name ()
+ << "::_tao_decode (" << be_idt << be_idt_nl;
+
+ if (!node->is_local ())
+ {
+ *os << "TAO_InputCDR &cdr" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl
- << "CORBA::Exception *result;" << be_nl
- << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
- << "result," << be_nl
- << "::" << node->name () << " (*this)," << be_nl
- << "0" << be_uidt_nl
- << ");" << be_uidt_nl
- << "return result;" << be_uidt_nl
- << "}\n" << be_nl;
-
- *os << "void " << node->name () << "::_raise ()" << be_nl
+ << "if (cdr >> *this)" << be_idt_nl
<< "{" << be_idt_nl
- << "TAO_RAISE (*this);" << be_uidt_nl
- << "}\n" << be_nl;
-
- *os << "void " << node->name ()
- << "::_tao_encode (" << be_idt << be_idt_nl;
+ << "return;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
- if (!node->is_local ())
+ if (be_global->use_raw_throw ())
{
- *os << "TAO_OutputCDR &cdr" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ") const" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (cdr << *this)" << be_idt_nl
- << "{" << be_idt_nl
- << "return;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- if (be_global->use_raw_throw ())
- {
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
- }
-
- *os << "}" << be_nl << be_nl;
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
}
else
{
- *os << "TAO_OutputCDR &" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ") const" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (be_global->use_raw_throw ())
- {
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
- }
-
- *os << "}" << be_nl << be_nl;
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
}
- *os << "void " << node->name ()
- << "::_tao_decode (" << be_idt << be_idt_nl;
+ *os << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "TAO_InputCDR &" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl;
- if (!node->is_local ())
+ if (be_global->use_raw_throw ())
{
- *os << "TAO_InputCDR &cdr" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (cdr >> *this)" << be_idt_nl
- << "{" << be_idt_nl
- << "return;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- if (be_global->use_raw_throw ())
- {
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
- }
-
- *os << "}" << be_nl << be_nl;
+ *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
}
else
{
- *os << "TAO_InputCDR &" << be_nl
- << "ACE_ENV_ARG_DECL" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (be_global->use_raw_throw ())
- {
- *os << "throw CORBA::MARSHAL ();" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
- }
-
- *os << "}" << be_nl << be_nl;
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl;
}
- // Constructor taking all members. It exists only if there are any
- // members.
- if (node->member_count () > 0)
+ *os << "}" << be_nl << be_nl;
+ }
+
+ // Constructor taking all members. It exists only if there are any
+ // members.
+ if (node->member_count () > 0)
+ {
+ // Generate the signature.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CS);
+ be_visitor_exception_ctor ec_visitor (&ctx);
+
+ if (node->accept (&ec_visitor) == -1)
{
- // Generate the signature.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_CS);
- be_visitor_exception_ctor ec_visitor (&ctx);
-
- if (node->accept (&ec_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception::"
- "visit_exception - "
- "codegen for ctor failed\n"),
- -1);
- }
-
- *os << " : CORBA_UserException ("
- << be_idt << be_idt << be_idt << be_idt_nl
- << "\"" << node->repoID () << "\"," << be_nl
- << "\"" << node->local_name () << "\"" << be_uidt_nl
- << ")" << be_uidt << be_uidt << be_uidt << be_uidt_nl;
- *os << "{\n";
-
- // Assign each individual member. We need yet another state.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
-
- // Indicate that the special ctor is being generated.
- ctx.exception (1);
-
- be_visitor_exception_ctor_assign eca_visitor (&ctx);
-
- *os << be_idt;
-
- if (node->accept (&eca_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_cs::"
- "visit_exception -"
- "codegen for scope failed\n"),
- -1);
- }
-
- os->decr_indent ();
-
- *os << "}\n\n";
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::"
+ "visit_exception - "
+ "codegen for ctor failed\n"),
+ -1);
}
- if (be_global->tc_support ())
+ *os << " : CORBA_UserException ("
+ << be_idt << be_idt << be_idt << be_idt_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->local_name () << "\"" << be_uidt_nl
+ << ")" << be_uidt << be_uidt << be_uidt << be_uidt_nl;
+ *os << "{" << be_idt;
+
+ // Assign each individual member. We need yet another state.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
+
+ // Indicate that the special ctor is being generated.
+ ctx.exception (1);
+
+ be_visitor_exception_ctor_assign eca_visitor (&ctx);
+
+ if (node->accept (&eca_visitor) == -1)
{
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
- ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- be_visitor_typecode_defn visitor (&ctx);
-
- if (node->accept (&visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_exception_cs::"
- "visit_exception - "
- "TypeCode definition failed\n"),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cs::"
+ "visit_exception -"
+ "codegen for scope failed\n"),
+ -1);
}
- if (be_global->tc_support ())
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
+ }
+
+ if (be_global->tc_support ())
+ {
+ *os << "// TAO extension - the virtual _type method." << be_nl;
+ *os << "CORBA::TypeCode_ptr " << node->name ()
+ << "::_type (void) const" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return ::" << node->tc_name () << ";" << be_uidt_nl;
+ *os << "}" << be_nl;
+ }
+
+ if (be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
+ ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ be_visitor_typecode_defn visitor (&ctx);
+
+ if (node->accept (&visitor) == -1)
{
- *os << "\n// TAO extension - the virtual _type method." << be_nl;
- *os << "CORBA::TypeCode_ptr " << node->name ()
- << "::_type (void) const" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "return ::" << node->tc_name () << ";" << be_uidt_nl;
- *os << "}" << be_nl << be_nl;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_cs::"
+ "visit_exception - "
+ "TypeCode definition failed\n"),
+ -1);
}
-
- node->cli_stub_gen (I_TRUE);
}
+ node->cli_stub_gen (I_TRUE);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp
index 677b50c3a22..cf497604458 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp
@@ -54,8 +54,6 @@ int be_visitor_exception_ctor::visit_exception (be_exception *node)
TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->node (node);
- os->indent ();
-
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
{
*os << node->local_name ();
@@ -194,11 +192,11 @@ int be_visitor_exception_ctor::visit_interface (be_interface *node)
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
{
- *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr ");
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr");
}
else
{
- *os << "const " << bt->name () << "_ptr ";
+ *os << "const " << bt->name () << "_ptr";
}
return 0;
@@ -220,11 +218,63 @@ int be_visitor_exception_ctor::visit_interface_fwd (be_interface_fwd *node)
if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
{
- *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr ");
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), "_ptr");
+ }
+ else
+ {
+ *os << "const " << bt->name () << "_ptr";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), " *");
+ }
+ else
+ {
+ *os << "const " << bt->name () << " *";
+ }
+
+ return 0;
+}
+
+int be_visitor_exception_ctor::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_EXCEPTION_CTOR_CH)
+ {
+ *os << "const " << bt->nested_type_name (this->ctx_->scope (), " *");
}
else
{
- *os << "const " << bt->name () << "_ptr ";
+ *os << "const " << bt->name () << " *";
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp
index 703f3835d69..37a3b4f9881 100644
--- a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp
@@ -352,6 +352,96 @@ be_visitor_field_cdr_op_ci::visit_interface_fwd (be_interface_fwd *)
return 0;
}
+// Visit value type.
+int
+be_visitor_field_cdr_op_ci::visit_valuetype (be_valuetype *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_field *f = this->ctx_->be_node_as_field ();
+
+ if (!f)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_valuetype - "
+ "cannot retrieve field node\n"),
+ -1);
+ }
+
+ // 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:
+ *os << "(strm >> _tao_aggregate." << f->local_name () << ".out ())";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because a valuetype cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_valuetype - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+// Visit value forward type.
+int
+be_visitor_field_cdr_op_ci::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the field node.
+ be_field *f = this->ctx_->be_node_as_field ();
+
+ if (f == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_valuetype_fwd - "
+ "cannot retrieve field node\n"),
+ -1);
+ }
+
+ // 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:
+ *os << "(strm >> _tao_aggregate." << f->local_name () << ".out ())";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "(strm << _tao_aggregate." << f->local_name () << ".in ())";
+
+ break;
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because a valuetype cannot be declared inside a
+ // structure.
+ break;
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_field_cdr_op_ci::"
+ "visit_valuetype_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
// Visit predefined type.
int
be_visitor_field_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
index b4da4d11ae5..a46d835851e 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
@@ -56,7 +56,7 @@ be_visitor_interface_cdr_op_ci::visit_interface (be_interface *node)
// First generate code for our children. The reason we do this first is
// because the inlined code for our children must be available before
- // it in our parent, but we must forward declare the parent
+ // it is seen in our parent, but we must forward declare the parent
// we use operators, so code like this:
//
// // IDL
@@ -68,8 +68,10 @@ be_visitor_interface_cdr_op_ci::visit_interface (be_interface *node)
// defined).
//
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Generate the CDR << and >> operator declarations.
- os->indent ();
*os << be_global->stub_export_macro ()
<< " CORBA::Boolean operator<< ("
<< be_idt << be_idt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
index 4d0175a46e3..59b1936413e 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
@@ -99,13 +99,17 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
// Save the sequence node for further use.
this->ctx_->node (node);
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// If we're an anonymous sequence, we must protect against
// being declared more than once.
if (!this->ctx_->tdef ())
{
- *os << "\n#if !defined _TAO_CDR_OP_"
+ *os << "#if !defined _TAO_CDR_OP_"
<< node->flat_name () << "_CPP_" << be_nl
- << "#define _TAO_CDR_OP_" << node->flat_name () << "_CPP_\n\n";
+ << "#define _TAO_CDR_OP_" << node->flat_name () << "_CPP_"
+ << be_nl << be_nl;
}
// Set the sub state as generating code for the output operator.
@@ -118,10 +122,12 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
<< "{" << be_idt_nl;
// First encode the sequence length.
- *os << "if (strm << _tao_sequence.length ())" << be_nl
+ *os << "CORBA::ULong _tao_seq_len = _tao_sequence.length ();"
+ << be_nl << be_nl;
+ *os << "if (strm << _tao_seq_len)" << be_idt_nl
<< "{" << be_idt_nl;
// Now encode the sequence elements.
- *os << "// encode all elements" << be_nl;
+ *os << "// Encode all elements." << be_nl;
if (bt->node_type () == AST_Decl::NT_sequence)
{
@@ -139,9 +145,9 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
}
}
- *os << "}" << be_nl
- << "return 0; // error" << be_uidt_nl
- << "}\n\n";
+ *os << "}" << be_uidt_nl << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
// Set the sub state as generating code for the input operator.
os->indent ();
@@ -153,8 +159,8 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
<< ")" << be_uidt_nl
<< "{" << be_idt_nl;
// First retrieve the length and adjust the sequence length accordingly.
- *os << "CORBA::ULong _tao_seq_len;" << be_nl;
- *os << "if (strm >> _tao_seq_len)" << be_nl
+ *os << "CORBA::ULong _tao_seq_len;" << be_nl << be_nl;
+ *os << "if (strm >> _tao_seq_len)" << be_idt_nl
<< "{" << be_idt_nl;
// Now check if the length does not exceed the maximum. We do this only
// for bounded sequences
@@ -189,22 +195,26 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
-1);
}
- *os << "// set the length of the sequence" << be_nl
- << "_tao_sequence.length (_tao_seq_len);" << be_nl;
+ *os << "// Set the length of the sequence." << be_nl
+ << "_tao_sequence.length (_tao_seq_len);" << be_nl << be_nl;
// Now we do a check for the sequence length to be non zero.
- // If length is 0 we return true.
+ // If length is 0 we return true.
*os << "// If length is 0 we return true." << be_nl;
- *os << "if (0 >= _tao_seq_len) " << be_idt_nl;
- *os << "return 1;" << be_uidt_nl;
+ *os << "if (0 >= _tao_seq_len) " << be_idt_nl
+ << "{" << be_idt_nl;
+ *os << "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
// Add a sanity check for the length of a sequence.
*os << "// Add a check to the length of the sequence" << be_nl;
*os << "// to make sure it does not exceed the length" << be_nl;
*os << "// of the stream. (See bug 58.)" << be_nl;
- *os << "if (_tao_seq_len > strm.length())" << be_idt_nl;
- *os << "return 0;" << be_uidt_nl;
+ *os << "if (_tao_seq_len > strm.length ())" << be_idt_nl
+ << "{" << be_idt_nl;
+ *os << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
- *os << "// retrieve all the elements" << be_nl;
+ *os << "// Retrieve all the elements." << be_nl;
if (bt->node_type () == AST_Decl::NT_sequence)
@@ -226,12 +236,12 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
if (expr->ev ()->u.ulval > 0)
{
// We are dealing with a bounded sequence.
- *os << "}" << be_uidt_nl;
+ *os << "}" << be_uidt << be_uidt_nl;
}
- *os << "}" << be_nl
- << "return 0; // error" << be_uidt_nl
- << "}\n\n";
+ *os << "}" << be_uidt_nl << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
if (!this->ctx_->tdef ())
{
@@ -547,7 +557,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
be_visitor_sequence_base visitor (&ctx);
// Initialize a boolean variable.
- *os << "CORBA::Boolean _tao_marshal_flag = 1;" << be_nl;
+ *os << "CORBA::Boolean _tao_marshal_flag = 1;" << be_nl << be_nl;
// We get here if the "type" of individual elements of the sequence is not a
// primitive type. In this case, we are left with no other alternative but
@@ -566,9 +576,9 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
if (expr->ev ()->et == AST_Expression::EV_ulong)
{
- *os << "for (CORBA::ULong i = 0; i < _tao_sequence.length ()"
+ *os << "for (CORBA::ULong i = 0; i < _tao_seq_len"
<< " && _tao_marshal_flag; "
- << "i++)" << be_nl
+ << "++i)" << be_idt_nl
<< "{" << be_idt_nl;
}
else
@@ -677,6 +687,8 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
break;
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
*os << "_tao_marshal_flag = (strm >> _tao_sequence[i].out ());"
<< be_uidt_nl;
@@ -790,6 +802,8 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
case AST_Decl::NT_wstring:
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_valuetype:
+ case AST_Decl::NT_valuetype_fwd:
*os << "_tao_marshal_flag = (strm << _tao_sequence[i].in ()";
break;
@@ -839,7 +853,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt)
-1);
}
- *os << be_nl;
+ *os << be_uidt_nl<< be_nl;
*os << "return _tao_marshal_flag;" << be_uidt_nl;
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp
index 03f39600204..0b273e9ebb3 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp
@@ -56,7 +56,7 @@ be_visitor_structure_cdr_op_ci::visit_structure (be_structure *node)
// it in our parent.
// Set the substate as generating code for the types defined in our scope.
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE);
if (this->visit_scope (node) == -1)
{
@@ -67,18 +67,22 @@ be_visitor_structure_cdr_op_ci::visit_structure (be_structure *node)
-1);
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Set the sub state as generating code for the output operator.
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
- *os << "ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, "
- << "const " << node->name () << " &_tao_aggregate)" << be_nl
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator<< (" << be_idt << be_idt_nl
+ << "TAO_OutputCDR &strm," << be_nl
+ << "const " << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
- {
- be_visitor_context new_ctx (*this->ctx_);
- be_visitor_cdr_op_field_decl field_decl (&new_ctx);
- field_decl.visit_scope (node);
- }
+ be_visitor_context new_ctx (*this->ctx_);
+ be_visitor_cdr_op_field_decl field_decl (&new_ctx);
+ field_decl.visit_scope (node);
*os << "if (" << be_idt_nl;
@@ -91,25 +95,28 @@ be_visitor_structure_cdr_op_ci::visit_structure (be_structure *node)
-1);
}
- *os << be_uidt_nl << ")"
- << be_idt_nl
+ *os << be_uidt_nl << " )"<< be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt_nl << be_uidt_nl
- << "}\n\n";
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
// Set the substate as generating code for the input operator.
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
+ this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- *os << "ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &strm, "
- << node->name () << " &_tao_aggregate)" << be_nl
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &strm," << be_nl
+ << node->name () << " &_tao_aggregate" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl;
- {
- be_visitor_context new_ctx (*this->ctx_);
- be_visitor_cdr_op_field_decl field_decl (&new_ctx);
- field_decl.visit_scope (node);
- }
+ new_ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
+ field_decl.visit_scope (node);
*os << "if (" << be_idt_nl;
@@ -122,12 +129,15 @@ be_visitor_structure_cdr_op_ci::visit_structure (be_structure *node)
-1);
}
- *os << be_uidt_nl << ")"
- << be_idt_nl
+ *os << be_uidt_nl << " )" << be_idt_nl
+ << "{" << be_idt_nl
<< "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
<< "else" << be_idt_nl
- << "return 0;" << be_uidt_nl << be_uidt_nl
- << "}\n\n";
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
node->cli_inline_cdr_op_gen (1);
return 0;
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 e1295658c4d..c93848c4f4a 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
@@ -63,10 +63,14 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
TAO_OutStream *os = this->ctx_->stream ();
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
// Set the sub state as generating code for the output operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
- *os << "ACE_INLINE CORBA::Boolean operator<< (" << be_idt << be_idt_nl
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator<< (" << be_idt << be_idt_nl
<< "TAO_OutputCDR &strm," << be_nl
<< "const " << node->name () << " &_tao_union" << be_uidt_nl
<< ")" << be_uidt_nl
@@ -97,8 +101,8 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
*os << "{" << be_idt_nl
<< "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "CORBA::Boolean result = 1;" << be_nl
+ << "}" << be_uidt_nl << be_nl
+ << "CORBA::Boolean result = 1;" << be_nl << be_nl
<< "switch (_tao_union._d ())" << be_nl
<< "{" << be_idt_nl;
@@ -125,13 +129,14 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
*os << "break;";
}
- *os << be_uidt_nl << "}" << be_nl
+ *os << be_uidt_nl << "}" << be_nl << be_nl
<< "return result;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
// Set the substate as generating code for the input operator.
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
- *os << "ACE_INLINE CORBA::Boolean operator>> (" << be_idt << be_idt_nl
+ *os << "ACE_INLINE" << be_nl
+ << "CORBA::Boolean operator>> (" << be_idt << be_idt_nl
<< "TAO_InputCDR &strm," << be_nl
<< node->name () << " &_tao_union" << be_uidt_nl
<< ")" << be_uidt_nl
@@ -169,8 +174,8 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
*os << "{" << be_idt_nl
<< "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "CORBA::Boolean result = 1;" << be_nl
+ << "}" << be_uidt_nl << be_nl
+ << "CORBA::Boolean result = 1;" << be_nl << be_nl
<< "switch (_tao_discriminant)" << be_nl
<< "{" << be_idt_nl;
@@ -198,9 +203,9 @@ be_visitor_union_cdr_op_ci::visit_union (be_union *node)
*os << "break;" << be_uidt << be_uidt_nl;
}
- *os << "}" << be_nl
+ *os << "}" << be_nl << be_nl
<< "return result;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
node->cli_inline_cdr_op_gen (1);
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
index c02c60bfd77..3e5a4ce5809 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
@@ -67,11 +67,13 @@ be_visitor_union_discriminant_ci::visit_enum (be_enum *node)
-1);
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
if ((dv.computed_ != 0) && (bu->default_index () == -1))
{
// only if all cases are not covered AND there is no explicit
// default, we get the _default () method
- os->indent ();
*os << "// the implicit _default () method" << be_nl;
*os << "ACE_INLINE void " << be_nl
<< bu->name () << "::_default ()" << be_nl
@@ -103,7 +105,6 @@ be_visitor_union_discriminant_ci::visit_enum (be_enum *node)
*os << ";" << be_uidt_nl << "}\n\n";
}
- os->indent ();
// the set method
*os << "// accessor to set the discriminant" << be_nl
<< "ACE_INLINE void" << be_nl
@@ -125,8 +126,9 @@ be_visitor_union_discriminant_ci::visit_enum (be_enum *node)
}
int
-be_visitor_union_discriminant_ci::visit_predefined_type (be_predefined_type
- *node)
+be_visitor_union_discriminant_ci::visit_predefined_type (
+ be_predefined_type *node
+ )
{
be_union *bu =
this->ctx_->be_node_as_union (); // get the enclosing union backend
@@ -155,11 +157,13 @@ be_visitor_union_discriminant_ci::visit_predefined_type (be_predefined_type
-1);
}
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
if ((dv.computed_ != 0) && (bu->default_index () == -1))
{
// Only if all cases are not covered AND there is no explicit
// default, we get the _default () method.
- os->indent ();
*os << "// the implicit _default () method" << be_nl;
*os << "ACE_INLINE void " << be_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union.cpp b/TAO/TAO_IDL/be/be_visitor_union/union.cpp
index 8340e0ed575..46990af1820 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union.cpp
@@ -90,13 +90,6 @@ be_visitor_union::visit_union_branch (be_union_branch *node)
status = node->accept (&visitor);
break;
}
- case TAO_CodeGen::TAO_UNION_PUBLIC_ACCESS_CS:
- {
- ctx.state (TAO_CodeGen::TAO_UNION_PUBLIC_ACCESS_CS);
- be_visitor_union_branch_public_access_cs visitor (&ctx);
- status = node->accept (&visitor);
- break;
- }
case TAO_CodeGen::TAO_UNION_CDR_OP_CH:
{
ctx.state (TAO_CodeGen::TAO_UNION_BRANCH_CDR_OP_CH);
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
index e879b5675fd..7a60fc6bbbb 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
@@ -37,192 +37,195 @@ be_visitor_union_ch::~be_visitor_union_ch (void)
int be_visitor_union_ch::visit_union (be_union *node)
{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
// Instantiate a visitor context with a copy of our context. This info
// will be modified based on what type of node we are visiting.
be_visitor_context ctx (*this->ctx_);
ctx.node (node);
- if (!node->cli_hdr_gen () && !node->imported ())
- {
- TAO_OutStream *os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream ();
- // Generate the ifdefined macro for the union type.
- os->gen_ifdef_macro (node->flat_name ());
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
- *os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
+ // Generate the ifdefined macro for the union type.
+ os->gen_ifdef_macro (node->flat_name ());
- *os << "class " << be_global->stub_export_macro () << " "
- << node->local_name () << be_nl
- << "{" << be_nl
- << "public:" << be_idt_nl
+ *os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
- // Generate default and copy constructors.
- << node->local_name () << " (void);" << be_nl
- << node->local_name () << " (const " << node->local_name ()
- << " &);" << be_nl
- // Generate destructor.
- << "~" << node->local_name () << " (void);" << be_nl;
+ *os << "class " << be_global->stub_export_macro () << " "
+ << node->local_name () << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
- *os << "static void _tao_any_destructor (void*);"
- << be_nl << be_nl;
+ // Generate default and copy constructors.
+ << node->local_name () << " (void);" << be_nl
+ << node->local_name () << " (const " << node->local_name ()
+ << " &);" << be_nl
+ // Generate destructor.
+ << "~" << node->local_name () << " (void);" << be_nl;
- // Generate assignment operator.
- *os << node->local_name () << " &operator= (const "
- << node->local_name () << " &);" << be_nl << be_nl;
+ *os << "static void _tao_any_destructor (void*);"
+ << be_nl << be_nl;
- // Retrieve the disriminant type.
- be_type *bt = be_type::narrow_from_decl (node->disc_type ());
+ // Generate assignment operator.
+ *os << node->local_name () << " &operator= (const "
+ << node->local_name () << " &);" << be_nl << be_nl;
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- "visit_union - "
- "bad disciminant type\n"),
- -1);
- }
+ // Retrieve the disriminant type.
+ be_type *bt = be_type::narrow_from_decl (node->disc_type ());
- // The discriminant type may have to be defined here if it was an enum
- // declaration inside of the union statement.
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "bad disciminant type\n"),
+ -1);
+ }
- ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH);
- be_visitor_union_discriminant_ch ud_visitor (&ctx);
+ // The discriminant type may have to be defined here if it was an enum
+ // declaration inside of the union statement.
- if (bt->accept (&ud_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- " visit_union - "
- "codegen for discriminant failed\n"),
- -1);
- }
+ ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH);
+ be_visitor_union_discriminant_ch ud_visitor (&ctx);
- // Generate the _var_type typedef.
- *os << "typedef " << node->local_name () << "_var _var_type;"
- << be_nl << be_nl;
+ if (bt->accept (&ud_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ " visit_union - "
+ "codegen for discriminant failed\n"),
+ -1);
+ }
- // Now generate the public defn for the union branch members. For this,
- // set our state to reflect what we are aiming to do.
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_CH);
+ // Generate the _var_type typedef.
+ *os << "typedef " << node->local_name () << "_var _var_type;"
+ << be_nl << be_nl;
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- "visit_union - "
- "codegen for public defn of union members\n"),
- -1);
- }
+ // Now generate the public defn for the union branch members. For this,
+ // set our state to reflect what we are aiming to do.
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_CH);
- // Now check if we need to generate the _default () method.
- be_union::DefaultValue dv;
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "codegen for public defn of union members\n"),
+ -1);
+ }
- if (node->default_value (dv) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- "visit_union - "
- "computing default value failed\n"),
- -1);
- }
+ // Now check if we need to generate the _default () method.
+ be_union::DefaultValue dv;
- if ((dv.computed_ != 0) && (node->default_index () == -1))
- {
- // Only if all cases are not covered AND there is no explicit
- // default, we get the _default () method.
- *os << "void _default (void);";
- }
+ if (node->default_value (dv) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "computing default value failed\n"),
+ -1);
+ }
+
+ if ((dv.computed_ != 0) && (node->default_index () == -1))
+ {
+ // Only if all cases are not covered AND there is no explicit
+ // default, we get the _default () method.
+ *os << "void _default (void);";
+ }
- *os << be_uidt_nl;
+ *os << be_uidt_nl;
- // Now generate the private data members of the union.
- *os << "private:" << be_idt_nl;
- *os << bt->nested_type_name (node) << " disc_;" << be_nl;
- *os << bt->nested_type_name (node) << " holder_;" << be_nl << be_nl;
- // Emit the ACE_NESTED_CLASS macro.
+ // Now generate the private data members of the union.
+ *os << "private:" << be_idt_nl;
+ *os << bt->nested_type_name (node) << " disc_;" << be_nl;
+ *os << bt->nested_type_name (node) << " holder_;" << be_nl << be_nl;
+ // Emit the ACE_NESTED_CLASS macro.
- // The members are inside of a union.
- *os << "union" << be_nl;
- *os << "{" << be_idt_nl;
+ // The members are inside of a union.
+ *os << "union" << be_nl;
+ *os << "{" << be_idt_nl;
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PRIVATE_CH);
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PRIVATE_CH);
- if (this->visit_scope (node) == -1)
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "codegen for private members of union\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl;
+ *os << "} u_;" << be_nl << be_nl;
+
+ // The reset method (TAO extension).
+ *os << "// TAO extension." << be_nl;
+ *os << "void _reset (" << bt->nested_type_name (node)
+ << ", CORBA::Boolean /* finalize */);" << be_nl;
+ *os << "// Frees any allocated storage." << be_uidt_nl;
+ *os << "}; //" << node->name () << be_nl << be_nl;
+
+ if (be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
+ be_visitor_typecode_decl tc_visitor (&ctx);
+
+ if (node->accept (&tc_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_ch::"
"visit_union - "
- "codegen for private members of union\n"),
+ "TypeCode declaration failed\n"),
-1);
}
+ }
- *os << be_uidt_nl;
- *os << "} u_;" << be_nl << be_nl;
+ os->gen_endif ();
- // The reset method (TAO extension).
- *os << "// TAO extension." << be_nl;
- *os << "void _reset (" << bt->nested_type_name (node)
- << ", CORBA::Boolean /* finalize */);" << be_nl;
- *os << "// Frees any allocated storage." << be_nl << be_nl;
- *os << "}; //" << node->name () << be_nl << be_nl;
+ // Generate the ifdefined macro for the _var type.
+ os->gen_ifdef_macro (node->flat_name (), "_var");
- if (be_global->tc_support ())
- {
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
- be_visitor_typecode_decl tc_visitor (&ctx);
-
- if (node->accept (&tc_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- "visit_union - "
- "TypeCode declaration failed\n"),
- -1);
- }
- }
+ // Generate var definition.
+ if (node->gen_var_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_ch::"
+ "visit_union - "
+ "codegen for _var\n"), -1);
+ }
- os->gen_endif ();
+ os->gen_endif ();
- // Generate the ifdefined macro for the _var type.
- os->gen_ifdef_macro (node->flat_name (), "_var");
+ // Generate the ifdefined macro for the array type.
+ os->gen_ifdef_macro (node->flat_name (), "_out");
- // Generate var definition.
- if (node->gen_var_defn () == -1)
+ // A class is generated for an out defn only for a variable
+ // length struct.
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ if (node->gen_out_defn () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_ch::"
"visit_union - "
- "codegen for _var\n"), -1);
- }
-
- os->gen_endif ();
-
- // Generate the ifdefined macro for the array type.
- os->gen_ifdef_macro (node->flat_name (), "_out");
-
- // A class is generated for an out defn only for a variable
- // length struct.
- if (node->size_type () == AST_Type::VARIABLE)
- {
- if (node->gen_out_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_ch::"
- "visit_union - "
- "codegen for _out\n"), -1);
- }
- }
- else
- {
- *os << "typedef " << node->local_name () << " &"
- << node->local_name () << "_out;" << be_nl << be_nl;
+ "codegen for _out\n"), -1);
}
-
- os->gen_endif ();
-
- node->cli_hdr_gen (I_TRUE);
+ }
+ else
+ {
+ *os << "typedef " << node->local_name () << " &"
+ << node->local_name () << "_out;" << be_nl << be_nl;
}
+ os->gen_endif ();
+ node->cli_hdr_gen (I_TRUE);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
index 00026783543..94b888811e7 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
@@ -39,264 +39,262 @@ be_visitor_union_cs::~be_visitor_union_cs (void)
// Visit the Union_cs node and its scope.
int be_visitor_union_cs::visit_union (be_union *node)
{
- TAO_OutStream *os;
- be_type *bt = 0;
-
- if (!node->cli_stub_gen () && !node->imported ())
+ if (node->cli_stub_gen () || node->imported ())
{
- os = this->ctx_->stream ();
+ return 0;
+ }
- be_visitor_context ctx (*this->ctx_);
- // The discriminant type may have to be defined here if it was an enum
- // declaration inside of the union statement. We need to generate its
- // typecode.
+ TAO_OutStream *os = this->ctx_->stream ();
- bt = be_type::narrow_from_decl (node->disc_type ());
+ be_visitor_context ctx (*this->ctx_);
+ // The discriminant type may have to be defined here if it was an enum
+ // declaration inside of the union statement. We need to generate its
+ // typecode.
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs::"
- "visit_union - "
- "bad discriminant type\n"), -1);
- }
+ be_type *bt = be_type::narrow_from_decl (node->disc_type ());
- ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CS);
- be_visitor_union_discriminant_cs disc_visitor (&ctx);
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs::"
+ "visit_union - "
+ "bad discriminant type\n"), -1);
+ }
- if (bt->accept (&disc_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs::"
- "visit union - "
- "codegen for discrminant failed\n"),
- -1);
- }
+ ctx.state (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CS);
+ be_visitor_union_discriminant_cs disc_visitor (&ctx);
- // First generate code for any of the members (if required, e.g.,
- // anonymous sequences, structs, unions, arrays).
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_CS);
+ if (bt->accept (&disc_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs::"
+ "visit union - "
+ "codegen for discrminant failed\n"),
+ -1);
+ }
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs"
- "visit_union - "
- "codegen for scope failed\n"),
- -1);
- }
+ // First generate code for any of the members (if required, e.g.,
+ // anonymous sequences, structs, unions, arrays).
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_CS);
- // Now generate the operations on the union such as the copy constructor
- // and the assignment operator.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs"
+ "visit_union - "
+ "codegen for scope failed\n"),
+ -1);
+ }
- *os << "// *************************************************************"
- << be_nl;
- *os << "// Operations for union " << node->name () << be_nl
- << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl;
- *os << "// *************************************************************\n\n";
+ // Now generate the operations on the union such as the copy constructor
+ // and the assignment operator.
- // Generate the copy constructor and the assignment operator here.
- os->indent ();
- *os << node->name () << "::" << node->local_name () << " (void)" << be_nl
- << "{" << be_idt_nl
- << "ACE_OS::memset (&this->disc_, 0, sizeof (this->disc_));" << be_nl
- << "ACE_OS::memset (&this->u_, 0, sizeof (this->u_));" << be_nl
- << "this->disc_ = ";
+ *os << "// *************************************************************"
+ << be_nl;
+ *os << "// Operations for union " << node->name () << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+ *os << "// *************************************************************\n\n";
- // The default constructor must initialize the discriminator
- // to the first case label value found in the union declaration
- // so that, if the uninitialized union is inserted into an Any,
- // the Any destructor's call to deep_free() will work properly.
- UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ // Generate the copy constructor and the assignment operator here.
+ os->indent ();
+ *os << node->name () << "::" << node->local_name () << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_OS::memset (&this->disc_, 0, sizeof (this->disc_));" << be_nl
+ << "ACE_OS::memset (&this->u_, 0, sizeof (this->u_));" << be_nl
+ << "this->disc_ = ";
- // Just get the union's first member.
- AST_Decl *d = si.item ();
+ // The default constructor must initialize the discriminator
+ // to the first case label value found in the union declaration
+ // so that, if the uninitialized union is inserted into an Any,
+ // the Any destructor's call to deep_free() will work properly.
+ UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- be_union_branch *ub = be_union_branch::narrow_from_decl (d);
+ // Just get the union's first member.
+ AST_Decl *d = si.item ();
- // Get the first label in its list.
- AST_UnionLabel *ul = ub->label (0);
+ be_union_branch *ub = be_union_branch::narrow_from_decl (d);
- if (ul->label_kind () == AST_UnionLabel::UL_label)
- {
- ub->gen_label_value (os);
- }
- else
- {
- ub->gen_default_label_value (os, node);
- }
+ // Get the first label in its list.
+ AST_UnionLabel *ul = ub->label (0);
- *os << ";";
+ if (ul->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+ }
+ else
+ {
+ ub->gen_default_label_value (os, node);
+ }
- *os << be_uidt_nl << "}" << be_nl << be_nl;
+ *os << ";";
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
+ *os << be_uidt_nl << "}" << be_nl << be_nl;
- // So we know we are generating the copy constructor.
- this->ctx_->sub_state (TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR);
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
- *os << node->name () << "::" << node->local_name ()
- << " (const ::" << node->name () << " &u)"
- << be_nl;
- *os << "{" << be_idt_nl;
- *os << "this->disc_ = u.disc_;" << be_nl;
- *os << "switch (this->disc_)" << be_nl;
- *os << "{" << be_idt_nl;
+ // So we know we are generating the copy constructor.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR);
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs"
- "visit_union - "
- "codegen for copy ctor failed\n"),
- -1);
- }
+ *os << node->name () << "::" << node->local_name ()
+ << " (const ::" << node->name () << " &u)"
+ << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "this->disc_ = u.disc_;" << be_nl;
+ *os << "switch (this->disc_)" << be_nl;
+ *os << "{" << be_idt_nl;
- // If there is no explicit default case, but there
- // is an implicit one, and the discriminant is an enum,
- // we need this to avert warnings in some compilers that
- // not all case values are included. If there is no
- // implicit default case, or the discriminator is not
- // an enum, this does no harm.
- if (node->default_index () == -1)
- {
- *os << "default:" << be_nl
- << "break;";
- }
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs"
+ "visit_union - "
+ "codegen for copy ctor failed\n"),
+ -1);
+ }
- *os << be_uidt_nl << "}" << be_uidt_nl
- << "}" << be_nl << be_nl;
+ // If there is no explicit default case, but there
+ // is an implicit one, and the discriminant is an enum,
+ // we need this to avert warnings in some compilers that
+ // not all case values are included. If there is no
+ // implicit default case, or the discriminator is not
+ // an enum, this does no harm.
+ if (node->default_index () == -1)
+ {
+ *os << "default:" << be_nl
+ << "break;";
+ }
+
+ *os << be_uidt_nl << "}" << be_uidt_nl
+ << "}" << be_nl << be_nl;
- *os << "// destructor" << be_nl
- << node->name () << "::~" << node->local_name ()
- << " (void)" << be_nl
+ *os << "// destructor" << be_nl
+ << node->name () << "::~" << node->local_name ()
+ << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "// finalize" << be_nl
+ << "this->_reset (this->disc_, 1);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ if (!node->is_local ())
+ {
+ *os << "void "
+ << node->name ()
+ << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
<< "{" << be_idt_nl
- << "// finalize" << be_nl
- << "this->_reset (this->disc_, 1);" << be_uidt_nl
- << "}" << be_nl << be_nl;
+ << node->local_name () << " *tmp = ACE_static_cast ("
+ << node->local_name () << "*, _tao_void_pointer);" << be_nl
+ << "delete tmp;" << be_uidt_nl
+ << "}\n" << be_nl;
+ }
- if (!node->is_local ())
- {
- *os << "void "
- << node->name ()
- << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
- << "{" << be_idt_nl
- << node->local_name () << " *tmp = ACE_static_cast ("
- << node->local_name () << "*, _tao_void_pointer);" << be_nl
- << "delete tmp;" << be_uidt_nl
- << "}\n" << be_nl;
- }
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
+
+ // Reset this for generating the assignment operator.
+ this->ctx_->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
+
+ // Assignment operator.
+ os->indent ();
+ *os << "// assignment operator" << be_nl;
+ *os << node->name () << " &" << be_nl;
+ *os << node->name () << "::operator= (const ::"
+ << node->name () << " &u)" << be_nl;
+ *os << "{" << be_idt_nl;
+ // First check for self-assignment.
+ *os << "if (&u == this)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ // Reset and set the discriminant.
+ *os << "this->_reset (u.disc_, 0);" << be_nl;
+ *os << "this->disc_ = u.disc_;" << be_nl << be_nl;
+ // now switch based on the disc value
+ *os << "switch (this->disc_)" << be_nl;
+ *os << "{" << be_idt_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs"
+ "visit_union - "
+ "codegen for assign op failed\n"),
+ -1);
+ }
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
+ // If there is no explicit default case, but there
+ // is an implicit one, and the discriminant is an enum,
+ // we need this to avert warnings in some compilers that
+ // not all case values are included. If there is no
+ // implicit default case, or the discriminator is not
+ // an enum, this does no harm.
+ if (node->default_index () == -1)
+ {
+ *os << "default:" << be_nl
+ << "break;" << be_uidt_nl;
+ }
+ else
+ {
+ *os << be_uidt_nl;
+ }
- // Reset this for generating the assignment operator.
- this->ctx_->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
+ *os << "}" << be_nl << be_nl;
+ *os << "return *this;" << be_uidt_nl;
+ *os << "}\n\n";
+
+ // The reset method.
+ this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS);
+ os->indent ();
+ *os << "// reset method to reset old values of a union" << be_nl;
+ *os << "void " << node->name () << "::_reset (" << bt->name ()
+ << ", CORBA::Boolean /*finalize*/)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "switch (this->disc_)" << be_nl;
+ *os << "{" << be_idt_nl;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs"
+ "visit_union - "
+ "codegen for reset failed\n"),
+ -1);
+ }
- // Assignment operator.
- os->indent ();
- *os << "// assignment operator" << be_nl;
- *os << node->name () << " &" << be_nl;
- *os << node->name () << "::operator= (const ::"
- << node->name () << " &u)" << be_nl;
- *os << "{" << be_idt_nl;
- // First check for self-assignment.
- *os << "if (&u == this)" << be_idt_nl
- << "{" << be_idt_nl
- << "return *this;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
- // Reset and set the discriminant.
- *os << "this->_reset (u.disc_, 0);" << be_nl;
- *os << "this->disc_ = u.disc_;" << be_nl << be_nl;
- // now switch based on the disc value
- *os << "switch (this->disc_)" << be_nl;
- *os << "{" << be_idt_nl;
-
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs"
- "visit_union - "
- "codegen for assign op failed\n"),
- -1);
- }
+ // If there is no explicit default case, but there
+ // is an implicit one, and the discriminant is an enum,
+ // we need this to avert warnings in some compilers that
+ // not all case values are included. If there is no
+ // implicit default case, or the discriminator is not
+ // an enum, this does no harm.
+ if (node->default_index () == -1)
+ {
+ os->decr_indent (0);
+ *os << "default:" << be_nl;
+ os->incr_indent ();
+ *os << "break;";
+ }
- // If there is no explicit default case, but there
- // is an implicit one, and the discriminant is an enum,
- // we need this to avert warnings in some compilers that
- // not all case values are included. If there is no
- // implicit default case, or the discriminator is not
- // an enum, this does no harm.
- if (node->default_index () == -1)
- {
- *os << "default:" << be_nl
- << "break;" << be_uidt_nl;
- }
- else
- {
- *os << be_uidt_nl;
- }
+ *os << be_uidt_nl << "}" << be_uidt_nl
+ << "}\n\n";
+
+ if (!node->is_local () && be_global->tc_support ())
+ {
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
+ ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- *os << "}" << be_nl << be_nl;
- *os << "return *this;" << be_uidt_nl;
- *os << "}\n\n";
-
- // The reset method.
- this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_RESET_CS);
- os->indent ();
- *os << "// reset method to reset old values of a union" << be_nl;
- *os << "void " << node->name () << "::_reset (" << bt->name ()
- << ", CORBA::Boolean /*finalize*/)" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "switch (this->disc_)" << be_nl;
- *os << "{" << be_idt_nl;
-
- if (this->visit_scope (node) == -1)
+ be_visitor_typecode_defn tc_visitor (&ctx);
+
+ if (tc_visitor.visit_union (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs"
+ "(%N:%l) be_visitor_union_cs::"
"visit_union - "
- "codegen for reset failed\n"),
+ "TypeCode definition failed\n"),
-1);
}
-
- // If there is no explicit default case, but there
- // is an implicit one, and the discriminant is an enum,
- // we need this to avert warnings in some compilers that
- // not all case values are included. If there is no
- // implicit default case, or the discriminator is not
- // an enum, this does no harm.
- if (node->default_index () == -1)
- {
- os->decr_indent (0);
- *os << "default:" << be_nl;
- os->incr_indent ();
- *os << "break;";
- }
-
- *os << be_uidt_nl << "}" << be_uidt_nl
- << "}\n\n";
-
- if (!node->is_local () && be_global->tc_support ())
- {
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
- ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
-
- be_visitor_typecode_defn tc_visitor (&ctx);
-
- if (tc_visitor.visit_union (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_cs::"
- "visit_union - "
- "TypeCode definition failed\n"),
- -1);
- }
- }
-
- node->cli_stub_gen (I_TRUE);
}
+ node->cli_stub_gen (I_TRUE);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
index 487a3d62f0b..21dd19b7c64 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
@@ -45,7 +45,6 @@
#include "be_visitor_union_branch/private_ch.cpp"
#include "be_visitor_union_branch/public_assign_cs.cpp"
#include "be_visitor_union_branch/public_reset_cs.cpp"
-#include "be_visitor_union_branch/public_access_cs.cpp"
#include "be_visitor_union_branch/public_ch.cpp"
#include "be_visitor_union_branch/public_ci.cpp"
#include "be_visitor_union_branch/public_cs.cpp"
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 cfdca57943c..dd4e8b98fd1 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
@@ -286,7 +286,7 @@ be_visitor_union_branch_cdr_op_ci::visit_interface (be_interface *node)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << node->name () << "_var _tao_union_tmp;" << be_nl
- << "result = strm >> _tao_union_tmp.inout ();" << be_nl
+ << "result = strm >> _tao_union_tmp.inout ();" << be_nl << be_nl
<< "if (result)" << be_idt_nl
<< "{" << be_idt_nl
<< "_tao_union."
@@ -341,7 +341,7 @@ be_visitor_union_branch_cdr_op_ci::visit_interface_fwd (be_interface_fwd *node)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << node->name () << "_var _tao_union_tmp;" << be_nl
- << "result = strm >> _tao_union_tmp.inout ();" << be_nl
+ << "result = strm >> _tao_union_tmp.inout ();" << be_nl << be_nl
<< "if (result)" << be_idt_nl
<< "{" << be_idt_nl
<< "_tao_union."
@@ -374,6 +374,116 @@ be_visitor_union_branch_cdr_op_ci::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_union_branch_cdr_op_ci::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the union_branch node.
+ be_union_branch *f = this->ctx_->be_node_as_union_branch ();
+
+ if (!f)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_valuetype - "
+ "cannot retrieve union_branch node\n"),
+ -1);
+ }
+
+ // 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:
+ *os << node->name () << "_var _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp.inout ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " (_tao_union_tmp.in ());" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ break;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be declared inside a
+ // union.
+ break;
+
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_valuetype - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_cdr_op_ci::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Retrieve the union_branch node.
+ be_union_branch *f = this->ctx_->be_node_as_union_branch ();
+
+ if (!f)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_valuetype_fwd - "
+ "cannot retrieve union_branch node\n"),
+ -1);
+ }
+
+ // 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:
+ *os << node->name () << "_var _tao_union_tmp;" << be_nl
+ << "result = strm >> _tao_union_tmp.inout ();" << be_nl << be_nl
+ << "if (result)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_union."
+ << f->local_name () << " (_tao_union_tmp.in ());" << be_nl
+ << "_tao_union._d (_tao_discriminant);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ break;
+
+ case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "result = strm << _tao_union."
+ << f->local_name () << " ();";
+ break;
+
+ case TAO_CodeGen::TAO_CDR_SCOPE:
+ // Nothing to be done because an interface cannot be forward declared
+ // inside a union.
+ break;
+
+ default:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_cdr_op_ci::"
+ "visit_valuetype_fwd - "
+ "bad sub state\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
be_visitor_union_branch_cdr_op_ci::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp
index 9d28f6fb19f..884c849fef8 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp
@@ -217,6 +217,74 @@ be_visitor_union_branch_private_ch::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_union_branch_private_ch::visit_valuetype (be_valuetype *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_private_ch::"
+ "visit_interface - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;" << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_private_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ be_decl *ub = this->ctx_->node ();
+ be_decl *bu = this->ctx_->scope ();
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_private_ch::"
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << bt->nested_type_name (bu, "_var")
+ << " *" << ub->local_name () << "_;" << be_nl;
+
+ return 0;
+}
+
+int
be_visitor_union_branch_private_ch::visit_predefined_type (
be_predefined_type *node
)
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_access_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_access_cs.cpp
deleted file mode 100644
index a00102a00bd..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_access_cs.cpp
+++ /dev/null
@@ -1,481 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// public_access_cs.cpp
-//
-// = DESCRIPTION
-// Visitor generating code for Union Branch in the client inline file.
-//
-// = AUTHOR
-// Aniruddha Gokhale
-//
-// ============================================================================
-
-ACE_RCSID (be_visitor_union_branch,
- public_access_cs,
- "$Id$")
-
-// *****************************************************
-// visitor for union_branch in the client
-// stubs file for the access method
-// *****************************************************
-
-be_visitor_union_branch_public_access_cs::
-be_visitor_union_branch_public_access_cs (be_visitor_context *ctx)
- : be_visitor_decl (ctx)
-{
-}
-
-be_visitor_union_branch_public_access_cs::
-~be_visitor_union_branch_public_access_cs (void)
-{
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_union_branch (
- be_union_branch *node
- )
-{
- TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt = be_type::narrow_from_decl (node->field_type ());
-
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cs::"
- "visit_union_branch - "
- "Bad union_branch type\n"),
- -1);
- }
-
- this->ctx_->node (node); // save the node
-
- for (unsigned long i = 0;
- i < node->label_list_length ();
- ++i)
- {
- // Check if we are printing the default case.
- if (node->label (i)->label_kind () == AST_UnionLabel::UL_default)
- {
- *os << "default:";
- }
- else
- {
- *os << "case ";
- node->gen_label_value (os, i);
- *os << ":";
- }
-
- if (i == (node->label_list_length () - 1))
- {
- *os << be_idt_nl;
- }
- else
- {
- *os << be_nl;
- }
- }
-
- if (bt->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_cs::"
- "visit_union_branch - "
- "codegen for union_branch type failed\n"),
- -1);
- }
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_array (be_array *node)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
- be_type *bt;
-
- if (this->ctx_->alias ())
- {
- bt = this->ctx_->alias ();
- }
- else
- {
- bt = node;
- }
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_enum - "
- "bad context information\n"),
- -1);
- }
-
- // For anonymous arrays, the type name has a _ prepended. We compute the
- // fullname with or without the underscore and use it later on.
- char fname [NAMEBUFSIZE]; // to hold the full and
-
- ACE_OS::memset (fname,
- '\0',
- NAMEBUFSIZE);
-
- if (bt->node_type () != AST_Decl::NT_typedef
- && bt->is_child (bu))
- {
- // For anonymous arrays ...
- // We have to generate a name for us that has an underscope prepended to
- // our local name. This needs to be inserted after the parents's name.
-
- if (bt->is_nested ())
- {
- be_decl *parent = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
- ACE_OS::sprintf (fname,
- "%s::_%s",
- parent->full_name (),
- bt->local_name ()->get_string ());
- }
- else
- {
- ACE_OS::sprintf (fname,
- "_%s",
- bt->full_name ());
- }
- }
- else
- {
- ACE_OS::sprintf (fname,
- "%s",
- bt->full_name ());
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << "if (alloc_flag)" << be_idt_nl
- << "this->u_." << ub->local_name () << "_ = " << fname
- << "_alloc ();" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_enum (be_enum *)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_enum - "
- "bad context information\n"),
- -1);
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_interface (be_interface *node)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
- be_type *bt;
-
- if (this->ctx_->alias ())
- {
- bt = this->ctx_->alias ();
- }
- else
- {
- bt = node;
- }
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_interface - "
- "bad context information\n"),
- -1);
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name () << "_, "
- << "("
- << bt->name () << "_var), 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_interface_fwd (be_interface_fwd *)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_interface - "
- "bad context information\n"),
- -1);
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return (CORBA::Object_ptr) &this->u_." << ub->local_name ()
- << "_->inout ();" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_predefined_type (be_predefined_type *node)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
- be_type *bt;
-
- if (this->ctx_->alias ())
- {
- bt = this->ctx_->alias ();
- }
- else
- {
- bt = node;
- }
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_interface - "
- "bad context information\n"),
- -1);
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- switch (node->pt ())
- {
- case AST_PredefinedType::PT_object:
- case AST_PredefinedType::PT_pseudo:
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- break;
- case AST_PredefinedType::PT_any:
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name ()
- << "_, " << bt->name () << ", 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- break;
- case AST_PredefinedType::PT_void:
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl;
-
- break;
- default:
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
- }
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_sequence (be_sequence *node)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
- be_type *bt;
-
- if (this->ctx_->alias ())
- {
- bt = this->ctx_->alias ();
- }
- else
- {
- bt = node;
- }
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_sequence - "
- "bad context information\n"),
- -1);
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name ()
- << "_, " << bt->name () << ", 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_string (be_string *)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_string - "
- "bad context information\n"),
- -1);
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_structure (be_structure *node)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
- be_type *bt;
-
- if (this->ctx_->alias ())
- {
- bt = this->ctx_->alias ();
- }
- else
- {
- bt = node;
- }
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_structure - "
- "bad context information\n"),
- -1);
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- if (bt->size_type () == be_type::VARIABLE
- || node->has_constructor ())
- {
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name ()
- << "_, " << bt->name () << ", 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
- }
- else
- {
- *os << "ACE_UNUSED_ARG (alloc_flag);" << be_nl
- << "return &this->u_." << ub->local_name () << "_;" << be_uidt_nl;
- }
-
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_typedef (be_typedef *node)
-{
- this->ctx_->alias (node);
-
- // The node to be visited in the base primitve type that gets typedefed.
- be_type *bt = node->primitive_base_type ();
-
- if (!bt || (bt->accept (this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_typedef - "
- "Bad primitive type\n"),
- -1);
- }
-
- this->ctx_->alias (0);
- return 0;
-}
-
-int
-be_visitor_union_branch_public_access_cs::visit_union (be_union *node)
-{
- be_union_branch *ub =
- this->ctx_->be_node_as_union_branch ();
- be_union *bu =
- this->ctx_->be_scope_as_union ();
- be_type *bt;
-
- if (this->ctx_->alias ())
- {
- bt = this->ctx_->alias ();
- }
- else
- {
- bt = node;
- }
-
- if (!ub || !bu)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_branch_public_access_cs::"
- "visit_union - "
- "bad context information\n"),
- -1);
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << "if (alloc_flag)" << be_idt_nl
- << "ACE_NEW_RETURN (this->u_." << ub->local_name ()
- << "_, " << bt->name () << ", 0);" << be_uidt_nl
- << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
-
- return 0;
-}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp
index c18e04a0dcf..1f04625d53c 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp
@@ -383,6 +383,146 @@ be_visitor_union_branch_public_assign_cs::visit_interface_fwd (
}
int
+be_visitor_union_branch_public_assign_cs::visit_valuetype (be_valuetype *node)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch (); // get union branch
+ be_union *bu =
+ this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_assign_cs::"
+ "visit_valuetype - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ idl_bool bt_is_defined = node->is_defined ();
+
+ *os << "if (u.u_." << ub->local_name () << "_ == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->u_." << ub->local_name () << "_ = 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ // So the template will work with the macro.
+ *os << "typedef "
+ << bt->name () << "_var OBJECT_FIELD;" << be_nl;
+ *os << "CORBA::add_ref (u.u_." << ub->local_name ()
+ << "_->ptr ());" << be_nl;
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
+ {
+ // We are generating the copy constructor.
+ *os << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (u.u_." << ub->local_name () << "_->ptr ())"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ // We are generating the assignment operator.
+ *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (u.u_." << ub->local_name () << "_->ptr ()),"
+ << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+
+ *os << "}" << be_uidt << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_assign_cs::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch (); // get union branch
+ be_union *bu =
+ this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_assign_cs::"
+ "visit_valuetype_fwd - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ idl_bool bt_is_defined = node->full_definition ()->is_defined ();
+
+ *os << "if (u.u_." << ub->local_name () << "_ == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->u_." << ub->local_name () << "_ = 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ // So the template will work with the macro.
+ *os << "typedef "
+ << bt->name () << "_var OBJECT_FIELD;" << be_nl;
+
+ if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR)
+ {
+ // We are generating the copy constructor.
+ *os << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (u.u_." << ub->local_name () << "_->ptr ())"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ // We are generating the assignment operator.
+ *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (u.u_." << ub->local_name () << "_->ptr ()),"
+ << be_nl
+ << "*this" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl;
+ }
+
+ *os << "}" << be_uidt << be_uidt_nl;
+
+ return 0;
+}
+
+int
be_visitor_union_branch_public_assign_cs::visit_predefined_type (
be_predefined_type *node
)
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp
index 54878d4986d..38cc9e02da3 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp
@@ -163,10 +163,8 @@ be_visitor_union_branch_public_ci::visit_array (be_array *node)
}
// Set method.
- os->indent ();
-
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
@@ -208,7 +206,7 @@ be_visitor_union_branch_public_ci::visit_array (be_array *node)
<< bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -242,10 +240,8 @@ be_visitor_union_branch_public_ci::visit_enum (be_enum *node)
TAO_OutStream *os = this->ctx_->stream ();
// Set method.
- os->indent ();
-
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
@@ -286,7 +282,7 @@ be_visitor_union_branch_public_ci::visit_enum (be_enum *node)
<< bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -320,10 +316,8 @@ be_visitor_union_branch_public_ci::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
// Set method.
- os->indent ();
-
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
@@ -381,7 +375,7 @@ be_visitor_union_branch_public_ci::visit_interface (be_interface *node)
<< bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_->ptr ();" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -407,7 +401,7 @@ be_visitor_union_branch_public_ci::visit_interface_fwd (be_interface_fwd *node)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_ci::"
- "visit_interface - "
+ "visit_interface_fwd - "
"bad context information\n"),
-1);
}
@@ -415,10 +409,8 @@ be_visitor_union_branch_public_ci::visit_interface_fwd (be_interface_fwd *node)
TAO_OutStream *os = this->ctx_->stream ();
// Set method.
- os->indent ();
-
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
@@ -476,7 +468,184 @@ be_visitor_union_branch_public_ci::visit_interface_fwd (be_interface_fwd *node)
<< bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_->ptr ();" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ci::visit_valuetype (be_valuetype *node)
+{
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_valuetype - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << "ACE_INLINE void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << bt->name ()
+ << " *val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset (";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+
+ *os << ", 0);" << be_nl
+ << "this->disc_ = ";
+
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+
+ *os << ", 0);" << be_nl
+ << "this->disc_ = ";
+
+ ub->gen_default_label_value (os, bu);
+ }
+
+ idl_bool bt_is_defined = node->is_defined ();
+
+ *os << ";" << be_nl
+ << "CORBA::add_ref (val);" << be_nl
+ << "typedef "
+ << bt->nested_type_name (bu, "_var")
+ << " OBJECT_FIELD;" << be_nl
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << "OBJECT_FIELD (val)" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Get method.
+ *os << "// Retrieve the member." << be_nl
+ << "ACE_INLINE " << bt->name () << "_ptr " << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->u_." << ub->local_name () << "_->ptr ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_ci::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ be_union_branch *ub = this->ctx_->be_node_as_union_branch ();
+ be_union *bu = this->ctx_->be_scope_as_union ();
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_ci::"
+ "visit_valuetype_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Set method.
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "// Accessor to set the member." << be_nl
+ << "ACE_INLINE void" << be_nl
+ << bu->name () << "::" << ub->local_name () << " (" << bt->name ()
+ << " *val)" << be_nl
+ << "{" << be_idt_nl
+ << "// Set the discriminant value." << be_nl
+ << "this->_reset (";
+
+ if (ub->label ()->label_kind () == AST_UnionLabel::UL_label)
+ {
+ ub->gen_label_value (os);
+
+ *os << ", 0);" << be_nl
+ << "this->disc_ = ";
+
+ ub->gen_label_value (os);
+ }
+ // Default label.
+ else
+ {
+ ub->gen_default_label_value (os, bu);
+
+ *os << ", 0);" << be_nl
+ << "this->disc_ = ";
+
+ ub->gen_default_label_value (os, bu);
+ }
+
+ idl_bool bt_is_defined = node->full_definition ()->is_defined ();
+
+ *os << ";" << be_nl
+ << "typedef "
+ << bt->nested_type_name (bu, "_var")
+ << " OBJECT_FIELD;" << be_nl
+ << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl;
+
+ if (bt_is_defined)
+ {
+ *os << "OBJECT_FIELD (" << bt->name () << "::";
+ }
+ else
+ {
+ *os << "OBJECT_FIELD (tao_" << node->flat_name ();
+ }
+
+ *os << "_duplicate (val))" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // Get method.
+ *os << "// Retrieve the member." << be_nl
+ << "ACE_INLINE " << bt->name () << "_ptr " << be_nl
+ << bu->name () << "::" << ub->local_name () << " (void) const" << be_nl
+ << "{" << be_idt_nl
+ << "return this->u_." << ub->local_name () << "_->ptr ();" << be_uidt_nl
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -512,10 +681,8 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
TAO_OutStream *os = this->ctx_->stream ();
// Set method.
- os->indent ();
-
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl
@@ -603,7 +770,7 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
<< "{" << be_idt_nl;
*os << "return this->u_." << ub->local_name ()
<< "_->ptr ();" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
break;
case AST_PredefinedType::PT_pseudo:
@@ -615,7 +782,7 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
<< "{" << be_idt_nl;
*os << "return this->u_." << ub->local_name ()
<< "_;" << be_uidt_nl;
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
break;
case AST_PredefinedType::PT_any:
@@ -635,7 +802,7 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
<< " (void)" << be_nl
<< "{" << be_idt_nl
<< "return *this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
break;
case AST_PredefinedType::PT_void:
break;
@@ -647,7 +814,7 @@ be_visitor_union_branch_public_ci::visit_predefined_type (
<< " (void) const" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
break;
}
@@ -708,8 +875,8 @@ be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node)
}
}
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// (1) Set from a const.
*os << "// Accessor to set the member." << be_nl
@@ -761,7 +928,7 @@ be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node)
<< bu->name () << "::" << ub->local_name () << " (void)" << be_nl
<< "{" << be_idt_nl
<< "return *this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -786,10 +953,8 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
// Three methods to set the string value.
// (1) Set method from char* or wchar*.
- os->indent ();
-
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "// Accessor to set the member." << be_nl
<< "ACE_INLINE void" << be_nl;
@@ -955,7 +1120,7 @@ be_visitor_union_branch_public_ci::visit_string (be_string *node)
<< " (void) const // get method" << be_nl
<< "{" << be_idt_nl
<< "return this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
@@ -1013,8 +1178,8 @@ be_visitor_union_branch_public_ci::visit_structure (be_structure *node)
}
}
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// (1) Set from a const.
*os << "// Accessor to set the member." << be_nl
@@ -1096,7 +1261,7 @@ be_visitor_union_branch_public_ci::visit_structure (be_structure *node)
*os << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl;
}
- *os << "}\n\n";
+ *os << "}" << be_nl << be_nl;
return 0;
}
@@ -1176,8 +1341,8 @@ be_visitor_union_branch_public_ci::visit_union (be_union *node)
}
}
- *os << be_nl << "// TAO_IDL - Generated from "
- << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+ *os << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// (1) Set from a const.
*os << "// Accessor to set the member." << be_nl
@@ -1229,7 +1394,7 @@ be_visitor_union_branch_public_ci::visit_union (be_union *node)
<< bu->name () << "::" << ub->local_name () << " (void)" << be_nl
<< "{" << be_idt_nl
<< "return *this->u_." << ub->local_name () << "_;" << be_uidt_nl
- << "}\n\n";
+ << "}" << be_nl << be_nl;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
index 25dc98b62ac..523b1e310c1 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
@@ -222,7 +222,63 @@ be_visitor_union_branch_public_reset_cs::visit_interface_fwd (be_interface_fwd *
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
- "visit_interface - "
+ "visit_interface_fwd - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "delete this->u_."
+ << ub->local_name () << "_;" << be_nl
+ << "this->u_." << ub->local_name ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_valuetype (be_valuetype *)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch ();
+ be_union *bu =
+ this->ctx_->be_scope_as_union ();
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_reset_cs::"
+ "visit_valuetype - "
+ "bad context information\n"),
+ -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "delete this->u_."
+ << ub->local_name () << "_;" << be_nl
+ << "this->u_." << ub->local_name ()
+ << "_ = 0;" << be_nl
+ << "break;" << be_uidt_nl;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_reset_cs::visit_valuetype_fwd (be_valuetype_fwd *)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch ();
+ be_union *bu =
+ this->ctx_->be_scope_as_union ();
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_reset_cs::"
+ "visit_valuetype_fwd - "
"bad context information\n"),
-1);
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
index 7f1b6b9c423..7ef0373f2b7 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
@@ -55,7 +55,9 @@ be_visitor_valuetype_cdr_op_ci::visit_valuetype (be_valuetype *node)
}
TAO_OutStream *os = this->ctx_->stream ();
- os->indent (); //start with whatever indentation level we are at now
+
+ *os << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// This is just declaration so no ACE_INLINE
*os << be_global->stub_export_macro () << " "
@@ -64,7 +66,7 @@ be_visitor_valuetype_cdr_op_ci::visit_valuetype (be_valuetype *node)
*os << be_global->stub_export_macro () << " "
<< "CORBA::Boolean operator>> (TAO_InputCDR &, "
- << node->full_name () << " *&);" << be_nl;
+ << node->full_name () << " *&);" << be_nl << be_nl;
if (this->visit_scope (node) == -1)
{
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 1fa40019b2d..6625132584f 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -483,7 +483,6 @@ public:
TAO_UNION_PUBLIC_CS,
TAO_UNION_PUBLIC_ASSIGN_CS,
TAO_UNION_PUBLIC_RESET_CS,
- TAO_UNION_PUBLIC_ACCESS_CS,
// Emitting code for private members of the union.
TAO_UNION_PRIVATE_CH,
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/array.h b/TAO/TAO_IDL/be_include/be_visitor_array/array.h
index a762f64a596..a6d9fd9832b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_array/array.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/array.h
@@ -56,6 +56,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit an interface forward node
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit a valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit a valuetype forward node
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit a predefined type node
diff --git a/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h
index fcda7343531..437fbf15255 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_array/cdr_op_ci.h
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit an interface forward node
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit a valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit a valuetype forward node
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit a predefined type node
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h
index 80529d2a203..ce696bb600a 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor.h
@@ -60,6 +60,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype forward
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h
index 52b6ab67dd7..e5f215fc179 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception/ctor_assign.h
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit valuetype
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit valuetype forward
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h
index eb180f8945f..7692e8625e8 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_field/cdr_op_ci.h
@@ -55,6 +55,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
index 89f51664fbb..7a647bb2308 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
@@ -29,7 +29,6 @@
#include "be_visitor_union_branch/public_cs.h"
#include "be_visitor_union_branch/public_assign_cs.h"
#include "be_visitor_union_branch/public_reset_cs.h"
-#include "be_visitor_union_branch/public_access_cs.h"
#include "be_visitor_union_branch/private_ch.h"
#include "be_visitor_union_branch/cdr_op_ch.h"
#include "be_visitor_union_branch/cdr_op_ci.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h
index 1a4b582c641..e9df14268e3 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/cdr_op_ci.h
@@ -55,6 +55,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h
index fdc7e9f2070..4d83cabea7d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/private_ch.h
@@ -59,6 +59,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_access_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_access_cs.h
deleted file mode 100644
index b1d76206108..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_access_cs.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- c++ -*- */
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// public_access_cs.h
-//
-// = DESCRIPTION
-// Visitor for the Union class.
-// This one generates code for the access method of the union class
-// for the union members. This is primarily used by the marshaling engine.
-//
-// = AUTHOR
-// Aniruddha Gokhale
-//
-// ============================================================================
-
-#ifndef _BE_VISITOR_UNION_BRANCH_PUBLIC_ACCESS_CS_H_
-#define _BE_VISITOR_UNION_BRANCH_PUBLIC_ACCESS_CS_H_
-
-class be_visitor_union_branch_public_access_cs : public be_visitor_decl
-{
- //
- // = TITLE
- // be_visitor_union_branch_public_access_cs
- //
- // = DESCRIPTION
- // This is used to generate the body of the access method
- //
-public:
- be_visitor_union_branch_public_access_cs (be_visitor_context *ctx);
- // constructor
-
- ~be_visitor_union_branch_public_access_cs (void);
- // destructor
-
- virtual int visit_union_branch (be_union_branch *node);
- // visit the union_branch node
-
- // =visit operations on all possible data types that a union_branch can be
-
- virtual int visit_array (be_array *node);
- // visit array type
-
- virtual int visit_enum (be_enum *node);
- // visit enum type
-
- virtual int visit_interface (be_interface *node);
- // visit interface type
-
- virtual int visit_interface_fwd (be_interface_fwd *node);
- // visit interface forward type
-
- virtual int visit_predefined_type (be_predefined_type *node);
- // visit predefined type
-
- virtual int visit_sequence (be_sequence *node);
- // visit sequence type
-
- virtual int visit_string (be_string *node);
- // visit string type
-
- virtual int visit_structure (be_structure *node);
- // visit structure type
-
- virtual int visit_typedef (be_typedef *node);
- // visit typedefed type
-
- virtual int visit_union (be_union *node);
- // visit union type
-
-};
-
-#endif /* _BE_VISITOR_UNION_BRANCH_PUBLIC_ACCESS_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h
index fe324e600d0..731ecad3b2d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_assign_cs.h
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h
index 585d8f0453d..d492157bd99 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_ci.h
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit value type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit value forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h
index c66e142c280..f079aeef154 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_cs.h
@@ -63,7 +63,6 @@ public:
virtual int visit_union (be_union *node);
// visit union type
-
};
#endif /* _BE_VISITOR_UNION_BRANCS_PUBLIC_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h
index e7fa0b7733a..695604da6c2 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_reset_cs.h
@@ -58,6 +58,12 @@ public:
virtual int visit_interface_fwd (be_interface_fwd *node);
// visit interface forward type
+ virtual int visit_valuetype (be_valuetype *node);
+ // visit interface type
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+ // visit interface forward type
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type