summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-09-01 00:44:37 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-09-01 00:44:37 +0000
commit7e6ba5dd62f367a0aa5e64dfe8712417f4f5f7e3 (patch)
treec9ae00bfb1892217bfa0dcd7d6f69c3209f7f77e
parent8d9bbfa5623c0225d21d085851ccd9ca7e49f294 (diff)
downloadATCD-7e6ba5dd62f367a0aa5e64dfe8712417f4f5f7e3.tar.gz
ChangeLogTag: Sun Aug 31 15:49:35 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/TAO_IDL/Makefile.BE1
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE.bor1
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp8
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp8
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp38
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_arg_traits.cpp651
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp48
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp33
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp97
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp148
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_tmplinst.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_traits.cpp399
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp7
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h9
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_arg_traits.h74
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_cs.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_traits.h16
28 files changed, 1039 insertions, 642 deletions
diff --git a/TAO/TAO_IDL/Makefile.BE b/TAO/TAO_IDL/Makefile.BE
index 69a2e942bfe..9e468f0d17c 100644
--- a/TAO/TAO_IDL/Makefile.BE
+++ b/TAO/TAO_IDL/Makefile.BE
@@ -73,6 +73,7 @@ FILES = be/be_array \
be/be_visitor_ami_pre_proc \
be/be_visitor_amh_pre_proc \
be/be_visitor_argument \
+ be/be_visitor_arg_traits \
be/be_visitor_array \
be/be_visitor_attribute \
be/be_visitor_ccm_pre_proc \
diff --git a/TAO/TAO_IDL/TAO_IDL_BE.bor b/TAO/TAO_IDL/TAO_IDL_BE.bor
index 1e8c0b85f1c..f015bc58c21 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE.bor
+++ b/TAO/TAO_IDL/TAO_IDL_BE.bor
@@ -54,6 +54,7 @@ OBJFILES = \
$(OBJDIR)\be_visitor_ami_pre_proc.obj \
$(OBJDIR)\be_visitor_amh_pre_proc.obj \
$(OBJDIR)\be_visitor_argument.obj \
+ $(OBJDIR)\be_visitor_arg_traits.obj \
$(OBJDIR)\be_visitor_array.obj \
$(OBJDIR)\be_visitor_attribute.obj \
$(OBJDIR)\be_visitor_ccm_pre_proc.obj \
diff --git a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
index 49eb35f2a4d..188950395d6 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
+++ b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
@@ -298,6 +298,10 @@ SOURCE=.\be\be_visitor_ami_pre_proc.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_arg_traits.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_argument.cpp
# End Source File
# Begin Source File
@@ -630,6 +634,10 @@ SOURCE=.\be_include\be_visitor_ami_pre_proc.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_arg_traits.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_argument.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp
index 70ff64ec4ce..018e7f31bdd 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp
+++ b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp
@@ -291,6 +291,10 @@ SOURCE=.\be\be_visitor_ami_pre_proc.cpp
# End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_arg_traits.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_argument.cpp
# End Source File
# Begin Source File
@@ -619,6 +623,10 @@ SOURCE=.\be_include\be_visitor_ami_pre_proc.h
# End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_arg_traits.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_argument.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index cc821d98247..850b0a1d4f5 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -657,6 +657,12 @@ TAO_CodeGen::start_server_skeletons (const char *fname)
this->gen_standard_include (this->server_skeletons_,
"tao/IFR_Client_Adapter.h");
+ if (be_global->gen_thru_poa_collocation ()
+ || be_global->gen_direct_collocation ())
+ {
+ this->gen_arg_file_includes (this->server_skeletons_);
+ }
+
// The following header must always be included.
this->gen_standard_include (this->server_skeletons_,
"tao/PortableInterceptor.h");
@@ -1332,6 +1338,14 @@ TAO_CodeGen::gen_stub_hdr_includes (void)
}
if (ACE_BIT_ENABLED (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.interface_seen_))
+ {
+ // Include the AbstractBase file from the Valuetype library.
+ this->gen_standard_include (this->client_header_,
+ "tao/Object_T.h");
+ }
+
+ if (ACE_BIT_ENABLED (idl_global->decls_seen_info_,
idl_global->decls_seen_masks.abstract_iface_seen_))
{
// Include the AbstractBase file from the Valuetype library.
@@ -1360,7 +1374,6 @@ TAO_CodeGen::gen_stub_hdr_includes (void)
this->gen_seq_file_includes ();
this->gen_var_file_includes ();
- this->gen_arg_file_includes ();
}
void
@@ -1393,7 +1406,7 @@ TAO_CodeGen::gen_stub_src_includes (void)
idl_global->decls_seen_masks.valuetype_seen_))
{
// Include files from the Valuetype library.
- this->gen_standard_include (this->client_header_,
+ this->gen_standard_include (this->client_stubs_,
"tao/Valuetype/ValueBase.h");
}
}
@@ -1406,6 +1419,7 @@ TAO_CodeGen::gen_stub_src_includes (void)
}
this->gen_any_file_includes ();
+ this->gen_arg_file_includes (this->client_stubs_);
}
void
@@ -1500,60 +1514,60 @@ TAO_CodeGen::gen_var_file_includes (void)
}
void
-TAO_CodeGen::gen_arg_file_includes (void)
+TAO_CodeGen::gen_arg_file_includes (TAO_OutStream *stream)
{
this->gen_cond_file_include (
idl_global->decls_seen_masks.basic_arg_seen_,
"tao/Basic_Arguments.h",
- this->client_header_
+ stream
);
this->gen_cond_file_include (
idl_global->decls_seen_masks.bd_string_arg_seen_,
"tao/BD_String_Argument_T.h",
- this->client_header_
+ stream
);
this->gen_cond_file_include (
idl_global->decls_seen_masks.fixed_array_arg_seen_,
"tao/Fixed_Array_Argument_T.h",
- this->client_header_
+ stream
);
this->gen_cond_file_include (
idl_global->decls_seen_masks.fixed_size_arg_seen_,
"tao/Fixed_Size_Argument_T.h",
- this->client_header_
+ stream
);
this->gen_cond_file_include (
idl_global->decls_seen_masks.object_arg_seen_,
"tao/Object_Argument_T.h",
- this->client_header_
+ stream
);
this->gen_cond_file_include (
idl_global->decls_seen_masks.special_basic_arg_seen_,
"tao/Special_Basic_Arguments.h",
- this->client_header_
+ stream
);
this->gen_cond_file_include (
idl_global->decls_seen_masks.ub_string_arg_seen_,
"tao/UB_String_Arguments.h",
- this->client_header_
+ stream
);
this->gen_cond_file_include (
idl_global->decls_seen_masks.var_array_arg_seen_,
"tao/Var_Array_Argument_T.h",
- this->client_header_
+ stream
);
this->gen_cond_file_include (
idl_global->decls_seen_masks.var_size_arg_seen_,
"tao/Var_Size_Argument_T.h",
- this->client_header_
+ stream
);
}
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index 5b1182adfb1..66bebab406d 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -67,6 +67,9 @@ be_decl::be_decl (void)
cli_inline_cdr_op_gen_ (I_FALSE),
cli_inline_cdr_decl_gen_ (I_FALSE),
cli_traits_gen_ (I_FALSE),
+ cli_arg_traits_gen_ (I_FALSE),
+ srv_arg_traits_gen_ (I_FALSE),
+ srv_sarg_traits_gen_ (I_FALSE),
cli_tmpl_class_gen_ (I_FALSE),
cli_pragma_inst_gen_ (I_FALSE),
cli_inarg_tmpl_class_gen_ (I_FALSE),
@@ -111,6 +114,9 @@ be_decl::be_decl (AST_Decl::NodeType type,
cli_inline_cdr_op_gen_ (I_FALSE),
cli_inline_cdr_decl_gen_ (I_FALSE),
cli_traits_gen_ (I_FALSE),
+ cli_arg_traits_gen_ (I_FALSE),
+ srv_arg_traits_gen_ (I_FALSE),
+ srv_sarg_traits_gen_ (I_FALSE),
cli_tmpl_class_gen_ (I_FALSE),
cli_pragma_inst_gen_ (I_FALSE),
cli_inarg_tmpl_class_gen_ (I_FALSE),
@@ -371,6 +377,24 @@ be_decl::cli_traits_gen (void)
}
idl_bool
+be_decl::cli_arg_traits_gen (void)
+{
+ return this->cli_arg_traits_gen_;
+}
+
+idl_bool
+be_decl::srv_arg_traits_gen (void)
+{
+ return this->srv_arg_traits_gen_;
+}
+
+idl_bool
+be_decl::srv_sarg_traits_gen (void)
+{
+ return this->srv_sarg_traits_gen_;
+}
+
+idl_bool
be_decl::cli_tmpl_class_gen (void)
{
return this->cli_tmpl_class_gen_;
@@ -588,6 +612,24 @@ be_decl::cli_traits_gen (idl_bool val)
}
void
+be_decl::cli_arg_traits_gen (idl_bool val)
+{
+ this->cli_arg_traits_gen_ = val;
+}
+
+void
+be_decl::srv_arg_traits_gen (idl_bool val)
+{
+ this->srv_arg_traits_gen_ = val;
+}
+
+void
+be_decl::srv_sarg_traits_gen (idl_bool val)
+{
+ this->srv_sarg_traits_gen_ = val;
+}
+
+void
be_decl::cli_tmpl_class_gen (idl_bool val)
{
this->cli_tmpl_class_gen_ = val;
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index 10036d51362..e0afb4450dd 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -605,7 +605,7 @@ be_sequence::gen_base_class_name (TAO_OutStream *os,
<< be_nl;
*os << elem->nested_type_name (ctx_scope) << "_slice"
<< linebreak << be_uidt_nl
- << ">" << be_uidt << be_uidt;
+ << ">" << be_uidt;
}
else
{
@@ -617,7 +617,7 @@ be_sequence::gen_base_class_name (TAO_OutStream *os,
<< linebreak << be_nl
<< this->max_size ()->ev ()->u.ulval << linebreak
<< be_uidt_nl
- << ">" << be_uidt << be_uidt;
+ << ">" << be_uidt;
}
break;
@@ -628,7 +628,7 @@ be_sequence::gen_base_class_name (TAO_OutStream *os,
<< be_idt << be_idt_nl
<< elem->nested_type_name (ctx_scope) << linebreak
<< be_uidt_nl
- << ">" << be_uidt << be_uidt;
+ << ">" << be_uidt;
}
else
{
@@ -638,7 +638,7 @@ be_sequence::gen_base_class_name (TAO_OutStream *os,
<< be_nl
<< this->max_size ()->ev ()->u.ulval << linebreak
<< be_uidt_nl
- << ">" << be_uidt << be_uidt;
+ << ">" << be_uidt;
}
break;
diff --git a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
new file mode 100644
index 00000000000..f2a4a181bee
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
@@ -0,0 +1,651 @@
+//=============================================================================
+/**
+* @file be_visitor_arg_traits.cpp
+*
+* $Id$
+*
+* This visitor generates template specializations for argument traits classes.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+
+#include "be_visitor_arg_traits.h"
+#include "be_visitor_context.h"
+#include "be_root.h"
+#include "be_module.h"
+#include "be_interface.h"
+#include "be_valuetype.h"
+#include "be_interface_fwd.h"
+#include "be_valuetype_fwd.h"
+#include "be_eventtype.h"
+#include "be_eventtype_fwd.h"
+#include "be_array.h"
+#include "be_enum.h"
+#include "be_sequence.h"
+#include "be_string.h"
+#include "be_structure.h"
+#include "be_field.h"
+#include "be_union.h"
+#include "be_union_branch.h"
+#include "be_typedef.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+#include "idl_defines.h"
+
+ACE_RCSID (be,
+ be_visitor_arg_traits,
+ "$Id$")
+
+be_visitor_arg_traits::be_visitor_arg_traits (char *S,
+ be_visitor_context *ctx)
+ : be_visitor_scope (ctx),
+ S_ (ACE::strnew (S))
+{
+}
+
+be_visitor_arg_traits::~be_visitor_arg_traits (void)
+{
+ delete [] this->S_;
+}
+
+int
+be_visitor_arg_traits::visit_root (be_root *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl
+ << "// Arg traits specializations." << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_root - visit scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl
+ << "};";
+
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_module (be_module *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_module - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_interface (be_interface *node)
+{
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ if (node->seen_in_operation ())
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits");
+
+ *os << be_nl << be_nl
+ << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << "_ptr," << be_nl
+ << node->name () << "_var," << be_nl
+ << node->name () << "_out," << be_nl
+ << "TAO::Objref_Traits<" << node->name () << ">" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_interface - visit scope failed\n"),
+ -1);
+ }
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_interface_fwd (be_interface_fwd *node)
+{
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ be_interface *fd =
+ be_interface::narrow_from_decl (node->full_definition ());
+
+ // The logic in visit_interface() should handle what gets generated
+ // and what doesn't.
+ if (this->visit_interface (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_interface_fwd - code generation failed\n"),
+ -1);
+ }
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_valuetype (be_valuetype *node)
+{
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ if (node->seen_in_operation ())
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits");
+
+ *os << be_nl << be_nl
+ << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << " *," << be_nl
+ << node->name () << "_var," << be_nl
+ << node->name () << "_out," << be_nl
+ << "TAO::Value_Traits<" << node->name () << ">" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_valuetype - visit scope failed\n"),
+ -1);
+ }
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ if (this->generated (node))
+ {
+ return 0;
+ }
+
+ be_valuetype *fd =
+ be_valuetype::narrow_from_decl (node->full_definition ());
+
+ // The logic in visit_valuetype() should handle what gets generated
+ // and what doesn't.
+ int status = this->visit_valuetype (fd);
+
+ if (status != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_valuetype_fwd - code generation failed\n"),
+ -1);
+ }
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_arg_traits::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_arg_traits::visit_sequence (be_sequence *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *alias = this->ctx_->alias ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // This will include the bound if there is one, and should also
+ // prevent duplication, even if there have been further typdefs.
+ os->gen_ifdef_macro (node->gen_name (), "arg_traits");
+
+ *os << be_nl << be_nl
+ << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << this->S_ << "Arg_Traits<"
+ << alias->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "Var_Size_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << alias->name () << "," << be_nl
+ << alias->name () << "_var," << be_nl
+ << alias->name () << "_out" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_string (be_string *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ unsigned long bound = node->max_size ()->ev ()->u.ulval;
+ be_typedef *alias = this->ctx_->alias ();
+
+ // Unbounded (w)string args are handled as a predefined type.
+ // Bounded (w)strings must come in as a typedef - they can't
+ // be used directly as arguments or return types.
+ if (bound == 0 || alias == 0)
+ {
+ return 0;
+ }
+
+ idl_bool wide = (node->width () != 1);
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits");
+
+ // A workaround 'dummy' type, since bounded (w)strings are all
+ // generated as typedefs of (w)char *.
+ *os << be_nl << be_nl
+ << "struct " << alias->local_name () << "_" << bound << " {};";
+
+ *os << be_nl << be_nl
+ << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << this->S_ << "Arg_Traits<"
+ << alias->local_name () << "_" << bound << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "BD_" << (wide ? "W" : "")
+ << "String_" << this->S_ << "Arg_Traits<" << bound << ">"
+ << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_array (be_array *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits");
+
+ *os << be_nl << be_nl
+ << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
+ << "_Array_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << "," << be_nl
+ << node->name () << "_slice," << be_nl
+ << node->name () << "_var," << be_nl;
+
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ *os << node->name () << "_out," << be_nl;
+ }
+
+ *os << node->name () << "_forany" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_enum (be_enum *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits");
+
+ *os << be_nl << be_nl
+ << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ *os << "Basic_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name () << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_structure (be_structure *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits");
+
+ *os << be_nl << be_nl
+ << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
+ << "_Size_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name ();
+
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ *os << "," << be_nl
+ << node->name () << "_var," << be_nl
+ << node->name () << "_out";
+ }
+
+ *os << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_structure - visit scope failed\n"),
+ -1);
+ }
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_field (be_field *node)
+{
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ // Valuetypes may not be *declared* in a field, so this will
+ // get handled elsewhere, and will also avoid nested valuetype
+ // recursion. So we set the field node as processed (the
+ // field *type* may not have been reached yet) and return.
+ if (bt->base_node_type () == AST_Decl::NT_valuetype)
+ {
+ node->cli_traits_gen (I_TRUE);
+ return 0;
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+// this->generated (node, I_TRUE);
+// this->generated (bt, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_union (be_union *node)
+{
+ if (this->generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ // This should be generated even for imported nodes. The ifdef guard prevents
+ // multiple declarations.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits");
+
+ *os << be_nl << be_nl
+ << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
+ << "class " << be_global->stub_export_macro () << " "
+ << this->S_ << "Arg_Traits<"
+ << node->name () << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl;
+
+ *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
+ << "_Size_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl
+ << node->name ();
+
+ if (node->size_type () == AST_Type::VARIABLE)
+ {
+ *os << "," << be_nl
+ << node->name () << "_var," << be_nl
+ << node->name () << "_out";
+ }
+
+ *os << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+
+ os->gen_endif ();
+
+ int status = this->visit_scope (node);
+
+ if (status != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_union - visit scope failed\n"),
+ -1);
+ }
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_union_branch (be_union_branch *node)
+{
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"),
+ -1);
+ }
+
+// this->generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_traits::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node);
+
+ // Make a decision based on the primitive base type.
+ be_type *bt = node->primitive_base_type ();
+
+ if (!bt || (bt->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+idl_bool
+be_visitor_arg_traits::generated (be_decl *node) const
+{
+ if (ACE_OS::strcmp (this->S_, "") == 0)
+ {
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CS:
+ return node->cli_arg_traits_gen ();
+ case TAO_CodeGen::TAO_ROOT_SS:
+ return node->srv_arg_traits_gen ();
+ default:
+ return 0;
+ }
+ }
+
+ return node->srv_sarg_traits_gen ();
+}
+
+void
+be_visitor_arg_traits::generated (be_decl *node,
+ idl_bool val)
+{
+ if (ACE_OS::strcmp (this->S_, "") == 0)
+ {
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CS:
+ node->cli_arg_traits_gen (I_TRUE);
+ return;
+ case TAO_CodeGen::TAO_ROOT_SS:
+ node->srv_arg_traits_gen (I_TRUE);
+ return;
+ default:
+ return;
+ }
+ }
+
+ node->srv_sarg_traits_gen (I_TRUE);
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
index f330d3ecb05..81550a51e67 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp
@@ -139,18 +139,6 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node)
<< ");" << be_uidt << be_uidt << be_uidt_nl
<< "}";
- *os << be_nl << be_nl
- << "#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \\"
- << be_idt_nl
- << " defined (ACE_HAS_GNU_REPO)" << be_nl
- << "template class TAO::Any_Dual_Impl_T<" << node->name () << ">;"
- << be_uidt_nl
- << "#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)" << be_nl
- << "# pragma instantiate TAO::Any_Dual_Impl_T<"
- << node->name () << " \\"
- << ">" << be_nl
- << "#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */";
-
// all we have to do is to visit the scope and generate code
if (this->visit_scope (node) == -1)
{
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 c8d7e8a058d..33b6ace1fd7 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
@@ -140,8 +140,9 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
<< node->name ()
<< "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
<< "{" << be_idt_nl
- << node->local_name () << " *_tao_tmp_pointer = ACE_static_cast ("
- << node->local_name () << "*, _tao_void_pointer);" << be_nl
+ << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl
+ << "ACE_static_cast ("
+ << node->local_name () << "*, _tao_void_pointer);" << be_uidt_nl
<< "delete _tao_tmp_pointer;" << be_uidt_nl
<< "}" << be_nl << be_nl;
}
@@ -294,11 +295,12 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
-1);
}
- *os << " : CORBA::UserException ("
- << be_idt << be_idt << be_idt << be_idt_nl
+ *os << be_idt_nl
+ << ": 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 << be_uidt_nl;
+ << ")" << be_uidt << be_uidt << be_uidt_nl;
*os << "{" << be_idt;
// Assign each individual member. We need yet another state.
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
index ae69be3da59..3fb2ecb845c 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
@@ -96,8 +96,6 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
<< node->full_name () << "_ptr &_tao_objref" << be_uidt_nl
<< ")" << be_uidt_nl
<< "{" << be_idt_nl;
- *os << "ACE_TRY_NEW_ENV" << be_nl
- << "{" << be_idt_nl;
if (node->is_abstract ())
{
@@ -117,49 +115,31 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
<< "{" << be_idt_nl
<< "return 0;" << be_uidt_nl
<< "}" << be_uidt_nl << be_nl
+ << "typedef ::" << node->name () << " RHS_SCOPED_NAME;"
+ << be_nl << be_nl
<< "// Narrow to the right type." << be_nl;
if (node->is_abstract ())
{
- *os << "if (obj->_is_objref ())" << be_idt_nl
- << "{" << be_idt_nl
- << "_tao_objref =" << be_idt_nl
- << node->full_name () << "::_unchecked_narrow ("
- << be_idt << be_idt_nl
- << "obj.in ()" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl
- << "else" << be_idt_nl
- << "{" << be_idt_nl
- << "_tao_objref =" << be_idt_nl
- << node->full_name () << "::_unchecked_narrow ("
- << be_idt << be_idt_nl
- << "obj._retn ()" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
+ *os << "_tao_objref =" << be_idt_nl
+ << "TAO::Narrow_Utils<RHS_SCOPED_NAME>::"
+ << "unchecked_narrow (obj.in ());"
+ << be_uidt_nl << be_nl;
}
else
{
*os << "_tao_objref =" << be_idt_nl
- << node->full_name () << "::_unchecked_narrow ("
+ << "TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow ("
<< be_idt << be_idt_nl
- << "obj.in ()" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl;
+ << "obj.in ()," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << be_uidt_nl
+ << ");" << be_uidt_nl << be_uidt_nl;
}
- *os << "ACE_TRY_CHECK;" << be_nl;
- *os << "return 1;" << be_uidt_nl;
- *os << "}" << be_nl
- << "ACE_CATCHANY" << be_nl
- << "{" << be_idt_nl
- << "// do nothing" << be_uidt_nl
- << "}" << be_nl
- << "ACE_ENDTRY;" << be_nl
- << "return 0;" << be_uidt_nl;
- *os << "}";
+ *os << "return 1;" << be_uidt_nl
+ << "}";
node->cli_stub_cdr_op_gen (1);
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
index 323d08dcc0f..9e603b45574 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -116,16 +116,18 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
// Generate the body.
*os << "{" << be_nl
- << "public:" << be_idt_nl
+ << "public:" << be_idt_nl;
- // Generate the _ptr_type and _var_type typedefs.
- << "typedef " << node->local_name () << "_ptr _ptr_type;"
+ if (!node->is_local ())
+ {
+ *os << "friend class TAO::Narrow_Utils<"
+ << node->local_name () << ">;" << be_nl;
+ }
+
+ *os << "typedef " << node->local_name () << "_ptr _ptr_type;"
<< be_nl
<< "typedef " << node->local_name () << "_var _var_type;"
- << be_nl;
-
- // Generate the static variable that we use for narrowing.
- *os << "static int _tao_class_id;" << be_nl << be_nl;
+ << be_nl << be_nl;
// Generate the static _duplicate, _narrow, and _nil operations.
*os << "// The static operations." << be_nl
@@ -146,23 +148,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
*os << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl;
- // There's no need for an _unchecked_narrow for locality
- // constrained object.
- *os << "static " << node->local_name () << "_ptr "
- << "_unchecked_narrow (" << be_idt << be_idt_nl;
-
- if (node->is_abstract ())
- {
- *os << "CORBA::AbstractBase_ptr obj" << be_nl;
- }
- else
- {
- *os << "CORBA::Object_ptr obj" << be_nl;
- }
-
- *os << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl;
-
// This method is defined in the header file to workaround old
// g++ problems.
*os << "static " << node->local_name () << "_ptr _nil (void)"
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
index 1a55b4875c9..522e3e85579 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -104,10 +104,6 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "}";
}
- // Initialize the static narrrowing helper variable.
- *os << be_nl << be_nl
- << "int " << node->full_name () << "::_tao_class_id = 0;";
-
if (node->has_mixed_parentage ())
{
*os << be_nl << be_nl
@@ -180,12 +176,13 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "_setup_collocation (int collocated)" << be_nl
<< "{" << be_idt_nl
<< "if (collocated)" << be_idt_nl
+ << "{" << be_idt_nl
<< "this->the" << node->base_proxy_broker_name ()
<< "_ =" << be_idt_nl
<< "::" << node->flat_client_enclosing_scope ()
<< node->base_proxy_broker_name ()
- << "_Factory_function_pointer (this);"
- << be_uidt << be_uidt;
+ << "_Factory_function_pointer (this);" << be_uidt << be_uidt_nl
+ << "}" << be_uidt;
// Now we setup the immediate parents.
int n_parents = node->n_inherits ();
@@ -229,8 +226,9 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< node->name ()
<< "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
<< "{" << be_idt_nl
- << node->local_name () << " *_tao_tmp_pointer = ACE_static_cast ("
- << node->local_name () << " *, _tao_void_pointer);" << be_nl
+ << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl
+ << "ACE_static_cast ("
+ << node->local_name () << " *, _tao_void_pointer);" << be_uidt_nl
<< "CORBA::release (_tao_tmp_pointer);" << be_uidt_nl
<< "}" << be_nl << be_nl;
}
@@ -252,73 +250,48 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
if (node->is_abstract ())
{
- *os << "CORBA::AbstractBase_ptr obj" << be_nl;
+ *os << "CORBA::AbstractBase_ptr";
}
else
{
- *os << "CORBA::Object_ptr obj" << be_nl;
+ *os << "CORBA::Object_ptr";
}
- *os << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ *os << " _tao_objref" << be_nl
+ << "ACE_ENV_ARG_DECL"
+ << (node->is_local () ? "_NOT_USED" : "")
+ << be_uidt_nl
<< ")" << be_uidt_nl
<< "{" << be_idt_nl;
- // Local interfaces have slightly different _narrow implementation.
- if (! node->is_local ())
+ if (node->is_local ())
{
- // Remote _narrow implementation.
- *os << "if (CORBA::is_nil (obj))" << be_idt_nl
- << "{" << be_idt_nl
- << "return " << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- if (! node->is_abstract ())
- {
- *os << "if (! obj->_is_local ())" << be_idt_nl
- << "{" << be_idt_nl;
- }
-
- *os << "CORBA::Boolean is_a =" << be_idt_nl
- << "obj->_is_a (" << be_idt << be_idt_nl
- << "\"" << node->repoID () << "\"" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl
- << "ACE_CHECK_RETURN (" << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ());" << be_nl << be_nl
- << "if (is_a == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "return " << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ();" << be_uidt_nl;
+ *os << node->local_name () << "_ptr proxy =" << be_idt_nl
+ << "dynamic_cast<" << node->local_name () << "_ptr> (_tao_objref);"
+ << be_uidt_nl
+ << "proxy->_add_ref ();" << be_nl
+ << "return proxy;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+ else
+ {
+ *os << "return" << be_idt_nl
+ << "TAO::Narrow_Utils<" << node->local_name () << ">::narrow ("
+ << be_idt << be_idt_nl
+ << "_tao_objref," << be_nl
+ << "\"" << node->repoID () << "\"";
- if (node->is_abstract ())
+ if (!node->is_abstract ())
{
- *os << "}" << be_uidt_nl;
+ *os << "," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << be_nl;
}
- else
- {
- *os << "}" << be_uidt << be_uidt_nl;
- *os << "}" << be_uidt_nl;
- }
-
- *os << be_nl;
- }
- *os << "return " << bt->nested_type_name (this->ctx_->scope ())
- << "::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER);" << be_uidt_nl
- << "}" << be_nl << be_nl;
-
- if (node->is_abstract ())
- {
- this->gen_abstract_unchecked_narrow (node,
- bt,
- os);
- }
- else
- {
- this->gen_concrete_unchecked_narrow (node,
- bt,
- os);
+ *os << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
+ << "}" << be_nl << be_nl;
}
if (node->is_abstract ())
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
index 9029c65e477..e650360eae0 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
@@ -518,9 +518,15 @@ be_visitor_interface_ss::this_method (be_interface *node)
*os << "CORBA::Object_var obj = tmp;" << be_nl
<< "(void) safe_stub.release ();" << be_nl
- << "return " << "::" << node->full_name ()
- << "::_unchecked_narrow (obj.in ());"
- << be_uidt_nl
+ << "typedef ::" << node->name () << " STUB_SCOPED_NAME;" << be_nl
+ << "return" << be_idt_nl
+ << "TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow ("
+ << be_idt << be_idt_nl
+ << "obj.in ()," << be_nl
+ << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer" << be_uidt_nl
+ << ");" << be_uidt << be_uidt << be_uidt_nl
<< "}";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp
index 10f6c35ceff..a64010af149 100644
--- a/TAO/TAO_IDL/be/be_visitor_root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root.cpp
@@ -58,6 +58,7 @@
#include "be_visitor_component_fwd.h"
#include "be_visitor_home.h"
#include "be_visitor_traits.h"
+#include "be_visitor_arg_traits.h"
#include "be_visitor_tmplinst.h"
#include "be_visitor_context.h"
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
index e8d90f607b1..a9544332408 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -47,6 +47,51 @@ int be_visitor_root::visit_root (be_root *node)
-1);
}
+ int status = 0;
+ be_visitor_context ctx = *this->ctx_;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_arg_traits arg_visitor ("", &ctx);
+ status = node->accept (&arg_visitor);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate stub arg traits\n"),
+ -1);
+ }
+ }
+
+ break;
+ case TAO_CodeGen::TAO_ROOT_SS:
+ {
+ if (be_global->gen_thru_poa_collocation ()
+ || be_global->gen_direct_collocation ())
+ {
+ be_visitor_arg_traits arg_visitor ("", &ctx);
+ status = node->accept (&arg_visitor);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate stub arg traits\n"),
+ -1);
+ }
+ }
+ }
+
+ break;
+ default:
+ break;
+ }
+
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -160,13 +205,11 @@ int be_visitor_root::visit_root (be_root *node)
}
}
- be_visitor_context ctx (*this->ctx_);
-
// Make one more pass over the entire tree and generate the OBV_ namespaces
// and OBV_ classes.
idl_bool obv = 1;
- int status = 0;
+ status = 0;
switch (this->ctx_->state ())
{
@@ -203,19 +246,26 @@ int be_visitor_root::visit_root (be_root *node)
status = 0;
ctx = *this->ctx_;
- if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CH)
+ switch (this->ctx_->state ())
{
- be_visitor_traits visitor (&ctx);
- status = node->accept (&visitor);
-
- if (status == -1)
+ case TAO_CodeGen::TAO_ROOT_CH:
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_root::"
- "visit_root - "
- "failed to generate traits\n"),
- -1);
+ be_visitor_traits visitor (&ctx);
+ status = node->accept (&visitor);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate traits\n"),
+ -1);
+ }
}
+
+ break;
+ default:
+ break;
}
// The next thing we need to do is make one more pass thru the entire tree
@@ -227,46 +277,46 @@ int be_visitor_root::visit_root (be_root *node)
switch (this->ctx_->state ())
{
- case TAO_CodeGen::TAO_ROOT_CH:
- {
- ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH);
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH);
- if (be_global->any_support ())
- {
- be_visitor_root_any_op visitor (&ctx);
- status = node->accept (&visitor);
- }
+ if (be_global->any_support ())
+ {
+ be_visitor_root_any_op visitor (&ctx);
+ status = node->accept (&visitor);
+ }
- break;
- }
- case TAO_CodeGen::TAO_ROOT_CS:
- {
- ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS);
- if (be_global->any_support ())
- {
- be_visitor_root_any_op visitor (&ctx);
- status = node->accept (&visitor);
- }
+ if (be_global->any_support ())
+ {
+ be_visitor_root_any_op visitor (&ctx);
+ status = node->accept (&visitor);
+ }
- break;
- }
- case TAO_CodeGen::TAO_ROOT_IH:
- case TAO_CodeGen::TAO_ROOT_SH:
- case TAO_CodeGen::TAO_ROOT_CI:
- case TAO_CodeGen::TAO_ROOT_IS:
- case TAO_CodeGen::TAO_ROOT_SI:
- case TAO_CodeGen::TAO_ROOT_SS:
- case TAO_CodeGen::TAO_ROOT_TIE_SH:
- break;
- default:
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_root::"
- "visit_constant - "
- "Bad context state\n"),
- -1);
- }
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ case TAO_CodeGen::TAO_ROOT_TIE_SH:
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_constant - "
+ "Bad context state\n"),
+ -1);
+ }
}
if (status == -1)
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
index 2f5de9277b1..c98a40c4cdb 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
@@ -367,11 +367,6 @@ be_visitor_sequence_ch::gen_varout_typedefs (be_sequence *node,
<< node->local_name () << "," << be_nl
<< elem->nested_type_name (scope);
- /*if (nt == AST_Decl::NT_array)
- {
- *os << "_slice *";
- }*/
-
*os << be_uidt_nl
<< ">" << be_uidt_nl
<< node->local_name () << "_var;" << be_uidt;
@@ -383,11 +378,6 @@ be_visitor_sequence_ch::gen_varout_typedefs (be_sequence *node,
<< node->local_name () << "_var," << be_nl
<< elem->nested_type_name (scope);
- /*if (nt == AST_Decl::NT_array)
- {
- *os << "_slice *";
- }*/
-
*os << be_uidt_nl
<< ">" << be_uidt_nl
<< node->local_name () << "_out;" << be_uidt;
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
index 65766b42d5c..fbb69be94ad 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
@@ -186,10 +186,8 @@ int be_visitor_sequence_cs::visit_sequence (be_sequence *node)
<< ")" << be_uidt_nl
<< "{" << be_idt_nl
<< node->local_name () << " * _tao_tmp_pointer =" << be_idt_nl
- << "ACE_static_cast (" << be_idt << be_idt_nl
- << node->local_name () << " *," << be_nl
- << "_tao_void_pointer" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl
+ << "ACE_static_cast (" << node->local_name ()
+ << " *, _tao_void_pointer);" << be_uidt_nl
<< "delete _tao_tmp_pointer;" << be_uidt_nl
<< "}";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp
index 40bd2d18787..545e872d407 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_cs.cpp
@@ -67,12 +67,15 @@ be_visitor_structure_cs::visit_structure (be_structure *node)
if (be_global->any_support ())
{
- *os << "void "
+ *os << "void " << be_nl
<< node->name ()
- << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl
+ << "::_tao_any_destructor (" << be_idt << be_idt_nl
+ << "void *_tao_void_pointer" << be_uidt_nl
+ << ")" << be_uidt_nl
<< "{" << be_idt_nl
- << node->local_name () << " *_tao_tmp_pointer = ACE_static_cast ("
- << node->local_name () << "*, _tao_void_pointer);" << be_nl
+ << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl
+ << "ACE_static_cast (" << node->local_name ()
+ << " *, _tao_void_pointer);" << be_uidt_nl
<< "delete _tao_tmp_pointer;" << be_uidt_nl
<< "}";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_tmplinst.cpp b/TAO/TAO_IDL/be/be_visitor_tmplinst.cpp
index edfc6ee31a9..d46197dcac6 100644
--- a/TAO/TAO_IDL/be/be_visitor_tmplinst.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_tmplinst.cpp
@@ -24,6 +24,7 @@
#include "be_valuetype.h"
#include "be_array.h"
#include "be_enum.h"
+#include "be_exception.h"
#include "be_sequence.h"
#include "be_string.h"
#include "be_structure.h"
diff --git a/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp b/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp
index 170d6708aa4..df69518a015 100644
--- a/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp
@@ -600,6 +600,30 @@ be_visitor_tmplinst_cs::visit_enum (be_enum *node)
}
int
+be_visitor_tmplinst_cs::visit_exception (be_exception *node)
+{
+ if (this->this_mode_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (be_global->any_support ())
+ {
+ *os << be_nl << be_nl
+ << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl
+ << "TAO::Any_Dual_Impl_T<" << this->linebreak_
+ << be_idt << be_idt_nl
+ << node->name () << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
be_visitor_tmplinst_cs::visit_structure (be_structure *node)
{
if (this->this_mode_generated (node))
diff --git a/TAO/TAO_IDL/be/be_visitor_traits.cpp b/TAO/TAO_IDL/be/be_visitor_traits.cpp
index 9dfff51054c..36032f9b35d 100644
--- a/TAO/TAO_IDL/be/be_visitor_traits.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_traits.cpp
@@ -22,19 +22,9 @@
#include "be_valuetype_fwd.h"
#include "be_eventtype.h"
#include "be_eventtype_fwd.h"
-#include "be_array.h"
-#include "be_enum.h"
-#include "be_sequence.h"
-#include "be_string.h"
-#include "be_structure.h"
-#include "be_field.h"
-#include "be_union.h"
-#include "be_union_branch.h"
#include "be_typedef.h"
#include "be_helper.h"
#include "be_extern.h"
-#include "utl_identifier.h"
-#include "idl_defines.h"
ACE_RCSID (be,
be_visitor_traits,
@@ -132,29 +122,6 @@ be_visitor_traits::visit_interface (be_interface *node)
os->gen_endif ();
}
- // This should be generated even for imported nodes. The ifdef guard prevents
- // multiple declarations.
- if (node->seen_in_operation ())
- {
- os->gen_ifdef_macro (node->flat_name (), "arg_traits");
-
- *os << be_nl << be_nl
- << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
- << "class " << be_global->stub_export_macro () << " Arg_Traits<"
- << node->name () << ">" << be_idt_nl
- << ": public" << be_idt << be_idt_nl
- << "Object_Arg_Traits_T<" << be_idt << be_idt_nl
- << node->name () << "_ptr," << be_nl
- << node->name () << "_var," << be_nl
- << node->name () << "_out," << be_nl
- << "TAO::Objref_Traits<" << node->name () << ">" << be_uidt_nl
- << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "};";
-
- os->gen_endif ();
- }
-
if (this->visit_scope (node) != 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -221,29 +188,6 @@ be_visitor_traits::visit_valuetype (be_valuetype *node)
os->gen_endif ();
}
- // This should be generated even for imported nodes. The ifdef guard prevents
- // multiple declarations.
- if (node->seen_in_operation ())
- {
- os->gen_ifdef_macro (node->flat_name (), "arg_traits");
-
- *os << be_nl << be_nl
- << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
- << "class " << be_global->stub_export_macro () << " Arg_Traits<"
- << node->name () << ">" << be_idt_nl
- << ": public" << be_idt << be_idt_nl
- << "Object_Arg_Traits_T<" << be_idt << be_idt_nl
- << node->name () << " *," << be_nl
- << node->name () << "_var," << be_nl
- << node->name () << "_out," << be_nl
- << "TAO::Value_Traits<" << node->name () << ">" << be_uidt_nl
- << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "};";
-
- os->gen_endif ();
- }
-
int status = this->visit_scope (node);
if (status != 0)
@@ -297,349 +241,6 @@ be_visitor_traits::visit_eventtype_fwd (be_eventtype_fwd *node)
return this->visit_valuetype_fwd (node);
}
-int
-be_visitor_traits::visit_sequence (be_sequence *node)
-{
- if (node->cli_traits_gen () || !node->seen_in_operation ())
- {
- return 0;
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
- be_typedef *alias = this->ctx_->alias ();
-
- *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__;
-
- // This will include the bound if there is one, and should also
- // prevent duplication, even if there have been further typdefs.
- os->gen_ifdef_macro (node->gen_name (), "traits");
-
- *os << be_nl << be_nl
- << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
- << "class " << be_global->stub_export_macro () << " Arg_Traits<"
- << alias->name () << ">" << be_idt_nl
- << ": public" << be_idt << be_idt_nl
- << "Var_Size_Arg_Traits_T<" << be_idt << be_idt_nl
- << alias->name () << "," << be_nl
- << alias->name () << "_var," << be_nl
- << alias->name () << "_out" << be_uidt_nl
- << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "};";
-
- os->gen_endif ();
-
- node->cli_traits_gen (I_TRUE);
- return 0;
-}
-
-int
-be_visitor_traits::visit_string (be_string *node)
-{
- if (node->cli_traits_gen () || !node->seen_in_operation ())
- {
- return 0;
- }
-
- unsigned long bound = node->max_size ()->ev ()->u.ulval;
- be_typedef *alias = this->ctx_->alias ();
-
- // Unbounded (w)string args are handled as a predefined type.
- // Bounded (w)strings must come in as a typedef - they can't
- // be used directly as arguments or return types.
- if (bound == 0 || alias == 0)
- {
- return 0;
- }
-
- idl_bool wide = (node->width () != 1);
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- os->gen_ifdef_macro (node->flat_name (), "arg_traits");
-
- // A workaround 'dummy' type, since bounded (w)strings are all
- // generated as typedefs of (w)char *.
- *os << be_nl << be_nl
- << "struct " << alias->local_name () << "_" << bound << " {};";
-
- *os << be_nl << be_nl
- << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
- << "class " << be_global->stub_export_macro () << " Arg_Traits<"
- << alias->local_name () << "_" << bound << ">" << be_idt_nl
- << ": public" << be_idt << be_idt_nl
- << "BD_" << (wide ? "W" : "")
- << "String_Arg_Traits<" << bound << ">"
- << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "};";
-
- os->gen_endif ();
-
- node->cli_traits_gen (I_TRUE);
- return 0;
-}
-
-int
-be_visitor_traits::visit_array (be_array *node)
-{
- if (node->cli_traits_gen ())
- {
- return 0;
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- // This should be generated even for imported nodes. The ifdef guard prevents
- // multiple declarations.
- if (node->seen_in_operation ())
- {
- os->gen_ifdef_macro (node->flat_name (), "arg_traits");
-
- *os << be_nl << be_nl
- << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
- << "class " << be_global->stub_export_macro () << " Arg_Traits<"
- << node->name () << ">" << be_idt_nl
- << ": public" << be_idt << be_idt_nl;
-
- *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
- << "_Array_Arg_Traits_T<" << be_idt << be_idt_nl
- << node->name () << "," << be_nl
- << node->name () << "_slice," << be_nl
- << node->name () << "_var," << be_nl;
-
- if (node->size_type () == AST_Type::VARIABLE)
- {
- *os << node->name () << "_out," << be_nl;
- }
-
- *os << node->name () << "_forany" << be_uidt_nl
- << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "};";
-
- os->gen_endif ();
- }
-
- node->cli_traits_gen (I_TRUE);
- return 0;
-}
-
-int
-be_visitor_traits::visit_enum (be_enum *node)
-{
- if (node->cli_traits_gen () || !node->seen_in_operation ())
- {
- return 0;
- }
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__;
-
- // This should be generated even for imported nodes. The ifdef guard prevents
- // multiple declarations.
- os->gen_ifdef_macro (node->flat_name (), "arg_traits");
-
- *os << be_nl << be_nl
- << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
- << "class " << be_global->stub_export_macro () << " Arg_Traits<"
- << node->name () << ">" << be_idt_nl
- << ": public" << be_idt << be_idt_nl;
-
- *os << "Basic_Arg_Traits_T<" << be_idt << be_idt_nl
- << node->name () << be_uidt_nl
- << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "};";
-
- os->gen_endif ();
-
- node->cli_traits_gen (I_TRUE);
- return 0;
-}
-
-int
-be_visitor_traits::visit_structure (be_structure *node)
-{
- if (node->cli_traits_gen ())
- {
- return 0;
- }
-
- // This should be generated even for imported nodes. The ifdef guard prevents
- // multiple declarations.
- if (node->seen_in_operation ())
- {
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__;
-
- os->gen_ifdef_macro (node->flat_name (), "arg_traits");
-
- *os << be_nl << be_nl
- << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
- << "class " << be_global->stub_export_macro () << " Arg_Traits<"
- << node->name () << ">" << be_idt_nl
- << ": public" << be_idt << be_idt_nl;
-
- *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
- << "_Size_Arg_Traits_T<" << be_idt << be_idt_nl
- << node->name ();
-
- if (node->size_type () == AST_Type::VARIABLE)
- {
- *os << "," << be_nl
- << node->name () << "_var," << be_nl
- << node->name () << "_out";
- }
-
- *os << be_uidt_nl
- << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "};";
-
- os->gen_endif ();
- }
-
- if (this->visit_scope (node) != 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_traits::"
- "visit_structure - visit scope failed\n"),
- -1);
- }
-
- node->cli_traits_gen (I_TRUE);
- return 0;
-}
-
-int
-be_visitor_traits::visit_field (be_field *node)
-{
- be_type *bt = be_type::narrow_from_decl (node->field_type ());
-
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_traits::"
- "visit_field - "
- "Bad field type\n"),
- -1);
- }
-
- // Valuetypes may not be *declared* in a field, so this will
- // get handled elsewhere, and will also avoid nested valuetype
- // recursion. So we set the field node as processed (the
- // field *type* may not have been reached yet) and return.
- if (bt->base_node_type () == AST_Decl::NT_valuetype)
- {
- node->cli_traits_gen (I_TRUE);
- return 0;
- }
-
- if (bt->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_traits::"
- "visit_field - "
- "codegen for field type failed\n"),
- -1);
- }
-
- node->cli_traits_gen (I_TRUE);
- bt->cli_traits_gen (I_TRUE);
- return 0;
-}
-
-int
-be_visitor_traits::visit_union (be_union *node)
-{
- if (node->cli_traits_gen ())
- {
- return 0;
- }
-
- // This should be generated even for imported nodes. The ifdef guard prevents
- // multiple declarations.
- if (node->seen_in_operation ())
- {
- TAO_OutStream *os = this->ctx_->stream ();
-
- *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__;
-
- os->gen_ifdef_macro (node->flat_name (), "arg_traits");
-
- *os << be_nl << be_nl
- << "ACE_TEMPLATE_SPECIALIZATION" << be_nl
- << "class " << be_global->stub_export_macro () << " Arg_Traits<"
- << node->name () << ">" << be_idt_nl
- << ": public" << be_idt << be_idt_nl;
-
- *os << (node->size_type () == AST_Type::FIXED ? "Fixed" : "Var")
- << "_Size_Arg_Traits_T<" << be_idt << be_idt_nl
- << node->name ();
-
- if (node->size_type () == AST_Type::VARIABLE)
- {
- *os << "," << be_nl
- << node->name () << "_var," << be_nl
- << node->name () << "_out";
- }
-
- *os << be_uidt_nl
- << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "};";
-
- os->gen_endif ();
- }
-
- int status = this->visit_scope (node);
-
- if (status != 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_traits::"
- "visit_union - visit scope failed\n"),
- -1);
- }
-
- node->cli_traits_gen (I_TRUE);
- return 0;
-}
-
-int
-be_visitor_traits::visit_union_branch (be_union_branch *node)
-{
- be_type *bt = be_type::narrow_from_decl (node->field_type ());
-
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_traits::"
- "visit_union_branch - "
- "Bad union_branch type\n"),
- -1);
- }
-
- if (bt->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_traits::"
- "visit_union_branch - "
- "codegen for union_branch type failed\n"),
- -1);
- }
-
- node->cli_traits_gen (I_TRUE);
- return 0;
-}
-
int
be_visitor_traits::visit_typedef (be_typedef *node)
{
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 2251761bfb2..2b78dad937c 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
@@ -182,10 +182,11 @@ int be_visitor_union_cs::visit_union (be_union *node)
<< 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
+ << node->local_name () << " *tmp =" << be_idt_nl
+ << "ACE_static_cast ("
+ << node->local_name () << " *, _tao_void_pointer);" << be_uidt_nl
<< "delete tmp;" << be_uidt_nl
- << "}\n" << be_nl;
+ << "}" << be_nl << be_nl;
}
this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 958256514e6..e2698fbcf68 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -386,7 +386,7 @@ private:
void gen_seq_file_includes (void);
void gen_any_file_includes (void);
void gen_var_file_includes (void);
- void gen_arg_file_includes (void);
+ void gen_arg_file_includes (TAO_OutStream *stream);
void gen_cond_file_include (ACE_UINT64 mask,
const char *filepath,
TAO_OutStream *stream);
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
index 1aa8be175a1..9be0a65208e 100644
--- a/TAO/TAO_IDL/be_include/be_decl.h
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -87,6 +87,9 @@ public:
idl_bool cli_inline_cdr_op_gen (void);
idl_bool cli_inline_cdr_decl_gen (void);
idl_bool cli_traits_gen (void);
+ idl_bool cli_arg_traits_gen (void);
+ idl_bool srv_arg_traits_gen (void);
+ idl_bool srv_sarg_traits_gen (void);
idl_bool cli_tmpl_class_gen (void);
idl_bool cli_pragma_inst_gen (void);
idl_bool cli_inarg_tmpl_class_gen (void);
@@ -124,6 +127,9 @@ public:
void cli_inline_cdr_op_gen (idl_bool);
void cli_inline_cdr_decl_gen (idl_bool);
void cli_traits_gen (idl_bool);
+ void cli_arg_traits_gen (idl_bool);
+ void srv_arg_traits_gen (idl_bool);
+ void srv_sarg_traits_gen (idl_bool);
void cli_tmpl_class_gen (idl_bool);
void cli_pragma_inst_gen (idl_bool);
void cli_inarg_tmpl_class_gen (idl_bool);
@@ -171,6 +177,9 @@ private:
idl_bool cli_inline_cdr_op_gen_;
idl_bool cli_inline_cdr_decl_gen_;
idl_bool cli_traits_gen_;
+ idl_bool cli_arg_traits_gen_;
+ idl_bool srv_arg_traits_gen_;
+ idl_bool srv_sarg_traits_gen_;
idl_bool cli_tmpl_class_gen_;
idl_bool cli_pragma_inst_gen_;
idl_bool cli_inarg_tmpl_class_gen_;
diff --git a/TAO/TAO_IDL/be_include/be_visitor_arg_traits.h b/TAO/TAO_IDL/be_include/be_visitor_arg_traits.h
new file mode 100644
index 00000000000..7d87ba82896
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_arg_traits.h
@@ -0,0 +1,74 @@
+//=============================================================================
+/**
+* @file be_visitor_arg_traits.h
+*
+* $Id$
+*
+* This visitor generates template specializations for argument traits classes.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+#ifndef TAO_BE_VISITOR_ARG_TRAITS_H
+#define TAO_BE_VISITOR_ARG_TRAITS_H
+
+#include "be_visitor_scope.h"
+
+/**
+ * @class be_visitor_arg_traits
+ *
+ * @brief Generates specialized template argument traits declarations.
+ */
+class be_visitor_arg_traits : public be_visitor_scope
+{
+public:
+ be_visitor_arg_traits (char *S,
+ be_visitor_context *ctx);
+
+ virtual ~be_visitor_arg_traits (void);
+
+ virtual int visit_root (be_root *node);
+
+ virtual int visit_module (be_module *node);
+
+ virtual int visit_array (be_array *node);
+
+ virtual int visit_enum (be_enum *node);
+
+ virtual int visit_interface (be_interface *node);
+
+ virtual int visit_interface_fwd (be_interface_fwd *node);
+
+ virtual int visit_valuetype (be_valuetype *node);
+
+ virtual int visit_valuetype_fwd (be_valuetype_fwd *node);
+
+ virtual int visit_eventtype (be_eventtype *node);
+
+ virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
+
+ virtual int visit_sequence (be_sequence *node);
+
+ virtual int visit_string (be_string *node);
+
+ virtual int visit_structure (be_structure *node);
+
+ virtual int visit_field (be_field *node);
+
+ virtual int visit_union (be_union *node);
+
+ virtual int visit_union_branch (be_union_branch *node);
+
+ virtual int visit_typedef (be_typedef *node);
+
+private:
+ idl_bool generated (be_decl *node) const;
+ void generated (be_decl *node,
+ idl_bool val);
+
+private:
+ char *S_;
+};
+
+
+#endif // TAO_BE_VISITOR_ARG_TRAITS_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_cs.h b/TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_cs.h
index 46266b4a5cb..c2a33185d65 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_cs.h
@@ -32,6 +32,8 @@ public:
virtual int visit_enum (be_enum *node);
+ virtual int visit_exception(be_exception *node);
+
virtual int visit_interface (be_interface *node);
virtual int visit_valuetype (be_valuetype *node);
diff --git a/TAO/TAO_IDL/be_include/be_visitor_traits.h b/TAO/TAO_IDL/be_include/be_visitor_traits.h
index 8415444ad94..ed7890c9105 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_traits.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_traits.h
@@ -32,10 +32,6 @@ public:
virtual int visit_module (be_module *node);
- virtual int visit_array (be_array *node);
-
- virtual int visit_enum (be_enum *node);
-
virtual int visit_interface (be_interface *node);
virtual int visit_interface_fwd (be_interface_fwd *node);
@@ -48,18 +44,6 @@ public:
virtual int visit_eventtype_fwd (be_eventtype_fwd *node);
- virtual int visit_sequence (be_sequence *node);
-
- virtual int visit_string (be_string *node);
-
- virtual int visit_structure (be_structure *node);
-
- virtual int visit_field (be_field *node);
-
- virtual int visit_union (be_union *node);
-
- virtual int visit_union_branch (be_union_branch *node);
-
virtual int visit_typedef (be_typedef *node);
};