summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-07-22 01:58:08 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-07-22 01:58:08 +0000
commitd9c3dc2d60f7592a81d624f1c7de1456a3faad5a (patch)
tree350ac91b5ef1907679b7dd96b1686fa7eb101622
parent96aea82837c8cf584f22c631a21aa2e66246a76d (diff)
downloadATCD-d9c3dc2d60f7592a81d624f1c7de1456a3faad5a.tar.gz
ChangeLogTag: Mon Jul 21 20:55:38 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog_ref27
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_valuetype.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp76
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp70
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp291
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation.cpp180
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp153
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp8
-rw-r--r--TAO/TAO_IDL/include/idl_global.h1
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp10
19 files changed, 354 insertions, 566 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref
index 2240997a316..2ef675de4d4 100644
--- a/TAO/ChangeLog_ref
+++ b/TAO/ChangeLog_ref
@@ -1,3 +1,30 @@
+Mon Jul 21 20:55:38 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be/be_interface.cpp:
+ * TAO_IDL/be/be_valuetype.cpp:
+ * TAO_IDL/be/be_visitor_constant/constant_cs.cpp:
+ * TAO_IDL/be/be_visitor_interface/interface_ch.cpp:
+ * TAO_IDL/be/be_visitor_interface/interface_cs.cpp:
+ * TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp:
+ * TAO_IDL/be/be_visitor_module/module_ch.cpp:
+ * TAO_IDL/be/be_visitor_module/module_sh.cpp:
+ * TAO_IDL/be/be_visitor_operation/operation.cpp:
+ * TAO_IDL/be/be_visitor_operation/operation_cs.cpp:
+ * TAO_IDL/be/be_visitor_root/root.cpp:
+ * TAO_IDL/be/be_visitor_root/root_ch.cpp:
+ * TAO_IDL/be/be_visitor_root/root_sth.cpp:
+ * TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp:
+ * TAO_IDL/be/be_visitor_valuetype/obv_module.cpp:
+ * TAO_IDL/include/idl_global.h:
+ * TAO_IDL/util/utl_global.cpp:
+
+ - Replaced use of 'TAO_NAMESPACE' in generated code with
+ 'namespace', along with related macros.
+
+ - Modified stub-side generated code to match Bala's
+ latest hand-crafted changes to support collocation.
+
Mon Jul 21 13:11:40 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
* tao/TAO.dsp:
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 4b2b5c46bb7..8868004a4c8 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -452,6 +452,8 @@ TAO_CodeGen::start_server_header (const char *fname)
// registers the POA factory with the Service_Configurator, so
// the ORB can automatically find it.
this->gen_standard_include (this->server_header_,
+ "tao/Collocation_Proxy_Broker.h");
+ this->gen_standard_include (this->server_header_,
"tao/PortableServer/PortableServer.h");
this->gen_standard_include (this->server_header_,
"tao/PortableServer/Servant_Base.h");
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 69d19ededed..289583d772c 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -95,10 +95,18 @@ be_interface::be_interface (UTL_ScopedName *n,
ACE_NEW (this->strategy_,
be_interface_default_strategy (this));
- if (abstract && this->is_defined ())
+ if (this->is_defined ())
{
+ // Set the flag that says we have a interface in this IDL file.
ACE_SET_BITS (idl_global->decls_seen_info_,
- idl_global->decls_seen_masks.abstract_iface_seen_);
+ idl_global->decls_seen_masks.interface_seen_);
+
+ if (abstract)
+ {
+ // Set the flag for abstract interface seen in this IDL file.
+ ACE_SET_BITS (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.abstract_iface_seen_);
+ }
}
}
diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp
index a5cc536d609..ba7fc2dd9a2 100644
--- a/TAO/TAO_IDL/be/be_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype.cpp
@@ -206,7 +206,7 @@ be_valuetype::gen_helper_header (char*,
<< "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- *os << "TAO_NAMESPACE CORBA" << be_nl
+ *os << "namespace CORBA" << be_nl
<< "{"
<< be_idt_nl
<< "TAO_NAMESPACE_STORAGE_CLASS void add_ref ("
@@ -215,8 +215,7 @@ be_valuetype::gen_helper_header (char*,
<< this->full_name () << " *);";
*os << be_uidt_nl
- << "}" << be_nl
- << "TAO_NAMESPACE_CLOSE";
+ << "}";
return 0;
}
@@ -237,7 +236,7 @@ be_valuetype::gen_helper_inline (char*,
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
*os << "#if defined (__ACE_INLINE__)" << be_nl << be_nl
- << "TAO_NAMESPACE CORBA" << be_nl
+ << "namespace CORBA" << be_nl
<< "{"
<< be_idt_nl
<< "TAO_NAMESPACE_STORAGE_CLASS void add_ref ("
@@ -245,8 +244,7 @@ be_valuetype::gen_helper_inline (char*,
<< "TAO_NAMESPACE_STORAGE_CLASS void remove_ref ("
<< this->full_name () << " *);"
<< be_uidt_nl
- << "}" << be_nl
- << "TAO_NAMESPACE_CLOSE" << be_nl << be_nl
+ << "}" << be_nl << be_nl
<< "#endif /*__ACE_INLINE__*/";
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp
index d60696b0bd3..455e55432bf 100644
--- a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp
@@ -94,8 +94,8 @@ be_visitor_constant_cs::gen_nested_namespace_begin (be_module *node)
if (ACE_OS::strcmp (item_name, "") != 0)
{
// leave the outermost root scope.
- *os << "TAO_NAMESPACE_BEGIN (" << item_name
- << ")" << be_nl;
+ *os << "namespace " << item_name << be_nl
+ << "{" << be_nl;
}
}
@@ -114,7 +114,7 @@ be_visitor_constant_cs::gen_nested_namespace_end (be_module *node)
if (ACE_OS::strcmp (i.item ()->get_string (), "") != 0)
{
// leave the outermost root scope.
- *os << "TAO_NAMESPACE_END" << be_nl;
+ *os << "}" << be_nl;
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
index 3a6e1243271..0f8d246cb53 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -55,16 +55,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
// Now the interface definition itself.
os->gen_ifdef_macro (node->flat_name ());
- if (!node->is_local () && !node->is_abstract ())
- {
- // Forward class declarations.
- *os << be_nl << be_nl
- << "class " << node->base_proxy_impl_name () << ";" << be_nl
- << "class " << node->remote_proxy_impl_name () << ";" << be_nl
- << "class " << node->base_proxy_broker_name () << ";" << be_nl
- << "class " << node->remote_proxy_broker_name () << ";";
- }
-
// Now generate the class definition.
*os << be_nl << be_nl
<< "class " << be_global->stub_export_macro ()
@@ -256,7 +246,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
// Add the Proxy Broker member variable.
*os << be_uidt_nl
<< "private:" << be_idt_nl
- << node->base_proxy_broker_name () << " *"
+ << "TAO::Collocation_Proxy_Broker *"
<< "the" << node->base_proxy_broker_name ()
<< "_;";
}
@@ -313,17 +303,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
// Protected destructor.
*os << "virtual ~" << node->local_name () << " (void);";
- if (! node->is_abstract () && ! node->is_local ())
- {
- // Friends declarations.
- *os << be_nl << be_nl
- << "friend class " << node->remote_proxy_impl_name () << ";"
- << be_nl
- << "friend class " << node->thru_poa_proxy_impl_name () << ";"
- << be_nl
- << "friend class " << node->direct_proxy_impl_name () << ";";
- }
-
// Private copy constructor and assignment operator. These are not
// allowed, hence they are private.
*os << be_uidt_nl << be_nl
@@ -349,47 +328,28 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
// Don't support smart proxies for local interfaces.
// @@@ (JP) This is TODO for abstract interfaces.
- if (! node->is_local () && ! node->is_abstract ())
+ if (! node->is_local ()
+ && ! node->is_abstract ())
{
- *os << be_nl << be_nl;
-
- // Smart Proxy related classes.
- ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH);
- be_visitor_interface_smart_proxy_ch sp_visitor (&ctx);
+ // List that generates proxy broker factory function pointer.
+ be_global->non_local_interfaces.enqueue_tail (node);
- if (node->accept (&sp_visitor) == -1)
+ if (be_global->gen_smart_proxies ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ch::"
- "visit_interface - "
- "codegen for smart proxy classes failed\n"),
- -1);
- }
-
- // Proxy Implementation Declaration.
- ctx = *this->ctx_;
- be_visitor_interface_proxy_impls_ch spi_visitor (&ctx);
-
- if (node->accept (&spi_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ch::"
- "visit_interface - "
- "codegen for Proxy Broker classes failed\n"),
- -1);
- }
+ *os << be_nl << be_nl;
- // Proxy Broker Declaration.
- ctx = *this->ctx_;
- be_visitor_interface_proxy_brokers_ch pb_visitor (&ctx);
+ // Smart Proxy related classes.
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH);
+ be_visitor_interface_smart_proxy_ch sp_visitor (&ctx);
- if (node->accept (&pb_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ch::"
- "visit_interface - "
- "codegen for Proxy Broker classes failed\n"),
- -1);
+ if (node->accept (&sp_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for smart proxy classes failed\n"),
+ -1);
+ }
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
index e5420ff73fe..1bb473a9fe3 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -131,8 +131,29 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "}";
}
- be_visitor_context ctx = (*this->ctx_);
+ // Generate the proxy broker factory function pointer definition.
+ *os << be_nl << be_nl
+ << "// Function pointer for collocation factory initialization."
+ << be_nl
+ << "TAO::Collocation_Proxy_Broker * " << be_nl
+ << "(*" << node->flat_client_enclosing_scope ()
+ << node->base_proxy_broker_name ()
+ << "_Factory_function_pointer) ("
+ << be_idt << be_idt_nl
+ << "CORBA::Object_ptr obj" << be_uidt_nl
+ << ") = 0;" << be_uidt;
+
+ // Generate code for the elements of the interface.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_cs::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+/*
// Interceptor classes. The interceptors helper classes must be
// defined before the interface operations because they are used in
// the implementation of these operations.
@@ -176,10 +197,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
-1);
}
}
-
- *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
- << "// " << __FILE__ << ":" << __LINE__;
-
+*/
if (node->is_local ())
{
*os << be_nl << be_nl
@@ -194,6 +212,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
*os << be_nl << be_nl
<< node->name () << "::" << node->local_name ()
<< " (int collocated)" << be_nl
+ << " : the" << node->base_proxy_broker_name () << "_ (0)" << be_nl
<< "{" << be_idt_nl
<< "this->" << node->flat_name ()
<< "_setup_collocation (collocated);" << be_uidt_nl
@@ -211,14 +230,15 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "::" << node->flat_client_enclosing_scope ()
<< node->base_proxy_broker_name ()
<< "_Factory_function_pointer (this);"
- << be_uidt << be_uidt_nl
- << "else" << be_idt_nl
+ << be_uidt << be_uidt;
+/*
+ *os << be_nl << "else" << be_idt_nl
<< "this->the" << node->base_proxy_broker_name ()
<< "_ =" << be_idt_nl
<< "::" << node->full_remote_proxy_broker_name ()
<< "::the" << node->remote_proxy_broker_name ()
<< " ();" << be_uidt << be_uidt;
-
+*/
// Now we setup the immediate parents.
int n_parents = node->n_inherits ();
int has_concrete_parent = 0;
@@ -417,7 +437,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
// The _duplicate method
*os << node->full_name () << "_ptr" << be_nl
<< node->full_name () << "::_duplicate ("
- << bt->nested_type_name (this->ctx_->scope ())
+ << bt->local_name ()
<< "_ptr obj)" << be_nl
<< "{" << be_idt_nl
<< "if (! CORBA::is_nil (obj))" << be_idt_nl
@@ -592,16 +612,6 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "}";
}
- // Generate code for the elements of the interface.
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface_cs::"
- "visit_interface - "
- "codegen for scope failed\n"),
- -1);
- }
-
if (! node->is_abstract ())
{
// Smart Proxy classes.
@@ -625,6 +635,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
if (be_global->tc_support ())
{
+ be_visitor_context ctx = *this->ctx_;
ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
be_visitor_typecode_defn tc_visitor (&ctx);
@@ -718,16 +729,15 @@ be_visitor_interface_cs::gen_concrete_unchecked_narrow (be_interface *node,
<< "{" << be_idt_nl
<< "if (CORBA::is_nil (obj))" << be_idt_nl
<< "{" << be_idt_nl
- << "return " << bt->nested_type_name (this->ctx_->scope ())
- << "::_nil ();" << be_uidt_nl
+ << "return " << bt->local_name () << "::_nil ();" << be_uidt_nl
<< "}" << be_uidt_nl << be_nl;
if (! node->is_local ())
{
// Declare the default proxy.
- *os << bt->nested_type_name (this->ctx_->scope ())
+ *os << bt->local_name ()
<< "_ptr default_proxy = "
- << bt->nested_type_name (this->ctx_->scope ())
+ << bt->local_name ()
<<"::_nil ();" << be_nl << be_nl;
// Code for lzay evaluation..
@@ -741,7 +751,7 @@ be_visitor_interface_cs::gen_concrete_unchecked_narrow (be_interface *node,
<< " (" << be_idt << be_idt_nl
<< "obj->steal_ior ()," << be_nl
<< "obj->orb_core ()" << be_uidt_nl << ")," << be_uidt_nl
- << bt->nested_type_name (this->ctx_->scope ())
+ << bt->local_name ()
<< "::_nil ()" << be_uidt_nl << ");" << be_uidt_nl << be_nl
<< "return default_proxy;" << be_uidt_nl
<< "}" << be_uidt_nl << be_nl;
@@ -755,7 +765,7 @@ be_visitor_interface_cs::gen_concrete_unchecked_narrow (be_interface *node,
<< "stub->_incr_refcnt ();" << be_uidt_nl
<< "}" << be_uidt_nl << be_nl;
- // If the policy didtates that the proxy be collocated, use the
+ // If the policy dictates that the proxy be collocated, use the
// function to create one.
*os << "if (" << be_idt << be_idt_nl
<< "!CORBA::is_nil (stub->servant_orb_var ().ptr ()) &&" << be_nl
@@ -773,7 +783,7 @@ be_visitor_interface_cs::gen_concrete_unchecked_narrow (be_interface *node,
<< "stub," << be_nl
<< "1," << be_nl
<< "obj->_servant ()" << be_uidt_nl << ")," << be_uidt_nl
- << bt->nested_type_name (this->ctx_->scope ())
+ << bt->local_name ()
<< "::_nil ()" << be_uidt_nl << ");"
<< be_uidt << be_uidt_nl
<< "}" << be_uidt_nl << be_nl;
@@ -790,7 +800,7 @@ be_visitor_interface_cs::gen_concrete_unchecked_narrow (be_interface *node,
<< "0," << be_nl
<< "obj->_servant ()" << be_uidt_nl
<< ")," << be_uidt_nl
- << bt->nested_type_name (this->ctx_->scope ())
+ << bt->local_name ()
<< "::_nil ()" << be_uidt_nl
<< ");" << be_uidt << be_uidt_nl
<< "}" << be_uidt_nl << be_nl;
@@ -848,9 +858,9 @@ be_visitor_interface_cs::gen_abstract_unchecked_narrow (be_interface *node,
<< "}" << be_uidt_nl << be_nl;
// Declare the default proxy.
- *os << bt->nested_type_name (this->ctx_->scope ())
+ *os << bt->local_name ()
<< "_ptr default_proxy = "
- << bt->nested_type_name (this->ctx_->scope ())
+ << bt->local_name ()
<<"::_nil ();" << be_nl << be_nl;
*os << "if (obj->_is_objref ())" << be_idt_nl
@@ -863,7 +873,7 @@ be_visitor_interface_cs::gen_abstract_unchecked_narrow (be_interface *node,
<< "0," << be_nl
<< "obj->_servant ()" << be_uidt_nl
<< ")," << be_uidt_nl
- << bt->nested_type_name (this->ctx_->scope ())
+ << bt->local_name ()
<< "::_nil ()" << be_uidt_nl
<< ");" << be_uidt << be_uidt_nl
<< "}" << be_uidt_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
index 2349632edd5..8d4031086ae 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
@@ -40,169 +40,162 @@ be_visitor_interface_smart_proxy_ch::~be_visitor_interface_smart_proxy_ch (void)
int be_visitor_interface_smart_proxy_ch::visit_interface (be_interface *node)
{
- if (be_global->gen_smart_proxies ())
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
{
- TAO_OutStream *os = this->ctx_->stream ();
- be_type *bt;
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
- if (this->ctx_->alias ())
- {
- bt = this->ctx_->alias ();
- }
- else
- {
- bt = node;
- }
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "class " << be_global->stub_export_macro ()<< " "
+ << "TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory" << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl << be_nl
+ << "TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory (int permanent = 1);"
+ << be_nl
+ <<"// <permanent> signifies that the proxy factory will remain" <<be_nl
+ <<"// registered with the Proxy Factory Adapter until the program"<<be_nl
+ <<"// terminates. That is, it will be a one-shot factory for the "<<be_nl
+ <<"// interface. If this value is set to 0, then the factory will"<<be_nl
+ <<"// be unregistered after the first invocation providing the "<<be_nl
+ << "// flexibility of having a different smart proxy per object "<<be_nl
+ <<"// instead of per interface."<<be_nl<< be_nl
+ << "virtual ~TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory (void);" << be_nl << be_nl
+ << "virtual "<< node->local_name ()
+ << "_ptr create_proxy (" << be_idt << be_idt_nl
+ << node->local_name ()
+ << "_ptr proxy" << be_nl
+ << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "};\n\n";
+
+ *os << "class " << be_global->stub_export_macro ()<< " "
+ << "TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter" << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl << be_nl
+ << "friend class TAO_Singleton<TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter, TAO_SYNCH_RECURSIVE_MUTEX>;" << be_nl << be_nl
+ << "void register_proxy_factory (" << be_idt << be_idt_nl
+ << "TAO_" << node->flat_name () << "_Default_Proxy_Factory *df,"<< be_nl
+ << "int one_shot_factory = 1" << be_nl
+ << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << "void unregister_proxy_factory (" << be_idt << be_idt_nl
+ << "ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << node->local_name ()
+ << "_ptr create_proxy (" << be_idt << be_idt_nl
+ << node->local_name () << "_ptr proxy" << be_nl
+ << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl
+ << "TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter (void);" << be_nl
+ << "~TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter (void);" << be_nl
+ << "TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter &operator= (" << be_idt << be_idt_nl
+ << "const TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter &" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory *proxy_factory_;" << be_nl
+ << "int one_shot_factory_;" << be_nl
+ << "int disable_factory_;"<<be_nl
+ << "TAO_SYNCH_RECURSIVE_MUTEX lock_;" << be_uidt_nl
+ << "};";
+
+ *os << be_nl << be_nl
+ << "typedef TAO_Singleton<TAO_"<<node->flat_name ()
+ << "_Proxy_Factory_Adapter, TAO_SYNCH_RECURSIVE_MUTEX> TAO_"
+ << node->flat_name ()<< "_PROXY_FACTORY_ADAPTER;"<<be_nl << be_nl;
+
+ *os << "class " << be_global->stub_export_macro ()<< " "
+ << "TAO_"<< node->flat_name ()
+ << "_Smart_Proxy_Base" << be_idt_nl
+ << ": public virtual "
+ << bt->nested_type_name (this->ctx_->scope ());
+
+
+ if (node->n_inherits () > 0)
+ {
+ long i;
- *os << be_nl << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
-
- *os << "class " << be_global->stub_export_macro ()<< " "
- << "TAO_" << node->flat_name ()
- << "_Default_Proxy_Factory" << be_nl
- << "{" << be_nl
- << "public:" << be_idt_nl << be_nl
- << "TAO_" << node->flat_name ()
- << "_Default_Proxy_Factory (int permanent = 1);"
- << be_nl
- <<"// <permanent> signifies that the proxy factory will remain" <<be_nl
- <<"// registered with the Proxy Factory Adapter until the program"<<be_nl
- <<"// terminates. That is, it will be a one-shot factory for the "<<be_nl
- <<"// interface. If this value is set to 0, then the factory will"<<be_nl
- <<"// be unregistered after the first invocation providing the "<<be_nl
- << "// flexibility of having a different smart proxy per object "<<be_nl
- <<"// instead of per interface."<<be_nl<< be_nl
- << "virtual ~TAO_" << node->flat_name ()
- << "_Default_Proxy_Factory (void);" << be_nl << be_nl
- << "virtual "<< node->local_name ()
- << "_ptr create_proxy (" << be_idt << be_idt_nl
- << node->local_name ()
- << "_ptr proxy" << be_nl
- << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl
- << "};\n\n";
-
- *os << "class " << be_global->stub_export_macro ()<< " "
- << "TAO_" << node->flat_name ()
- << "_Proxy_Factory_Adapter" << be_nl
- << "{" << be_nl
- << "public:" << be_idt_nl << be_nl
- << "friend class TAO_Singleton<TAO_" << node->flat_name ()
- << "_Proxy_Factory_Adapter, TAO_SYNCH_RECURSIVE_MUTEX>;" << be_nl << be_nl
- << "void register_proxy_factory (" << be_idt << be_idt_nl
- << "TAO_" << node->flat_name () << "_Default_Proxy_Factory *df,"<< be_nl
- << "int one_shot_factory = 1" << be_nl
- << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl
- << "void unregister_proxy_factory (" << be_idt << be_idt_nl
- << "ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt_nl << be_nl
- << node->local_name ()
- << "_ptr create_proxy (" << be_idt << be_idt_nl
- << node->local_name () << "_ptr proxy" << be_nl
- << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl << be_nl
- << "protected:" << be_idt_nl
- << "TAO_" << node->flat_name ()
- << "_Proxy_Factory_Adapter (void);" << be_nl
- << "~TAO_" << node->flat_name ()
- << "_Proxy_Factory_Adapter (void);" << be_nl
- << "TAO_" << node->flat_name ()
- << "_Proxy_Factory_Adapter &operator= (" << be_idt << be_idt_nl
- << "const TAO_" << node->flat_name ()
- << "_Proxy_Factory_Adapter &" << be_uidt_nl
- << ");" << be_uidt_nl
- << "TAO_" << node->flat_name ()
- << "_Default_Proxy_Factory *proxy_factory_;" << be_nl
- << "int one_shot_factory_;" << be_nl
- << "int disable_factory_;"<<be_nl
- << "TAO_SYNCH_RECURSIVE_MUTEX lock_;" << be_uidt_nl
- << "};";
-
- *os << be_nl << be_nl
- << "typedef TAO_Singleton<TAO_"<<node->flat_name ()
- << "_Proxy_Factory_Adapter, TAO_SYNCH_RECURSIVE_MUTEX> TAO_"
- << node->flat_name ()<< "_PROXY_FACTORY_ADAPTER;"<<be_nl << be_nl;
-
- *os << "class " << be_global->stub_export_macro ()<< " "
- << "TAO_"<< node->flat_name ()
- << "_Smart_Proxy_Base" << be_idt_nl
- << ": public virtual "
- << bt->nested_type_name (this->ctx_->scope ());
-
-
- if (node->n_inherits () > 0)
+ for (i = 0; i < node->n_inherits (); i++)
{
- long i;
+ be_interface *inherited =
+ be_interface::narrow_from_decl (node->inherits ()[i]);
+ be_decl *scope = 0;
- for (i = 0; i < node->n_inherits (); i++)
+ if (inherited->is_nested ())
{
- be_interface *inherited =
- be_interface::narrow_from_decl (node->inherits ()[i]);
- be_decl *scope = 0;
-
- if (inherited->is_nested ())
- {
- // Inherited node is used in the scope of "node" node.
- scope =
- be_scope::narrow_from_scope (node->defined_in ())->decl ();
- }
-
- *os << "," << be_nl << " public virtual ";
- *os << inherited->nested_sp_type_name (scope,
- "_Smart_Proxy_Base");
+ // Inherited node is used in the scope of "node" node.
+ scope =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
}
- }
- else
- {
- *os << "," << be_nl << " public virtual TAO_Smart_Proxy_Base";
- }
- *os << be_uidt_nl;
-
- *os << "{" << be_nl
- << "public:" << be_idt_nl
- << "TAO_"<< node->flat_name () << "_Smart_Proxy_Base (void);"
- << be_nl
- // Just to keep Old g++ complier (version: 2.7.2.3) happy it's
- // necesssary to declare and define the destructor explicitly.
- << "~TAO_"<< node->flat_name () << "_Smart_Proxy_Base (void);"
- << be_nl
- // This method will delegate this method to the <base_proxy_>
- // member of the smart proxy and so the smart proxy's (nil)
- // stubobj will not be returned.
- << "virtual TAO_Stub *_stubobj (void) const;"
- << be_nl
- // Another version of the above method..
- << "virtual TAO_Stub *_stubobj (void);"
- << be_uidt_nl;
-
- // Generate code for the interface definition by traversing thru the
- // elements of its scope. We depend on the front-end to have made sure
- // that only legal syntactic elements appear in our scope.
- os->indent ();
-
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface_ch::"
- "visit_interface - "
- "codegen for scope failed\n"),
- -1);
+ *os << "," << be_nl << " public virtual ";
+ *os << inherited->nested_sp_type_name (scope,
+ "_Smart_Proxy_Base");
}
-
- *os << "protected:" << be_idt_nl
- << "::" << node->full_name ()
- << "_ptr get_proxy (void);" << be_nl
- << "::" << node->full_name () << "_var proxy_;"
- << be_uidt_nl
- << "};\n\n";
}
else
{
- ACE_UNUSED_ARG (node);
+ *os << "," << be_nl << " public virtual TAO_Smart_Proxy_Base";
}
+ *os << be_uidt_nl;
+
+ *os << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "TAO_"<< node->flat_name () << "_Smart_Proxy_Base (void);"
+ << be_nl
+ // Just to keep Old g++ complier (version: 2.7.2.3) happy it's
+ // necesssary to declare and define the destructor explicitly.
+ << "~TAO_"<< node->flat_name () << "_Smart_Proxy_Base (void);"
+ << be_nl
+ // This method will delegate this method to the <base_proxy_>
+ // member of the smart proxy and so the smart proxy's (nil)
+ // stubobj will not be returned.
+ << "virtual TAO_Stub *_stubobj (void) const;"
+<< be_nl
+// Another version of the above method..
+<< "virtual TAO_Stub *_stubobj (void);"
+ << be_uidt_nl;
+
+ // Generate code for the interface definition by traversing thru the
+ // elements of its scope. We depend on the front-end to have made sure
+ // that only legal syntactic elements appear in our scope.
+ os->indent ();
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << "protected:" << be_idt_nl
+ << "::" << node->full_name ()
+ << "_ptr get_proxy (void);" << be_nl
+ << "::" << node->full_name () << "_var proxy_;"
+ << be_uidt_nl
+ << "};\n\n";
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
index 63e3a5fee87..a830c622330 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
@@ -47,8 +47,7 @@ be_visitor_module_ch::visit_module (be_module *node)
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- *os << "TAO_NAMESPACE "
- << " " << node->local_name () << be_nl
+ *os << "namespace " << node->local_name () << be_nl
<< "{" << be_idt;
// Generate code for the module definition by traversing thru the
@@ -67,7 +66,7 @@ be_visitor_module_ch::visit_module (be_module *node)
<< "// " << __FILE__ << ":" << __LINE__ << be_nl;
*os << be_nl
- << "}\nTAO_NAMESPACE_CLOSE // module " << node->name ();
+ << "} // module " << node->name ();
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp
index fc5e6743c73..7466b7aa0f6 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp
@@ -52,17 +52,17 @@ be_visitor_module_sh::visit_module (be_module *node)
// Now generate the class definition. The prefix POA_ is prepended to our
// name only if we are the outermost module.
- *os << "TAO_NAMESPACE ";
+ *os << "namespace ";
if (!node->is_nested ())
{
// We are outermost module.
- *os << " POA_" << node->local_name () << be_nl;
+ *os << "POA_" << node->local_name () << be_nl;
}
else
{
// We are inside another module.
- *os << " " << node->local_name () << be_nl;
+ *os << node->local_name () << be_nl;
}
*os << "{" << be_idt_nl;
@@ -79,7 +79,7 @@ be_visitor_module_sh::visit_module (be_module *node)
*os << be_uidt_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- *os << "}" << be_nl << "TAO_NAMESPACE_CLOSE // module "
+ *os << "} // module "
<< node->name ();
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
index 8c12018e4f5..a63791945aa 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
@@ -381,45 +381,70 @@ be_visitor_operation::gen_stub_operation_body (
be_type *return_type
)
{
- TAO_OutStream *os = this->ctx_->stream ();
- be_visitor_context ctx;
- const char *target = "_collocated_tao_target_";
+ be_interface *intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
- if (node->defined_in ()->is_abstract ())
+ if (!intf)
{
- target = "this";
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
}
- *os << be_nl << "{" << be_idt_nl;
-
- const char *env = this->gen_environment_var ();
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_visitor_context ctx;
- if (ACE_OS::strcmp ("", env) != 0)
- {
- *os << env << be_nl;
- }
+ *os << be_nl << "{" << be_idt_nl;
- // Generate the actual code for the stub. However, if any of the argument
- // types is "native", we flag a MARSHAL exception.
- // last argument - is always ACE_ENV_ARG_PARAMETER
- if (!node->has_native ())
+ if (node->has_native ()) // native exists => no stub
{
- // native type does not exist.
-
- // Generate any "pre" stub information such as tables or declarations
- // This is a template method and the actual work will be done by the
- // derived class
- if (this->gen_pre_stub_info (node) == -1)
+ if (this->gen_raise_exception (return_type,
+ "CORBA::MARSHAL",
+ "") == -1)
{
ACE_ERROR_RETURN ((
LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
- "gen_pre_stub_info failed\n"
+ "codegen for native exception failed\n"
),
-1
);
}
+
+ *os << be_uidt_nl << "}";
+
+ return 0;
+ }
+
+ if (!node->is_abstract ())
+ {
+ // If the object is lazily evaluated the proxy brker might well
+ // be null. Initialize it now.
+ *os << "if (!this->is_evaluated ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << intf->flat_name () << "_setup_collocation ("
+ << be_idt << be_idt_nl
+ << "this->ACE_NESTED_CLASS (CORBA, Object)::_is_collocated ()"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+
+ const char *env = this->gen_environment_var ();
+
+ if (ACE_OS::strcmp ("", env) != 0)
+ {
+ *os << env << be_nl;
}
// Declare return type helper class.
@@ -485,12 +510,12 @@ be_visitor_operation::gen_stub_operation_body (
*os << be_nl << be_nl
<< "TAO::Invocation_Adapter _tao_call (" << be_idt << be_idt_nl
- << "_collocated_tao_target_," << be_nl
+ << "this," << be_nl
<< "_tao_signature," << be_nl
<< node->argument_count () + 1 << "," << be_nl
<< "\"" << node->local_name () << "\"," << be_nl
- << ACE_OS::strlen (node->local_name ()->get_string ()) << be_nl
- << "0";
+ << ACE_OS::strlen (node->local_name ()->get_string ()) << "," << be_nl
+ << "this->the" << intf->base_proxy_broker_name () << "_";
if (node->flags () == AST_Operation::OP_oneway)
{
@@ -536,106 +561,11 @@ be_visitor_operation::gen_stub_operation_body (
*os << "ACE_CHECK_RETURN (_tao_retval.excp ());";
}
- // Temporary hack until we finish code generation refactoring.
- *os << "\n\n#if 0" << be_nl << be_nl;
-
- if (node->has_native ()) // native exists => no stub
+ if (!this->void_return_type (return_type))
{
- if (this->gen_raise_exception (return_type,
- "CORBA::MARSHAL",
- "") == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for return var failed\n"
- ),
- -1
- );
- }
+ *os << be_nl << be_nl
+ << "return _tao_retval.retn ();";
}
- else
- {
- // Generate code that retrieves the underlying stub object and then
- // invokes do_static_call on it.
- *os << "TAO_Stub *istub = " << target << "->_stubobj ();"
- << be_nl << be_nl
- << "if (istub == 0)" << be_idt_nl
- << "{" << be_idt_nl;
-
- // If the stub object was bad, then we raise a system exception.
- if (this->gen_raise_exception (return_type, "CORBA::INTERNAL", "") == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for checking exception failed\n"
- ),
- -1
- );
- }
-
- *os << be_uidt_nl << "}" << be_uidt_nl;
-
- // Do any pre marshal and invoke processing with return type. This
- // includes allocating memory, initialization.
- ctx = *this->ctx_;
- be_visitor_operation_rettype_pre_invoke_cs rpi_visitor (&ctx);
-
- if (return_type->accept (&rpi_visitor) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for retval pre invoke failed\n"
- ),
- -1
- );
- }
-
- // Do any pre marshal and invoke stuff with arguments.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS);
- be_visitor_operation_argument api_visitor (&ctx);
-
- if (node->accept (&api_visitor) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for argument pre invoke failed\n"
- ),
- -1
- );
- }
-
- // Generate the code for marshaling in the parameters and transmitting
- // them.
- if (this->gen_marshal_and_invoke (node, return_type) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for marshal and invoke failed\n"
- ),
- -1
- );
- }
-
- // Temporary hack until we finish refactoring the code generation.
- *os << "\n\n#endif /* 0 */";
-
- if (!this->void_return_type (return_type))
- {
- *os << be_nl << be_nl
- << "return _tao_retval.retn ();";
- }
- } // end of if (!native)
*os << be_uidt_nl << "}";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
index 9b080c5c111..d1259dc9c77 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
@@ -121,157 +121,8 @@ be_visitor_operation_cs::visit_operation (be_operation *node)
-1);
}
- *os << be_nl;
-
- // @@@ (JP) No collocation for abstract interface operations yet. We
- // are generating the code as if there were no proxies, and using
- // the (concrete interface's) stub info that we got over the wire.
- if (intf->is_abstract ())
- {
- return this->gen_stub_operation_body (node,
- bt);
- }
- else
- {
- *os << "{" << be_idt_nl;
- *os << this->gen_environment_var ();
-
- if (be_global->exception_support ())
- {
- *os << be_nl << be_nl;
- }
-
- // For what follows, the return type node nust be unaliased.
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- be_typedef *btd = be_typedef::narrow_from_decl (bt);
- bt = btd->primitive_base_type ();
- }
-
- AST_Decl::NodeType bnt = bt->base_node_type ();
- be_predefined_type *bpt = 0;
- AST_PredefinedType::PredefinedType pdt = AST_PredefinedType::PT_void;
-
- if (bnt == AST_Decl::NT_pre_defined)
- {
- bpt = be_predefined_type::narrow_from_decl (bt);
- pdt = bpt->pt ();
-
- if (pdt == AST_PredefinedType::PT_longlong)
- {
- *os << "CORBA::LongLong _tao_check_retval = "
- << "ACE_CDR_LONGLONG_INITIALIZER;" << be_nl << be_nl;
- }
- else if (pdt == AST_PredefinedType::PT_longdouble)
- {
- *os << "CORBA::LongDouble _tao_check_retval = "
- << "ACE_CDR_LONG_DOUBLE_INITIALIZER;" << be_nl << be_nl;
- }
- }
-
- // If the object is lazily evaluated the proxy brker might well
- // be null. Initialize it now
- *os << "if (!this->is_evaluated ())" << be_idt_nl
- << "{" << be_idt_nl
- << "ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);" << be_uidt_nl << be_nl
- << "}" << be_uidt_nl
- << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)"<< be_idt_nl
- << "{" << be_idt_nl
- << intf->flat_name () << "_setup_collocation (" << be_idt << be_idt_nl
- << "this->ACE_NESTED_CLASS (CORBA, Object)::_is_collocated ()"
- << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- // Generate code that retrieves the proper proxy implementation
- // using the proxy broker available, and perform the call
- // using the proxy implementation provided by the broker.
-
- *os << intf->base_proxy_impl_name () << " &proxy = " << be_idt_nl
- << "this->the" << intf->base_proxy_broker_name ()
- << "_->select_proxy (this ACE_ENV_ARG_PARAMETER);" << be_uidt_nl;
-
- if (!this->void_return_type (bt))
- {
- *os << "ACE_CHECK_RETURN (";
-
- if (bnt == AST_Decl::NT_enum)
- {
- // The enum is a unique type, so we must cast.
- *os << "(" << bt->name () << ")0);";
- }
- else if (bnt == AST_Decl::NT_struct || bnt == AST_Decl::NT_union)
- {
- if (bt->size_type () == AST_Type::FIXED)
- {
- // For a fixed size struct or union the return value
- // is not a pointer, so we call the default constructor
- // and return the result.
- *os << bt->name () << " ());";
- }
- else
- {
- *os << "0);";
- }
- }
- else if (bnt == AST_Decl::NT_pre_defined)
- {
- if (pdt == AST_PredefinedType::PT_longlong
- || pdt == AST_PredefinedType::PT_longdouble)
- {
- *os << "_tao_check_retval);" << be_nl
- << "ACE_UNUSED_ARG (_tao_check_retval);";
- }
- else
- {
- *os << "0);";
- }
- }
- else
- {
- *os << "0);";
- }
-
- *os << be_nl << be_nl
- << "return ";
- }
- else
- {
- *os << "ACE_CHECK;" << be_nl << be_nl;
- }
-
- *os << "proxy." << node->local_name ()
- << " (" << be_idt << be_idt_nl << "this";
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_scope::visit_scope - "
- "bad node in this scope\n"),
- -1);
- }
-
- be_decl *decl = be_decl::narrow_from_decl (d);
-
- *os << "," << be_nl
- << decl->local_name ();
- }
-
- if (!be_global->exception_support ())
- {
- *os << be_nl << "ACE_ENV_ARG_PARAMETER";
- }
-
- *os << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}";
- }
-
- return 0;
+ return this->gen_stub_operation_body (node,
+ bt);
}
int
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
index fe75a9ef6f8..d81ba187cc1 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -82,7 +82,7 @@ int be_visitor_root::visit_root (be_root *node)
*os << be_nl << be_nl
<< "extern " << be_global->stub_export_macro () << be_nl
- << i->full_base_proxy_broker_name () << " *" << be_nl
+ << "TAO::Collocation_Proxy_Broker *" << be_nl
<< "(*" << i->flat_client_enclosing_scope ()
<< i->base_proxy_broker_name ()
<< "_Factory_function_pointer) ("
@@ -138,7 +138,7 @@ int be_visitor_root::visit_root (be_root *node)
<< be_nl
<< "// interfaces that inherit from both CORBA::Object" << be_nl
<< "// and CORBA::AbstractBase." << be_nl << be_nl
- << "TAO_NAMESPACE CORBA" << be_nl
+ << "namespace CORBA" << be_nl
<< "{" << be_idt;
}
@@ -156,8 +156,7 @@ int be_visitor_root::visit_root (be_root *node)
if (size > 0)
{
*os << be_uidt_nl
- << "}" << be_nl
- << "TAO_NAMESPACE_CLOSE";
+ << "}";
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
index ff7dba28e3a..4eb2af89c37 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp
@@ -51,5 +51,23 @@ be_visitor_root_ch::init (void)
// Initialize the stream.
this->ctx_->stream (tao_cg->client_header ());
+ // If this IDL file contains an interface declaration, generated a
+ // forward declaration of the proxy broker for a possible collocated call.
+ if (ACE_BIT_ENABLED (idl_global->decls_seen_info_,
+ idl_global->decls_seen_masks.interface_seen_))
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__;
+
+ *os << be_nl << be_nl
+ << "namespace TAO" << be_nl
+ << "{" << be_idt_nl
+ << "class Collocation_Proxy_Broker;" << be_uidt_nl
+ << "}";
+ }
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp
index adeb9b52f39..161541c8f94 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp
@@ -124,17 +124,17 @@ be_visitor_root_sth::visit_module (be_module *node)
// Now generate the class definition. The prefix POA_ is prepended to our
// name only if we are the outermost module.
- *os << "TAO_NAMESPACE ";
+ *os << "namespace ";
if (node->is_nested ())
{
// We are inside another module.
- *os << " " << node->local_name () << be_nl;
+ *os << node->local_name () << be_nl;
}
else
{
// We are outermost module.
- *os << " POA_" << node->local_name () << be_nl;
+ *os << "POA_" << node->local_name () << be_nl;
}
*os << "{" << be_idt;
@@ -148,8 +148,7 @@ be_visitor_root_sth::visit_module (be_module *node)
-1);
}
- *os << be_uidt_nl << "}" << be_nl << "TAO_NAMESPACE_CLOSE // module "
- << node->name ();
+ *os << be_uidt_nl << "} // module " << node->name ();
if (!node->is_nested ())
{
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
index f864066f8d1..d0e5367afe5 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
@@ -230,8 +230,8 @@ be_visitor_typecode_defn::gen_nested_namespace_begin (be_module *node)
if (ACE_OS::strcmp (item_name, "") != 0)
{
// Leave the outermost root scope.
- *os << "TAO_NAMESPACE_BEGIN (" << item_name
- << ")" << be_nl;
+ *os << "namespace " << item_name << be_nl
+ << "{" << be_idt_nl;
}
}
@@ -250,7 +250,7 @@ be_visitor_typecode_defn::gen_nested_namespace_end (be_module *node)
if (ACE_OS::strcmp (i.item ()->get_string (), "") != 0)
{
// Leave the outermost root scope.
- *os << be_nl << "TAO_NAMESPACE_END";
+ *os << be_nl << "}";
}
}
@@ -383,7 +383,6 @@ be_visitor_typecode_defn::visit_type (be_type *node)
if (node->is_nested () &&
node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
{
- *os << "TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)" << be_nl;
be_module *module = be_module::narrow_from_scope (node->defined_in ());
if (!module || (this->gen_nested_namespace_begin (module) == -1))
@@ -394,20 +393,12 @@ be_visitor_typecode_defn::visit_type (be_type *node)
-1);
}
- *os << "TAO_NAMESPACE_DEFINE (" << be_idt << be_idt_nl
- << "::CORBA::TypeCode_ptr," << be_nl
- << "_tc_";
-
- // Local name generation.
- *os << node->local_name ();
-
- *os << "," << be_nl
- << "&_tc_TAO_tc_";
-
- // Flat name generation.
- *os << node->flat_name ();
-
- *os << be_uidt_nl << ")" << be_uidt;
+ *os << "::CORBA::TypeCode_ptr _tc_"
+ << node->local_name ()
+ << " =" << be_idt_nl
+ << "&_tc_TAO_tc_"
+ << node->flat_name () << ";"
+ << be_uidt << be_uidt;
if (this->gen_nested_namespace_end (module) == -1)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp
index 9b44cb603f9..a672665094a 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp
@@ -54,17 +54,17 @@ be_visitor_obv_module::visit_module (be_module *node)
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- *os << "TAO_NAMESPACE ";
+ *os << "namespace ";
if (!node->is_nested ())
{
// We are outermost module, so prepend.
- *os << " OBV_" << node->local_name () << be_nl;
+ *os << "OBV_" << node->local_name () << be_nl;
}
else
{
// We are inside another module.
- *os << " " << node->local_name () << be_nl;
+ *os << node->local_name () << be_nl;
}
*os << "{" << be_idt;
@@ -84,7 +84,7 @@ be_visitor_obv_module::visit_module (be_module *node)
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__;
- *os << be_uidt_nl << be_nl << "}TAO_NAMESPACE_CLOSE";
+ *os << be_uidt_nl << be_nl << "}";
}
}
diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h
index 948901cabbc..b31e438cb6c 100644
--- a/TAO/TAO_IDL/include/idl_global.h
+++ b/TAO/TAO_IDL/include/idl_global.h
@@ -271,6 +271,7 @@ public:
{
dsf (void);
+ ACE_UINT64 interface_seen_;
ACE_UINT64 valuetype_seen_;
ACE_UINT64 abstract_iface_seen_;
ACE_UINT64 iface_seq_seen_;
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index 0804b4e6637..1a22f02cefe 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -85,7 +85,8 @@ ACE_RCSID (util,
static long seen_once[INCREMENT] = {0};
IDL_GlobalData::dsf::dsf (void)
- : valuetype_seen_ (0),
+ : interface_seen_ (0),
+ valuetype_seen_ (0),
abstract_iface_seen_ (0),
iface_seq_seen_ (0),
basic_arg_seen_ (0),
@@ -203,9 +204,10 @@ IDL_GlobalData::IDL_GlobalData (void)
const ACE_UINT64 cursor = 1U;
- ACE_SET_BITS (this->decls_seen_masks.valuetype_seen_, cursor);
- ACE_SET_BITS (this->decls_seen_masks.abstract_iface_seen_, cursor << 1);
- ACE_SET_BITS (this->decls_seen_masks.iface_seq_seen_, cursor << 2);
+ ACE_SET_BITS (this->decls_seen_masks.interface_seen_, cursor);
+ ACE_SET_BITS (this->decls_seen_masks.valuetype_seen_, cursor << 1);
+ ACE_SET_BITS (this->decls_seen_masks.abstract_iface_seen_, cursor << 2);
+ ACE_SET_BITS (this->decls_seen_masks.iface_seq_seen_, cursor << 3);
ACE_SET_BITS (this->decls_seen_masks.basic_arg_seen_, cursor << 32);
ACE_SET_BITS (this->decls_seen_masks.bd_string_arg_seen_, cursor << 33);