summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsmit <msmit@remedy.nl>2011-12-01 08:38:35 +0000
committermsmit <msmit@remedy.nl>2011-12-01 08:38:35 +0000
commit0d4c989bbd3b547116f28bb3ff43154ba49016d3 (patch)
tree4645118c54512390213ee27a8e7c9f00b5fb7855
parent4fde7aa4092831f3b3ea899762b667f467a9382e (diff)
downloadATCD-0d4c989bbd3b547116f28bb3ff43154ba49016d3.tar.gz
Thu Dec 1 08:37:33 UTC 2011 Marcel Smit <msmit@remedy.nl>
* TAO_IDL/be/be_codegen.cpp: * TAO_IDL/be/be_visitor_component.cpp: * TAO_IDL/be/be_visitor_component/component_svh.cpp: * TAO_IDL/be/be_visitor_component/component_svs.cpp: * TAO_IDL/be/be_visitor_component/component_svth.cpp: * TAO_IDL/be/be_visitor_component/component_svts.cpp: * TAO_IDL/be/be_visitor_component/context_svh.cpp: * TAO_IDL/be/be_visitor_component/context_svs.cpp: * TAO_IDL/be/be_visitor_module/module.cpp: * TAO_IDL/be_include/be_visitor_component.h: * TAO_IDL/be_include/be_visitor_component/component_svth.h: * TAO_IDL/be_include/be_visitor_component/component_svts.h: Moved the generated Context code to the _svnt_T files. Later on these classes will be templated.
-rw-r--r--TAO/ChangeLog.BRANCH17
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp22
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_svth.cpp102
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_svts.cpp114
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module.cpp4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_svth.h42
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_svts.h44
13 files changed, 361 insertions, 33 deletions
diff --git a/TAO/ChangeLog.BRANCH b/TAO/ChangeLog.BRANCH
index 0e0e6e9c1d3..81bc0a7e8ef 100644
--- a/TAO/ChangeLog.BRANCH
+++ b/TAO/ChangeLog.BRANCH
@@ -1,3 +1,20 @@
+Thu Dec 1 08:37:33 UTC 2011 Marcel Smit <msmit@remedy.nl>
+
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be/be_visitor_component.cpp:
+ * TAO_IDL/be/be_visitor_component/component_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/component_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/component_svth.cpp:
+ * TAO_IDL/be/be_visitor_component/component_svts.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svs.cpp:
+ * TAO_IDL/be/be_visitor_module/module.cpp:
+ * TAO_IDL/be_include/be_visitor_component.h:
+ * TAO_IDL/be_include/be_visitor_component/component_svth.h:
+ * TAO_IDL/be_include/be_visitor_component/component_svts.h:
+ Moved the generated Context code to the _svnt_T files. Later on
+ these classes will be templated.
+
Local Variables:
mode: change-log
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index d690a50a49e..26107bd3a76 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -1068,6 +1068,12 @@ TAO_CodeGen::start_ciao_svnt_header (const char *fname)
<< "# pragma once\n"
<< "#endif /* ACE_LACKS_PRAGMA_ONCE */\n";
+
+ *this->ciao_svnt_header_
+ << "#include \""
+ << be_global->be_get_ciao_tmpl_svnt_hdr_fname(true)
+ << "\"";
+
this->gen_svnt_hdr_includes (this->ciao_svnt_header_);
return 0;
@@ -1112,11 +1118,6 @@ TAO_CodeGen::start_ciao_svnt_source (const char *fname)
<< be_global->be_get_ciao_svnt_hdr_fname (true)
<< "\"" << be_nl;
- *this->ciao_svnt_source_
- << "#include \""
- << be_global->be_get_ciao_tmpl_svnt_hdr_fname(true)
- << "\"";
-
this->gen_svnt_src_includes (this->ciao_svnt_source_);
return 0;
@@ -1820,7 +1821,7 @@ TAO_CodeGen::end_server_template_header (void)
// Insert the code to include the template source file.
*this->server_template_header_
- << "\n\n#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)";
+ << be_nl << "#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)";
*this->server_template_header_
<< "\n#include \""
<< be_global->be_get_server_template_skeleton_fname (1)
diff --git a/TAO/TAO_IDL/be/be_visitor_component.cpp b/TAO/TAO_IDL/be/be_visitor_component.cpp
index ac735c69cb9..c990879d4d8 100644
--- a/TAO/TAO_IDL/be/be_visitor_component.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component.cpp
@@ -66,10 +66,12 @@
#include "be_visitor_component/component.cpp"
#include "be_visitor_component/component_svh.cpp"
+#include "be_visitor_component/component_svth.cpp"
#include "be_visitor_component/facet_svth.cpp"
#include "be_visitor_component/context_svh.cpp"
#include "be_visitor_component/servant_svh.cpp"
#include "be_visitor_component/component_svs.cpp"
+#include "be_visitor_component/component_svts.cpp"
#include "be_visitor_component/facet_svts.cpp"
#include "be_visitor_component/context_svs.cpp"
#include "be_visitor_component/servant_svs.cpp"
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp
index b6a57eaacd2..efe5a83c4a3 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp
@@ -54,17 +54,17 @@ be_visitor_component_svh::visit_component (be_component *node)
<< "_Impl" << be_nl
<< "{" << be_idt;
- // Generate the context class declaration.
- be_visitor_context_svh context_visitor (this->ctx_);
-
- if (context_visitor.visit_component (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_svh::")
- ACE_TEXT ("visit_component - ")
- ACE_TEXT ("context visitor failed\n")),
- -1);
- }
+// // Generate the context class declaration.
+// be_visitor_context_svh context_visitor (this->ctx_);
+//
+// if (context_visitor.visit_component (node) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("be_visitor_component_svh::")
+// ACE_TEXT ("visit_component - ")
+// ACE_TEXT ("context visitor failed\n")),
+// -1);
+// }
// Generate the servant class declaration.
be_visitor_servant_svh servant_visitor (this->ctx_);
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp
index 3248f0e7a88..8d863fafbd8 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp
@@ -50,16 +50,16 @@ be_visitor_component_svs::visit_component (be_component *node)
<< "_Impl" << be_nl
<< "{" << be_idt;
- be_visitor_context_svs context_visitor (this->ctx_);
-
- if (context_visitor.visit_component (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_svs::")
- ACE_TEXT ("visit_component - ")
- ACE_TEXT ("context visitor failed\n")),
- -1);
- }
+// be_visitor_context_svs context_visitor (this->ctx_);
+
+// if (context_visitor.visit_component (node) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("be_visitor_component_svs::")
+// ACE_TEXT ("visit_component - ")
+// ACE_TEXT ("context visitor failed\n")),
+// -1);
+// }
be_visitor_servant_svs servant_visitor (this->ctx_);
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_svth.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_svth.cpp
new file mode 100644
index 00000000000..b1cdf2971dc
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_svth.cpp
@@ -0,0 +1,102 @@
+
+//=============================================================================
+/**
+ * @file component_svth.cpp
+ *
+ * $Id$
+ *
+ * Visitor generating code for Components in the servant header.
+ *
+ *
+ * @author Marcel Smit
+ */
+//=============================================================================
+
+// ******************************************************
+// Component visitor for server header
+// ******************************************************
+be_visitor_component_svth::be_visitor_component_svth (be_visitor_context *ctx)
+ : be_visitor_component (ctx),
+ os_ (*ctx->stream ()),
+ export_macro_ (be_global->svnt_export_macro ())
+{
+ /// All existing CIAO examples set the servant export values in the CIDL
+ /// compiler to equal the IDL compiler's skel export values. Below is a
+ /// partial effort to decouple them, should be completely decoupled
+ /// sometime. See comment in codegen.cpp, line 1173.
+ if (export_macro_ == "")
+ {
+ export_macro_ = be_global->skel_export_macro ();
+ }
+}
+
+be_visitor_component_svth::~be_visitor_component_svth (void)
+{
+}
+
+int
+be_visitor_component_svth::visit_component (be_component *node)
+{
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ /// Fills in the node's has_* members, for use in minimizing
+ /// code generation.
+ node->scan (node);
+
+ be_visitor_facet_svth facet_svth(this->ctx_);
+
+
+ if (facet_svth.visit_component (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_svth::")
+ ACE_TEXT ("visit_provides - ")
+ ACE_TEXT ("facet visitor failed\n")),
+ -1);
+ }
+
+ /// CIDL-generated namespace used 'CIDL_' + composition name.
+ /// Now we use 'CIAO_' + component's flat name.
+ os_ << be_nl_2
+ << "namespace CIAO_" << node->flat_name ()
+ << "_Impl" << be_nl
+ << "{" << be_idt;
+
+ // Generate the context class declaration.
+ be_visitor_context_svh context_visitor (this->ctx_);
+
+ if (context_visitor.visit_component (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_svth::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("context visitor failed\n")),
+ -1);
+ }
+// // Generate the servant class declaration.
+// be_visitor_servant_svh servant_visitor (this->ctx_);
+//
+// if (servant_visitor.visit_component (node) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("be_visitor_component_svth::")
+// ACE_TEXT ("visit_component - ")
+// ACE_TEXT ("servant visitor failed\n")),
+// -1);
+// }
+//
+ os_ << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_component_svth::visit_connector (be_connector *node)
+{
+ return this->visit_component (node);
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_svts.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_svts.cpp
new file mode 100644
index 00000000000..478aaf60c86
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_svts.cpp
@@ -0,0 +1,114 @@
+
+//=============================================================================
+/**
+ * @file component_svts.cpp
+ *
+ * $Id$
+ *
+ * Visitor generating code for Components in the templated servant source.
+ *
+ *
+ * @author Marcel Smit
+ */
+//=============================================================================
+
+// ******************************************************
+// Component visitor for servant source
+// ******************************************************
+
+be_visitor_component_svts::be_visitor_component_svts (be_visitor_context *ctx)
+ : be_visitor_component (ctx),
+ os_ (*ctx->stream ()),
+ export_macro_ (be_global->svnt_export_macro ())
+{
+ /// All existing CIAO examples set the servant export values in the CIDL
+ /// compiler to equal the IDL compiler's skel export values. Below is a
+ /// partial effort to decouple them, should be completely decoupled
+ /// sometime. See comment in codegen.cpp, line 1173.
+ if (export_macro_ == "")
+ {
+ export_macro_ = be_global->skel_export_macro ();
+ }
+}
+
+be_visitor_component_svts::~be_visitor_component_svts (void)
+{
+}
+
+// int
+// be_visitor_component_svts::visit_provides (be_provides *node)
+// {
+// be_visitor_facet_svts facet_svts (this->ctx_);
+//
+//
+// if (facet_svts.visit_provides (node) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("be_visitor_component_svts::")
+// ACE_TEXT ("visit_provides - ")
+// ACE_TEXT ("facet visitor failed\n")),
+// -1);
+// }
+// return 0;
+// }
+
+int
+be_visitor_component_svts::visit_component (be_component *node)
+{
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ be_visitor_facet_svts facet_svts (this->ctx_);
+
+
+ if (facet_svts.visit_component (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_svts::")
+ ACE_TEXT ("visit_provides - ")
+ ACE_TEXT ("facet visitor failed\n")),
+ -1);
+ }
+ /// CIDL-generated namespace used 'CIDL_' + composition name.
+ /// Now we use 'CIAO_' + component's flat name.
+ os_ << be_nl_2
+ << "namespace CIAO_" << node->flat_name ()
+ << "_Impl" << be_nl
+ << "{" << be_idt;
+
+ be_visitor_context_svs context_visitor (this->ctx_);
+
+ if (context_visitor.visit_component (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_svts::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("context visitor failed\n")),
+ -1);
+ }
+
+// be_visitor_servant_svs servant_visitor (this->ctx_);
+//
+// if (servant_visitor.visit_component (node) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("be_visitor_component_svts::")
+// ACE_TEXT ("visit_component - ")
+// ACE_TEXT ("servant visitor failed\n")),
+// -1);
+// }
+//
+ os_ << be_uidt_nl
+ << "}";
+//
+ return 0;
+}
+
+int
+be_visitor_component_svts::visit_connector (be_connector *node)
+{
+ return this->visit_component (node);
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp
index f3615ad1be2..d10baac3f43 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp
@@ -12,6 +12,7 @@
* @author Jeff Parsons
*/
//=============================================================================
+#include <be_helper.h>
be_visitor_context_svh::be_visitor_context_svh (be_visitor_context *ctx)
: be_visitor_component_scope (ctx)
@@ -44,14 +45,17 @@ be_visitor_context_svh::visit_component (be_component *node)
<< "class " << lname << "_Servant;"
<< be_nl_2;
+
os_ << "class " << export_macro_.c_str () << " " << lname
<< "_Context" << be_idt_nl
<< ": public virtual ::CIAO::"
<< be_global->ciao_container_type ()
- << "_Context_Impl<" << be_idt << be_idt_nl
+ << "_Context_Impl_T<" << be_idt << be_idt_nl
<< global << sname << "::CCM_" << lname
<< "_Context," << be_nl
- << "::" << node->name () << ">" << be_uidt << be_uidt << be_uidt_nl
+ << "::" << node->name () << ">";
+
+ os_ << be_uidt << be_uidt << be_uidt_nl
<< "{" << be_nl
<< "public:" << be_idt_nl;
@@ -62,7 +66,7 @@ be_visitor_context_svh::visit_component (be_component *node)
os_ << "/// Some useful typedefs." << be_nl
<< "typedef" << be_nl
<< "::CIAO::" << be_global->ciao_container_type ()
- << "_Context_Impl<" << be_idt << be_idt_nl
+ << "_Context_Impl_T<" << be_idt << be_idt_nl
<< global << sname << "::CCM_"
<< lname << "_Context," << be_nl
<< "::" << node->name () << ">" << be_uidt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp
index 418165944e4..853d3cdd911 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp
@@ -49,7 +49,7 @@ be_visitor_context_svs::visit_component (be_component *node)
<< be_global->ciao_container_type () << "_Container> (h, c, id),"
<< be_idt_nl
<< "::CIAO::" << be_global->ciao_container_type ()
- << "_Context_Impl<" << be_idt_nl
+ << "_Context_Impl_T<" << be_idt_nl
<< global << sname << "::CCM_"
<< lname << "_Context," << be_nl
<< "::" << node->full_name () << "> (h, c, sv, id)";
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
index 8402c983f6f..8fc9893e5ed 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
@@ -669,13 +669,13 @@ be_visitor_module::visit_component (be_component *node)
break;
case TAO_CodeGen::TAO_ROOT_SVTH:
{
- be_visitor_facet_svth visitor (&ctx);
+ be_visitor_component_svth visitor (&ctx);
status = node->accept (&visitor);
break;
}
case TAO_CodeGen::TAO_ROOT_SVTS:
{
- be_visitor_facet_svts visitor (&ctx);
+ be_visitor_component_svts visitor (&ctx);
status = node->accept (&visitor);
break;
}
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component.h b/TAO/TAO_IDL/be_include/be_visitor_component.h
index 1fd4cfdf9b1..a8fc84a8b53 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_component.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_component.h
@@ -21,10 +21,12 @@
#include "be_visitor_component/component.h"
#include "be_visitor_component/component_svh.h"
+#include "be_visitor_component/component_svth.h"
#include "be_visitor_component/facet_svth.h"
#include "be_visitor_component/context_svh.h"
#include "be_visitor_component/servant_svh.h"
#include "be_visitor_component/component_svs.h"
+#include "be_visitor_component/component_svts.h"
#include "be_visitor_component/facet_svts.h"
#include "be_visitor_component/context_svs.h"
#include "be_visitor_component/servant_svs.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_svth.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_svth.h
new file mode 100644
index 00000000000..fb92dc03c87
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_svth.h
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+//=============================================================================
+/**
+ * @file component_svth.h
+ *
+ * $Id$
+ *
+ * Concrete visitor for the Component node.
+ * This provides for code generation in the templated servant header
+ *
+ *
+ * @author Marcel Smit
+ */
+//=============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_SVTH_H_
+#define _BE_COMPONENT_COMPONENT_SVTH_H_
+
+/**
+ * @class be_visitor_component_svth
+ *
+ * @brief be_visitor_component_svth
+ *
+ * This is a concrete visitor to generate the servant header for component.
+ */
+class be_visitor_component_svth : public be_visitor_component
+{
+public:
+ be_visitor_component_svth (be_visitor_context *ctx);
+
+ ~be_visitor_component_svth (void);
+
+ virtual int visit_component (be_component *node);
+ virtual int visit_connector (be_connector *node);
+
+private:
+ TAO_OutStream &os_;
+ ACE_CString export_macro_;
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_SVTH_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_svts.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_svts.h
new file mode 100644
index 00000000000..45d073a821a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_svts.h
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+//=============================================================================
+/**
+ * @file component_svts.h
+ *
+ * $Id$
+ *
+ * Concrete visitor for the Component node.
+ * This provides for code generation in the templated servant source
+ *
+ *
+ * @author Marcel Smit
+ */
+//=============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_SVTS_H_
+#define _BE_COMPONENT_COMPONENT_SVTS_H_
+
+/**
+ * @class be_visitor_component_svts
+ *
+ * @brief be_visitor_component_svts
+ *
+ * This is a concrete visitor to generate the servant
+ * source for component.
+ */
+class be_visitor_component_svts : public be_visitor_component
+{
+public:
+ be_visitor_component_svts (be_visitor_context *ctx);
+
+ ~be_visitor_component_svts (void);
+
+ virtual int visit_component (be_component *node);
+ virtual int visit_connector (be_connector *node);
+// virtual int visit_provides (be_provides *node);
+
+private:
+ TAO_OutStream &os_;
+ ACE_CString export_macro_;
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_SVTS_H_ */
+