summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-19 07:14:26 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-19 07:14:26 +0000
commitc6d100e38b1dbac02df8b5ef01f667c13ab2314d (patch)
tree1a949a70ee5ae10c1614ce151a58eed6d9e15f79
parent071b5b873710f4a90d5f2c9f183a8ec1f3aa9a14 (diff)
downloadATCD-c6d100e38b1dbac02df8b5ef01f667c13ab2314d.tar.gz
ChangeLogTag:Thu Aug 19 01:47:49 1999 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp13
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp28
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp30
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp98
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp129
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp51
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp399
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp5
-rw-r--r--TAO/TAO_IDL/driver/drv_args.cpp8
-rw-r--r--TAO/docs/compiler.html10
16 files changed, 470 insertions, 332 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
index 95a34d1c4a9..1f47ff41a63 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
@@ -53,12 +53,13 @@ be_visitor_interface_any_op_ch::visit_interface (be_interface *node)
os->indent ();
// Generate the stub factory function pointer declaration
- *os << "extern " << idl_global->stub_export_macro () << " "
- << node->full_name () << "_ptr (*_TAO_collocation_"
- << node->flat_name () << "_Stub_Factory_function_pointer) ("
- << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj" << be_uidt_nl
- << ");" << be_uidt_nl;
+ if (!idl_global->gen_locality_constraint ())
+ *os << "extern " << idl_global->stub_export_macro () << " "
+ << node->full_name () << "_ptr (*_TAO_collocation_"
+ << node->flat_name () << "_Stub_Factory_function_pointer) ("
+ << be_idt << be_idt_nl
+ << "CORBA::Object_ptr obj" << be_uidt_nl
+ << ");" << be_uidt_nl;
// @@ Michael: This might not be the right place ..
if (idl_global->ami_call_back () == I_TRUE)
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
index 705f8a9c3a0..1729c056a18 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
@@ -51,21 +51,27 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node)
TAO_OutStream *os = this->ctx_->stream ();
- os->indent ();
- // Generate the stub factory function pointer definition.
- *os << node->full_name () << "_ptr (*";
-
- *os << "_TAO_collocation_"
- << node->flat_name () << "_Stub_Factory_function_pointer) ("
- << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj" << be_uidt_nl
- << ") = 0;" << be_uidt_nl;
+ // There's only one implementation of collocated stub for
+ // locality constraint interface. Therefore, the collocated
+ // stub factory function pointer is not required.
+ if (!idl_global->gen_locality_constraint ())
+ {
+ os->indent ();
+ // Generate the stub factory function pointer definition.
+ *os << node->full_name () << "_ptr (*";
+
+ *os << "_TAO_collocation_"
+ << node->flat_name () << "_Stub_Factory_function_pointer) ("
+ << be_idt << be_idt_nl
+ << "CORBA::Object_ptr obj" << be_uidt_nl
+ << ") = 0;" << be_uidt_nl;
+ }
- // @@ Michael: This might not be the right place ..
+ // @@ Michael: This might not be the right place ..
if (idl_global->ami_call_back () == I_TRUE)
{
// AMI Handler stuff
- be_interface_type_strategy *old_strategy =
+ be_interface_type_strategy *old_strategy =
node->set_strategy (new be_interface_ami_handler_strategy (node));
os->indent ();
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
index b4b4d6817b9..84bf14fae9e 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp
@@ -44,6 +44,9 @@ be_visitor_interface_cdr_op_ch::~be_visitor_interface_cdr_op_ch (void)
int
be_visitor_interface_cdr_op_ch::visit_interface (be_interface *node)
{
+ // No CDR operations for locality constraint interfaces.
+ if (idl_global->gen_locality_constraint ())
+ return 0;
if (node->cli_hdr_cdr_op_gen () || node->imported ())
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
index eca259e8df1..f1e2c1f7377 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp
@@ -44,6 +44,10 @@ be_visitor_interface_cdr_op_ci::~be_visitor_interface_cdr_op_ci (void)
int
be_visitor_interface_cdr_op_ci::visit_interface (be_interface *node)
{
+ // No CDR operations for locality constraint interfaces.
+ if (idl_global->gen_locality_constraint ())
+ return 0;
+
// already generated and/or we are imported. Don't do anything.
if (node->cli_inline_cdr_op_gen () || node->imported ())
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
index 35e4c18f006..91774a2f324 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp
@@ -39,6 +39,11 @@ be_visitor_interface_cdr_op_cs::~be_visitor_interface_cdr_op_cs (void)
int
be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node)
{
+ // No CDR operations for locality constraint interfaces.
+ if (idl_global->gen_locality_constraint ())
+ return 0;
+
+ // already generated and/or we are imported. Don't do anything.
if (node->cli_stub_cdr_op_gen () || node->imported ())
return 0;
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 cb88a9a04ad..89dca721f38 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -54,7 +54,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
if (idl_global->ami_call_back () == I_TRUE)
{
- be_interface_type_strategy *old_strategy =
+ be_interface_type_strategy *old_strategy =
node->set_strategy (new be_interface_ami_handler_strategy (node));
// Set the context.
@@ -199,17 +199,21 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
<< "static " << node->local_name () << "_ptr "
<< "_narrow (" << be_idt << be_idt_nl
<< "CORBA::Object_ptr obj," << be_nl
- << "CORBA::Environment &env = " << be_idt_nl
- << "TAO_default_environment ()"
- << be_uidt << be_uidt_nl
- << ");" << be_uidt_nl
- << "static " << node->local_name () << "_ptr "
- << "_unchecked_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj," << be_nl
- << "CORBA::Environment &env = " << be_idt_nl
- << "TAO_default_environment ()"
- << be_uidt << be_uidt_nl
- << ");" << be_uidt_nl;
+ << "CORBA::Environment &env = " << be_idt_nl
+ << "TAO_default_environment ()"
+ << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+
+ // There's no need for an _unchecked_narrow for locality constraint object.
+ if (!idl_global->gen_locality_constraint ())
+ *os << "static " << node->local_name () << "_ptr "
+ << "_unchecked_narrow (" << be_idt << be_idt_nl
+ << "CORBA::Object_ptr obj," << be_nl
+ << "CORBA::Environment &env = " << be_idt_nl
+ << "TAO_default_environment ()"
+ << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl;
+
// This method is defined in the header file to workaround old
// g++ problems
*os << "static " << node->local_name () << "_ptr _nil (void)"
@@ -284,7 +288,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
{
// = Generate the default stub code for Handler.
- be_interface_type_strategy *old_strategy =
+ be_interface_type_strategy *old_strategy =
node->set_strategy (new be_interface_ami_handler_strategy (node));
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 9539f64869a..e412fe881f4 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -69,50 +69,70 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "if (is_a == 0)" << be_idt_nl
<< "return " << node->full_name () << "::_nil ();" << be_uidt_nl;
- *os << "return " << node->full_name ()
- << "::_unchecked_narrow (obj, ACE_TRY_ENV);" << be_uidt_nl
- << "}" << be_nl << be_nl;
-
// This may be necessary to work around a GCC compiler bug!
// const char *skel_name = node->full_skel_name (); // unused at this time
// const char *coll_name = node->full_coll_name ();
// assert (coll_name != 0);
// The _unchecked_narrow method
- *os << node->full_name () << "_ptr " << node->full_name ()
- << "::_unchecked_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj," << be_nl
- << "CORBA::Environment &" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (CORBA::is_nil (obj))" << be_idt_nl
- << "return " << node->full_name () << "::_nil ();" << be_uidt_nl;
-
- *os << "TAO_Stub* stub = obj->_stubobj ();" << be_nl
- << "stub->_incr_refcnt ();" << be_nl;
-
- *os << "if (obj->_is_collocated () && _TAO_collocation_" << node->flat_name ()
- << "_Stub_Factory_function_pointer != 0)" << be_idt_nl
- << "{" << be_idt_nl
- << node->local_name () << "_ptr retv = _TAO_collocation_"
- << node->flat_name ()
- << "_Stub_Factory_function_pointer (obj);" << be_nl
- << "if (retv != 0)" << be_idt_nl
- << "return retv;" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl;
-
- *os << "return new " << node->full_name () << "(stub);" << be_uidt_nl
- << "}" << be_nl << be_nl;
-
- // The _duplicate method
- *os << node->full_name () << "_ptr " << be_nl
- << node->full_name () << "::_duplicate ("
- << node->full_name () << "_ptr obj)" << be_nl
- << "{" << be_idt_nl
- << "if (!CORBA::is_nil (obj))" << be_idt_nl
- << "obj->_incr_refcnt ();" << be_uidt_nl
- << "return obj;" << be_uidt_nl
- << "}" << be_nl << be_nl;
+ if (!idl_global->gen_locality_constraint ())
+ {
+ *os << "return " << node->full_name ()
+ << "::_unchecked_narrow (obj, ACE_TRY_ENV);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ *os << node->full_name () << "_ptr " << node->full_name ()
+ << "::_unchecked_narrow (" << be_idt << be_idt_nl
+ << "CORBA::Object_ptr obj," << be_nl
+ << "CORBA::Environment &" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (CORBA::is_nil (obj))" << be_idt_nl
+ << "return " << node->full_name () << "::_nil ();" << be_uidt_nl;
+
+ *os << "TAO_Stub* stub = obj->_stubobj ();" << be_nl
+ << "stub->_incr_refcnt ();" << be_nl;
+
+ *os << "if (obj->_is_collocated () && _TAO_collocation_"
+ << node->flat_name () << "_Stub_Factory_function_pointer != 0)"
+ << be_idt_nl << "{" << be_idt_nl << node->local_name ()
+ << "_ptr retv = _TAO_collocation_"
+ << node->flat_name () << "_Stub_Factory_function_pointer (obj);"
+ << be_nl << "if (retv != 0)" << be_idt_nl << "return retv;"
+ << be_uidt << be_uidt_nl << "}" << be_uidt_nl;
+
+ *os << "return new " << node->full_name () << "(stub);" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+
+ // The _duplicate method
+ *os << node->full_name () << "_ptr " << be_nl
+ << node->full_name () << "::_duplicate ("
+ << node->full_name () << "_ptr obj)" << be_nl
+ << "{" << be_idt_nl
+ << "if (!CORBA::is_nil (obj))" << be_idt_nl
+ << "obj->_incr_refcnt ();" << be_uidt_nl
+ << "return obj;" << be_uidt_nl;
+ }
+ else
+ {
+ // _narrow implementation for locality constraint object.
+ *os << "void *servant = 0;" << be_nl
+ << "if (!obj->_is_collocated ()" << be_idt << be_idt << be_idt_nl
+ << "|| !obj->_servant ()" << be_nl
+ << "|| (servant = obj->_servant()->_downcast (\""
+ << node->repoID () << "\")) == 0" << be_uidt_nl
+ << ")" << be_uidt_nl
+ << "ACE_THROW_RETURN (CORBA::MARSHAL (), "
+ << node->full_name () << "::_nil ());" << be_uidt_nl;
+
+ // Locality constraint objects alway use "direct" collocated
+ // implementation.
+ *os << "return new " << node->full_coll_name (be_interface::DIRECT)
+ << "(" << be_idt << be_idt_nl << "ACE_reinterpret_cast ("
+ << node->full_name () << "_ptr, servant)," << be_nl
+ << "0" << be_uidt_nl << ");" << be_uidt << be_uidt_nl;
+ }
+ *os << "}" << be_nl << be_nl;
// generate code for the elements of the interface
if (this->visit_scope (node) == -1)
@@ -179,7 +199,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
if (idl_global->ami_call_back () == I_TRUE)
{
- be_interface_type_strategy *old_strategy =
+ be_interface_type_strategy *old_strategy =
node->set_strategy (new be_interface_ami_handler_strategy (node));
// = Generate the default stub code for Handler.
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
index bf0fce57413..810b199eaec 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
@@ -96,16 +96,24 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
else
{
// We don't inherit from another user defined object, hence our
- // base class is the ServantBase class.
- *os << " public virtual PortableServer::ServantBase";
+ // base class is the ServantBase class (or, Local_ServantBase for
+ // locality constraint interface.)
+ if (!idl_global->gen_locality_constraint ())
+ *os << " public virtual PortableServer::ServantBase";
+ else
+ *os << " public virtual TAO_Local_ServantBase";
}
+
*os << be_nl
<< "{" << be_nl
<< "protected:" << be_idt_nl
<< namebuf << " (void);\n" << be_uidt_nl
- << "public:" << be_idt_nl
- << namebuf << " (const " << namebuf << "& rhs);" << be_nl
- << "virtual ~" << namebuf << " (void);\n\n";
+ << "public:" << be_idt_nl;
+
+ // No copy constructor for locality constraint interface.
+ if (!idl_global->gen_locality_constraint ())
+ *os << namebuf << " (const " << namebuf << "& rhs);" << be_nl;
+ *os << "virtual ~" << namebuf << " (void);\n\n";
*os << be_nl
<< "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl
@@ -119,34 +127,39 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
<< "const char* logical_type_id" << be_uidt_nl
<< ");\n" << be_uidt_nl;
- // add a skeleton for our _is_a method
- *os << "static void _is_a_skel (" << be_idt << be_idt_nl
- << "CORBA::ServerRequest &req," << be_nl
- << "void *obj," << be_nl
- << "void *context," << be_nl
- << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl
- << "TAO_default_environment ()"
- << be_uidt << be_uidt_nl
- << ");\n" << be_uidt_nl;
-
- // add a skeleton for our _non_existent method
- *os << "static void _non_existent_skel (" << be_idt << be_idt_nl
- << "CORBA::ServerRequest &req," << be_nl
- << "void *obj," << be_nl
- << "void *context," << be_nl
- << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl
- << "TAO_default_environment ()"
- << be_uidt << be_uidt_nl
- << ");\n" << be_uidt_nl;
-
- // add the dispatch method
- *os << "virtual void _dispatch (" << be_idt << be_idt_nl
- << "CORBA::ServerRequest &_tao_req," << be_nl
- << "void *_tao_context," << be_nl
- << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl
- << "TAO_default_environment ()"
- << be_uidt << be_uidt_nl
- << ");\n" << be_uidt_nl;
+ // No static skeleton methods and the _dispatch operation for
+ // locality constraint interface.
+ if (!idl_global->gen_locality_constraint ())
+ {
+ // add a skeleton for our _is_a method
+ *os << "static void _is_a_skel (" << be_idt << be_idt_nl
+ << "CORBA::ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *context," << be_nl
+ << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl
+ << "TAO_default_environment ()"
+ << be_uidt << be_uidt_nl
+ << ");\n" << be_uidt_nl;
+
+ // add a skeleton for our _non_existent method
+ *os << "static void _non_existent_skel (" << be_idt << be_idt_nl
+ << "CORBA::ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *context," << be_nl
+ << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl
+ << "TAO_default_environment ()"
+ << be_uidt << be_uidt_nl
+ << ");\n" << be_uidt_nl;
+
+ // add the dispatch method
+ *os << "virtual void _dispatch (" << be_idt << be_idt_nl
+ << "CORBA::ServerRequest &_tao_req," << be_nl
+ << "void *_tao_context," << be_nl
+ << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl
+ << "TAO_default_environment ()"
+ << be_uidt << be_uidt_nl
+ << ");\n" << be_uidt_nl;
+ }
// Print out the _this() method.
*os << node->full_name () << " *_this (" << be_idt << be_idt_nl
@@ -169,15 +182,21 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
-1);
}
- // generate skeletons for operations of our base classes. These skeletons
- // just cast the pointer to the appropriate type before invoking the call.
- if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1)
+ // Skip the generation of static skeletons for locality constraint
+ // interface.
+ if (!idl_global->gen_locality_constraint ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_sh::"
- "visit_interface - "
- "inheritance graph traversal failed\n"),
- -1);
+ // generate skeletons for operations of our base classes. These
+ // skeletons just cast the pointer to the appropriate type
+ // before invoking the call.
+ if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
}
*os << be_uidt_nl << "};\n\n";
@@ -185,7 +204,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
be_visitor_context ctx (*this->ctx_);
be_visitor *visitor = 0;
-
+
// generate the collocated class
if (idl_global->gen_thru_poa_collocation ())
{
@@ -228,20 +247,24 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
visitor = 0;
}
- // generate the TIE class.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SH);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ // No need to generate TIE class for locality constraint interface.
+ if (!idl_global->gen_locality_constraint ())
{
+ // generate the TIE class.
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SH);
+ visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor || (node->accept (visitor) == -1))
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for TIE class failed\n"),
+ -1);
+ }
delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_sh::"
- "visit_interface - "
- "codegen for TIE class failed\n"),
- -1);
}
- delete visitor;
*os << "\n";
ctx.stream (tao_cg->server_template_header ());
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
index 6ac012bab0a..91c74396f9d 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
@@ -60,31 +60,36 @@ be_visitor_interface_si::visit_interface (be_interface *node)
-1);
}
- // Generate skeletons for operations of our base classes. These skeletons
- // just cast the pointer to the appropriate type before invoking the
- // call. Hence we generate these in the inline file
- if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os)
- == -1)
+ // Skip the generation of static skeleton and TIE class for locality
+ // constraint interface.
+ if (!idl_global->gen_locality_constraint ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface_si::"
- "visit_interface - "
- "codegen for base class skeletons failed\n"), -1);
- }
+ // Generate skeletons for operations of our base classes. These skeletons
+ // just cast the pointer to the appropriate type before invoking the
+ // call. Hence we generate these in the inline file
+ if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_si::"
+ "visit_interface - "
+ "codegen for base class skeletons failed\n"), -1);
+ }
- // generate the TIE class
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SI);
- ctx.stream (tao_cg->server_template_inline ());
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_sh::"
- "visit_interface - "
- "codegen for TIE class failed\n"),
- -1);
+ // generate the TIE class
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SI);
+ ctx.stream (tao_cg->server_template_inline ());
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor || (node->accept (visitor) == -1))
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for TIE class failed\n"),
+ -1);
+ }
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
index fb2d0243007..01989fba163 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
@@ -54,71 +54,76 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
os->indent (); // start with whatever indentation level we are at
- if (node->gen_operation_table () == -1)
+ // Skip the generation of collocation factory function pointer
+ // initializer if the interface is locality constraint.
+ if (!idl_global->gen_locality_constraint ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ss::"
- "visit_interface - "
- "codegen for operation table failed\n"),
- -1);
- }
-
- // Collocation function pointer initializer.
- *os << node->full_name () << "_ptr _TAO_collocation_POA_"
- << node->flat_name () << "_Stub_Factory (" << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj" << be_uidt_nl
- << ")" << be_uidt_nl;
-
- *os << "{" << be_idt_nl
- << "TAO_Stub *stub = obj->_stubobj ();" << be_nl << be_nl
- << "switch (stub->servant_orb_var ()->orb_core"
- << " ()->get_collocation_strategy ())" << be_idt_nl
- << "{" << be_nl << "case TAO_ORB_Core::THRU_POA:" << be_idt_nl;
-
- if (idl_global->gen_thru_poa_collocation ())
- *os << "return new " << node->full_coll_name (be_interface::THRU_POA)
- << " (stub);" << be_uidt_nl;
- else
- *os << "break;" << be_uidt_nl;
-
- *os << "case TAO_ORB_Core::DIRECT:" << be_idt_nl;
+ if (node->gen_operation_table () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "codegen for operation table failed\n"),
+ -1);
+ }
- if (idl_global->gen_direct_collocation ())
- *os << "if (obj->_servant () != 0)" << be_idt_nl
- << "{" << be_idt_nl
- << node->full_skel_name () << "* servant = ACE_reinterpret_cast ("
- << node->full_skel_name () << "*, obj->_servant ()->_downcast (\""
- << node->repoID () << "\"));" << be_nl
- << "if (servant != 0)" << be_idt_nl
- << "return new " << node->full_coll_name (be_interface::DIRECT)
- << " (servant, stub);" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl;
-
- *os << "break;" << be_uidt_nl
- << "default:" << be_idt_nl
- << "break;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "return 0;" << be_uidt_nl
- << "}\n\n";
-
- *os << "int _TAO_collocation_POA_" << node->flat_name ()
- << "_Stub_Factory_Initializer"
- << " (long dummy)" << be_nl
- << "{" << be_idt_nl
- << "ACE_UNUSED_ARG (dummy);" << be_nl << be_nl
- << "_TAO_collocation_" << node->flat_name ()
- << "_Stub_Factory_function_pointer = " << be_idt_nl
- << "_TAO_collocation_POA_" << node->flat_name ()
- << "_Stub_Factory;" << be_uidt_nl << be_nl
- << "return 0;" << be_uidt_nl << "}" << be_nl << be_nl;
-
- *os << "static int _TAO_collocation_POA_" << node->flat_name ()
- << "_Stub_Factory_Initializer_Scarecrow = " << be_idt_nl
- << "_TAO_collocation_POA_" << node->flat_name ()
- << "_Stub_Factory_Initializer ("
- << "ACE_reinterpret_cast (long, _TAO_collocation_POA_"
- << node->flat_name () << "_Stub_Factory_Initializer));"
- << be_uidt_nl << be_nl;
+ // Collocation factory function pointer initializer.
+ *os << node->full_name () << "_ptr _TAO_collocation_POA_"
+ << node->flat_name () << "_Stub_Factory (" << be_idt << be_idt_nl
+ << "CORBA::Object_ptr obj" << be_uidt_nl
+ << ")" << be_uidt_nl;
+
+ *os << "{" << be_idt_nl
+ << "TAO_Stub *stub = obj->_stubobj ();" << be_nl << be_nl
+ << "switch (stub->servant_orb_var ()->orb_core"
+ << " ()->get_collocation_strategy ())" << be_idt_nl
+ << "{" << be_nl << "case TAO_ORB_Core::THRU_POA:" << be_idt_nl;
+
+ if (idl_global->gen_thru_poa_collocation ())
+ *os << "return new " << node->full_coll_name (be_interface::THRU_POA)
+ << " (stub);" << be_uidt_nl;
+ else
+ *os << "break;" << be_uidt_nl;
+
+ *os << "case TAO_ORB_Core::DIRECT:" << be_idt_nl;
+
+ if (idl_global->gen_direct_collocation ())
+ *os << "if (obj->_servant () != 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << node->full_skel_name () << "* servant = ACE_reinterpret_cast ("
+ << node->full_skel_name () << "*, obj->_servant ()->_downcast (\""
+ << node->repoID () << "\"));" << be_nl
+ << "if (servant != 0)" << be_idt_nl
+ << "return new " << node->full_coll_name (be_interface::DIRECT)
+ << " (servant, stub);" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl;
+
+ *os << "break;" << be_uidt_nl
+ << "default:" << be_idt_nl
+ << "break;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "return 0;" << be_uidt_nl
+ << "}\n\n";
+
+ *os << "int _TAO_collocation_POA_" << node->flat_name ()
+ << "_Stub_Factory_Initializer"
+ << " (long dummy)" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_UNUSED_ARG (dummy);" << be_nl << be_nl
+ << "_TAO_collocation_" << node->flat_name ()
+ << "_Stub_Factory_function_pointer = " << be_idt_nl
+ << "_TAO_collocation_POA_" << node->flat_name ()
+ << "_Stub_Factory;" << be_uidt_nl << be_nl
+ << "return 0;" << be_uidt_nl << "}" << be_nl << be_nl;
+
+ *os << "static int _TAO_collocation_POA_" << node->flat_name ()
+ << "_Stub_Factory_Initializer_Scarecrow = " << be_idt_nl
+ << "_TAO_collocation_POA_" << node->flat_name ()
+ << "_Stub_Factory_Initializer ("
+ << "ACE_reinterpret_cast (long, _TAO_collocation_POA_"
+ << node->flat_name () << "_Stub_Factory_Initializer));"
+ << be_uidt_nl << be_nl;
+ }
// constructor
*os << "// skeleton constructor" << be_nl;
@@ -136,36 +141,44 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
" (void)" << be_nl;
}
- *os << "{" << be_idt_nl
- << "this->optable_ = &tao_" << node->flat_name ()
- << "_optable;" << be_uidt_nl
- << "}" << be_nl << be_nl;
-
- *os << "// copy ctor" << be_nl;
- // find if we are at the top scope or inside some module
- if (!node->is_nested ())
- {
- // we are outermost. So the POA_ prefix is prepended to our name
- *os << node->full_skel_name () << "::POA_"
- << node->local_name () << " ("
- << "const POA_" << node->local_name () << "& rhs)";
- }
+ *os << "{" << be_idt_nl;
+ // No need to initialize optable for locality constraint interface.
+ if (!idl_global->gen_locality_constraint ())
+ *os << "this->optable_ = &tao_" << node->flat_name ()
+ << "_optable;" << be_uidt_nl;
else
+ *os << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+ // Skip copy constructor if interface is locality constraint.
+ if (!idl_global->gen_locality_constraint ())
{
- // the POA_ prefix is prepended to our outermost module name
- *os << node->full_skel_name () << "::"
- << node->local_name () << " (const "
- << node->local_name () << "& rhs)";
+ *os << "// copy ctor" << be_nl;
+ // find if we are at the top scope or inside some module
+ if (!node->is_nested ())
+ {
+ // we are outermost. So the POA_ prefix is prepended to our name
+ *os << node->full_skel_name () << "::POA_"
+ << node->local_name () << " ("
+ << "const POA_" << node->local_name () << "& rhs)";
+ }
+ else
+ {
+ // the POA_ prefix is prepended to our outermost module name
+ *os << node->full_skel_name () << "::"
+ << node->local_name () << " (const "
+ << node->local_name () << "& rhs)";
+ }
+ *os << be_idt_nl
+ << ": ";
+ if (node->traverse_inheritance_graph
+ (be_interface::copy_ctor_helper, os) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::visit_interface - "
+ " copy ctor generation failed\n"), -1);
+ *os << " TAO_ServantBase (rhs)" << be_uidt_nl
+ << "{}" << be_nl << be_nl;
}
- *os << be_idt_nl
- << ": ";
- if (node->traverse_inheritance_graph
- (be_interface::copy_ctor_helper, os) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_ss::visit_interface - "
- " copy ctor generation failed\n"), -1);
- *os << " TAO_ServantBase (rhs)" << be_uidt_nl
- << "{}" << be_nl << be_nl;
*os << "// skeleton destructor" << be_nl;
@@ -195,52 +208,57 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
-1);
}
- // generate code for the _is_a skeleton
- os->indent ();
- *os << "void " << node->full_skel_name ()
- << "::_is_a_skel (" << be_idt << be_idt_nl
- << "CORBA::ServerRequest &_tao_server_request, " << be_nl
- << "void * _tao_object_reference," << be_nl
- << "void * /* context */," << be_nl
- << "CORBA::Environment &ACE_TRY_ENV" << be_uidt_nl
- << ")" << be_uidt_nl;
- *os << "{" << be_idt_nl;
- *os << "TAO_InputCDR &_tao_in = _tao_server_request.incoming ();" << be_nl;
- *os << node->full_skel_name () << " *_tao_impl = ("
- << node->full_skel_name () << " *) _tao_object_reference;" << be_nl;
- *os << "CORBA::Boolean _tao_retval = 0;" << be_nl;
- *os << "CORBA::String_var value;" << be_nl;
- *os << "if (!((_tao_in >> value.out ())))" << be_idt_nl;
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl << be_nl;
- *os << "_tao_retval = _tao_impl->_is_a (value.in (), ACE_TRY_ENV);" << be_nl;
- *os << "ACE_CHECK;" << be_nl << be_nl;
- *os << "_tao_server_request.init_reply (ACE_TRY_ENV);" << be_nl;
- *os << "ACE_CHECK;" << be_nl;
- *os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" << be_nl;
- *os << "if (!((_tao_out << CORBA::Any::from_boolean (_tao_retval))))" << be_idt_nl;
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt << be_uidt_nl;
- *os << "}" << be_nl << be_nl;
-
-
- // generate code for the _non_existent skeleton
- *os << "void " << node->full_skel_name ()
- << "::_non_existent_skel (" << be_idt << be_idt_nl
- << "CORBA::ServerRequest &_tao_server_request, " << be_nl
- << "void * _tao_object_reference," << be_nl
- << "void * /* context */," << be_nl
- << "CORBA::Environment &ACE_TRY_ENV" << be_uidt_nl
- << ")" << be_uidt_nl;
- *os << "{" << be_idt_nl;
- *os << node->full_skel_name () << " *_tao_impl = ("
- << node->full_skel_name () << " *) _tao_object_reference;" << be_nl;
- *os << "CORBA::Boolean _tao_retval = _tao_impl->_non_existent (ACE_TRY_ENV);" << be_nl;
- *os << "ACE_CHECK;" << be_nl << be_nl;
- *os << "_tao_server_request.init_reply (ACE_TRY_ENV);" << be_nl;
- *os << "ACE_CHECK;" << be_nl;
- *os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" << be_nl;
- *os << "if (!((_tao_out << CORBA::Any::from_boolean (_tao_retval))))" << be_idt_nl;
- *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt << be_uidt_nl;
- *os << "}\n\n";
+ // Skip the generation of default static skeletons if the interface
+ // is locality constraint.
+ if (!idl_global->gen_locality_constraint ())
+ {
+ // generate code for the _is_a skeleton
+ os->indent ();
+ *os << "void " << node->full_skel_name ()
+ << "::_is_a_skel (" << be_idt << be_idt_nl
+ << "CORBA::ServerRequest &_tao_server_request, " << be_nl
+ << "void * _tao_object_reference," << be_nl
+ << "void * /* context */," << be_nl
+ << "CORBA::Environment &ACE_TRY_ENV" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << "TAO_InputCDR &_tao_in = _tao_server_request.incoming ();" << be_nl;
+ *os << node->full_skel_name () << " *_tao_impl = ("
+ << node->full_skel_name () << " *) _tao_object_reference;" << be_nl;
+ *os << "CORBA::Boolean _tao_retval = 0;" << be_nl;
+ *os << "CORBA::String_var value;" << be_nl;
+ *os << "if (!((_tao_in >> value.out ())))" << be_idt_nl;
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt_nl << be_nl;
+ *os << "_tao_retval = _tao_impl->_is_a (value.in (), ACE_TRY_ENV);" << be_nl;
+ *os << "ACE_CHECK;" << be_nl << be_nl;
+ *os << "_tao_server_request.init_reply (ACE_TRY_ENV);" << be_nl;
+ *os << "ACE_CHECK;" << be_nl;
+ *os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" << be_nl;
+ *os << "if (!((_tao_out << CORBA::Any::from_boolean (_tao_retval))))" << be_idt_nl;
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+
+
+ // generate code for the _non_existent skeleton
+ *os << "void " << node->full_skel_name ()
+ << "::_non_existent_skel (" << be_idt << be_idt_nl
+ << "CORBA::ServerRequest &_tao_server_request, " << be_nl
+ << "void * _tao_object_reference," << be_nl
+ << "void * /* context */," << be_nl
+ << "CORBA::Environment &ACE_TRY_ENV" << be_uidt_nl
+ << ")" << be_uidt_nl;
+ *os << "{" << be_idt_nl;
+ *os << node->full_skel_name () << " *_tao_impl = ("
+ << node->full_skel_name () << " *) _tao_object_reference;" << be_nl;
+ *os << "CORBA::Boolean _tao_retval = _tao_impl->_non_existent (ACE_TRY_ENV);" << be_nl;
+ *os << "ACE_CHECK;" << be_nl << be_nl;
+ *os << "_tao_server_request.init_reply (ACE_TRY_ENV);" << be_nl;
+ *os << "ACE_CHECK;" << be_nl;
+ *os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" << be_nl;
+ *os << "if (!((_tao_out << CORBA::Any::from_boolean (_tao_retval))))" << be_idt_nl;
+ *os << "ACE_THROW (CORBA::MARSHAL ());" << be_uidt << be_uidt_nl;
+ *os << "}\n\n";
+ }
os->indent ();
*os << "CORBA::Boolean " << node->full_skel_name ()
@@ -292,26 +310,31 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << "return 0;" << be_uidt_nl
<< "}" << be_nl << be_nl;
- // now the dispatch method
- *os << "void " << node->full_skel_name () <<
- "::_dispatch (CORBA::ServerRequest &req, " <<
- "void *context, CORBA::Environment &ACE_TRY_ENV)" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "TAO_Skeleton skel; // pointer to skeleton for operation" << be_nl;
- *os << "const char *opname = req.operation (); // retrieve operation name"
- << be_nl;
- *os << "// find the skeleton corresponding to this opname" << be_nl;
- *os << "if (this->_find (opname, skel, req.operation_length ()) == -1)" << be_nl;
- *os << "{" << be_idt_nl;
- *os << "ACE_ERROR ((LM_ERROR, \"Bad operation <%s>\\n\", opname));" << be_nl;
- *os << "ACE_THROW (CORBA_BAD_OPERATION ());"
- //<< "ACE_TRY_ENV);" << be_uidt_nl;
- << be_uidt_nl;
- // *os << "env.exception (new CORBA_BAD_OPERATION ());" << be_nl;
- *os << "}" << be_nl;
- *os << "else" << be_idt_nl;
- *os << "skel (req, this, context, ACE_TRY_ENV);" << be_uidt << be_uidt_nl;
- *os << "}" << be_nl << be_nl;
+ // Also skip the generation of the _dispatch method for locality
+ // constraint interface.
+ if (!idl_global->gen_locality_constraint ())
+ {
+ // now the dispatch method
+ *os << "void " << node->full_skel_name () <<
+ "::_dispatch (CORBA::ServerRequest &req, " <<
+ "void *context, CORBA::Environment &ACE_TRY_ENV)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "TAO_Skeleton skel; // pointer to skeleton for operation" << be_nl;
+ *os << "const char *opname = req.operation (); // retrieve operation name"
+ << be_nl;
+ *os << "// find the skeleton corresponding to this opname" << be_nl;
+ *os << "if (this->_find (opname, skel, req.operation_length ()) == -1)" << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "ACE_ERROR ((LM_ERROR, \"Bad operation <%s>\\n\", opname));" << be_nl;
+ *os << "ACE_THROW (CORBA_BAD_OPERATION ());"
+ //<< "ACE_TRY_ENV);" << be_uidt_nl;
+ << be_uidt_nl;
+ // *os << "env.exception (new CORBA_BAD_OPERATION ());" << be_nl;
+ *os << "}" << be_nl;
+ *os << "else" << be_idt_nl;
+ *os << "skel (req, this, context, ACE_TRY_ENV);" << be_uidt << be_uidt_nl;
+ *os << "}" << be_nl << be_nl;
+ }
*os << "const char* " << node->full_skel_name ()
<< "::_interface_repository_id (void) const"
@@ -326,37 +349,47 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
<< "::_this (CORBA_Environment &ACE_TRY_ENV)" << be_nl
<< "{" << be_idt_nl
<< "TAO_Stub *stub = this->_create_stub (ACE_TRY_ENV);" << be_nl
- << "ACE_CHECK_RETURN (0);" << be_nl
- << "if (stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects ())" << be_idt_nl
- << "switch (stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ())" << be_idt_nl
- << "{" << be_nl
- << "case TAO_ORB_Core::THRU_POA:" << be_idt_nl;
-
- // Thru POA stub
- if (idl_global->gen_thru_poa_collocation ())
- *os << "return new "
- << node->full_coll_name (be_interface::THRU_POA) << " (stub);" << be_uidt_nl;
- else
- *os << "ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);" << be_uidt_nl;
+ << "ACE_CHECK_RETURN (0);" << be_nl;
- // Direct stub
- *os << "case TAO_ORB_Core::DIRECT:" << be_idt_nl;
- if (idl_global->gen_direct_collocation ())
+ // The _this operation is much more simpler for locality constraint
+ // interface.
+ if (idl_global->gen_locality_constraint ())
*os << "return new "
- << node->full_coll_name (be_interface::DIRECT) << " (this, stub);" << be_uidt_nl;
+ << node->full_coll_name (be_interface::DIRECT) << " (this, stub);"
+ << be_uidt_nl << "}\n\n";
else
- *os << "ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);" << be_uidt_nl;
+ {
+ *os << "if (stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects ())" << be_idt_nl
+ << "switch (stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ())" << be_idt_nl
+ << "{" << be_nl
+ << "case TAO_ORB_Core::THRU_POA:" << be_idt_nl;
+
+ // Thru POA stub
+ if (idl_global->gen_thru_poa_collocation ())
+ *os << "return new "
+ << node->full_coll_name (be_interface::THRU_POA) << " (stub);" << be_uidt_nl;
+ else
+ *os << "ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);" << be_uidt_nl;
- *os << "default:" << be_idt_nl
- << "ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "else" << be_idt_nl
- << "{" << be_idt_nl
- << "// stub->_incr_refcnt ();" << be_nl
- << "CORBA::Object_var obj = new CORBA::Object (stub);" << be_nl
- << "return " << node->name () << "::_unchecked_narrow (obj.in ());" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}\n\n";
+ // Direct stub
+ *os << "case TAO_ORB_Core::DIRECT:" << be_idt_nl;
+ if (idl_global->gen_direct_collocation ())
+ *os << "return new "
+ << node->full_coll_name (be_interface::DIRECT) << " (this, stub);" << be_uidt_nl;
+ else
+ *os << "ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);" << be_uidt_nl;
+
+ *os << "default:" << be_idt_nl
+ << "ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "// stub->_incr_refcnt ();" << be_nl
+ << "CORBA::Object_var obj = new CORBA::Object (stub);" << be_nl
+ << "return " << node->name () << "::_unchecked_narrow (obj.in ());" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}\n\n";
+ }
// the _create_collocated_objref method. If the idl compiler does
// not generate the type of collocated stub but the orb is asking
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
index a154fd94c07..887068f0b52 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
@@ -60,7 +60,7 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
-1);
}
- // generate the CORBA::Environment parameter for the alternative mapping
+ // generate the CORBA::Environment parameter for the alternative mapping
if (!idl_global->exception_support ())
{
// if the operation node has parameters, then we need to insert a comma
@@ -104,6 +104,14 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH:
+ // User defined operations are pure virtual if the interface
+ // is locality constraint.
+ if (idl_global->gen_locality_constraint ())
+ {
+ *os << " = 0;\n\n";
+ break;
+ }
+ // Fall thru.
case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH:
case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH:
*os << ";\n\n";
@@ -218,4 +226,3 @@ be_visitor_operation_arglist::post_process (be_decl *bd)
}
return 0;
}
-
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 f3e46b3eb18..3e76c129671 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
@@ -54,6 +54,10 @@ be_visitor_operation_cs::post_process (be_decl *bd)
int
be_visitor_operation_cs::visit_operation (be_operation *node)
{
+ // For locality constraint interface, all operations are pure virtual.
+ if (idl_global->gen_locality_constraint ())
+ return 0;
+
TAO_OutStream *os; // output stream
be_type *bt; // type node
be_visitor_context ctx; // visitor context
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp
index 05bca9d22d2..d9401665d1d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp
@@ -119,8 +119,8 @@ be_visitor_operation_sh::visit_operation (be_operation *node)
delete visitor;
// generate the corresponding static skeleton method for this operation only
- // if there was no "native" type
- if (!node->has_native ())
+ // if there was no "native" type and the interface is not locality constraint.
+ if (!node->has_native () && !idl_global->gen_locality_constraint ())
{
os->indent ();
*os << "static void ";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
index 172fe6e66a2..9b9fe85274f 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
@@ -95,6 +95,11 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
+ // Skip the generation of static skeloton if the interface is
+ // locality constraint.
+ if (idl_global->gen_locality_constraint ())
+ return 0;
+
// generate the signature of the static skeleton
os->indent ();
*os << "void " << intf->full_skel_name () << "::";
diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp
index f48953c2c8b..fd6b7ab8610 100644
--- a/TAO/TAO_IDL/driver/drv_args.cpp
+++ b/TAO/TAO_IDL/driver/drv_args.cpp
@@ -621,6 +621,14 @@ DRV_parse_args (long ac, char **av)
{
// optimized typecode support
idl_global->gen_locality_constraint (1);
+
+ // Automatically switch on the generation of
+ // direct collocated stubs and supress the generation
+ // of thru_poa collocated stubs and ami_call_back stuff
+ // if we are building for locality constraint interfaces.
+ idl_global->gen_thru_poa_collocation (0);
+ idl_global->gen_direct_collocation (1);
+ idl_global->ami_call_back (0);
}
else if (av[i][2] == 't')
{
diff --git a/TAO/docs/compiler.html b/TAO/docs/compiler.html
index 1793931c943..f7839b76642 100644
--- a/TAO/docs/compiler.html
+++ b/TAO/docs/compiler.html
@@ -483,6 +483,16 @@ also receives other options that are specific to it. <P>
<td>&nbsp;</td>
</tr>
+ <tr><a name="Gl flag">
+ <td><tt>-Gl </tt></td>
+
+ <td><b>For TAO Core developer only</b>. Generate <em>locality
+ constraint</em> interface implementation. This flag is not of
+ general interests and should never be used by end-users.
+ </td>
+ <td>&nbsp;</td>
+ </tr>
+
<tr><a name="Gp">
<td><tt>-Gp </tt></td>