summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-07-13 19:47:13 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-07-13 19:47:13 +0000
commit29ad17f6790f8b02434a7c7294b3c089aa367895 (patch)
tree7d517ceebf465df2376c3e0c998b3167a8988ff8
parent70f5175e2171cd91f1b1ba1b52e86983e00142a3 (diff)
downloadATCD-29ad17f6790f8b02434a7c7294b3c089aa367895.tar.gz
ChangeLogTag: Sun Jul 13 14:40:35 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog_ref27
-rw-r--r--TAO/TAO_IDL/Makefile.BE2
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE.bor2
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp4
-rw-r--r--TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp4
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp116
-rw-r--r--TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp529
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_tmplinst_cs.cpp734
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h24
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h58
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_tmplinst_cs.h92
13 files changed, 1578 insertions, 18 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref
index 2351bbe85c4..c8179296532 100644
--- a/TAO/ChangeLog_ref
+++ b/TAO/ChangeLog_ref
@@ -1,3 +1,30 @@
+Sun Jul 13 14:40:35 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_decl.cpp:
+ * TAO_IDL/be/be_visitor_root.cpp:
+ * TAO_IDL/be/be_visitor_root/root.cpp:
+ * TAO_IDL/be_include/be_decl.h:
+ * TAO_IDL/be_include/be_visitor_arg_tmplinst.h:
+ * TAO_IDL/be/be_visitor_arg_tmplinst.cpp:
+
+ Finished implementation of code generation for explicit
+ template instantiation for the arg template helper classes.
+
+ * TAO_IDL/be_include/be_visitor_tmplinst_cs.h:
+ * TAO_IDL/be/be_visitor_tmplinst_cs.cpp:
+
+ Renamed be_visitor_tmplinst* class and files and
+ be_visitor_tmplinst_cs*, since we are going to have to
+ generate explicit template instantiations for the skeleton-
+ side arg helper classes as well.
+
+ * TAO_IDL/Makefile.BE:
+ * TAO_IDL/TAO_IDL_BE.bor:
+ * TAO_IDL/TAO_IDL_BE_DLL.dsp:
+ * TAO_IDL/TAO_IDL_BE_LIB.dsp:
+
+ Update project and makefiles with the renamed files.
+
Sat Jul 12 18:42:40 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be/be_decl.cpp:
diff --git a/TAO/TAO_IDL/Makefile.BE b/TAO/TAO_IDL/Makefile.BE
index 069f96733c7..94aee82b095 100644
--- a/TAO/TAO_IDL/Makefile.BE
+++ b/TAO/TAO_IDL/Makefile.BE
@@ -100,7 +100,7 @@ FILES = be/be_array \
be/be_visitor_structure_fwd \
be/be_visitor_traits \
be/be_visitor_tmplinst \
- be/be_visitor_arg_tmplinst \
+ be/be_visitor_arg_tmplinst_cs \
be/be_visitor_typecode \
be/be_visitor_typedef \
be/be_visitor_union \
diff --git a/TAO/TAO_IDL/TAO_IDL_BE.bor b/TAO/TAO_IDL/TAO_IDL_BE.bor
index f74ea98b9cf..5dac668e247 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE.bor
+++ b/TAO/TAO_IDL/TAO_IDL_BE.bor
@@ -79,7 +79,7 @@ OBJFILES = \
$(OBJDIR)\be_visitor_structure.obj \
$(OBJDIR)\be_visitor_structure_fwd.obj \
$(OBJDIR)\be_visitor_traits.obj \
- $(OBJDIR)\be_visitor_tmplinst.obj \
+ $(OBJDIR)\be_visitor_tmplinst_cs.obj \
$(OBJDIR)\be_visitor_arg_tmplinst.obj \
$(OBJDIR)\be_visitor_typecode.obj \
$(OBJDIR)\be_visitor_typedef.obj \
diff --git a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
index 2bb93a05ecf..9b7c2b02ebb 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
+++ b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp
@@ -402,7 +402,7 @@ SOURCE=.\be\be_visitor_structure_fwd.cpp
# End Source File
# Begin Source File
-SOURCE=.\be\be_visitor_tmplinst.cpp
+SOURCE=.\be\be_visitor_tmplinst_cs.cpp
# End Source File
# Begin Source File
@@ -738,7 +738,7 @@ SOURCE=.\be_include\be_visitor_structure_fwd.h
# End Source File
# Begin Source File
-SOURCE=.\be_include\be_visitor_tmplinst.h
+SOURCE=.\be_include\be_visitor_tmplinst_cs.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 b2a73d6c52a..a09c1c2733f 100644
--- a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp
+++ b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp
@@ -395,7 +395,7 @@ SOURCE=.\be\be_visitor_structure_fwd.cpp
# End Source File
# Begin Source File
-SOURCE=.\be\be_visitor_tmplinst.cpp
+SOURCE=.\be\be_visitor_tmplinst_cs.cpp
# End Source File
# Begin Source File
@@ -727,7 +727,7 @@ SOURCE=.\be_include\be_visitor_structure_fwd.h
# End Source File
# Begin Source File
-SOURCE=.\be_include\be_visitor_tmplinst.h
+SOURCE=.\be_include\be_visitor_tmplinst_cs.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index d869e645701..9253b003f39 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -68,7 +68,15 @@ be_decl::be_decl (void)
cli_inline_cdr_decl_gen_ (I_FALSE),
cli_traits_gen_ (I_FALSE),
cli_tmpl_class_gen_ (I_FALSE),
- cli_pragma_inst_gen_ (I_FALSE)
+ cli_pragma_inst_gen_ (I_FALSE),
+ cli_inarg_tmpl_class_gen_ (I_FALSE),
+ cli_inarg_pragma_inst_gen_ (I_FALSE),
+ cli_inoutarg_tmpl_class_gen_ (I_FALSE),
+ cli_inoutarg_pragma_inst_gen_ (I_FALSE),
+ cli_outarg_tmpl_class_gen_ (I_FALSE),
+ cli_outarg_pragma_inst_gen_ (I_FALSE),
+ cli_retarg_tmpl_class_gen_ (I_FALSE),
+ cli_retarg_pragma_inst_gen_ (I_FALSE)
{
}
@@ -94,7 +102,15 @@ be_decl::be_decl (AST_Decl::NodeType type,
cli_inline_cdr_decl_gen_ (I_FALSE),
cli_traits_gen_ (I_FALSE),
cli_tmpl_class_gen_ (I_FALSE),
- cli_pragma_inst_gen_ (I_FALSE)
+ cli_pragma_inst_gen_ (I_FALSE),
+ cli_inarg_tmpl_class_gen_ (I_FALSE),
+ cli_inarg_pragma_inst_gen_ (I_FALSE),
+ cli_inoutarg_tmpl_class_gen_ (I_FALSE),
+ cli_inoutarg_pragma_inst_gen_ (I_FALSE),
+ cli_outarg_tmpl_class_gen_ (I_FALSE),
+ cli_outarg_pragma_inst_gen_ (I_FALSE),
+ cli_retarg_tmpl_class_gen_ (I_FALSE),
+ cli_retarg_pragma_inst_gen_ (I_FALSE)
{
}
@@ -347,6 +363,54 @@ be_decl::cli_pragma_inst_gen (void)
}
idl_bool
+be_decl::cli_inarg_tmpl_class_gen (void)
+{
+ return this->cli_inarg_tmpl_class_gen_;
+}
+
+idl_bool
+be_decl::cli_inarg_pragma_inst_gen (void)
+{
+ return this->cli_inarg_pragma_inst_gen_;
+}
+
+idl_bool
+be_decl::cli_inoutarg_tmpl_class_gen (void)
+{
+ return this->cli_inoutarg_tmpl_class_gen_;
+}
+
+idl_bool
+be_decl::cli_inoutarg_pragma_inst_gen (void)
+{
+ return this->cli_inoutarg_pragma_inst_gen_;
+}
+
+idl_bool
+be_decl::cli_outarg_tmpl_class_gen (void)
+{
+ return this->cli_outarg_tmpl_class_gen_;
+}
+
+idl_bool
+be_decl::cli_outarg_pragma_inst_gen (void)
+{
+ return this->cli_outarg_pragma_inst_gen_;
+}
+
+idl_bool
+be_decl::cli_retarg_tmpl_class_gen (void)
+{
+ return this->cli_retarg_tmpl_class_gen_;
+}
+
+idl_bool
+be_decl::cli_retarg_pragma_inst_gen (void)
+{
+ return this->cli_retarg_pragma_inst_gen_;
+}
+
+idl_bool
be_decl::cli_inline_gen (void)
{
return this->cli_inline_gen_;
@@ -456,6 +520,54 @@ be_decl::cli_pragma_inst_gen (idl_bool val)
}
void
+be_decl::cli_inarg_tmpl_class_gen (idl_bool val)
+{
+ this->cli_inarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::cli_inarg_pragma_inst_gen (idl_bool val)
+{
+ this->cli_inarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::cli_inoutarg_tmpl_class_gen (idl_bool val)
+{
+ this->cli_inoutarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::cli_inoutarg_pragma_inst_gen (idl_bool val)
+{
+ this->cli_inoutarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::cli_outarg_tmpl_class_gen (idl_bool val)
+{
+ this->cli_outarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::cli_outarg_pragma_inst_gen (idl_bool val)
+{
+ this->cli_outarg_pragma_inst_gen_ = val;
+}
+
+void
+be_decl::cli_retarg_tmpl_class_gen (idl_bool val)
+{
+ this->cli_retarg_tmpl_class_gen_ = val;
+}
+
+void
+be_decl::cli_retarg_pragma_inst_gen (idl_bool val)
+{
+ this->cli_retarg_pragma_inst_gen_ = val;
+}
+
+void
be_decl::srv_hdr_gen (idl_bool val)
{
this->srv_hdr_gen_ = val;
diff --git a/TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp b/TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp
index b533f4efb77..4d642c27303 100644
--- a/TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp
@@ -25,14 +25,28 @@
#include "be_sequence.h"
#include "be_string.h"
#include "be_structure.h"
+#include "be_structure_fwd.h"
#include "be_field.h"
#include "be_union.h"
+#include "be_union_fwd.h"
#include "be_union_branch.h"
#include "be_typedef.h"
#include "be_helper.h"
-be_visitor_arg_tmplinst::be_visitor_arg_tmplinst (be_visitor_tmplinst *rhs)
- : be_visitor_tmplinst (rhs)
+be_visitor_arg_tmplinst::be_visitor_arg_tmplinst (
+ be_visitor_context *ctx,
+ be_visitor_tmplinst_cs::Mode mode,
+ char * prefix,
+ char * suffix,
+ char * linebreak,
+ const char * S
+ )
+ : be_visitor_decl (ctx),
+ mode_ (mode),
+ prefix_ (prefix),
+ suffix_ (suffix),
+ linebreak_ (linebreak),
+ S_ (S)
{
}
@@ -43,24 +57,128 @@ be_visitor_arg_tmplinst::~be_visitor_arg_tmplinst (void)
int
be_visitor_arg_tmplinst::visit_interface (be_interface *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << this->prefix_ << be_idt << be_idt_nl
+ << "TAO::";
+
+ this->gen_direction (os);
+
+ *os << "_Object_" << this->S_ << "Argument_T<" << this->linebreak_
+ << be_idt << be_idt_nl
+ << node->name () << "_ptr";
+
+ switch (this->dir_)
+ {
+ case _tao_OUT:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_out";
+ break;
+ case _tao_RET:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_var";
+ break;
+ default:
+ break;
+ }
+
+ *os << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
int
be_visitor_arg_tmplinst::visit_interface_fwd (be_interface_fwd *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ be_interface *fd =
+ be_interface::narrow_from_decl (node->full_definition ());
+
+ if (this->visit_interface (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_tmplinst::"
+ "visit_interface_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
int
be_visitor_arg_tmplinst::visit_valuetype (be_valuetype *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << this->prefix_ << be_idt << be_idt_nl
+ << "TAO::";
+
+ this->gen_direction (os);
+
+ *os << "_Object_" << this->S_ << "Argument_T<" << this->linebreak_
+ << be_idt << be_idt_nl
+ << node->name () << " *";
+
+ switch (this->dir_)
+ {
+ case _tao_OUT:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_out";
+ break;
+ case _tao_RET:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_var";
+ break;
+ default:
+ break;
+ }
+
+ *os << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
int
be_visitor_arg_tmplinst::visit_valuetype_fwd (be_valuetype_fwd *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ be_valuetype *fd =
+ be_valuetype::narrow_from_decl (node->full_definition ());
+
+ if (this->visit_valuetype (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_tmplinst::"
+ "visit_valuetype_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
@@ -79,30 +197,244 @@ be_visitor_arg_tmplinst::visit_eventtype_fwd (be_eventtype_fwd *node)
int
be_visitor_arg_tmplinst::visit_sequence (be_sequence *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << this->prefix_ << be_idt << be_idt_nl
+ << "TAO::";
+
+ this->gen_direction (os);
+
+ *os << "_Var_Size_" << this->S_ << "Argument_T<" << this->linebreak_
+ << be_idt << be_idt_nl
+ << node->name ();
+
+ switch (this->dir_)
+ {
+ case _tao_OUT:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_out";
+ break;
+ case _tao_RET:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_var";
+ break;
+ default:
+ break;
+ }
+
+ *os << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
int
be_visitor_arg_tmplinst::visit_string (be_string *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ 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)
+ {
+ this->this_mode_and_dir_generated (node, I_TRUE);
+ return 0;
+ }
+
+ idl_bool wide = (node->width () != 1);
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << this->prefix_ << be_idt << be_idt_nl
+ << "TAO::";
+
+ this->gen_direction (os);
+
+ *os << "_BD_String_" << this->S_ << "Argument_T<" << this->linebreak_
+ << be_idt << be_idt_nl
+ << "CORBA::" << (wide ? "W" : "") << "Char";
+
+ switch (this->dir_)
+ {
+ case _tao_OUT:
+ *os << "," << this->linebreak_ << be_nl
+ << "CORBA::" << (wide ? "W" : "") << "String_out";
+ break;
+ case _tao_RET:
+ *os << "," << this->linebreak_ << be_nl
+ << "CORBA::" << (wide ? "W" : "") << "String_var";
+ break;
+ default:
+ break;
+ }
+
+ *os << "," << this->linebreak_ << be_nl
+ << "ACE_InputCDR::to_" << (wide ? "w" : "") << "char,"
+ << this->linebreak_ << be_nl
+ << "ACE_OutputCDR::from_" << (wide ? "w" : "") << "char,"
+ << this->linebreak_ << be_nl
+ << bound << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
int
be_visitor_arg_tmplinst::visit_array (be_array *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ idl_bool fixed = (node->size_type () == AST_Type::FIXED);
+
+ *os << be_nl << be_nl
+ << this->prefix_ << be_idt << be_idt_nl
+ << "TAO::";
+
+ this->gen_direction (os);
+
+ *os << "_" << (fixed ? "Fixed" : "Var") << "_Array_"
+ << this-> S_ << "Argument_T<"
+ << this->linebreak_ << be_idt << be_idt_nl
+ << node->name () << "," << this->linebreak_ << be_nl;
+
+ switch (this->dir_)
+ {
+ case _tao_IN:
+ *os << node->name () << "_slice," << this->linebreak_ << be_nl;
+ break;
+ case _tao_OUT:
+ if (!fixed)
+ {
+ *os << node->name () << "_slice," << this->linebreak_ << be_nl
+ << node->name () << "_var," << this->linebreak_ << be_nl
+ << node->name () << "_out," << this->linebreak_ << be_nl;
+ }
+
+ break;
+ case _tao_RET:
+ *os << node->name () << "_slice," << this->linebreak_ << be_nl
+ << node->name () << "_var," << this->linebreak_ << be_nl;
+ break;
+ default:
+ break;
+ }
+
+ *os << node->name () << "_forany" << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
int
be_visitor_arg_tmplinst::visit_enum (be_enum *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << this->prefix_ << be_idt << be_idt_nl
+ << "TAO::";
+
+ this->gen_direction (os);
+
+ *os << "_Basic_" << this->S_ << "Argument_T<" << be_idt << be_idt_nl
+ << node->name () << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
int
be_visitor_arg_tmplinst::visit_structure (be_structure *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ idl_bool fixed = (node->size_type () == AST_Type::FIXED);
+
+ *os << be_nl << be_nl
+ << this->prefix_ << be_idt << be_idt_nl
+ << "TAO::";
+
+ this->gen_direction (os);
+
+ *os << "_" << (fixed ? "Fixed" : "Var") << "_Size_"
+ << this->S_ << "Argument_T<"
+ << be_idt << be_idt_nl
+ << node->name ();
+
+ if (!fixed)
+ {
+ switch (this->dir_)
+ {
+ case _tao_OUT:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_out";
+ break;
+ case _tao_RET:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_var";
+ break;
+ default:
+ break;
+ }
+ }
+
+ *os << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_tmplinst::visit_structure_fwd (be_structure_fwd *node)
+{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ be_structure *fd = be_structure::narrow_from_decl (node->full_definition ());
+
+ if (this->visit_structure (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_tmplinst::"
+ "visit_structure_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
@@ -135,6 +467,68 @@ be_visitor_arg_tmplinst::visit_field (be_field *node)
int
be_visitor_arg_tmplinst::visit_union (be_union *node)
{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ idl_bool fixed = (node->size_type () == AST_Type::FIXED);
+
+ *os << be_nl << be_nl
+ << this->prefix_ << be_idt << be_idt_nl
+ << "TAO::";
+
+ this->gen_direction (os);
+
+ *os << "_" << (fixed ? "Fixed" : "Var") << "_Size_"
+ << this-> S_ << "Argument_T<"
+ << be_idt << be_idt_nl
+ << node->name ();
+
+ if (!fixed)
+ {
+ switch (this->dir_)
+ {
+ case _tao_OUT:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_out";
+ break;
+ case _tao_RET:
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_var";
+ break;
+ default:
+ break;
+ }
+ }
+
+ *os << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_arg_tmplinst::visit_union_fwd (be_union_fwd *node)
+{
+ if (this->this_mode_and_dir_generated (node))
+ {
+ return 0;
+ }
+
+ be_union *fd = be_union::narrow_from_decl (node->full_definition ());
+
+ if (this->visit_union (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_tmplinst::"
+ "visit_union_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->this_mode_and_dir_generated (node, I_TRUE);
return 0;
}
@@ -186,7 +580,136 @@ be_visitor_arg_tmplinst::visit_typedef (be_typedef *node)
}
void
-be_visitor_arg_tmplinst::cleanup (void)
+be_visitor_arg_tmplinst::direction (void)
+{
+ this->dir_ = _tao_RET;
+}
+
+void
+be_visitor_arg_tmplinst::direction (AST_Argument::Direction dir)
{
+ switch (dir)
+ {
+ case AST_Argument::dir_IN:
+ this->dir_ = _tao_IN;
+ break;
+ case AST_Argument::dir_INOUT:
+ this->dir_ = _tao_INOUT;
+ break;
+ case AST_Argument::dir_OUT:
+ this->dir_ = _tao_OUT;
+ break;
+ default:
+ break;
+ }
+}
+
+idl_bool
+be_visitor_arg_tmplinst::this_mode_and_dir_generated (be_decl *node) const
+{
+ switch (this->mode_)
+ {
+ case be_visitor_tmplinst_cs::TMPL_CLASS:
+ switch (this->dir_)
+ {
+ case _tao_IN:
+ return node->cli_inarg_tmpl_class_gen ();
+ case _tao_INOUT:
+ return node->cli_inoutarg_tmpl_class_gen ();
+ case _tao_OUT:
+ return node->cli_outarg_tmpl_class_gen ();
+ case _tao_RET:
+ return node->cli_retarg_tmpl_class_gen ();
+ default:
+ return I_FALSE;
+ }
+ case be_visitor_tmplinst_cs::PRAGMA_INST:
+ switch (this->dir_)
+ {
+ case _tao_IN:
+ return node->cli_inarg_pragma_inst_gen ();
+ case _tao_INOUT:
+ return node->cli_inoutarg_pragma_inst_gen ();
+ case _tao_OUT:
+ return node->cli_outarg_pragma_inst_gen ();
+ case _tao_RET:
+ return node->cli_retarg_pragma_inst_gen ();
+ default:
+ return I_FALSE;
+ }
+ default:
+ return I_FALSE;
+ }
+}
+
+void
+be_visitor_arg_tmplinst::this_mode_and_dir_generated (be_decl *node,
+ idl_bool val)
+{
+ switch (this->mode_)
+ {
+ case be_visitor_tmplinst_cs::TMPL_CLASS:
+ switch (this->dir_)
+ {
+ case _tao_IN:
+ node->cli_inarg_tmpl_class_gen (val);
+ break;
+ case _tao_INOUT:
+ node->cli_inoutarg_tmpl_class_gen (val);
+ break;
+ case _tao_OUT:
+ node->cli_outarg_tmpl_class_gen (val);
+ break;
+ case _tao_RET:
+ node->cli_retarg_tmpl_class_gen (val);
+ break;
+ default:
+ break;
+ }
+ break;
+ case be_visitor_tmplinst_cs::PRAGMA_INST:
+ switch (this->dir_)
+ {
+ case _tao_IN:
+ node->cli_inarg_pragma_inst_gen (val);
+ break;
+ case _tao_INOUT:
+ node->cli_inoutarg_pragma_inst_gen (val);
+ break;
+ case _tao_OUT:
+ node->cli_outarg_pragma_inst_gen (val);
+ break;
+ case _tao_RET:
+ node->cli_retarg_pragma_inst_gen (val);
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void
+be_visitor_arg_tmplinst::gen_direction (TAO_OutStream *os)
+{
+ switch (this->dir_)
+ {
+ case _tao_IN:
+ *os << "In";
+ break;
+ case _tao_INOUT:
+ *os << "Inout";
+ break;
+ case _tao_OUT:
+ *os << "Out";
+ break;
+ case _tao_RET:
+ *os << "Ret";
+ break;
+ default:
+ break;
+ }
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp
index 10f6c35ceff..3c77ed588bc 100644
--- a/TAO/TAO_IDL/be/be_visitor_root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root.cpp
@@ -58,7 +58,7 @@
#include "be_visitor_component_fwd.h"
#include "be_visitor_home.h"
#include "be_visitor_traits.h"
-#include "be_visitor_tmplinst.h"
+#include "be_visitor_tmplinst_cs.h"
#include "be_visitor_context.h"
#include "be_visitor_root/root.cpp"
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
index 9306335402d..5d8c1264812 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -370,7 +370,7 @@ int be_visitor_root::visit_root (be_root *node)
os->gen_ifdef_AHETI ();
- be_visitor_tmplinst visitor (this->ctx_);
+ be_visitor_tmplinst_cs visitor (this->ctx_);
if (node->accept (&visitor) == -1)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_tmplinst_cs.cpp b/TAO/TAO_IDL/be/be_visitor_tmplinst_cs.cpp
new file mode 100644
index 00000000000..6ad96b670fd
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_tmplinst_cs.cpp
@@ -0,0 +1,734 @@
+//=============================================================================
+/**
+* @file be_visitor_tmplinst_cs.cpp
+*
+* $Id$
+*
+* This visitor generates explicit template instantiations, guarded so they
+* are seen only by compilers whose platforms require explicit template
+* instantiation.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+
+#include "be_visitor_tmplinst_cs.h"
+#include "be_visitor_arg_tmplinst.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_structure_fwd.h"
+#include "be_field.h"
+#include "be_union.h"
+#include "be_union_fwd.h"
+#include "be_union_branch.h"
+#include "be_typedef.h"
+#include "be_operation.h"
+#include "be_argument.h"
+#include "be_helper.h"
+#include "be_extern.h"
+#include "utl_identifier.h"
+
+be_visitor_tmplinst_cs::be_visitor_tmplinst_cs (be_visitor_context *ctx)
+ : be_visitor_scope (ctx),
+ mode_ (TMPL_CLASS),
+ prefix_ (ACE::strnew (" template class")),
+ suffix_ (ACE::strnew (";")),
+ linebreak_ (ACE::strnew (""))
+{
+}
+
+be_visitor_tmplinst_cs::~be_visitor_tmplinst_cs (void)
+{
+ delete [] this->prefix_;
+ this->prefix_ = 0;
+ delete [] this->suffix_;
+ this->suffix_ = 0;
+ delete [] this->linebreak_;
+ this->linebreak_ = 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_root (be_root *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_root - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_module (be_module *node)
+{
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_module - visit scope failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_interface (be_interface *node)
+{
+ if (this->this_mode_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->seen_in_operation ())
+ {
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst");
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Arg_Traits<" << node->name ()
+ << ">" << this->suffix_;
+
+ *os << be_nl << be_nl
+ << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl
+ << "TAO::Object_Arg_Traits_T<" << this->linebreak_
+ << be_idt << be_idt_nl
+ << node->name () << "_ptr," << this->linebreak_ << be_nl
+ << node->name () << "_var," << this->linebreak_ << be_nl
+ << node->name () << "_out" << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ os->gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_interface - visit scope failed\n"),
+ -1);
+ }
+
+ if (node->imported ())
+ {
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+ }
+
+ // @@@ (JP) This condition may change or go away once we
+ // regenerate the ORB hand-crafted code.
+ if (!node->is_defined ())
+ {
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Objref_Traits<" << node->name ()
+ << ">" << this->suffix_;
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_interface_fwd (be_interface_fwd *node)
+{
+ if (this->this_mode_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_tmplinst_cs::"
+ "visit_interface_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_valuetype (be_valuetype *node)
+{
+ if (this->this_mode_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->seen_in_operation ())
+ {
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst");
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Arg_Traits<" << node->name ()
+ << ">" << this->suffix_;
+
+ *os << be_nl << be_nl
+ << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl
+ << "TAO::Object_Arg_Traits_T<" << this->linebreak_
+ << be_idt << be_idt_nl
+ << node->name () << " *," << this->linebreak_ << be_nl
+ << node->name () << "_var," << this->linebreak_ << be_nl
+ << node->name () << "_out" << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ os->gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_valuetype - visit scope failed\n"),
+ -1);
+ }
+
+ if (node->imported ())
+ {
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+ }
+
+ // @@@ (JP) This condition may change or go away once we
+ // regenerate the ORB hand-crafted code.
+ if (!node->is_defined ())
+ {
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Value_Traits<" << node->name ()
+ << ">" << this->suffix_;
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ if (this->this_mode_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_tmplinst_cs::"
+ "visit_valuetype_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_eventtype (be_eventtype *node)
+{
+ return this->visit_valuetype (node);
+}
+
+int
+be_visitor_tmplinst_cs::visit_eventtype_fwd (be_eventtype_fwd *node)
+{
+ return this->visit_valuetype_fwd (node);
+}
+
+int
+be_visitor_tmplinst_cs::visit_operation (be_operation *node)
+{
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ const char * S = "";
+
+ be_visitor_arg_tmplinst visitor (this->ctx_,
+ this->mode_,
+ this->prefix_,
+ this->suffix_,
+ this->linebreak_,
+ S);
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+ visitor.direction ();
+
+ if (bt->accept (&visitor) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ be_argument *arg = 0;
+
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ arg = be_argument::narrow_from_decl (si.item ());
+ visitor.direction (arg->direction ());
+ bt = be_type::narrow_from_decl (arg->field_type ());
+
+ if (bt->accept (&visitor) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_operation - "
+ "codegen for argument failed\n"),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_sequence (be_sequence *node)
+{
+ if (this->this_mode_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_typedef *alias = this->ctx_->alias ();
+
+ if (node->seen_in_operation ())
+ {
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst");
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Arg_Traits<" << alias->name ()
+ << ">" << this->suffix_;
+
+ *os << be_nl << be_nl
+ << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl
+ << "TAO::Var_Size_Arg_Traits<" << this->linebreak_
+ << be_idt << be_idt_nl
+ << alias->name () << "," << this->linebreak_ << be_nl
+ << alias->name () << "_var," << this->linebreak_ << be_nl
+ << alias->name () << "_out" << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ os->gen_endif ();
+ }
+
+ if (node->imported ())
+ {
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_string (be_string *node)
+{
+ if (this->this_mode_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)
+ {
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+ }
+
+ idl_bool wide = (node->width () != 1);
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst");
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Arg_Traits<" << alias->local_name ()
+ << "_" << bound << ">" << this->suffix_;
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::BD_" << (wide ? "W" : "")
+ << "String_Arg_Traits<" << bound << ">" << this->suffix_;
+
+ os->gen_endif ();
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_array (be_array *node)
+{
+ if (this->this_mode_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->seen_in_operation ())
+ {
+ idl_bool variable = (node->size_type () == AST_Type::VARIABLE);
+
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst");
+
+ *os << be_nl << be_nl << this->prefix_ << " TAO::Arg_Traits<"
+ << node->name () << ">" << this->suffix_;
+
+ *os << be_nl << be_nl
+ << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl
+ << "TAO::" << (variable ? "Var" : "Fixed") << "_Array_Arg_Traits<"
+ << this->linebreak_ << be_idt << be_idt_nl
+ << node->name () << "," << this->linebreak_ << be_nl
+ << node->name () << "_slice," << this->linebreak_ << be_nl
+ << node->name () << "_var," << this->linebreak_ << be_nl;
+
+ if (variable)
+ {
+ *os << node->name () << "_out," << this->linebreak_ << be_nl;
+ }
+
+ *os << node->name () << "_forany" << this->linebreak_ << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ os->gen_endif ();
+ }
+
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_enum (be_enum *node)
+{
+ if (this->this_mode_generated (node) || !node->seen_in_operation ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst");
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Arg_Traits<" << node->name ()
+ << ">" << this->suffix_;
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Basic_Arg_Traits_T<" << node->name ()
+ << ">" << this->suffix_;
+
+ os->gen_endif ();
+
+ 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))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->seen_in_operation ())
+ {
+ idl_bool variable = (node->size_type () == AST_Type::VARIABLE);
+
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst");
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Arg_Traits<" << node->name ()
+ << ">" << this->suffix_;
+
+ *os << be_nl << be_nl
+ << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl
+ << "TAO::" << (variable ? "Var" : "Fixed") << "_Size_Arg_Traits<"
+ << this->linebreak_ << be_idt << be_idt_nl
+ << node->name ();
+
+ if (variable)
+ {
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_var," << this->linebreak_ << be_nl
+ << node->name () << "_out" << this->linebreak_;
+ }
+
+ *os << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ os->gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_structure - visit scope failed\n"),
+ -1);
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_structure_fwd (be_structure_fwd *node)
+{
+ if (this->this_mode_generated (node))
+ {
+ return 0;
+ }
+
+ be_structure *fd = be_structure::narrow_from_decl (node->full_definition ());
+
+ if (this->visit_structure (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_structure_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::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_tmplinst_cs::"
+ "visit_field - "
+ "Bad field type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_field - "
+ "codegen for field type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_union (be_union *node)
+{
+ if (this->this_mode_generated (node))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (node->seen_in_operation ())
+ {
+ idl_bool variable = (node->size_type () == AST_Type::VARIABLE);
+
+ os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst");
+
+ *os << be_nl << be_nl
+ << this->prefix_ << " TAO::Arg_Traits<" << node->name ()
+ << ">" << this->suffix_;
+
+ *os << be_nl << be_nl
+ << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl
+ << "TAO::" << (variable ? "Var" : "Fixed") << "_Size_Arg_Traits<"
+ << this->linebreak_ << be_idt << be_idt_nl
+ << node->name ();
+
+ if (variable)
+ {
+ *os << "," << this->linebreak_ << be_nl
+ << node->name () << "_var," << this->linebreak_ << be_nl
+ << node->name () << "_out" << this->linebreak_;
+ }
+
+ *os << be_uidt_nl
+ << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt;
+
+ os->gen_endif ();
+ }
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_structure - visit scope failed\n"),
+ -1);
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::visit_union_fwd (be_union_fwd *node)
+{
+ if (this->this_mode_generated (node))
+ {
+ return 0;
+ }
+
+ be_union *fd = be_union::narrow_from_decl (node->full_definition ());
+
+ if (this->visit_union (fd) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_union_fwd - code generation failed\n"),
+ -1);
+ }
+
+ this->this_mode_generated (node, I_TRUE);
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::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_tmplinst_cs::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"),
+ -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_tmplinst_cs::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_tmplinst_cs::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_tmplinst_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"),
+ -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+idl_bool
+be_visitor_tmplinst_cs::this_mode_generated (be_decl *node) const
+{
+ switch (this->mode_)
+ {
+ case TMPL_CLASS:
+ return node->cli_tmpl_class_gen ();
+ case PRAGMA_INST:
+ return node->cli_pragma_inst_gen ();
+ default:
+ return I_FALSE;
+ }
+}
+
+void
+be_visitor_tmplinst_cs::this_mode_generated (be_decl *node,
+ idl_bool val)
+{
+ switch (this->mode_)
+ {
+ case TMPL_CLASS:
+ node->cli_tmpl_class_gen (val);
+ break;
+ case PRAGMA_INST:
+ node->cli_pragma_inst_gen (val);
+ break;
+ default:
+ break;
+ }
+}
+
+void
+be_visitor_tmplinst_cs::switch_mode (void)
+{
+ this->mode_ = PRAGMA_INST;
+ delete [] this->prefix_;
+ this->prefix_ = ACE::strnew ("# pragma instantiate");
+ delete [] this->suffix_;
+ this->suffix_ = ACE::strnew ("");
+ delete [] this->linebreak_;
+ this->linebreak_ = ACE::strnew (" \\");
+}
+
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
index 262bc2768f5..30ca9252485 100644
--- a/TAO/TAO_IDL/be_include/be_decl.h
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -89,6 +89,14 @@ public:
idl_bool cli_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);
+ idl_bool cli_inarg_pragma_inst_gen (void);
+ idl_bool cli_inoutarg_tmpl_class_gen (void);
+ idl_bool cli_inoutarg_pragma_inst_gen (void);
+ idl_bool cli_outarg_tmpl_class_gen (void);
+ idl_bool cli_outarg_pragma_inst_gen (void);
+ idl_bool cli_retarg_tmpl_class_gen (void);
+ idl_bool cli_retarg_pragma_inst_gen (void);
// Set the flag indicating that code generation is done.
void cli_hdr_gen (idl_bool);
@@ -108,6 +116,14 @@ public:
void cli_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);
+ void cli_inarg_pragma_inst_gen (idl_bool);
+ void cli_inoutarg_tmpl_class_gen (idl_bool);
+ void cli_inoutarg_pragma_inst_gen (idl_bool);
+ void cli_outarg_tmpl_class_gen (idl_bool);
+ void cli_outarg_pragma_inst_gen (idl_bool);
+ void cli_retarg_tmpl_class_gen (idl_bool);
+ void cli_retarg_pragma_inst_gen (idl_bool);
// Narrowing
DEF_NARROW_METHODS1 (be_decl, AST_Decl);
@@ -137,6 +153,14 @@ private:
idl_bool cli_traits_gen_;
idl_bool cli_tmpl_class_gen_;
idl_bool cli_pragma_inst_gen_;
+ idl_bool cli_inarg_tmpl_class_gen_;
+ idl_bool cli_inarg_pragma_inst_gen_;
+ idl_bool cli_inoutarg_tmpl_class_gen_;
+ idl_bool cli_inoutarg_pragma_inst_gen_;
+ idl_bool cli_outarg_tmpl_class_gen_;
+ idl_bool cli_outarg_pragma_inst_gen_;
+ idl_bool cli_retarg_tmpl_class_gen_;
+ idl_bool cli_retarg_pragma_inst_gen_;
};
#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h b/TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h
index cb94bf5ed2d..fab5e937573 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h
@@ -14,17 +14,23 @@
#ifndef TAO_BE_VISITOR_ARG_TMPLINST_H
#define TAO_BE_VISITOR_ARG_TMPLINST_H
-#include "be_visitor_tmplinst.h"
+#include "be_visitor_tmplinst_cs.h"
+#include "ast_argument.h"
/**
* @class be_visitor_arg_tmplinst
*
* @brief Generates explicit template instantiations for arg helper classes.
*/
-class be_visitor_arg_tmplinst : public be_visitor_tmplinst
+class be_visitor_arg_tmplinst : public be_visitor_decl
{
public:
- be_visitor_arg_tmplinst (be_visitor_tmplinst *rhs);
+ be_visitor_arg_tmplinst (be_visitor_context *ctx,
+ be_visitor_tmplinst_cs::Mode mode,
+ char * prefix,
+ char * suffix,
+ char * linebreak,
+ const char * S);
virtual ~be_visitor_arg_tmplinst (void);
@@ -50,16 +56,58 @@ public:
virtual int visit_structure (be_structure *node);
+ virtual int visit_structure_fwd (be_structure_fwd *node);
+
virtual int visit_field (be_field *node);
virtual int visit_union (be_union *node);
+ virtual int visit_union_fwd (be_union_fwd *node);
+
virtual int visit_union_branch (be_union_branch *node);
virtual int visit_typedef (be_typedef *node);
-protected:
- virtual void cleanup (void);
+ // Accdessors for the member.
+ void direction (void);
+ void direction (AST_Argument::Direction dir);
+
+private:
+ // Set/get the appropriate flag on the node we are traversing,
+ // to make sure we don't generate something twice.
+ idl_bool this_mode_and_dir_generated (be_decl *node) const;
+ void this_mode_and_dir_generated (be_decl *node,
+ idl_bool val);
+
+ // Generate the direction prefix to the arg class name.
+ void gen_direction (TAO_OutStream *os);
+
+private:
+ enum Direction
+ {
+ _tao_IN,
+ _tao_INOUT,
+ _tao_OUT,
+ _tao_RET
+ };
+
+ // Generating 'template class' or '#pragma instantiate'.
+ be_visitor_tmplinst_cs::Mode mode_;
+
+ // Contains the prefix string itself.
+ char * prefix_;
+
+ // ';' or empty string
+ char * suffix_;
+
+ // backslash for '#pragma instantiate' mode, empty otherwise.
+ char * linebreak_;
+
+ // Value of the above enum we are holding.
+ Direction dir_;
+
+ // Contains 'S' to insert in skel side arg class name, or empty.
+ const char * S_;
};
diff --git a/TAO/TAO_IDL/be_include/be_visitor_tmplinst_cs.h b/TAO/TAO_IDL/be_include/be_visitor_tmplinst_cs.h
new file mode 100644
index 00000000000..6205b863238
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_tmplinst_cs.h
@@ -0,0 +1,92 @@
+//=============================================================================
+/**
+* @file be_visitor_tmplinst_cs.h
+*
+* $Id$
+*
+* This visitor generates explicit template instantiations, guarded so they
+* are seen only by compilers whose platforms require explicit template
+* instantiation.
+*
+* @author Jeff Parsons <j.parsons@vanderbilt.edu>
+*/
+//=============================================================================
+#ifndef TAO_BE_VISITOR_TMPLINST_CS_H
+#define TAO_BE_VISITOR_TMPLINST_CS_H
+
+#include "be_visitor_scope.h"
+
+/**
+ * @class be_visitor_tmplinst
+ *
+ * @brief Generates explicit template instantiations.
+ */
+class be_visitor_tmplinst_cs : public be_visitor_scope
+{
+public:
+ enum Mode
+ {
+ TMPL_CLASS,
+ PRAGMA_INST
+ };
+
+ be_visitor_tmplinst_cs (be_visitor_context *ctx);
+
+ virtual ~be_visitor_tmplinst_cs (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_operation (be_operation *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_structure_fwd (be_structure_fwd *node);
+
+ virtual int visit_field (be_field *node);
+
+ virtual int visit_union (be_union *node);
+
+ virtual int visit_union_fwd (be_union_fwd *node);
+
+ virtual int visit_union_branch (be_union_branch *node);
+
+ virtual int visit_typedef (be_typedef *node);
+
+ void switch_mode (void);
+
+private:
+ idl_bool this_mode_generated (be_decl *node) const;
+ void this_mode_generated (be_decl *node,
+ idl_bool val);
+
+private:
+ Mode mode_;
+ char * prefix_;
+ char * suffix_;
+ char * linebreak_;
+};
+
+
+#endif // TAO_BE_VISITOR_TMPLINST_CS_H