summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-02-01 22:31:29 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-02-01 22:31:29 +0000
commit55f699d0bdd5dadccc980058242fea75537ba070 (patch)
treeefe56fd8bf82e22506c9887543e49f334913ec69
parentd595c81d24ff7856c3db702502c603fb9af480df (diff)
downloadATCD-55f699d0bdd5dadccc980058242fea75537ba070.tar.gz
ChangeLogTag: Mon Feb 1 22:30:44 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--modules/TAO/ChangeLog35
-rw-r--r--modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp4
-rw-r--r--modules/TAO/TAO_IDL/be/be_decl.cpp85
-rw-r--r--modules/TAO/TAO_IDL/be/be_scope.cpp3
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp185
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_home.cpp1
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_home/factory_svs.cpp50
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_home/home_ex_idl.cpp75
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_home/home_exh.cpp194
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_home/home_exs.cpp235
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_home/home_svh.cpp41
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_home/home_svs.cpp306
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_operation.cpp1
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp75
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp7
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp2
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h5
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_home.h1
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_home/factory_svs.h55
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_home/home_ex_idl.h6
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exh.h21
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exs.h11
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svh.h6
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svs.h17
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h8
25 files changed, 622 insertions, 807 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog
index fdb760da3de..60be84daaf5 100644
--- a/modules/TAO/ChangeLog
+++ b/modules/TAO/ChangeLog
@@ -1,3 +1,38 @@
+Mon Feb 1 22:30:44 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_home/factory_svs.cpp:
+ * TAO_IDL/be_include/be_visitor_home/factory_svs.h:
+
+ Removed this recently-added visitor, turned out
+ to be unnecessary.
+
+ * TAO_IDL/be/be_visitor_home/home_svs.cpp:
+ * TAO_IDL/be/be_visitor_home/home_exs.cpp:
+ * TAO_IDL/be/be_visitor_home/home_svh.cpp:
+ * TAO_IDL/be/be_visitor_home/home_ex_idl.cpp:
+ * TAO_IDL/be/be_visitor_home/home_exh.cpp:
+ * TAO_IDL/be/be_visitor_operation/arglist.cpp:
+ * TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp:
+ * TAO_IDL/be/be_visitor_valuetype/arglist.cpp:
+ * TAO_IDL/be/be_decl.cpp:
+ * TAO_IDL/be/be_visitor_home.cpp:
+ * TAO_IDL/be/be_visitor_operation.cpp:
+ * TAO_IDL/be/be_scope.cpp:
+ * TAO_IDL/be/be_visitor_ccm_pre_proc.cpp:
+ * TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp:
+ * TAO_IDL/be_include/be_visitor_home/home_ex_idl.h:
+ * TAO_IDL/be_include/be_visitor_home/home_exh.h:
+ * TAO_IDL/be_include/be_visitor_home/home_svs.h:
+ * TAO_IDL/be_include/be_visitor_home/home_exs.h:
+ * TAO_IDL/be_include/be_visitor_home/home_svh.h:
+ * TAO_IDL/be_include/be_visitor_operation/arglist.h:
+ * TAO_IDL/be_include/be_visitor_ccm_pre_proc.h:
+ * TAO_IDL/be_include/be_visitor_home.h:
+
+ More work toward handling home factories and
+ finders as members of the home's scope rather
+ than as a list in the home class. In progress.
+
Fri Jan 29 22:03:03 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be/be_visitor_home/factory_svs.cpp:
diff --git a/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp b/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp
index 0c9ca968a60..5e82cd0c299 100644
--- a/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp
+++ b/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp
@@ -1143,12 +1143,12 @@ ast_visitor_tmpl_module_inst::visit_factory (AST_Factory *node)
if (this->for_finder_)
{
added_factory =
- idl_global->gen ()->create_factory (&sn);
+ idl_global->gen ()->create_finder (&sn);
}
else
{
added_factory =
- idl_global->gen ()->create_finder (&sn);
+ idl_global->gen ()->create_factory (&sn);
}
idl_global->scopes ().top ()->add_to_scope (added_factory);
diff --git a/modules/TAO/TAO_IDL/be/be_decl.cpp b/modules/TAO/TAO_IDL/be/be_decl.cpp
index df0ce31d2c7..fc12d25d443 100644
--- a/modules/TAO/TAO_IDL/be/be_decl.cpp
+++ b/modules/TAO/TAO_IDL/be/be_decl.cpp
@@ -35,6 +35,7 @@
#include "be_enum.h"
#include "be_operation.h"
#include "be_factory.h"
+#include "be_finder.h"
#include "be_sequence.h"
#include "be_visitor.h"
@@ -316,47 +317,49 @@ be_decl::scope (void)
{
be_decl *d = this;
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface_fwd:
- // Resolve forward declared interface by looking at full_definition()
- // field and iterating.
- d =
- be_interface::narrow_from_decl (
- (be_interface_fwd::narrow_from_decl (this))->full_definition ()
- );
- // Fall through
- case AST_Decl::NT_interface:
- return be_interface::narrow_from_decl (d);
- case AST_Decl::NT_module:
- return be_module::narrow_from_decl (d);
- case AST_Decl::NT_root:
- return be_root::narrow_from_decl (d);
- case AST_Decl::NT_except:
- return be_exception::narrow_from_decl (d);
- case AST_Decl::NT_union:
- return be_union::narrow_from_decl (d);
- case AST_Decl::NT_struct:
- return be_structure::narrow_from_decl (d);
- case AST_Decl::NT_enum:
- return be_enum::narrow_from_decl (d);
- case AST_Decl::NT_op:
- return be_operation::narrow_from_decl (d);
- case AST_Decl::NT_factory:
- return be_factory::narrow_from_decl (d);
- case AST_Decl::NT_sequence:
- return be_sequence::narrow_from_decl (d);
- case AST_Decl::NT_valuetype:
- return be_valuetype::narrow_from_decl (d);
- case AST_Decl::NT_component:
- return be_component::narrow_from_decl (d);
- case AST_Decl::NT_eventtype:
- return be_eventtype::narrow_from_decl (d);
- case AST_Decl::NT_home:
- return be_home::narrow_from_decl (d);
- default:
- return (be_scope *)0;
- }
+ switch (this->node_type ())
+ {
+ case AST_Decl::NT_interface_fwd:
+ // Resolve forward declared interface by looking at full_definition()
+ // field and iterating.
+ d =
+ be_interface::narrow_from_decl (
+ (be_interface_fwd::narrow_from_decl (this))->full_definition ()
+ );
+ // Fall through
+ case AST_Decl::NT_interface:
+ return be_interface::narrow_from_decl (d);
+ case AST_Decl::NT_module:
+ return be_module::narrow_from_decl (d);
+ case AST_Decl::NT_root:
+ return be_root::narrow_from_decl (d);
+ case AST_Decl::NT_except:
+ return be_exception::narrow_from_decl (d);
+ case AST_Decl::NT_union:
+ return be_union::narrow_from_decl (d);
+ case AST_Decl::NT_struct:
+ return be_structure::narrow_from_decl (d);
+ case AST_Decl::NT_enum:
+ return be_enum::narrow_from_decl (d);
+ case AST_Decl::NT_op:
+ return be_operation::narrow_from_decl (d);
+ case AST_Decl::NT_factory:
+ return be_factory::narrow_from_decl (d);
+ case AST_Decl::NT_finder:
+ return be_finder::narrow_from_decl (d);
+ case AST_Decl::NT_sequence:
+ return be_sequence::narrow_from_decl (d);
+ case AST_Decl::NT_valuetype:
+ return be_valuetype::narrow_from_decl (d);
+ case AST_Decl::NT_component:
+ return be_component::narrow_from_decl (d);
+ case AST_Decl::NT_eventtype:
+ return be_eventtype::narrow_from_decl (d);
+ case AST_Decl::NT_home:
+ return be_home::narrow_from_decl (d);
+ default:
+ return (be_scope *)0;
+ }
}
// Boolean methods to test if code was already generated.
diff --git a/modules/TAO/TAO_IDL/be/be_scope.cpp b/modules/TAO/TAO_IDL/be/be_scope.cpp
index 91f03b92adb..5ea78ce9a90 100644
--- a/modules/TAO/TAO_IDL/be/be_scope.cpp
+++ b/modules/TAO/TAO_IDL/be/be_scope.cpp
@@ -13,6 +13,7 @@
#include "be_enum.h"
#include "be_operation.h"
#include "be_factory.h"
+#include "be_finder.h"
#include "be_root.h"
#include "be_visitor.h"
@@ -92,6 +93,8 @@ be_scope::decl (void)
return be_operation::narrow_from_scope (this);
case AST_Decl::NT_factory:
return be_factory::narrow_from_scope (this);
+ case AST_Decl::NT_finder:
+ return be_finder::narrow_from_scope (this);
default:
return (be_decl *)0;
}
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
index 629100adadc..c566bcd4406 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
@@ -32,6 +32,7 @@
#include "be_eventtype.h"
#include "be_eventtype_fwd.h"
#include "be_home.h"
+#include "be_finder.h"
#include "be_extern.h"
#include "ast_generator.h"
@@ -357,7 +358,7 @@ be_visitor_ccm_pre_proc::visit_home (be_home *node)
ACE_TEXT ("for implicit interface failed\n")),
-1);
}
-
+/*
if (this->gen_factories (node, xplicit) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -375,7 +376,7 @@ be_visitor_ccm_pre_proc::visit_home (be_home *node)
ACE_TEXT ("for finders declarations failed\n")),
-1);
}
-
+*/
if (this->gen_implicit_ops (node, implicit) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -429,6 +430,118 @@ be_visitor_ccm_pre_proc::visit_eventtype_fwd (be_eventtype_fwd *node)
}
int
+be_visitor_ccm_pre_proc::visit_operation (be_operation *node)
+{
+ UTL_ScopedName sn (node->local_name (), 0);
+
+ be_operation *home_op = 0;
+ ACE_NEW_RETURN (home_op,
+ be_operation (node->return_type (),
+ node->flags (),
+ &sn,
+ node->is_local (),
+ node->is_abstract ()),
+ -1);
+
+ home_op->be_add_exceptions (node->exceptions ());
+
+ idl_global->scopes ().top ()->add_to_scope (home_op);
+ idl_global->scopes ().push (home_op);
+
+ if (this->visit_scope (home_op) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_operation - code generation ")
+ ACE_TEXT ("for scope failed\n")),
+ -1);
+ }
+
+ idl_global->scopes ().pop ();
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::visit_argument (be_argument *node)
+{
+ UTL_ScopedName sn (node->local_name (), 0);
+
+ be_argument *added_arg = 0;
+ ACE_NEW_RETURN (added_arg,
+ be_argument (node->direction (),
+ node->field_type (),
+ &sn),
+ -1);
+
+ idl_global->scopes ().top ()->add_to_scope (added_arg);
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::visit_factory (be_factory *node)
+{
+ UTL_ScopedName sn (node->local_name (), 0);
+
+ be_operation *added_factory = 0;
+ ACE_NEW_RETURN (added_factory,
+ be_operation (comp_,
+ AST_Operation::OP_noflags,
+ &sn,
+ node->is_local (),
+ node->is_abstract ()),
+ -1);
+
+ idl_global->scopes ().top ()->add_to_scope (added_factory);
+ idl_global->scopes ().push (added_factory);
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_factory - code generation ")
+ ACE_TEXT ("for scope failed\n")),
+ -1);
+ }
+
+ idl_global->scopes ().pop ();
+
+ return 0;
+}
+
+int
+be_visitor_ccm_pre_proc::visit_finder (be_finder *node)
+{
+ UTL_ScopedName sn (node->local_name (), 0);
+
+ be_operation *added_finder = 0;
+ ACE_NEW_RETURN (added_finder,
+ be_operation (comp_,
+ AST_Operation::OP_noflags,
+ &sn,
+ node->is_local (),
+ node->is_abstract ()),
+ -1);
+
+ idl_global->scopes ().top ()->add_to_scope (added_finder);
+ idl_global->scopes ().push (added_finder);
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("visit_finder - code generation ")
+ ACE_TEXT ("for scope failed\n")),
+ -1);
+ }
+
+ idl_global->scopes ().pop ();
+
+ return 0;
+}
+
+int
be_visitor_ccm_pre_proc::gen_factories (be_home *node,
AST_Interface *xplicit)
{
@@ -1561,13 +1674,16 @@ be_visitor_ccm_pre_proc::create_explicit (be_home *node)
// We're at global scope here so we need to fool the scope stack
// for a minute so the correct repo id can be calculated at
// interface construction time.
- idl_global->scopes ().push (node->defined_in ());
+ AST_Module *m =
+ AST_Module::narrow_from_scope (node->defined_in ());
+
+ idl_global->scopes ().push (m);
UTL_ScopedName *explicit_name =
- this->create_scoped_name (0,
- node->local_name (),
- "Explicit",
- ScopeAsDecl (node->defined_in ()));
+ this->create_scoped_name ("",
+ node->local_name (),
+ "Explicit",
+ m);
be_interface *i = 0;
ACE_NEW_RETURN (i,
@@ -1579,44 +1695,39 @@ be_visitor_ccm_pre_proc::create_explicit (be_home *node)
false,
false),
0);
-
- // Back to reality.
- idl_global->scopes ().pop ();
-
- i->set_name (explicit_name);
- i->set_defined_in (node->defined_in ());
- i->set_imported (node->imported ());
+
+ (void) m->be_add_interface (i);
+
i->gen_fwd_helper_name ();
i->original_interface (node);
-
- // Reuse the home's decls in the explicit interface. No need
- // to check for name clashes, redefinition, etc. because it
- // has already been done in the home and the explicit interface
- // is empty at this point. Later addition of factory and finder
- // operations will do these checks to make sure they don't
- // clash with the other decls.
- for (UTL_ScopeActiveIterator iter (node, UTL_Scope::IK_decls);
- ! iter.is_done ();
- iter.next ())
- {
- AST_Decl *d = iter.item ();
- d->set_defined_in (i);
- UTL_ScopedName *new_name =
- this->create_scoped_name (0,
- d->local_name ()->get_string (),
- 0,
- i);
- d->set_name (new_name);
- i->add_to_scope (d);
+
+ idl_global->scopes ().push (i);
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_ccm_pre_proc::")
+ ACE_TEXT ("create_explicit - code generation ")
+ ACE_TEXT ("for home scope failed\n")),
+ 0);
}
-
+
+ // Through with the explicit interface scope
+ idl_global->scopes ().pop ();
+
+ explicit_name->destroy ();
+ delete explicit_name;
+ explicit_name = 0;
+
header.destroy ();
+
parent_list->destroy ();
delete parent_list;
parent_list = 0;
+
+ // Through with the scope containing the home.
+ idl_global->scopes ().pop ();
- AST_Module *m = AST_Module::narrow_from_scope (node->defined_in ());
- m->be_add_interface (i);
return i;
}
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_home.cpp b/modules/TAO/TAO_IDL/be/be_visitor_home.cpp
index 705c90751a1..f0519280945 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_home.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_home.cpp
@@ -54,5 +54,4 @@
#include "be_visitor_home/home_ex_idl.cpp"
#include "be_visitor_home/home_exh.cpp"
#include "be_visitor_home/home_exs.cpp"
-#include "be_visitor_home/factory_svs.cpp"
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_home/factory_svs.cpp b/modules/TAO/TAO_IDL/be/be_visitor_home/factory_svs.cpp
deleted file mode 100644
index 8bf3bf91ff5..00000000000
--- a/modules/TAO/TAO_IDL/be/be_visitor_home/factory_svs.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO_IDL_BE
-//
-// = FILENAME
-// factory_svs.cpp
-//
-// = DESCRIPTION
-// Visitor generating code for home factores and finders
-// in the servant source.
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-be_visitor_factory_svs::be_visitor_factory_svs (
- be_visitor_context *ctx,
- be_home *h_node,
- AST_Component *comp,
- bool for_finder)
- : be_visitor_scope (ctx),
- h_node_ (h_node),
- comp_ (comp),
- os_ (*ctx->stream ()),
- for_finder_ (for_finder),
- unused_args_(false)
-{
-}
-
-be_visitor_factory_svs::~be_visitor_factory_svs (void)
-{
-}
-
-int
-be_visitor_factory_svs::visit_factory (be_factory *node)
-{
- os_ << be_nl << be_nl
- << "::" << comp_->name () << "_ptr" << be_nl
- << h_node_->original_local_name ()->get_string ()
- << "_Servant::" << node->local_name ();
-
- return 0;
-}
-
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_home/home_ex_idl.cpp b/modules/TAO/TAO_IDL/be/be_visitor_home/home_ex_idl.cpp
index 35233729108..11a78557e3a 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_home/home_ex_idl.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_home/home_ex_idl.cpp
@@ -158,6 +158,32 @@ be_visitor_home_ex_idl::visit_argument (be_argument *node)
}
int
+be_visitor_home_ex_idl::visit_factory (be_factory *node)
+{
+ os_ << be_nl
+ << "::Components::EnterpriseComponent "
+ << IdentifierHelper::try_escape (node->original_local_name ()).c_str ()
+ << " (" << be_idt << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_ex_idl::")
+ ACE_TEXT ("visit_factory - ")
+ ACE_TEXT ("codegen for scope failed\n")));
+ }
+
+ os_ << ")"
+ << be_uidt << be_uidt;
+
+ this->gen_exception_list (node->exceptions (), "", true);
+
+ os_ << ";";
+
+ return 0;
+}
+
+int
be_visitor_home_ex_idl::visit_sequence (be_sequence *node)
{
// Keep output statements separate because of side effects.
@@ -314,9 +340,6 @@ be_visitor_home_ex_idl::gen_explicit (void)
ACE_TEXT ("visit_scope() failed\n")));
}
- this->gen_factories ();
- this->gen_finders ();
-
os_ << be_uidt_nl
<< "};";
}
@@ -403,52 +426,6 @@ be_visitor_home_ex_idl::gen_exception_list (
}
void
-be_visitor_home_ex_idl::gen_factories (void)
-{
- this->gen_init_ops (node_->factories ());
-}
-
-void
-be_visitor_home_ex_idl::gen_finders (void)
-{
- this->gen_init_ops (node_->finders ());
-}
-
-void
-be_visitor_home_ex_idl::gen_init_ops (AST_Home::INIT_LIST & list)
-{
- AST_Operation **op = 0;
-
- for (AST_Home::INIT_LIST::ITERATOR i = list.begin ();
- !i.done ();
- i.advance ())
- {
- i.next (op);
- be_operation *bop = be_operation::narrow_from_decl (*op);
-
- os_ << be_nl
- << "::Components::EnterpriseComponent "
- << IdentifierHelper::try_escape (bop->original_local_name ()).c_str ()
- << " (" << be_idt << be_idt;
-
- if (this->visit_scope (bop) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_ex_idl::")
- ACE_TEXT ("gen_init_ops - ")
- ACE_TEXT ("visit_scope() failed\n")));
- }
-
- os_ << ")"
- << be_uidt << be_uidt;
-
- this->gen_exception_list (bop->exceptions (), "", true);
-
- os_ << ";";
- }
-}
-
-void
be_visitor_home_ex_idl::gen_home_executor (void)
{
AST_Component *comp = node_->managed_component ();
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_home/home_exh.cpp b/modules/TAO/TAO_IDL/be/be_visitor_home/home_exh.cpp
index 9ebdc43053e..c31a1546633 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_home/home_exh.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_home/home_exh.cpp
@@ -84,6 +84,31 @@ be_visitor_home_exh::visit_attribute (be_attribute *node)
}
int
+be_visitor_home_exh::visit_factory (be_factory *node)
+{
+ os_ << be_nl << be_nl
+ << "virtual ::Components::EnterpriseComponent_ptr" << be_nl
+ << node->local_name ();
+
+ // We can reuse this visitor.
+ be_visitor_valuetype_init_arglist_ch v (this->ctx_);
+
+ if (v.visit_factory (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_exh::")
+ ACE_TEXT ("visit_factory - ")
+ ACE_TEXT ("codegen for argument ")
+ ACE_TEXT ("list failed\n")),
+ -1);
+ }
+
+ os_ << ";";
+
+ return 0;
+}
+
+int
be_visitor_home_exh::gen_exec_class (void)
{
// We don't want a '_cxx_' prefix here.
@@ -105,12 +130,46 @@ be_visitor_home_exh::gen_exec_class (void)
os_ << be_nl << be_nl
<< "virtual ~" << lname << "_exec_i (void);";
- this->gen_ops_attrs ();
-
- this->gen_factories ();
-
- this->gen_finders ();
+ be_home *h = node_;
+ while (h != 0)
+ {
+ if (this->visit_scope (h) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_exh::")
+ ACE_TEXT ("gen_exec_class - ")
+ ACE_TEXT ("visit_scope() failed\n")),
+ -1);
+ }
+
+ for (long i = 0; i < h->n_inherits (); ++i)
+ {
+ // A closure of all the supported interfaces is stored
+ // in the base class 'pd_inherits_flat' member.
+ be_interface *bi =
+ be_interface::narrow_from_decl (h->inherits ()[i]);
+
+ int status =
+ bi->traverse_inheritance_graph (
+ be_visitor_home_exh::op_attr_decl_helper,
+ &os_);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_exh::")
+ ACE_TEXT ("gen_exec_class - ")
+ ACE_TEXT ("traverse_inheritance_graph() ")
+ ACE_TEXT ("failed on %s\n"),
+ bi->full_name ()),
+ -1);
+ }
+ }
+
+ h = be_home::narrow_from_decl (h->base_home ());
+ }
+
os_ << be_nl << be_nl
<< "// Implicit operations.";
@@ -124,129 +183,6 @@ be_visitor_home_exh::gen_exec_class (void)
return 0;
}
-int
-be_visitor_home_exh::gen_ops_attrs (void)
-{
- os_ << be_nl << be_nl
- << "// All operations and attributes.";
-
- int status =
- node_->traverse_inheritance_graph (
- be_visitor_home_exh::op_attr_decl_helper,
- &os_);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_exh::")
- ACE_TEXT ("gen_ops_attrs - ")
- ACE_TEXT ("traverse_inheritance_graph() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- return 0;
-}
-
-int
-be_visitor_home_exh::gen_factories (void)
-{
- os_ << be_nl << be_nl
- << "// Factory operations.";
-
- return this->gen_factories_r (node_);
-}
-
-int
-be_visitor_home_exh::gen_factories_r (AST_Home *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->gen_init_ops_i (node->factories ()) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_exh::")
- ACE_TEXT ("gen_factories_r - ")
- ACE_TEXT ("gen_init_ops_i() failed\n")),
- -1);
- }
-
- AST_Home *base = node->base_home ();
-
- return this->gen_factories_r (base);
-}
-
-int
-be_visitor_home_exh::gen_finders (void)
-{
- os_ << be_nl << be_nl
- << "// Finder operations.";
-
- return this->gen_finders_r (node_);
-}
-
-int
-be_visitor_home_exh::gen_finders_r (AST_Home *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->gen_init_ops_i (node->finders ()) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_exh::")
- ACE_TEXT ("gen_finders_r - ")
- ACE_TEXT ("gen_init_ops_i() failed\n")),
- -1);
- }
-
- AST_Home *base = node->base_home ();
-
- return this->gen_finders_r (base);
-}
-
-int
-be_visitor_home_exh::gen_init_ops_i (AST_Home::INIT_LIST & list)
-{
- AST_Operation **op = 0;
-
- for (AST_Home::INIT_LIST::ITERATOR i = list.begin ();
- !i.done ();
- i.advance ())
- {
- i.next (op);
- be_operation *bop = be_operation::narrow_from_decl (*op);
-
- /// Return type for home exec factories and finders is not
- /// the same as for the corresponding home servant, so we
- /// generate the return type and op name by hand, then finish
- /// the operation traversal with an arglist visitor.
- os_ << be_nl << be_nl
- << "::Components::EnterpriseComponent_ptr" << be_nl
- << bop->local_name ();
-
- be_visitor_operation_arglist visitor (this->ctx_);
-
- if (visitor.visit_operation (bop) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_exh::")
- ACE_TEXT ("gen_init_ops_i - ")
- ACE_TEXT ("visit_operation() failed\n")),
- -1);
- }
-
- os_ << ";";
- }
-
- return 0;
-}
-
void
be_visitor_home_exh::gen_entrypoint (void)
{
@@ -273,5 +209,3 @@ be_visitor_home_exh::op_attr_decl_helper (be_interface * /* derived */,
/// visit_attribute(), we can get away with this for the declarations.
return visitor.visit_scope (ancestor);
}
-
-
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_home/home_exs.cpp b/modules/TAO/TAO_IDL/be/be_visitor_home/home_exs.cpp
index 7fa9c539455..28befbbacfb 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_home/home_exs.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_home/home_exs.cpp
@@ -89,6 +89,42 @@ be_visitor_home_exs::visit_attribute (be_attribute *node)
}
int
+be_visitor_home_exs::visit_factory (be_factory *node)
+{
+ AST_Decl *scope = ScopeAsDecl (comp_->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+ const char *lname = comp_->local_name ()->get_string ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl << be_nl
+ << "::Components::EnterpriseComponent_ptr" << be_nl
+ << node_->original_local_name ()->get_string ()
+ << "_exec_i::" << node->local_name ();
+
+ be_visitor_operation_arglist visitor (this->ctx_);
+ visitor.unused (true);
+
+ if (visitor.visit_factory (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_exs::")
+ ACE_TEXT ("visit_factory - ")
+ ACE_TEXT ("codegen for arglist failed\n")),
+ -1);
+ }
+
+ os_ << be_nl
+ << "{" << be_idt_nl
+ << your_code_here_ << be_nl
+ << "return " << global << sname << "::CCM_"
+ << lname << "::_nil ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
be_visitor_home_exs::gen_exec_class (void)
{
// No '_cxx_' prefix.
@@ -110,12 +146,54 @@ be_visitor_home_exs::gen_exec_class (void)
<< lname << "_exec_i::~" << lname << "_exec_i (void)" << be_nl
<< "{" << be_nl
<< "}";
-
- this->gen_ops_attrs ();
-
- this->gen_factories ();
-
- this->gen_finders ();
+
+ be_home *h = node_;
+
+ while (h != 0)
+ {
+ if (this->visit_scope (h) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_exs::")
+ ACE_TEXT ("gen_exec_class - ")
+ ACE_TEXT ("codegen for scope ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ for (long i = 0; i < h->n_inherits (); ++i)
+ {
+ // A closure of all the supported interfaces is stored
+ // in the base class 'pd_inherits_flat' member.
+ be_interface *bi =
+ be_interface::narrow_from_decl (h->inherits ()[i]);
+
+ bi->get_insert_queue ().reset ();
+ bi->get_del_queue ().reset ();
+ bi->get_insert_queue ().enqueue_tail (bi);
+
+ Home_Exec_Op_Attr_Generator op_attr_gen (this);
+
+ int status =
+ bi->traverse_inheritance_graph (op_attr_gen,
+ &os_,
+ false,
+ false);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_exs::")
+ ACE_TEXT ("gen_exec_class - ")
+ ACE_TEXT ("traverse_inheritance_graph() ")
+ ACE_TEXT ("failed for %s\n"),
+ bi->full_name ()),
+ -1);
+ }
+ }
+
+ h = be_home::narrow_from_decl (h->base_home ());
+ }
os_ << be_nl << be_nl
<< "// Implicit operations.";
@@ -140,150 +218,6 @@ be_visitor_home_exs::gen_exec_class (void)
return 0;
}
-int
-be_visitor_home_exs::gen_ops_attrs (void)
-{
- os_ << be_nl << be_nl
- << "// All operations and attributes.";
-
- node_->get_insert_queue ().reset ();
- node_->get_del_queue ().reset ();
- node_->get_insert_queue ().enqueue_tail (node_);
-
- Home_Exec_Op_Attr_Generator op_attr_gen (this);
-
- int status =
- node_->traverse_inheritance_graph (op_attr_gen,
- &os_,
- false,
- false);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_exs::")
- ACE_TEXT ("gen_ops_attrs - ")
- ACE_TEXT ("traverse_inheritance_graph() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- return 0;
-}
-
-int
-be_visitor_home_exs::gen_factories (void)
-{
- os_ << be_nl << be_nl
- << "// Factory operations.";
-
- return this->gen_factories_r (node_);
-}
-
-int
-be_visitor_home_exs::gen_factories_r (AST_Home *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->gen_init_ops_i (node->factories ()) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_exs::")
- ACE_TEXT ("gen_factories_r - ")
- ACE_TEXT ("gen_init_ops_i() failed\n")),
- -1);
- }
-
- AST_Home *base = node->base_home ();
-
- return this->gen_factories_r (base);
-}
-
-int
-be_visitor_home_exs::gen_finders (void)
-{
- os_ << be_nl << be_nl
- << "// Finder operations.";
-
- return this->gen_finders_r (node_);
-}
-
-int
-be_visitor_home_exs::gen_finders_r (AST_Home *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->gen_init_ops_i (node->finders ()) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_exs::")
- ACE_TEXT ("gen_finders_r - ")
- ACE_TEXT ("gen_init_ops_i() failed\n")),
- -1);
- }
-
- AST_Home *base = node->base_home ();
-
- return this->gen_finders_r (base);
-}
-
-int
-be_visitor_home_exs::gen_init_ops_i (AST_Home::INIT_LIST & list)
-{
- AST_Decl *scope = ScopeAsDecl (comp_->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
- const char *lname = comp_->local_name ()->get_string ();
- const char *global = (sname_str == "" ? "" : "::");
-
- AST_Operation **op = 0;
-
- for (AST_Home::INIT_LIST::ITERATOR i = list.begin ();
- !i.done ();
- i.advance ())
- {
- i.next (op);
- be_operation *bop = be_operation::narrow_from_decl (*op);
-
- /// Return type for home exec factories and finders is not
- /// the same as for the corresponding home servant, so we
- /// generate the return type and op name by hand, then finish
- /// the operation traversal with an arglist visitor.
- os_ << be_nl << be_nl
- << "::Components::EnterpriseComponent_ptr" << be_nl
- << node_->original_local_name ()->get_string ()
- << "_exec_i::"
- << bop->local_name ();
-
- be_visitor_operation_arglist visitor (this->ctx_);
- visitor.unused (true);
-
- if (visitor.visit_operation (bop) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_exs::")
- ACE_TEXT ("gen_init_ops_i - ")
- ACE_TEXT ("visit_operation() failed\n")),
- -1);
- }
-
- os_ << be_nl
- << "{" << be_idt_nl
- << your_code_here_ << be_nl
- << "return " << global << sname << "::CCM_"
- << lname << "::_nil ();" << be_uidt_nl
- << "}";
- }
-
- return 0;
-}
-
void
be_visitor_home_exs::gen_entrypoint (void)
{
@@ -318,4 +252,3 @@ Home_Exec_Op_Attr_Generator::emit (be_interface * /* derived_interface */,
return visitor_->visit_scope (base_interface);
}
-
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_home/home_svh.cpp b/modules/TAO/TAO_IDL/be/be_visitor_home/home_svh.cpp
index 8adaf80bc87..c6c3118fb0b 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_home/home_svh.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_home/home_svh.cpp
@@ -200,6 +200,30 @@ be_visitor_home_svh::gen_servant_class (void)
-1);
}
+ for (long i = 0; i < h->n_inherits (); ++i)
+ {
+ // A closure of all the supported interfaces is stored
+ // in the base class 'pd_inherits_flat' member.
+ be_interface *bi =
+ be_interface::narrow_from_decl (h->inherits ()[i]);
+
+ int status =
+ bi->traverse_inheritance_graph (
+ be_visitor_home_svh::op_attr_decl_helper,
+ &os_);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_svh::")
+ ACE_TEXT ("gen_servant_class - ")
+ ACE_TEXT ("traverse_inheritance_graph() ")
+ ACE_TEXT ("failed for %s\n"),
+ bi->full_name ()),
+ -1);
+ }
+ }
+
h = be_home::narrow_from_decl (h->base_home ());
}
@@ -222,4 +246,21 @@ be_visitor_home_svh::gen_entrypoint (void)
<< "const char * ins_name);" << be_uidt;
}
+int
+be_visitor_home_svh::op_attr_decl_helper (be_interface * /* derived */,
+ be_interface *ancestor,
+ TAO_OutStream *os)
+{
+ /// We're in a static method, so we have to instantiate a temporary
+ /// visitor and context.
+ be_visitor_context ctx;
+ ctx.state (TAO_CodeGen::TAO_ROOT_SVH);
+ ctx.stream (os);
+ be_visitor_home_svh visitor (&ctx);
+
+ /// Since this visitor overriddes only visit_operation() and
+ /// visit_attribute(), we can get away with this for the declarations.
+ return visitor.visit_scope (ancestor);
+}
+
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_home/home_svs.cpp b/modules/TAO/TAO_IDL/be/be_visitor_home/home_svs.cpp
index 6d2b4e11807..43c1ffc95bc 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_home/home_svs.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_home/home_svs.cpp
@@ -111,19 +111,71 @@ be_visitor_home_svs::visit_argument (be_argument *node)
int
be_visitor_home_svs::visit_factory (be_factory *node)
{
- be_visitor_factory_svs v (this->ctx_,
- node_,
- comp_,
- this->for_finder_);
-
- if (v.visit_factory (node) != 0)
+ os_ << be_nl << be_nl
+ << "::" << comp_->name () << "_ptr" << be_nl
+ << node_->original_local_name ()->get_string ()
+ << "_Servant::" << node->local_name ();
+
+ be_visitor_operation_arglist al_visitor (this->ctx_);
+ al_visitor.unused (this->for_finder_);
+
+ if (al_visitor.visit_factory (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_svs::")
- ACE_TEXT ("visit_factory - ")
- ACE_TEXT ("traversal failed\n")),
+ "be_visitor_factory_svs::"
+ "visit_factory - "
+ "codegen for argument list failed\n"),
-1);
}
+
+ os_ << be_nl
+ << "{" << be_idt_nl;
+
+ if (this->for_finder_)
+ {
+ os_ << "throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,"
+ << be_nl
+ << " CORBA::COMPLETED_NO);";
+ }
+ else
+ {
+ ACE_CString comp_sname_str (
+ ScopeAsDecl (comp_->defined_in ())->full_name ());
+ const char *comp_sname = comp_sname_str.c_str ();
+ const char *comp_lname = comp_->local_name ()->get_string ();
+ const char *global = (comp_sname_str == "" ? "" : "::");
+
+ os_ << "::Components::EnterpriseComponent_var _ciao_ec ="
+ << be_idt_nl
+ << "this->executor_->" << node->local_name () << " (";
+
+ if (node->argument_count () > 0)
+ {
+ os_ << be_idt_nl;
+
+ if (this->visit_scope (node) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_factory_svs::"
+ "visit_factory - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ os_ << be_uidt;
+ }
+
+ os_ << ");" << be_uidt_nl << be_nl
+ << global << comp_sname << "::CCM_" << comp_lname
+ << "_var _ciao_comp =" << be_idt_nl
+ << global << comp_sname << "::CCM_" << comp_lname
+ << "::_narrow (_ciao_ec.in ());" << be_uidt_nl << be_nl
+ << "return this->_ciao_activate_component "
+ << "(_ciao_comp.in ());";
+ }
+
+ os_ << be_uidt_nl
+ << "}";
// In case it was set for the call above.
this->for_finder_ = false;
@@ -236,217 +288,39 @@ be_visitor_home_svs::gen_servant_class (void)
-1);
}
- h = be_home::narrow_from_decl (h->base_home ());
- }
-
-/*
- this->gen_ops_attrs ();
-
- os_ << be_nl << be_nl
- << "/// Factory operations.";
-
- this->gen_factories_r (node_);
-
- os_ << be_nl << be_nl
- << "/// Finder operations.";
-
- this->gen_finders_r (node_);
-*/
- return 0;
-}
-
-int
-be_visitor_home_svs::gen_ops_attrs (void)
-{
- os_ << be_nl << be_nl
- << "/// All home operations and attributes.";
-
- node_->get_insert_queue ().reset ();
- node_->get_del_queue ().reset ();
- node_->get_insert_queue ().enqueue_tail (node_);
-
- Home_Op_Attr_Generator op_attr_gen (this);
-
- int status =
- node_->traverse_inheritance_graph (op_attr_gen,
- &os_,
- false,
- false);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_svs::")
- ACE_TEXT ("gen_ops_attrs - ")
- ACE_TEXT ("traverse_inheritance_graph() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- return 0;
-}
-
-int
-be_visitor_home_svs::gen_factories (void)
-{
- return this->gen_factories_r (node_);
-}
-
-int
-be_visitor_home_svs::gen_factories_r (AST_Home *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->gen_init_ops (node->factories (), false) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_svs::")
- ACE_TEXT ("gen_factories_r - ")
- ACE_TEXT ("gen_init_ops_i() failed\n")),
- -1);
- }
-
- AST_Home *base = node->base_home ();
-
- return this->gen_factories_r (base);
-}
-
-int
-be_visitor_home_svs::gen_finders (void)
-{
- os_ << be_nl << be_nl
- << "// Finder operations.";
-
- return this->gen_finders_r (node_);
-}
-
-int
-be_visitor_home_svs::gen_finders_r (AST_Home *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- if (this->gen_init_ops (node->finders (), true) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_svs::")
- ACE_TEXT ("gen_finders_r - ")
- ACE_TEXT ("gen_init_ops_i() failed\n")),
- -1);
- }
-
- AST_Home *base = node->base_home ();
-
- return this->gen_finders_r (base);
-}
-
-int
-be_visitor_home_svs::gen_init_ops (AST_Home::INIT_LIST & list,
- bool finder_list)
-{
- AST_Operation **op = 0;
- ACE_CString comp_sname_str (
- ScopeAsDecl (comp_->defined_in ())->full_name ());
- const char *comp_sname = comp_sname_str.c_str ();
- const char *comp_lname = comp_->local_name ()->get_string ();
- const char *global = (comp_sname_str == "" ? "" : "::");
-
- for (AST_Home::INIT_LIST::ITERATOR i = list.begin ();
- !i.done ();
- i.advance ())
- {
- i.next (op);
- be_operation *bop = be_operation::narrow_from_decl (*op);
-
- // Retrieve the operation return type.
- be_type *bt = be_type::narrow_from_decl (bop->return_type ());
-
- if (bt == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_home_svs::"
- "gen_init_ops - "
- "Bad return type\n"),
- -1);
- }
-
- os_ << be_nl << be_nl;
-
- be_visitor_operation_rettype rt_visitor (this->ctx_);
-
- if (bt->accept (&rt_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_home_svs::"
- "gen_init_ops - "
- "codegen for return type failed\n"),
- -1);
- }
-
- os_ << be_nl
- << node_->original_local_name ()->get_string ()
- << "_Servant::" << bop->local_name ();
-
- be_visitor_operation_arglist al_visitor (this->ctx_);
-
- // Finder operations are as yet unimplemented in CIAO, so
- // any args will be unused and should be commented out.
- al_visitor.unused (finder_list);
-
- if (bop->accept (&al_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_home_svs::"
- "gen_init_ops - "
- "codegen for argument list failed\n"),
- -1);
- }
-
- os_ << be_nl
- << "{" << be_idt_nl;
-
- if (finder_list)
+ for (long i = 0; i < h->n_inherits (); ++i)
{
- os_ << "throw ::CORBA::NO_IMPLEMENT ();";
- }
- else
- {
- os_ << "::Components::EnterpriseComponent_var _ciao_ec ="
- << be_idt_nl
- << "this->executor_->" << bop->local_name () << " (";
-
- if (bop->argument_count () != 0)
+ // A closure of all the supported interfaces is stored
+ // in the base class 'pd_inherits_flat' member.
+ be_interface *bi =
+ be_interface::narrow_from_decl (h->inherits ()[i]);
+
+ bi->get_insert_queue ().reset ();
+ bi->get_del_queue ().reset ();
+ bi->get_insert_queue ().enqueue_tail (bi);
+
+ Home_Op_Attr_Generator op_attr_gen (this);
+
+ int status =
+ bi->traverse_inheritance_graph (op_attr_gen,
+ &os_,
+ false,
+ false);
+
+ if (status == -1)
{
- os_ << be_idt_nl;
-
- if (this->visit_scope (bop) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_home_svs")
- ACE_TEXT ("::gen_init_ops - ")
- ACE_TEXT ("visit_scope() failed\n")),
- -1);
- }
-
- os_ << be_uidt;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_home_svs::")
+ ACE_TEXT ("gen_servant_class - ")
+ ACE_TEXT ("traverse_inheritance_graph() ")
+ ACE_TEXT ("failed for %s\n"),
+ bi->full_name ()),
+ -1);
}
- os_ << ");" << be_uidt_nl << be_nl
- << global << comp_sname << "::CCM_" << comp_lname
- << "_var _ciao_comp =" << be_idt_nl
- << global << comp_sname << "::CCM_" << comp_lname
- << "::_narrow (_ciao_ec.in ());" << be_uidt_nl << be_nl
- << "return this->_ciao_activate_component "
- << "(_ciao_comp.in ());";
- }
-
- os_ << be_uidt_nl
- << "}";
+ }
+
+ h = be_home::narrow_from_decl (h->base_home ());
}
return 0;
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_operation.cpp b/modules/TAO/TAO_IDL/be/be_visitor_operation.cpp
index e6ceb76baa5..fdd8490a9b9 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_operation.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_operation.cpp
@@ -42,6 +42,7 @@
#include "be_eventtype.h"
#include "be_eventtype_fwd.h"
#include "be_home.h"
+#include "be_factory.h"
#include "be_extern.h"
#include "be_helper.h"
#include "be_identifier_helper.h"
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
index edfad396bd6..675b1518896 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
@@ -112,6 +112,48 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
}
int
+be_visitor_operation_arglist::visit_factory (be_factory *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ bool has_args = node->argument_count () > 0;
+
+ *os << " (";
+
+ if (has_args)
+ {
+ *os << be_idt_nl;
+ }
+
+ // All we do is hand over code generation to our scope.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_operation_arglist::")
+ ACE_TEXT ("visit_factory - ")
+ ACE_TEXT ("codegen for scope failed\n")),
+ -1);
+ }
+
+ if (!has_args)
+ {
+ *os << "void";
+ }
+
+ *os << ")";
+
+ if (has_args)
+ {
+ *os << be_uidt;
+ }
+
+ // At present, visit_factory() is called only from the home
+ // servant source visitor, so we don't need to check the state
+ // for semicolon generation.
+
+ return 0;
+}
+
+int
be_visitor_operation_arglist::visit_argument (be_argument *node)
{
// Get the visitor that will dump the argument's mapping in the operation
@@ -124,32 +166,25 @@ be_visitor_operation_arglist::visit_argument (be_argument *node)
// generate the appropriate relative scoped names.
be_operation *op =
be_operation::narrow_from_scope (this->ctx_->scope ());
-
- if (op == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_arglist::"
- "visit_argument - "
- "Bad operation\n"),
- -1);
- }
+ be_interface *intf = 0;
// We need the interface node in which this operation was defined. However,
// if this operation node was an attribute node in disguise, we get this
// information from the context
- be_interface *intf = this->ctx_->attribute ()
- ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
- : be_interface::narrow_from_scope (op->defined_in ());
-
- if (!intf)
+ if (op == 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_arglist::"
- "visit_argument - "
- "Bad interface\n"),
- -1);
+ be_factory *f =
+ be_factory::narrow_from_scope (this->ctx_->scope ());
+
+ intf = be_interface::narrow_from_scope (f->defined_in ());
}
-
+ else
+ {
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (op->defined_in ());
+ }
+
// Set new scope.
ctx.scope (intf);
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/modules/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
index 4d8a91e5c4e..bf8fac0eea1 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
@@ -131,6 +131,13 @@ be_visitor_obv_operation_arglist::visit_argument (be_argument *node)
be_operation *op =
be_operation::narrow_from_decl (this->ctx_->node ());
+ // Sometimes the operation is stored in the context scope instead.
+ if (op == 0)
+ {
+ op =
+ be_operation::narrow_from_scope (this->ctx_->scope ());
+ }
+
if (op == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp b/modules/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
index 3896bb95bb8..345bc7d2bf7 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
@@ -89,7 +89,7 @@ be_visitor_valuetype_init_arglist_ch::post_process (be_decl *bd)
TAO_OutStream *os = this->ctx_->stream ();
// If we are not the last node in the list of arguments, generate a comma.
- if (!this->last_node (bd))
+ if (! this->last_node (bd))
{
*os << "," << be_nl;
}
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h b/modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
index fbcea505907..d562a80871a 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
@@ -59,6 +59,11 @@ public:
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_argument (be_argument *node);
+ virtual int visit_factory (be_factory *node);
+ virtual int visit_finder (be_finder *node);
+
private:
// Utility methods to handle the corresponding IDL declarations.
int gen_factories (be_home *node,
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_home.h b/modules/TAO/TAO_IDL/be_include/be_visitor_home.h
index ce1eab2c414..9c4d117bdf2 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_home.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_home.h
@@ -36,6 +36,5 @@
#include "be_visitor_home/home_ex_idl.h"
#include "be_visitor_home/home_exh.h"
#include "be_visitor_home/home_exs.h"
-#include "be_visitor_home/factory_svs.h"
#endif
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_home/factory_svs.h b/modules/TAO/TAO_IDL/be_include/be_visitor_home/factory_svs.h
deleted file mode 100644
index 2b109117e06..00000000000
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_home/factory_svs.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// $Id$
-//
-/* -*- c++ -*- */
-// ============================================================================
-//
-// = LIBRARY
-// TAO_IDL_BE
-//
-// = FILENAME
-// factory_svs.h
-//
-// = DESCRIPTION
-// Concrete visitor for home factory and finder nodes.
-// This provides for code generation in the servant source
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-#ifndef _BE_HOME_FACTORY_SVS_H_
-#define _BE_HOME_FACTORY_SVS_H_
-
-class be_visitor_factory_svs : public be_visitor_scope
-{
- //
- // = TITLE
- // be_visitor_factory_svs
- //
- // = DESCRIPTION
- // This is a concrete visitor to generate the servant
- // source for a home factory or finder.
- //
- //
-public:
- be_visitor_factory_svs (be_visitor_context *ctx,
- be_home *h_node,
- AST_Component *comp,
- bool for_finder);
-
- ~be_visitor_factory_svs (void);
-
- virtual int visit_factory (be_factory *node);
-
-private:
- be_home *h_node_;
- AST_Component *comp_;
- TAO_OutStream &os_;
- bool for_finder_;
- bool unused_args_;
-};
-
-#endif /* _BE_HOME_FACTORY_SVS_H_ */
-
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_ex_idl.h b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_ex_idl.h
index d47d19c42c8..fe036bdb105 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_ex_idl.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_ex_idl.h
@@ -40,10 +40,10 @@ public:
virtual int visit_home (be_home *node);
- /// To regenerate attribute & operation declarations.
virtual int visit_attribute (be_attribute *node);
virtual int visit_operation (be_operation *node);
virtual int visit_argument (be_argument *node);
+ virtual int visit_factory (be_factory *node);
/// To regenerate the name of an anonymous type.
/// Anonymous arrays are not allowed.
@@ -64,10 +64,6 @@ private:
const char *prefix = "",
bool init_op = false);
- void gen_factories (void);
- void gen_finders (void);
- void gen_init_ops (AST_Home::INIT_LIST & list);
-
void gen_home_executor (void);
/// The CCM preproc visitor changed the scoped name and the
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exh.h b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exh.h
index 781d77779b7..30fa01f07f9 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exh.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exh.h
@@ -41,21 +41,7 @@ public:
virtual int visit_home (be_home *node);
virtual int visit_operation (be_operation *node);
virtual int visit_attribute (be_attribute *node);
-
-private:
- int gen_exec_class (void);
-
- int gen_ops_attrs (void);
-
- int gen_factories (void);
- int gen_factories_r (AST_Home *node);
-
- int gen_finders (void);
- int gen_finders_r (AST_Home *node);
-
- int gen_init_ops_i (AST_Home::INIT_LIST & list);
-
- void gen_entrypoint (void);
+ virtual int visit_factory (be_factory *node);
/// Helper method passed to traverse_inheritance_graph(),
/// collects supported operations and attributes.
@@ -64,6 +50,11 @@ private:
TAO_OutStream *);
private:
+ int gen_exec_class (void);
+
+ void gen_entrypoint (void);
+
+private:
be_home *node_;
AST_Component *comp_;
TAO_OutStream &os_;
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exs.h b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exs.h
index 7e97dd71af7..b4f992ba0c2 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exs.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_exs.h
@@ -41,20 +41,11 @@ public:
virtual int visit_home (be_home *node);
virtual int visit_operation (be_operation *node);
virtual int visit_attribute (be_attribute *node);
+ virtual int visit_factory (be_factory *node);
private:
int gen_exec_class (void);
- int gen_ops_attrs (void);
-
- int gen_factories (void);
- int gen_factories_r (AST_Home *node);
-
- int gen_finders (void);
- int gen_finders_r (AST_Home *node);
-
- int gen_init_ops_i (AST_Home::INIT_LIST & list);
-
void gen_entrypoint (void);
private:
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svh.h b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svh.h
index 049801b7d7e..a56852de596 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svh.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svh.h
@@ -48,6 +48,12 @@ private:
void gen_entrypoint (void);
+ /// Helper method passed to traverse_inheritance_graph(),
+ /// collects supported operations and attributes.
+ static int op_attr_decl_helper (be_interface *,
+ be_interface *,
+ TAO_OutStream *);
+
private:
be_home *node_;
AST_Component *comp_;
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svs.h b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svs.h
index 2fe0736ad4d..239eda8dfb8 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svs.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_home/home_svs.h
@@ -48,25 +48,8 @@ public:
private:
int gen_servant_class (void);
- int gen_ops_attrs (void);
-
- int gen_factories (void);
- int gen_factories_r (AST_Home *node);
-
- int gen_finders (void);
- int gen_finders_r (AST_Home *node);
-
- int gen_init_ops (AST_Home::INIT_LIST & list,
- bool finder_list);
-
void gen_entrypoint (void);
- /// Helper method passed to traverse_inheritance_graph(),
- /// collects supported operations and attributes.
- static int op_attr_defn_helper (be_interface *,
- be_interface *,
- TAO_OutStream *);
-
private:
be_home *node_;
AST_Component *comp_;
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h b/modules/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h
index ee03504ded5..1745f5c03e8 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_operation/arglist.h
@@ -38,19 +38,15 @@ class be_visitor_operation_arglist : public be_visitor_operation
//
public:
be_visitor_operation_arglist (be_visitor_context *ctx);
- // constructor
~be_visitor_operation_arglist (void);
- // destructor
virtual int visit_operation (be_operation *node);
- // visit the operation
-
+ virtual int visit_factory (be_factory *node);
virtual int visit_argument (be_argument *node);
- // visit each argument
virtual int post_process (be_decl *);
- // stuff to o/p after each element of the scope is handled.
+ // Stuff to output after each element of the scope is handled.
void unused (bool val);
// Set the member.