summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-20 22:56:00 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-20 22:56:00 +0000
commit4ba0451f1f65685a21a3bc399758e26c933e11c0 (patch)
treed3b9e41cf8bc283822b3045241c88a39d1293c01
parent293edc4103d53f8858a981324f9c5e1f3debc81d (diff)
downloadATCD-4ba0451f1f65685a21a3bc399758e26c933e11c0.tar.gz
ChangeLogTag: Tue Oct 20 22:55:25 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--modules/TAO/ChangeLog30
-rw-r--r--modules/TAO/TAO_IDL/be/be_component.cpp8
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component.cpp1
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component/component_scope.cpp66
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp44
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp221
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp12
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp3
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp41
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp1116
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_component.h4
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component.h1
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component/component_scope.h52
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h11
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h34
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h6
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h5
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h9
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h233
19 files changed, 1050 insertions, 847 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog
index 358bc577494..6d5c8833c62 100644
--- a/modules/TAO/ChangeLog
+++ b/modules/TAO/ChangeLog
@@ -1,3 +1,33 @@
+Tue Oct 20 22:55:25 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_component/component_scope.cpp:
+ * TAO_IDL/be_include/be_visitor_component/component_scope.h:
+
+ New files containing a new base class visitor, encapsulating
+ a scope visitation method that recurses over the scopes of
+ a component's ancestors, if any.
+
+ * TAO_IDL/be/be_visitor_component.cpp:
+ * TAO_IDL/be/be_component.cpp:
+ * TAO_IDL/be/be_visitor_component/servant_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/servant_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svs.cpp:
+ * TAO_IDL/be_include/be_component.h:
+ * TAO_IDL/be_include/be_visitor_component/servant_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/context_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/servant_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/context_svs.h:
+ * TAO_IDL/be_include/be_visitor_component.h:
+
+ Replaced all occurrences of recursive scope iteration
+ with new visitor classes derived from the abstract
+ visitor above.
+
Mon Oct 19 23:26:07 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be/be_visitor_component/servant_svs.cpp:
diff --git a/modules/TAO/TAO_IDL/be/be_component.cpp b/modules/TAO/TAO_IDL/be/be_component.cpp
index 1b3947e8179..200e87c7dea 100644
--- a/modules/TAO/TAO_IDL/be/be_component.cpp
+++ b/modules/TAO/TAO_IDL/be/be_component.cpp
@@ -90,6 +90,14 @@ be_component::~be_component (void)
{
}
+be_component *
+be_component::base_component (void) const
+{
+ return
+ be_component::narrow_from_decl (
+ this->AST_Component::base_component ());
+}
+
void
be_component::redefine (AST_Interface *from)
{
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component.cpp
index 31e867a6fd8..6ead4189b8c 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component.cpp
@@ -60,6 +60,7 @@
#include "be_extern.h"
#include "be_visitor_component/component.cpp"
+#include "be_visitor_component/component_scope.cpp"
#include "be_visitor_component/component_ch.cpp"
#include "be_visitor_component/component_ci.cpp"
#include "be_visitor_component/component_cs.cpp"
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component/component_scope.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component/component_scope.cpp
new file mode 100644
index 00000000000..30e7e96877a
--- /dev/null
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component/component_scope.cpp
@@ -0,0 +1,66 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_scope.cpp
+//
+// = DESCRIPTION
+// Abstract visitor providing ancestor scope visitation.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_component_scope::be_visitor_component_scope (
+ be_visitor_context *ctx)
+ : be_visitor_scope (ctx),
+ node_ (0),
+ os_ (*ctx->stream ()),
+ export_macro_ (be_global->svnt_export_macro ()),
+ swapping_ (be_global->gen_component_swapping ()),
+ static_config_ (be_global->gen_ciao_static_config ())
+{
+ /// 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_scope::~be_visitor_component_scope (
+ void)
+{
+}
+
+int
+be_visitor_component_scope::visit_component_scope (
+ be_component *node)
+{
+ if (node == 0)
+ {
+ return 0;
+ }
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_scope")
+ ACE_TEXT ("::visit_component_scope - ")
+ ACE_TEXT ("visit_scope() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ return this->visit_component_scope (node->base_component ());
+}
+
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp
index ac7f0d795e9..05a26e8d124 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp
@@ -20,20 +20,8 @@
// ============================================================================
be_visitor_context_svh::be_visitor_context_svh (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- node_ (0),
- os_ (*ctx->stream ()),
- export_macro_ (be_global->svnt_export_macro ()),
- swapping_ (be_global->gen_component_swapping ())
+ : be_visitor_component_scope (ctx)
{
- /// 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_context_svh::~be_visitor_context_svh (void)
@@ -108,16 +96,16 @@ be_visitor_context_svh::visit_component (be_component *node)
<< "// defined in " << global << sname
<< "::CCM_" << lname << "_Context.";
- if (this->gen_context_r (node) == -1)
+ if (this->visit_component_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_context_svh")
ACE_TEXT ("::visit_component - ")
- ACE_TEXT ("gen_context_r() ")
+ ACE_TEXT ("visit_component_scope() ")
ACE_TEXT ("failed\n")),
-1);
}
-
+
if (swapping_)
{
os_ << be_nl << be_nl
@@ -304,27 +292,3 @@ be_visitor_context_svh::visit_mirror_port (be_mirror_port *)
return 0;
}
-int
-be_visitor_context_svh::gen_context_r (be_component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_context_svh")
- ACE_TEXT ("::gen_context_r - ")
- ACE_TEXT ("visit_scope() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- be_component *ancestor =
- be_component::narrow_from_decl (node->base_component ());
-
- return this->gen_context_r (ancestor);
-}
-
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp
index fac362541e8..f0618fb41a5 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp
@@ -20,11 +20,7 @@
// ============================================================================
be_visitor_context_svs::be_visitor_context_svs (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- node_ (0),
- os_ (*ctx->stream ()),
- swapping_ (be_global->gen_component_swapping ()),
- static_config_ (be_global->gen_ciao_static_config ())
+ : be_visitor_component_scope (ctx)
{
}
@@ -88,12 +84,12 @@ be_visitor_context_svs::visit_component (be_component *node)
<< "_Context *> (p);" << be_uidt_nl
<< "}";
- if (this->gen_context_r (node) == -1)
+ if (this->visit_component_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_context_svs")
ACE_TEXT ("::visit_component - ")
- ACE_TEXT ("gen_context_r() ")
+ ACE_TEXT ("visit_component_scope() ")
ACE_TEXT ("failed\n")),
-1);
}
@@ -125,7 +121,17 @@ be_visitor_context_svs::visit_component (be_component *node)
<< "ACE_UNUSED_ARG (_ciao_index);" << be_nl
<< "ACE_UNUSED_ARG (_ciao_size);";
- this->gen_swapping_get_consumers_r (node);
+ be_visitor_swapping_get_consumer v (this->ctx_);
+
+ if (v.visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_context_svs")
+ ACE_TEXT ("::visit_component - ")
+ ACE_TEXT ("swapping_get_consumer ")
+ ACE_TEXT ("visitor failed\n")),
+ -1);
+ }
os_ << be_nl << be_nl
<< "throw ::Components::InvalidName ();" << be_uidt_nl
@@ -479,123 +485,6 @@ be_visitor_context_svs::visit_mirror_port (be_mirror_port *)
return 0;
}
-int
-be_visitor_context_svs::gen_context_r (be_component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_context_svs")
- ACE_TEXT ("::gen_context_r - ")
- ACE_TEXT ("visit_scope() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- be_component *ancestor =
- be_component::narrow_from_decl (node->base_component ());
-
- return this->gen_context_r (ancestor);
-}
-
-void
-be_visitor_context_svs::gen_swapping_get_consumers_r (
- AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- this->gen_swapping_get_consumer_block (
- d->local_name ()->get_string ());
- }
-
- node = node->base_component ();
- this->gen_swapping_get_consumers_r (node);
-}
-
-void
-be_visitor_context_svs::gen_swapping_get_consumer_block (
- const char * port_name)
-{
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (publisher_name, \""
- << port_name << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "_ciao_size = this->_ciao_publishes_"
- << port_name << "_.size ();" << be_nl << be_nl
- << "ACE_NEW_THROW_EX (tmp," << be_nl
- << " ::Components::"
- << "ConsumerDescriptions (_ciao_size)," << be_nl
- << " ::CORBA::NO_MEMORY ());";
-
- if (! static_config_)
- {
- os_ << be_nl << be_nl
- << "{" << be_idt_nl
- << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_," << be_nl
- << " 0);";
- }
-
- os_ << be_nl << be_nl
- << "for (" << tao_cg->upcase (port_name)
- << "_TABLE::const_iterator iter =" << be_idt_nl
- << " this->ciao_publishes_" << port_name
- << "_.begin ();" << be_uidt_nl
- << " iter != this->ciao_publishes_" << port_name
- << ".end ();" << be_nl
- << " ++iter, ++_ciao_index)" << be_idt_nl
- << "{" << be_idt_nl
- << "if ( ::CORBA::is_nil (iter->second.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::Components::ConsumerDescription * cd = 0;" << be_nl
- << "ACE_NEW_THROW_EX (cd," << be_nl
- << " OBV_Components::ConsumerDescription,"
- << be_nl
- << " ::CORBA::NO_MEMORY ());"
- << be_nl << be_nl
- << "::Components::ConsumerDescription_var safe = cd;"
- << be_nl
- << "safe->name (\"\");" << be_nl
- << "safe->type_id (\"\");" << be_nl
- << "safe->consumer (iter->second.in ());"
- << be_nl << be_nl
- << "retval[_ciao_index] = safe;" << be_uidt_nl
- << "}" << be_uidt;
-
- if (! static_config_)
- {
- os_ << be_uidt_nl
- << "}";
- }
-
- os_ << be_uidt_nl << be_nl
- << "return retval._retn ();" << be_uidt_nl
- << "}";
-}
-
void
be_visitor_context_svs::gen_uses_simplex (
AST_Type *obj,
@@ -814,3 +703,85 @@ be_visitor_context_svs::gen_uses_multiplex (
<< "}";
}
+// ===============================================
+
+be_visitor_swapping_get_consumer::be_visitor_swapping_get_consumer (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_swapping_get_consumer::~be_visitor_swapping_get_consumer (
+ void)
+{
+}
+
+int
+be_visitor_swapping_get_consumer::visit_publishes (
+ be_publishes *node)
+{
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (publisher_name, \""
+ << port_name << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_ciao_size = this->_ciao_publishes_"
+ << port_name << "_.size ();" << be_nl << be_nl
+ << "ACE_NEW_THROW_EX (tmp," << be_nl
+ << " ::Components::"
+ << "ConsumerDescriptions (_ciao_size)," << be_nl
+ << " ::CORBA::NO_MEMORY ());";
+
+ if (! static_config_)
+ {
+ os_ << be_nl << be_nl
+ << "{" << be_idt_nl
+ << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_," << be_nl
+ << " 0);";
+ }
+
+ os_ << be_nl << be_nl
+ << "for (" << tao_cg->upcase (port_name)
+ << "_TABLE::const_iterator iter =" << be_idt_nl
+ << " this->ciao_publishes_" << port_name
+ << "_.begin ();" << be_uidt_nl
+ << " iter != this->ciao_publishes_" << port_name
+ << ".end ();" << be_nl
+ << " ++iter, ++_ciao_index)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "if ( ::CORBA::is_nil (iter->second.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::Components::ConsumerDescription * cd = 0;" << be_nl
+ << "ACE_NEW_THROW_EX (cd," << be_nl
+ << " OBV_Components::ConsumerDescription,"
+ << be_nl
+ << " ::CORBA::NO_MEMORY ());"
+ << be_nl << be_nl
+ << "::Components::ConsumerDescription_var safe = cd;"
+ << be_nl
+ << "safe->name (\"\");" << be_nl
+ << "safe->type_id (\"\");" << be_nl
+ << "safe->consumer (iter->second.in ());"
+ << be_nl << be_nl
+ << "retval[_ciao_index] = safe;" << be_uidt_nl
+ << "}" << be_uidt;
+
+ if (! static_config_)
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ os_ << be_uidt_nl << be_nl
+ << "return retval._retn ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+} \ No newline at end of file
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp
index 2f9146fed1b..5e8546f6643 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp
@@ -20,18 +20,8 @@
// ============================================================================
be_visitor_facet_svh::be_visitor_facet_svh (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- os_ (*ctx->stream ()),
- export_macro_ (be_global->svnt_export_macro ())
+ : be_visitor_component_scope (ctx)
{
- /// 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_facet_svh::~be_visitor_facet_svh (void)
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp
index f1208567eaa..ce18fe211d2 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp
@@ -20,8 +20,7 @@
// ============================================================================
be_visitor_facet_svs::be_visitor_facet_svs (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- os_ (*ctx->stream ())
+ : be_visitor_component_scope (ctx)
{
}
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp
index 77ab8476882..d4aa9c57e88 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp
@@ -20,19 +20,8 @@
// ============================================================================
be_visitor_servant_svh::be_visitor_servant_svh (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- node_ (0),
- os_ (*ctx->stream ()),
- export_macro_ (be_global->svnt_export_macro ())
+ : be_visitor_component_scope (ctx)
{
- /// 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_servant_svh::~be_visitor_servant_svh (void)
@@ -107,14 +96,14 @@ be_visitor_servant_svh::visit_component (be_component *node)
-1);
}
- status = this->gen_servant_r (node_);
+ status = this->visit_component_scope (node);
if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_servant_svh::"
"visit_component - "
- "gen_servant_r() failed\n"),
+ "visit_component_scope() failed\n"),
-1);
}
@@ -370,30 +359,6 @@ be_visitor_servant_svh::visit_mirror_port (be_mirror_port *)
return 0;
}
-int
-be_visitor_servant_svh::gen_servant_r (be_component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_servant_svh")
- ACE_TEXT ("::gen_servant_r - ")
- ACE_TEXT ("visit_scope() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- be_component *ancestor =
- be_component::narrow_from_decl (node->base_component ());
-
- return this->gen_servant_r (ancestor);
-}
-
void
be_visitor_servant_svh::gen_non_type_specific (void)
{
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp
index cd72435b444..0539a0d180e 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp
@@ -20,26 +20,14 @@
// ============================================================================
be_visitor_servant_svs::be_visitor_servant_svs (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- node_ (0),
+ : be_visitor_component_scope (ctx),
op_scope_ (0),
- os_ (*ctx->stream ()),
- export_macro_ (be_global->svnt_export_macro ()),
- swapping_ (be_global->gen_component_swapping ()),
n_provides_ (0UL),
n_uses_ (0UL),
n_publishes_ (0UL),
n_emits_ (0UL),
n_consumes_ (0UL)
{
- /// 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_servant_svs::~be_visitor_servant_svs (void)
@@ -92,9 +80,15 @@ be_visitor_servant_svs::visit_component (be_component *node)
<< be_nl
<< "this->context_->_ciao_instance_id (this->ins_name_);";
- if (be_global->gen_ciao_valuefactory_reg ())
+ be_visitor_obv_factory_reg ofr_visitor (this->ctx_);
+
+ if (ofr_visitor.visit_component_scope (node) == -1)
{
- this->gen_obv_factory_registration_r (node);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "visit_component - "
+ "OBV factory registration failed\n"),
+ -1);
}
os_ << be_nl << be_nl
@@ -137,7 +131,16 @@ be_visitor_servant_svs::visit_component (be_component *node)
<< "const char * descr_name = descr[i]->name ();" << be_nl
<< "::CORBA::Any & descr_value = descr[i]->value ();";
- this->gen_attr_set_r (node_);
+ be_visitor_attr_set as_visitor (this->ctx_);
+
+ if (as_visitor.visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "visit_component - "
+ "attr init visitor failed\n"),
+ -1);
+ }
os_ << be_nl << be_nl
<< "ACE_UNUSED_ARG (descr_name);" << be_nl
@@ -185,12 +188,12 @@ be_visitor_servant_svs::visit_component (be_component *node)
// This call will generate all other operations and attributes,
// including inherited ones.
- if (this->gen_servant_r (node) == -1)
+ if (this->visit_component_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_component_svs::"
"visit_component - "
- "gen_servant_r() failed\n"),
+ "visit_component_scope() failed\n"),
-1);
}
@@ -206,7 +209,16 @@ be_visitor_servant_svs::visit_component (be_component *node)
<< "::Components::EventConsumerBase_var ecb_var;"
<< be_nl;
- this->gen_populate_r (node);
+ be_visitor_populate_port_tables ppt_visitor (this->ctx_);
+
+ if (ppt_visitor.visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "visit_component - "
+ "populate port tables visitor failed\n"),
+ -1);
+ }
os_ << be_uidt_nl
<< "}";
@@ -749,78 +761,6 @@ be_visitor_servant_svs::visit_mirror_port (be_mirror_port *)
return 0;
}
-int
-be_visitor_servant_svs::gen_servant_r (be_component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_servant_svs")
- ACE_TEXT ("::gen_servant_r - ")
- ACE_TEXT ("visit_scope() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- be_component *ancestor =
- be_component::narrow_from_decl (node->base_component ());
-
- return this->gen_servant_r (ancestor);
-}
-
-void
-be_visitor_servant_svs::gen_obv_factory_registration_r (
- AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
- AST_Type *port_type = 0;
-
- switch (d->node_type ())
- {
- case AST_Decl::NT_publishes:
- case AST_Decl::NT_emits:
- case AST_Decl::NT_consumes:
- port_type =
- AST_Field::narrow_from_decl (d)->field_type ();
- this->gen_obv_factory_registration (port_type);
- break;
- default:
- break;
- }
- }
-
- node = node->base_component ();
- this->gen_obv_factory_registration_r (node);
-}
-
-void
-be_visitor_servant_svs::gen_obv_factory_registration (AST_Type *t)
-{
- if (be_global->gen_ciao_valuefactory_reg ())
- {
- const char *fname = t->full_name ();
-
- os_ << be_nl << be_nl
- << "TAO_OBV_REGISTER_FACTORY (" << be_idt_nl
- << "::" << fname << "_init," << be_nl
- << "::" << fname << ");" << be_uidt;
- }
-}
-
void
be_visitor_servant_svs::compute_slots (AST_Component *node)
{
@@ -858,44 +798,6 @@ be_visitor_servant_svs::compute_slots (AST_Component *node)
}
}
-int
-be_visitor_servant_svs::gen_attr_set_r (AST_Component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- // Get the next AST decl node
- AST_Decl *d = si.item ();
-
- if (d->node_type () == AST_Decl::NT_attr)
- {
- be_attribute *attr =
- be_attribute::narrow_from_decl (d);
-
- be_visitor_attribute_component_init v (this->ctx_);
-
- if (v.visit_attribute (attr) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_servant_svs")
- ACE_TEXT ("::gen_attr_set_r - ")
- ACE_TEXT ("visit_attribute() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
- }
- }
-
- node = node->base_component ();
- return this->gen_attr_set_r (node);
-}
-
void
be_visitor_servant_svs::gen_provides_top (void)
{
@@ -917,26 +819,16 @@ be_visitor_servant_svs::gen_provides_top (void)
<< "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
<< "}" << be_uidt;
- AST_Component *node = node_;
-
- while (node != 0)
+ be_visitor_facet_executor_block feb_visitor (this->ctx_);
+
+ if (feb_visitor.visit_component_scope (node_) == -1)
{
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- this->gen_facet_executor_block (
- d->local_name ()->get_string ());
- }
-
- node = node->base_component ();
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_provides_top - "
+ "facet executor block visitor failed\n"));
+
+ return;
}
os_ << be_nl << be_nl
@@ -945,19 +837,6 @@ be_visitor_servant_svs::gen_provides_top (void)
}
void
-be_visitor_servant_svs::gen_facet_executor_block (
- const char *port_name)
-{
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (name, \"" << port_name
- << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->executor_->get_" << port_name
- << " ();" << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
be_visitor_servant_svs::gen_publishes_top (void)
{
os_ << be_nl << be_nl
@@ -980,28 +859,16 @@ be_visitor_servant_svs::gen_publishes_top (void)
<< "throw ::Components::InvalidName ();" << be_uidt_nl
<< "}" << be_uidt;
- AST_Component *node = node_;
+ be_visitor_subscribe_block sb_visitor (this->ctx_);
- while (node != 0)
+ if (sb_visitor.visit_component_scope (node_) == -1)
{
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- this->gen_subscribe_block (p);
- }
-
- node = node->base_component ();
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_publishes_top - "
+ "subscribe block visitor failed\n"));
+
+ return;
}
os_ << be_nl << be_nl
@@ -1027,28 +894,16 @@ be_visitor_servant_svs::gen_publishes_top (void)
<< "throw ::Components::InvalidName ();" << be_uidt_nl
<< "}" << be_uidt;
- node = node_;
+ be_visitor_unsubscribe_block ub_visitor (this->ctx_);
- while (node != 0)
+ if (ub_visitor.visit_component_scope (node_) == -1)
{
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- this->gen_unsubscribe_block (p);
- }
-
- node = node->base_component ();
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_publishes_top - "
+ "unsubscribe block visitor failed\n"));
+
+ return;
}
os_ << be_nl << be_nl
@@ -1071,29 +926,16 @@ be_visitor_servant_svs::gen_publishes_top (void)
<< "safe_retval->length (" << n_publishes_
<< "UL);";
- node = node_;
- ACE_CDR::ULong slot = 0UL;
+ be_visitor_event_source_desc esd_visitor (this->ctx_);
- while (node != 0)
+ if (esd_visitor.visit_component_scope (node_) == -1)
{
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- this->gen_event_source_description (p, slot++);
- }
-
- node = node->base_component ();
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_publishes_top - "
+ "event source description visitor failed\n"));
+
+ return;
}
os_ << be_nl << be_nl
@@ -1102,98 +944,6 @@ be_visitor_servant_svs::gen_publishes_top (void)
}
void
-be_visitor_servant_svs::gen_subscribe_block (
- AST_Publishes *p)
-{
- const char *obj_name = p->publishes_type ()->full_name ();
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (publisher_name, \""
- << port_name << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "::" << obj_name << "Consumer_var sub =" << be_idt_nl
- << "::" << obj_name << "Consumer::_narrow (subscribe);"
- << be_uidt_nl << be_nl
- << "if ( ::CORBA::is_nil (sub.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "::CORBA::Boolean const substitutable =" << be_idt_nl
- << "subscribe->ciao_is_substitutable (" << be_idt_nl
- << "::" << obj_name
- << "::_tao_obv_static_repository_id ());"
- << be_uidt << be_uidt_nl << be_nl
- << "if (substitutable)" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->subscribe_" << port_name
- << "_generic (subscribe);" << be_uidt_nl
- << "}" << be_uidt_nl
- << "else" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl
- << "else" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->subscribe_" << port_name
- << " (sub.in ());" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_servant_svs::gen_unsubscribe_block (
- AST_Publishes *p)
-{
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (publisher_name, \""
- << port_name << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->unsubscribe_" << port_name
- << " (ck);" << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_servant_svs::gen_event_source_description (
- AST_Publishes *p,
- ACE_CDR::ULong slot)
-{
- AST_Type *obj = p->publishes_type ();
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_nl << be_nl;
-
- if (! be_global->gen_ciao_static_config ())
- {
- os_ << "{" << be_idt_nl
- << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->context_->"
- << port_name << "_lock_," << be_nl
- << " 0);" << be_nl << be_nl;
- }
-
- os_ << "::CIAO::Servant::describe_pub_event_source<"
- << be_idt_nl
- << "::" << obj->full_name () << "Consumer_var> ("
- << be_idt_nl
- << "\"" << port_name << "\"," << be_nl
- << "\"" << obj->repoID () << "\"," << be_nl
- << "this->context_->ciao_publishes_"
- << port_name << "_," << be_nl
- << "safe_retval," << be_nl
- << slot << "UL);" << be_uidt << be_uidt;
-
- if (! be_global->gen_ciao_static_config ())
- {
- os_ << be_uidt_nl
- << "}";
- }
-}
-
-void
be_visitor_servant_svs::gen_uses_top (void)
{
os_ << be_nl << be_nl
@@ -1216,28 +966,16 @@ be_visitor_servant_svs::gen_uses_top (void)
<< "throw ::Components::InvalidName ();" << be_uidt_nl
<< "}" << be_uidt;
- AST_Component *node = node_;
-
- while (node != 0)
+ be_visitor_connect_block cb_visitor (this->ctx_);
+
+ if (cb_visitor.visit_component_scope (node_) == -1)
{
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
-
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
-
- this->gen_connect_block (u);
- }
-
- node = node->base_component ();
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_uses_top - "
+ "connect block visitor failed\n"));
+
+ return;
}
os_ << be_nl << be_nl
@@ -1263,28 +1001,16 @@ be_visitor_servant_svs::gen_uses_top (void)
<< "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
<< "}" << be_uidt;
- node = node_;
-
- while (node != 0)
+ be_visitor_disconnect_block db_visitor (this->ctx_);
+
+ if (db_visitor.visit_component_scope (node_) == -1)
{
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
-
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
-
- this->gen_disconnect_block (u);
- }
-
- node = node->base_component ();
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_uses_top - "
+ "disconnect block visitor failed\n"));
+
+ return;
}
os_ << be_nl << be_nl
@@ -1307,29 +1033,121 @@ be_visitor_servant_svs::gen_uses_top (void)
<< "safe_retval->length (" << n_uses_
<< "UL);";
- node = node_;
- ACE_CDR::ULong slot = 0UL;
+ be_visitor_receptacle_desc rd_visitor (this->ctx_);
+
+ if (rd_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_uses_top - "
+ "receptacle description visitor failed\n"));
+
+ return;
+ }
- while (node != 0)
+ os_ << be_nl << be_nl
+ << "return safe_retval._retn ();" << be_uidt_nl
+ << "}";
+}
+
+void
+be_visitor_servant_svs::gen_emits_top (void)
+{
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << node_->local_name () << "_Servant::connect_consumer ("
+ << be_idt_nl
+ << "const char * emitter_name," << be_nl
+ << "::Components::EventConsumerBase_ptr consumer)"
+ << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
{
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
+ os_ << "if (emitter_name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt;
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
+ be_visitor_connect_consumer_block ccb_visitor (this->ctx_);
- this->gen_receptacle_description (u, slot++);
- }
+ if (ccb_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_emits_top - "
+ "connect consumer block visitor failed\n"));
+
+ return;
+ }
- node = node->base_component ();
+ os_ << be_nl << be_nl
+ << "ACE_UNUSED_ARG (consumer);" << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::EventConsumerBase_ptr" << be_nl
+ << node_->local_name ()
+ << "_Servant::disconnect_consumer (" << be_idt_nl
+ << "const char * source_name)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "if (source_name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ be_visitor_disconnect_consumer_block dcb_visitor (this->ctx_);
+
+ if (dcb_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_emits_top - "
+ "disconnect consumer block visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::EmitterDescriptions *" << be_nl
+ << node_->local_name ()
+ << "_Servant::get_all_emitters (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::Components::EmitterDescriptions *retval = 0;"
+ << be_nl
+ << "ACE_NEW_RETURN (retval," << be_nl
+ << " ::Components::EmitterDescriptions,"
+ << be_nl
+ << " 0);" << be_nl << be_nl
+ << "::Components::EmitterDescriptions_var "
+ << "safe_retval = retval;" << be_nl
+ << "safe_retval->length (" << n_emits_
+ << "UL);";
+
+ be_visitor_emitter_desc ed_visitor (this->ctx_);
+
+ if (ed_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_emits_top - "
+ "emitter description visitor failed\n"));
+
+ return;
}
os_ << be_nl << be_nl
@@ -1337,12 +1155,134 @@ be_visitor_servant_svs::gen_uses_top (void)
<< "}";
}
+// ==========================================================
+
+be_visitor_obv_factory_reg::be_visitor_obv_factory_reg (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_obv_factory_reg::~be_visitor_obv_factory_reg (void)
+{
+}
+
+int
+be_visitor_obv_factory_reg::visit_publishes (be_publishes *node)
+{
+ this->gen_obv_factory_registration (node->field_type ());
+
+ return 0;
+}
+
+int
+be_visitor_obv_factory_reg::visit_emits (be_emits *node)
+{
+ this->gen_obv_factory_registration (node->field_type ());
+
+ return 0;
+}
+
+int
+be_visitor_obv_factory_reg::visit_consumes (be_consumes *node)
+{
+ this->gen_obv_factory_registration (node->field_type ());
+
+ return 0;
+}
+
void
-be_visitor_servant_svs::gen_connect_block (AST_Uses *u)
+be_visitor_obv_factory_reg::gen_obv_factory_registration (AST_Type *t)
+{
+ if (be_global->gen_ciao_valuefactory_reg ())
+ {
+ const char *fname = t->full_name ();
+
+ os_ << be_nl << be_nl
+ << "TAO_OBV_REGISTER_FACTORY (" << be_idt_nl
+ << "::" << fname << "_init," << be_nl
+ << "::" << fname << ");" << be_uidt;
+ }
+}
+
+// ==========================================================
+
+be_visitor_attr_set::be_visitor_attr_set (be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_attr_set::~be_visitor_attr_set (void)
+{
+}
+
+int
+be_visitor_attr_set::visit_attribute (be_attribute *node)
+{
+ be_visitor_attribute_component_init v (this->ctx_);
+
+ if (v.visit_attribute (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_attr_set")
+ ACE_TEXT ("::visit_attribute - ")
+ ACE_TEXT ("component attr init visitor ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ return 0;
+}
+
+// ==========================================================
+
+be_visitor_facet_executor_block::be_visitor_facet_executor_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_facet_executor_block::~be_visitor_facet_executor_block (
+ void)
{
- const char *obj_name = u->uses_type ()->full_name ();
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
+}
+
+int
+be_visitor_facet_executor_block::visit_provides (
+ be_provides *node)
+{
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (name, \"" << port_name
+ << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->executor_->get_" << port_name
+ << " ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_connect_block::be_visitor_connect_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_connect_block::~be_visitor_connect_block (void)
+{
+}
+
+int
+be_visitor_connect_block::visit_uses (be_uses *node)
+{
+ const char *obj_name = node->uses_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
os_ << be_nl << be_nl
<< "if (ACE_OS::strcmp (name, \"" << port_name
@@ -1393,13 +1333,28 @@ be_visitor_servant_svs::gen_connect_block (AST_Uses *u)
os_ << be_uidt_nl
<< "}" << be_uidt;
+
+ return 0;
}
-void
-be_visitor_servant_svs::gen_disconnect_block (AST_Uses *u)
+// ======================================================
+
+be_visitor_disconnect_block::be_visitor_disconnect_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_disconnect_block::~be_visitor_disconnect_block (
+ void)
{
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
+}
+
+int
+be_visitor_disconnect_block::visit_uses (be_uses *node)
+{
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
os_ << be_nl << be_nl
<< "if (ACE_OS::strcmp (name, \"" << port_name
@@ -1419,21 +1374,34 @@ be_visitor_servant_svs::gen_disconnect_block (AST_Uses *u)
os_ << "return this->disconnect_" << port_name
<< " (" << (is_multiple ? "ck" : "") << ");" << be_uidt_nl
<< "}" << be_uidt;
+
+ return 0;
}
-void
-be_visitor_servant_svs::gen_receptacle_description (
- AST_Uses *u,
- ACE_CDR::ULong slot)
+// ======================================================
+
+be_visitor_receptacle_desc::be_visitor_receptacle_desc (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ slot_ (0UL)
+{
+}
+
+be_visitor_receptacle_desc::~be_visitor_receptacle_desc (
+ void)
{
- AST_Type *obj = u->uses_type ();
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
+}
+
+int
+be_visitor_receptacle_desc::visit_uses (be_uses *node)
+{
+ AST_Type *obj = node->uses_type ();
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
os_ << be_nl << be_nl;
- bool gen_guard =
- is_multiple && ! be_global->gen_ciao_static_config ();
+ bool gen_guard = is_multiple && ! static_config_;
if (gen_guard)
{
@@ -1454,163 +1422,178 @@ be_visitor_servant_svs::gen_receptacle_description (
<< "this->context_->ciao_uses_"
<< port_name << "_," << be_nl
<< "safe_retval," << be_nl
- << slot << "UL);" << be_uidt << be_uidt;
+ << slot_++ << "UL);" << be_uidt << be_uidt;
if (gen_guard)
{
os_ << be_uidt_nl
<< "}";
}
+
+ return 0;
}
-void
-be_visitor_servant_svs::gen_emits_top (void)
+// ======================================================
+
+be_visitor_subscribe_block::be_visitor_subscribe_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
{
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name () << "_Servant::connect_consumer ("
- << be_idt_nl
- << "const char * emitter_name," << be_nl
- << "::Components::EventConsumerBase_ptr consumer)"
- << be_uidt_nl
- << "{" << be_idt_nl;
+}
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
+be_visitor_subscribe_block::~be_visitor_subscribe_block (
+ void)
+{
+}
- os_ << "if (emitter_name == 0)" << be_idt_nl
+int
+be_visitor_subscribe_block::visit_publishes (
+ be_publishes *node)
+{
+ const char *obj_name =
+ node->publishes_type ()->full_name ();
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (publisher_name, \""
+ << port_name << "\") == 0)" << be_idt_nl
<< "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "::" << obj_name << "Consumer_var sub =" << be_idt_nl
+ << "::" << obj_name << "Consumer::_narrow (subscribe);"
+ << be_uidt_nl << be_nl
+ << "if ( ::CORBA::is_nil (sub.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Boolean const substitutable =" << be_idt_nl
+ << "subscribe->ciao_is_substitutable (" << be_idt_nl
+ << "::" << obj_name
+ << "::_tao_obv_static_repository_id ());"
+ << be_uidt << be_uidt_nl << be_nl
+ << "if (substitutable)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->subscribe_" << port_name
+ << "_generic (subscribe);" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->subscribe_" << port_name
+ << " (sub.in ());" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
<< "}" << be_uidt;
- AST_Component *node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
+ return 0;
+}
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
+// ==========================================================
- this->gen_connect_consumer_block (e);
- }
+be_visitor_unsubscribe_block::be_visitor_unsubscribe_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
- node = node->base_component ();
- }
+be_visitor_unsubscribe_block::~be_visitor_unsubscribe_block (
+ void)
+{
+}
- os_ << be_nl << be_nl
- << "ACE_UNUSED_ARG (consumer);" << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
+int
+be_visitor_unsubscribe_block::visit_publishes (
+ be_publishes *node)
+{
+ const char *port_name =
+ node->local_name ()->get_string ();
os_ << be_nl << be_nl
- << "::Components::EventConsumerBase_ptr" << be_nl
- << node_->local_name ()
- << "_Servant::disconnect_consumer (" << be_idt_nl
- << "const char * source_name)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "if (source_name == 0)" << be_idt_nl
+ << "if (ACE_OS::strcmp (publisher_name, \""
+ << port_name << "\") == 0)" << be_idt_nl
<< "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "return this->unsubscribe_" << port_name
+ << " (ck);" << be_uidt_nl
<< "}" << be_uidt;
- node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
+ return 0;
+}
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
+// ==========================================================
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
+be_visitor_event_source_desc::be_visitor_event_source_desc (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ slot_ (0UL)
+{
+}
- this->gen_disconnect_consumer_block (e);
- }
+be_visitor_event_source_desc::~be_visitor_event_source_desc (
+ void)
+{
+}
- node = node->base_component ();
- }
+int
+be_visitor_event_source_desc::visit_publishes (
+ be_publishes *node)
+{
+ AST_Type *obj = node->publishes_type ();
+ const char *port_name =
+ node->local_name ()->get_string ();
- os_ << be_nl << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
+ os_ << be_nl << be_nl;
- os_ << be_nl << be_nl
- << "::Components::EmitterDescriptions *" << be_nl
- << node_->local_name ()
- << "_Servant::get_all_emitters (void)" << be_nl
- << "{" << be_idt_nl
- << "::Components::EmitterDescriptions *retval = 0;"
- << be_nl
- << "ACE_NEW_RETURN (retval," << be_nl
- << " ::Components::EmitterDescriptions,"
- << be_nl
- << " 0);" << be_nl << be_nl
- << "::Components::EmitterDescriptions_var "
- << "safe_retval = retval;" << be_nl
- << "safe_retval->length (" << n_emits_
- << "UL);";
+ if (! static_config_)
+ {
+ os_ << "{" << be_idt_nl
+ << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->context_->"
+ << port_name << "_lock_," << be_nl
+ << " 0);" << be_nl << be_nl;
+ }
- node = node_;
- ACE_CDR::ULong slot = 0UL;
+ os_ << "::CIAO::Servant::describe_pub_event_source<"
+ << be_idt_nl
+ << "::" << obj->full_name () << "Consumer_var> ("
+ << be_idt_nl
+ << "\"" << port_name << "\"," << be_nl
+ << "\"" << obj->repoID () << "\"," << be_nl
+ << "this->context_->ciao_publishes_"
+ << port_name << "_," << be_nl
+ << "safe_retval," << be_nl
+ << slot_++ << "UL);" << be_uidt << be_uidt;
- while (node != 0)
+ if (! be_global->gen_ciao_static_config ())
{
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
+ os_ << be_uidt_nl
+ << "}";
+ }
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
+ return 0;
+}
- this->gen_emitter_description (e, slot++);
- }
+// ======================================================
- node = node->base_component ();
- }
+be_visitor_connect_consumer_block::be_visitor_connect_consumer_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
- os_ << be_nl << be_nl
- << "return safe_retval._retn ();" << be_uidt_nl
- << "}";
+be_visitor_connect_consumer_block::~be_visitor_connect_consumer_block (void)
+{
}
-void
-be_visitor_servant_svs::gen_connect_consumer_block (
- AST_Emits *e)
+int
+be_visitor_connect_consumer_block::visit_emits (
+ be_emits *node)
{
- const char *obj_name = e->emits_type ()->full_name ();
- const char *port_name = e->local_name ()->get_string ();
+ const char *obj_name =
+ node->emits_type ()->full_name ();
+ const char *port_name =
+ node->local_name ()->get_string ();
os_ << be_nl << be_nl
<< "if (ACE_OS::strcmp (emitter_name, \""
@@ -1629,13 +1612,29 @@ be_visitor_servant_svs::gen_connect_consumer_block (
<< " (_ciao_consumer.in ());" << be_nl << be_nl
<< "return;" << be_uidt_nl
<< "}" << be_uidt;
+
+ return 0;
}
-void
-be_visitor_servant_svs::gen_disconnect_consumer_block (
- AST_Emits *e)
+// ======================================================
+
+be_visitor_disconnect_consumer_block::be_visitor_disconnect_consumer_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
{
- const char *port_name = e->local_name ()->get_string ();
+}
+
+be_visitor_disconnect_consumer_block::~be_visitor_disconnect_consumer_block (
+ void)
+{
+}
+
+int
+be_visitor_disconnect_consumer_block::visit_emits (
+ be_emits *node)
+{
+ const char *port_name =
+ node->local_name ()->get_string ();
os_ << be_nl << be_nl
<< "if (ACE_OS::strcmp (source_name, \""
@@ -1644,15 +1643,30 @@ be_visitor_servant_svs::gen_disconnect_consumer_block (
<< "return this->disconnect_" << port_name
<< " ();" << be_uidt_nl
<< "}" << be_uidt;
+
+ return 0;
}
-void
-be_visitor_servant_svs::gen_emitter_description (
- AST_Emits *e,
- ACE_CDR::ULong slot)
+// ======================================================
+
+be_visitor_emitter_desc::be_visitor_emitter_desc (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ slot_ (0UL)
+{
+}
+
+be_visitor_emitter_desc::~be_visitor_emitter_desc (
+ void)
+{
+}
+
+int
+be_visitor_emitter_desc::visit_emits (be_emits *node)
{
- AST_Type *obj = e->emits_type ();
- const char *port_name = e->local_name ()->get_string ();
+ AST_Type *obj = node->emits_type ();
+ const char *port_name =
+ node->local_name ()->get_string ();
os_ << be_nl << be_nl
<< "::CIAO::Servant::describe_emit_event_source<"
@@ -1664,47 +1678,47 @@ be_visitor_servant_svs::gen_emitter_description (
<< "this->context_->ciao_emits_" << port_name
<< "_consumer_," << be_nl
<< "safe_retval," << be_nl
- << slot << "UL);" << be_uidt << be_uidt;
+ << slot_++ << "UL);" << be_uidt << be_uidt;
+
+ return 0;
}
-void
-be_visitor_servant_svs::gen_populate_r (AST_Component *node)
+// ======================================================
+
+be_visitor_populate_port_tables::be_visitor_populate_port_tables (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
{
- if (node == 0)
- {
- return;
- }
+}
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
+be_visitor_populate_port_tables::~be_visitor_populate_port_tables (
+ void)
+{
+}
- switch (d->node_type ())
- {
- case AST_Decl::NT_provides:
- os_ << be_nl
- << "obj_var = this->provide_"
- << d->local_name ()->get_string () << "_i ();";
-
- break;
- case AST_Decl::NT_consumes:
- os_ << be_nl
- << "ecb_var = this->get_consumer_"
- << d->local_name ()->get_string () << "_i ();";
-
- break;
- default:
- break;
- }
- }
+int
+be_visitor_populate_port_tables::visit_provides (
+ be_provides *node)
+{
+ os_ << be_nl
+ << "obj_var = this->provide_"
+ << node->local_name ()->get_string () << "_i ();";
- node = node->base_component ();
- this->gen_populate_r (node);
+ return 0;
}
-// ==========================================================
+int
+be_visitor_populate_port_tables::visit_consumes (
+ be_consumes *node)
+{
+ os_ << be_nl
+ << "ecb_var = this->get_consumer_"
+ << node->local_name ()->get_string () << "_i ();";
+
+ return 0;
+}
+
+// ======================================================
Component_Op_Attr_Generator::Component_Op_Attr_Generator (
be_visitor_scope * visitor)
diff --git a/modules/TAO/TAO_IDL/be_include/be_component.h b/modules/TAO/TAO_IDL/be_include/be_component.h
index 868f3ffc2f3..a682a141491 100644
--- a/modules/TAO/TAO_IDL/be_include/be_component.h
+++ b/modules/TAO/TAO_IDL/be_include/be_component.h
@@ -43,6 +43,10 @@ public:
long n_supports_flat);
~be_component (void);
+
+ be_component *base_component (void) const;
+ // Override of the AST method to eliminate narrowing of
+ // the return value.
virtual void redefine (AST_Interface *from);
// Catch BE-specific members before delegating to the base class.
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component.h
index f01088ff129..5c0046631b2 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component.h
@@ -25,6 +25,7 @@
#include "be_visitor_interface.h"
#include "be_visitor_component/component.h"
+#include "be_visitor_component/component_scope.h"
#include "be_visitor_component/component_ch.h"
#include "be_visitor_component/component_ci.h"
#include "be_visitor_component/component_cs.h"
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component/component_scope.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component/component_scope.h
new file mode 100644
index 00000000000..e7c49fa9fe0
--- /dev/null
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component/component_scope.h
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// component_scope.h
+//
+// = DESCRIPTION
+// Base class for visitors that need to visit the scope of a
+// component and its ancestors, if any.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_SCOPE_H_
+#define _BE_COMPONENT_COMPONENT_SCOPE_H_
+
+class be_visitor_component_scope : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_component_scope
+ //
+ // = DESCRIPTION
+ // This is an abstract visitor providing a scope visitation
+ // method that traverses the base component recursively.
+ //
+protected:
+ be_visitor_component_scope (be_visitor_context *ctx);
+
+ virtual ~be_visitor_component_scope (void);
+
+public:
+ int visit_component_scope (be_component *node);
+
+protected:
+ be_component *node_;
+ TAO_OutStream &os_;
+ ACE_CString export_macro_;
+ bool swapping_;
+ bool static_config_;
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_SCOPE_H_ */
+
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h
index c82c5cd6410..d1abaabe26b 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h
@@ -23,7 +23,7 @@
#ifndef _BE_COMPONENT_CONTEXT_SVH_H_
#define _BE_COMPONENT_CONTEXT_SVH_H_
-class be_visitor_context_svh : public be_visitor_scope
+class be_visitor_context_svh : public be_visitor_component_scope
{
//
// = TITLE
@@ -45,15 +45,6 @@ public:
virtual int visit_emits (be_emits *node);
virtual int visit_extended_port (be_extended_port *node);
virtual int visit_mirror_port (be_mirror_port *node);
-
-private:
- int gen_context_r (be_component *node);
-
-private:
- be_component *node_;
- TAO_OutStream &os_;
- ACE_CString export_macro_;
- bool swapping_;
};
#endif /* _BE_COMPONENT_CONTEXT_SVH_H_ */
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h
index 7663b40c98a..4b5e2c7b807 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h
@@ -23,7 +23,7 @@
#ifndef _BE_COMPONENT_CONTEXT_SVS_H_
#define _BE_COMPONENT_CONTEXT_SVS_H_
-class be_visitor_context_svs : public be_visitor_scope
+class be_visitor_context_svs : public be_visitor_component_scope
{
//
// = TITLE
@@ -47,22 +47,32 @@ public:
virtual int visit_mirror_port (be_mirror_port *node);
private:
- int gen_context_r (be_component *node);
-
- void gen_swapping_get_consumers_r (AST_Component *node);
- void gen_swapping_get_consumer_block (const char *port_name);
-
void gen_uses_simplex (AST_Type *obj,
const char *port_name);
void gen_uses_multiplex (AST_Type *obj,
const char *port_name);
-
+};
+
+// ======================================================
+
+class be_visitor_swapping_get_consumer
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_swapping_get_comsumer
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate a block of code
+ // for each publishes port, including inherited ports.
+ //
+ //
+public:
+ be_visitor_swapping_get_consumer (be_visitor_context *ctx);
-private:
- be_component *node_;
- TAO_OutStream &os_;
- bool swapping_;
- bool static_config_;
+ ~be_visitor_swapping_get_consumer (void);
+
+ virtual int visit_publishes (be_publishes *node);
};
#endif /* _BE_COMPONENT_CONTEXT_SVS_H_ */
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h
index b7769b9510f..40d703ce7a2 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h
@@ -23,7 +23,7 @@
#ifndef _BE_COMPONENT_FACET_SVH_H_
#define _BE_COMPONENT_FACET_SVH_H_
-class be_visitor_facet_svh : public be_visitor_scope
+class be_visitor_facet_svh : public be_visitor_component_scope
{
//
// = TITLE
@@ -43,10 +43,6 @@ public:
virtual int visit_provides (be_provides *node);
virtual int visit_extended_port (be_extended_port *node);
virtual int visit_mirror_port (be_mirror_port *node);
-
-private:
- TAO_OutStream &os_;
- ACE_CString export_macro_;
};
#endif /* _BE_COMPONENT_FACET_SVH_H_ */
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h
index ebbce6631b7..2a1d76382e7 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h
@@ -23,7 +23,7 @@
#ifndef _BE_COMPONENT_FACET_SVS_H_
#define _BE_COMPONENT_FACET_SVS_H_
-class be_visitor_facet_svs : public be_visitor_scope
+class be_visitor_facet_svs : public be_visitor_component_scope
{
//
// = TITLE
@@ -43,9 +43,6 @@ public:
virtual int visit_provides (be_provides *node);
virtual int visit_extended_port (be_extended_port *node);
virtual int visit_mirror_port (be_mirror_port *node);
-
-private:
- TAO_OutStream &os_;
};
#endif /* _BE_COMPONENT_FACET_SVS_H_ */
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h
index 17df7ef6721..38eaef1393d 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h
@@ -23,7 +23,7 @@
#ifndef _BE_COMPONENT_SERVANT_SVH_H_
#define _BE_COMPONENT_SERVANT_SVH_H_
-class be_visitor_servant_svh : public be_visitor_scope
+class be_visitor_servant_svh : public be_visitor_component_scope
{
//
// = TITLE
@@ -50,15 +50,8 @@ public:
virtual int visit_mirror_port (be_mirror_port *node);
private:
- int gen_servant_r (be_component *node);
-
/// Base class overrides and CIAO-specific code.
void gen_non_type_specific (void);
-
-private:
- be_component *node_;
- TAO_OutStream &os_;
- ACE_CString export_macro_;
};
#endif /* _BE_COMPONENT_SERVANT_SVH_H_ */
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h
index 45055bfa81b..d3ae2a8f24c 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h
@@ -23,7 +23,8 @@
#ifndef _BE_COMPONENT_SERVANT_SVS_H_
#define _BE_COMPONENT_SERVANT_SVS_H_
-class be_visitor_servant_svs : public be_visitor_scope
+class be_visitor_servant_svs
+ : public be_visitor_component_scope
{
//
// = TITLE
@@ -51,54 +52,18 @@ public:
virtual int visit_mirror_port (be_mirror_port *node);
private:
- int gen_servant_r (be_component *node);
-
void compute_slots (AST_Component *node);
- void gen_obv_factory_registration_r (AST_Component *node);
- void gen_obv_factory_registration (AST_Type *t);
-
- int gen_attr_set_r (AST_Component *node);
-
void gen_provides_top (void);
-
- void gen_facet_executor_block (const char *port_name);
-
void gen_uses_top (void);
-
- void gen_connect_block (AST_Uses *u);
-
- void gen_disconnect_block (AST_Uses *u);
-
- void gen_receptacle_description (AST_Uses *u,
- ACE_CDR::ULong slot);
-
void gen_publishes_top (void);
-
- void gen_subscribe_block (AST_Publishes *p);
-
- void gen_unsubscribe_block (AST_Publishes *p);
-
- void gen_event_source_description (AST_Publishes *p,
- ACE_CDR::ULong slot);
-
void gen_emits_top (void);
-
- void gen_connect_consumer_block (AST_Emits *e);
-
- void gen_disconnect_consumer_block (AST_Emits *e);
-
- void gen_emitter_description (AST_Emits *e,
- ACE_CDR::ULong slot);
-
- void gen_populate_r (AST_Component *node);
-
+
private:
- be_component *node_;
be_interface *op_scope_;
- TAO_OutStream &os_;
- ACE_CString export_macro_;
- bool swapping_;
+
+ // Not used for now, but might be useful if generated
+ // code is optimized.
ACE_CDR::ULong n_provides_;
ACE_CDR::ULong n_uses_;
ACE_CDR::ULong n_publishes_;
@@ -106,6 +71,192 @@ private:
ACE_CDR::ULong n_consumes_;
};
+// ======================================================
+
+class be_visitor_obv_factory_reg
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_obv_factory_reg (be_visitor_context *ctx);
+
+ ~be_visitor_obv_factory_reg (void);
+
+ virtual int visit_publishes (be_publishes *node);
+ virtual int visit_emits (be_emits *node);
+ virtual int visit_consumes (be_consumes *node);
+
+private:
+ void gen_obv_factory_registration (AST_Type *t);
+};
+
+// ======================================================
+
+class be_visitor_attr_set : public be_visitor_component_scope
+{
+public:
+ be_visitor_attr_set (be_visitor_context *ctx);
+
+ ~be_visitor_attr_set (void);
+
+ virtual int visit_attribute (be_attribute *node);
+};
+
+// ======================================================
+
+class be_visitor_facet_executor_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_facet_executor_block (be_visitor_context *ctx);
+
+ ~be_visitor_facet_executor_block (void);
+
+ virtual int visit_provides (be_provides *node);
+};
+
+// ======================================================
+
+class be_visitor_connect_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_connect_block (be_visitor_context *ctx);
+
+ ~be_visitor_connect_block (void);
+
+ virtual int visit_uses (be_uses *node);
+};
+
+// ======================================================
+
+class be_visitor_disconnect_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_disconnect_block (be_visitor_context *ctx);
+
+ ~be_visitor_disconnect_block (void);
+
+ virtual int visit_uses (be_uses *node);
+};
+
+// ======================================================
+
+class be_visitor_receptacle_desc
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_receptacle_desc (be_visitor_context *ctx);
+
+ ~be_visitor_receptacle_desc (void);
+
+ virtual int visit_uses (be_uses *node);
+
+private:
+ ACE_CDR::ULong slot_;
+};
+
+// ======================================================
+
+class be_visitor_subscribe_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_subscribe_block (be_visitor_context *ctx);
+
+ ~be_visitor_subscribe_block (void);
+
+ virtual int visit_publishes (be_publishes *node);
+};
+
+// ======================================================
+
+class be_visitor_unsubscribe_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_unsubscribe_block (be_visitor_context *ctx);
+
+ ~be_visitor_unsubscribe_block (void);
+
+ virtual int visit_publishes (be_publishes *node);
+};
+
+// ======================================================
+
+class be_visitor_event_source_desc
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_event_source_desc (be_visitor_context *ctx);
+
+ ~be_visitor_event_source_desc (void);
+
+ virtual int visit_publishes (be_publishes *node);
+
+private:
+ ACE_CDR::ULong slot_;
+};
+
+// ======================================================
+
+class be_visitor_connect_consumer_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_connect_consumer_block (be_visitor_context *ctx);
+
+ ~be_visitor_connect_consumer_block (void);
+
+ virtual int visit_emits (be_emits *node);
+};
+
+// ======================================================
+
+class be_visitor_disconnect_consumer_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_disconnect_consumer_block (be_visitor_context *ctx);
+
+ ~be_visitor_disconnect_consumer_block (void);
+
+ virtual int visit_emits (be_emits *node);
+};
+
+// ======================================================
+
+class be_visitor_emitter_desc
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_emitter_desc (be_visitor_context *ctx);
+
+ ~be_visitor_emitter_desc (void);
+
+ virtual int visit_emits (be_emits *node);
+
+private:
+ ACE_CDR::ULong slot_;
+};
+
+// ======================================================
+
+class be_visitor_populate_port_tables
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_populate_port_tables (be_visitor_context *ctx);
+
+ ~be_visitor_populate_port_tables (void);
+
+ virtual int visit_provides (be_provides *node);
+
+ virtual int visit_consumes (be_consumes *node);
+};
+
+// ======================================================
+
/// Worker class passed to traverse_inheritance_graph(),
/// collects supported operations and attributes.
class Component_Op_Attr_Generator