summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL
diff options
context:
space:
mode:
authorkirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-11-19 23:58:43 +0000
committerkirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-11-19 23:58:43 +0000
commit52017be0f466e59676c410f00509d2053a6b8347 (patch)
treeefb75a66a350f30604a32fae8157b0c6d9ec913b /TAO/TAO_IDL
parent32405d77135081dff4d8f1f7728351d767731f3c (diff)
downloadATCD-52017be0f466e59676c410f00509d2053a6b8347.tar.gz
ChangeLogTag:Fri Nov 19 17:05:00 1999 Kirthika Parameswaran
<kirthika@cs.wustl.edu>
Diffstat (limited to 'TAO/TAO_IDL')
-rw-r--r--TAO/TAO_IDL/be/be_visitor.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp57
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp139
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp122
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp203
8 files changed, 564 insertions, 27 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor.cpp b/TAO/TAO_IDL/be/be_visitor.cpp
index 44376118d82..26b5631dc58 100644
--- a/TAO/TAO_IDL/be/be_visitor.cpp
+++ b/TAO/TAO_IDL/be/be_visitor.cpp
@@ -27,7 +27,6 @@
ACE_RCSID(be, be_visitor, "$Id$")
-
be_visitor::be_visitor (void)
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
index 3648cf955eb..c736c070614 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
@@ -80,7 +80,6 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
// Get the strategy from the attribute and hand it over
// to the operation
delete op->set_strategy (node->get_get_strategy ());
-
be_visitor_context ctx (*this->ctx_);
@@ -118,6 +117,12 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_ATTRIBUTE_DIRECT_COLLOCATED_SS:
ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_COLLOCATED_SS);
break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CH:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CS:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
+ break;
case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH:
ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SH);
break;
@@ -245,7 +250,12 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI:
ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI);
break;
-
+ case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CH:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CS:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
+ break;
default:
// error
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
index 10a797980ec..57ccda35af5 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
@@ -94,6 +94,12 @@ be_visitor_interface::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_DIRECT_COLLOCATED_SS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CH);
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
+ ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_SMART_PROXY_CS);
+ break;
case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_TIE_SH);
break;
@@ -171,6 +177,8 @@ be_visitor_interface::visit_constant (be_constant *node)
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
case TAO_CodeGen::TAO_INTERFACE_CI:
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_IH:
@@ -259,6 +267,8 @@ be_visitor_interface::visit_enum (be_enum *node)
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
return 0; // nothing to be done
@@ -343,6 +353,8 @@ be_visitor_interface::visit_exception (be_exception *node)
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
return 0; // nothing to be done
@@ -431,6 +443,12 @@ be_visitor_interface::visit_operation (be_operation *node)
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS:
ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_COLLOCATED_SS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH);
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
+ ctx.state (TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS);
+ break;
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH:
@@ -559,6 +577,8 @@ be_visitor_interface::visit_structure (be_structure *node)
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
return 0; // nothing to be done
@@ -643,6 +663,8 @@ be_visitor_interface::visit_union (be_union *node)
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
return 0; // nothing to be done
@@ -727,6 +749,8 @@ be_visitor_interface::visit_typedef (be_typedef *node)
case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
+ case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
case TAO_CodeGen::TAO_INTERFACE_TIE_SH:
case TAO_CodeGen::TAO_INTERFACE_TIE_SI:
return 0; // nothing to be done
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 c445d69e923..5bac6598162 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -157,7 +157,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
<< "static " << node->local_name () << "_ptr " << "_duplicate ("
<< node->local_name () << "_ptr obj);" << be_nl
<< "static " << node->local_name () << "_ptr "
- << "_narrow (" << be_idt << be_idt_nl
+ << "_narrow (" << be_idt << be_idt_nl
<< "CORBA::Object_ptr obj," << be_nl
<< "CORBA::Environment &env = " << be_idt_nl
<< "TAO_default_environment ()"
@@ -193,7 +193,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
"codegen for scope failed\n"), -1);
}
// the _is_a method
- os->indent ();
+ os->indent ();
*os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl
<< "const CORBA::Char *type_id, " << be_nl
<< "CORBA::Environment &env = " << be_idt_nl
@@ -219,16 +219,35 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
*os << "private:" << be_idt_nl;
*os << node->local_name () << " (const " << node->local_name () << " &);"
<< be_nl
- << "void operator= (const " << node->local_name () << " &);" << be_uidt_nl;
+ << "void operator= (const " << node->local_name () << " &);";
+ *os << be_uidt <<be_uidt_nl;
*os << "};\n\n";
- os->gen_endif ();
+ // Smart Proxy related classes.
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor *visitor = 0;
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH);
+ visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor || (node->accept (visitor) == -1))
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for smart proxy classes failed\n"),
+ -1);
+ }
+ delete visitor;
+ visitor = 0;
+
+ os->gen_endif ();
+
// by using a visitor to declare and define the TypeCode, we have the
// added advantage to conditionally not generate any code. This will be
// based on the command line options. This is still TO-DO
- be_visitor *visitor;
- be_visitor_context ctx (*this->ctx_);
+ // be_visitor *visitor;
+ visitor = 0;
ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL);
visitor = tao_cg->make_visitor (&ctx);
if (!visitor || (node->accept (visitor) == -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 61513077111..8fc51c0f174 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -84,11 +84,6 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< ")" << be_uidt_nl
<< "{" << be_idt_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
if (!idl_global->gen_locality_constraint ())
{
@@ -96,20 +91,29 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "return " << node->full_name () << "::_nil ();" << be_uidt_nl;
*os << "TAO_Stub* stub = obj->_stubobj ();" << be_nl
- << "stub->_incr_refcnt ();" << be_nl;
+ << "stub->_incr_refcnt ();" << be_nl
+ // Declare the default proxy.
+ <<node->full_name () << "_ptr default_proxy = "
+ << node->full_name () <<"::_nil ();" << be_nl;
+
+ // If the policy didtates that the proxy be collocated, use the
+ // function to create one.
*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 << node->full_name () << "_ptr retval = 0;" << be_nl
- << "ACE_NEW_RETURN (retval, " << node->full_name ()
- << " (stub), 0);" << be_nl
- << "return retval;" << be_uidt_nl;
+ << be_idt_nl << "{"<<be_idt_nl
+ << "default_proxy = _TAO_collocation_"<< node->flat_name ()
+ << "_Stub_Factory_function_pointer (obj);"
+ << be_uidt_nl<<"}"<<be_uidt_nl;
+
+ // The default proxy will either be returned else be transformed to
+ // a smart one!
+ *os << "if (CORBA::is_nil (default_proxy))" << be_idt_nl
+ << "ACE_NEW_RETURN (default_proxy, "<< node->full_name ()
+ << " (stub), " << node->full_name () << "::_nil ());"<< be_uidt_nl
+ << "return TAO_" << node->flat_name ()
+ << "_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (default_proxy);"
+ << be_uidt_nl;
}
else
{
@@ -189,11 +193,27 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "return \"" << node->repoID () << "\";" << be_uidt_nl
<< "}\n\n";
+ // Smart Proxy classes
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor *visitor = 0;
+
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS);
+ visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor || (node->accept (visitor) == -1))
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_cs::"
+ "visit_interface - "
+ "codegen for smart proxy classes failed\n"),
+ -1);
+ }
+ delete visitor;
+ visitor = 0;
+
// by using a visitor to declare and define the TypeCode, we have the
// added advantage to conditionally not generate any code. This will be
// based on the command line options. This is still TO-DO
- be_visitor *visitor;
- be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN);
ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
visitor = tao_cg->make_visitor (&ctx);
@@ -206,5 +226,6 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
-1);
}
+
return 0;
}
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
new file mode 100644
index 00000000000..42df6ada1cb
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/smart_proxy_ch.cpp
@@ -0,0 +1,139 @@
+//
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// smart_proxy_ch.cpp
+//
+// = DESCRIPTION
+// This provides code generation for smart proxy classes for an
+// interface in the client header.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_interface.h"
+
+ACE_RCSID(be_visitor_interface, smart_proxy_ch, "$Id$")
+
+
+// ************************************************************
+// smart proxy class in header
+// ************************************************************
+
+
+be_visitor_interface_smart_proxy_ch::be_visitor_interface_smart_proxy_ch
+(be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+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)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // output the class defn
+
+ *os << "class 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 register_proxy_factory = 1);"
+ << be_nl << be_nl
+ << "virtual ~TAO_" << node->flat_name ()
+ << "_Default_Proxy_Factory (void);" << be_nl << be_nl
+ << "virtual "<< node->full_name ()
+ << "_ptr create_proxy (" << be_idt << be_idt_nl
+ << node->full_name () << "_ptr proxy," << be_nl
+ << "CORBA::Environment &env = " << be_idt_nl
+ << "TAO_default_environment ()" << be_uidt << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "};\n\n";
+
+ *os << "class TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter" << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl << be_nl
+ << "friend class ACE_Singleton<TAO_" << node->flat_name ()
+ << "_Proxy_Factory_Adapter, ACE_SYNCH_RECURSIVE_MUTEX>;" << be_nl << be_nl
+ << "int register_proxy_factory (" << be_idt << be_idt_nl
+ << "TAO_" << node->flat_name () << "_Default_Proxy_Factory *df,"<< be_nl
+ << "CORBA::Environment &env = " << be_idt_nl
+ << "TAO_default_environment ()" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << "int unregister_proxy_factory (" << be_idt << be_idt_nl
+ << "CORBA::Environment &env = " << be_idt_nl
+ << "TAO_default_environment ()" << be_uidt << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl
+ << node->full_name () << "_ptr create_proxy (" << be_idt << be_idt_nl
+ << node->full_name () << "_ptr proxy," << be_nl
+ << "CORBA::Environment &env = " << be_idt_nl
+ << "TAO_default_environment ()" << be_uidt << 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 delete_proxy_factory_;" << be_nl
+ << "ACE_Recursive_Thread_Mutex lock_;"<<be_nl
+ << "};\n\n";
+
+ os->indent ();
+ *os << "typedef ACE_Singleton<TAO_"<<node->flat_name ()
+ << "_Proxy_Factory_Adapter, ACE_SYNCH_RECURSIVE_MUTEX> TAO_"
+ << node->flat_name ()<< "_PROXY_FACTORY_ADAPTER;"<<be_nl;
+
+ *os << "class TAO_"<< node->flat_name ()
+ << "_Smart_Proxy_Base : public virtual "<< node->full_name ()
+ << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "TAO_"<< node->flat_name () << "_Smart_Proxy_Base ("
+ << node->full_name () << "_ptr proxy);" << 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->decr_indent ();
+ *os << "private:" << be_idt_nl
+ << node->full_name () << "_var base_proxy_;"
+ << be_uidt_nl
+ << "};\n\n";
+
+ return 0;
+}
+
+
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
new file mode 100644
index 00000000000..33af2828483
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_ch.cpp
@@ -0,0 +1,122 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_smart_proxy_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation node in the client header.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_operation.h"
+
+ACE_RCSID(be_visitor_operation, operation_smart_proxy_ch, "$Id$")
+
+
+// ******************************************************
+// primary visitor for "operation" in client header
+// ******************************************************
+
+be_visitor_operation_smart_proxy_ch::be_visitor_operation_smart_proxy_ch (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_operation_smart_proxy_ch::~be_visitor_operation_smart_proxy_ch (void)
+{
+}
+
+int
+be_visitor_operation_smart_proxy_ch::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os; // output stream
+ be_type *bt; // type node
+
+ os = this->ctx_->stream ();
+ this->ctx_->node (node); // save the node
+
+ os->indent (); // start with the current indentation level
+
+ // every operation is declared virtual in the client code
+ *os << "virtual ";
+
+ // STEP I: generate the return type
+ bt = be_type::narrow_from_decl (node->return_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_ch::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // grab the right visitor to generate the return type
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_smart_proxy_ch::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+ if (bt->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_ch::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+ delete visitor;
+
+ // STEP 2: generate the operation name
+ *os << " " << node->local_name ();
+
+ // STEP 3: generate the argument list with the appropriate mapping. For these
+ // we grab a visitor that generates the parameter listing
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH);
+ visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_smart_proxy_ch::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+ delete visitor;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
new file mode 100644
index 00000000000..77709617ba3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/smart_proxy_cs.cpp
@@ -0,0 +1,203 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_smart_proxy_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the stubs file.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_operation.h"
+
+ACE_RCSID(be_visitor_operation, operation_smart_proxy_cs, "$Id$")
+
+
+// ************************************************************
+// Operation visitor for client stubs
+// ************************************************************
+
+be_visitor_operation_smart_proxy_cs::be_visitor_operation_smart_proxy_cs
+(be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_operation_smart_proxy_cs::~be_visitor_operation_smart_proxy_cs (void)
+{
+}
+
+int be_visitor_operation_smart_proxy_cs::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // 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;
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_cs::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ // retrieve the operation return type
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_cs::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // STEP 2: generate the return type mapping (same as in the header file)
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_smart_proxy_cs::"
+ "visit_operation - "
+ "Bad visitor for return type\n"),
+ -1);
+ }
+
+ if (bt->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_cs::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+ delete visitor;
+
+ // Its necessary to take care of the nested case. The smart proxy classes
+ // are in the same scope as the proxy (i.e. interface) but here the
+ // node (i.e the operation) is already in a scope lower than intf
+ // (i.e. be_interface), so for deciding the exact scope use intf.
+
+ be_decl* scope = be_scope::narrow_from_scope (intf->defined_in ())->decl ();
+
+ *os << " ";
+ *os << scope->full_name ();
+
+ // Only if there exists any nesting "::" is needed!
+ if (intf->is_nested ())
+ *os << "::";
+
+ *os << "TAO_" << intf->flat_name () <<"_Smart_Proxy_Base::";
+ *os << node->local_name () << " ";
+
+ // STEP 4: generate the argument list with the appropriate mapping (same as
+ // in the header file)
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS);
+ visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_ss::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ss::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+ delete visitor;
+
+ *os << "{" << be_idt << "\n";
+
+ os->indent ();
+
+ // Simply make the call and leave everything to the layer
+ // above, i.e. the client code.
+ if (!this->void_return_type (bt))
+ {
+ *os << "return ";
+ }
+
+ *os << "this->base_proxy_";
+
+ if (this->gen_invoke (ctx, node) == -1)
+ return -1;
+
+ *os << be_uidt_nl
+ << "}\n\n";
+
+ return 0;
+}
+
+int be_visitor_operation_smart_proxy_cs::gen_invoke (be_visitor_context &ctx,
+ be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "->" << node->local_name () << " ("
+ << be_idt << be_idt << "\n";
+
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor || (node->accept (visitor) == -1))
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_smart_proxy_cs::"
+ "gen_invoke - "
+ "codegen for making upcall failed\n"),
+ -1);
+ }
+
+ // end the upcall
+ *os << be_uidt_nl
+ << ");\n" << be_uidt;
+ return 0;
+}
+
+int
+be_visitor_operation_smart_proxy_cs::void_return_type (be_type *bt)
+{
+ // is the operation return type void?
+
+ if (bt->node_type () == AST_Decl::NT_pre_defined
+ && (be_predefined_type::narrow_from_decl (bt)->pt ()
+ == AST_PredefinedType::PT_void))
+ return 1;
+ else
+ return 0;
+}