summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-12 03:48:51 +0000
committeralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-12 03:48:51 +0000
commiteef953f6431182015d3ac9645ae548d93b8c4c97 (patch)
tree3da9d8c8c5b75ad5b79679b0ea829ed03920bb73
parent4d3149d6220480573c4902fe268635103ef6b164 (diff)
downloadATCD-eef953f6431182015d3ac9645ae548d93b8c4c97.tar.gz
ChangeLog Entry:Fri Jun 11 22:32:46 1999 Alexander Babu Arulanthu <alex@cs.wustl.edu>
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp173
-rw-r--r--TAO/TAO_IDL/be/be_visitor_factory.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ch.cpp127
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ci.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp1
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h8
-rw-r--r--TAO/TAO_IDL/be_include/be_interface.h32
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ch.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ci.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h1
15 files changed, 464 insertions, 90 deletions
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index f2d84c938ad..26b9ed29d28 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -351,18 +351,27 @@ be_interface::gen_def_ctors_helper (be_interface* node, be_interface* base, TAO_
}
-// generate the var definition
+// generate the var definition. If <interface_name> is not 0, generate
+// the var defn for that name. Otherwise, do it for the interface you
+// are visiting (this).
int
-be_interface::gen_var_defn (void)
+be_interface::gen_var_defn (char* interface_name)
{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
char namebuf [NAMEBUFSIZE]; // names
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (namebuf, "%s_var", this->local_name ()->get_string ());
+ // Decide which name to use.
+ if (interface_name == 0)
+ interface_name = this->local_name ()->get_string ();
- // retrieve a singleton instance of the code generator
+ // Buffer with name of the var class.
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf,
+ "%s_var",
+ interface_name);
+
+ // Retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
ch = cg->client_header ();
@@ -380,7 +389,7 @@ be_interface::gen_var_defn (void)
// default constr
*ch << namebuf << " (void); // default constructor" << nl;
- *ch << namebuf << " (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " (" << interface_name << "_ptr);" << nl;
// copy constructor
*ch << namebuf << " (const " << namebuf <<
@@ -391,31 +400,31 @@ be_interface::gen_var_defn (void)
*ch << nl;
// assignment operator from a pointer
- *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " &operator= (" << interface_name << "_ptr);" << nl;
// assignment from _var
*ch << namebuf << " &operator= (const " << namebuf <<
" &);" << nl;
// arrow operator
- *ch << local_name () << "_ptr operator-> (void) const;" << nl;
+ *ch << interface_name << "_ptr operator-> (void) const;" << nl;
*ch << nl;
// other extra types (cast operators, [] operator, and others)
- *ch << "operator const " << local_name () << "_ptr &() const;" << nl;
- *ch << "operator " << local_name () << "_ptr &();" << nl;
+ *ch << "operator const " << interface_name << "_ptr &() const;" << nl;
+ *ch << "operator " << interface_name << "_ptr &();" << nl;
*ch << "// in, inout, out, _retn " << nl;
// the return types of in, out, inout, and _retn are based on the parameter
// passing rules and the base type
- *ch << local_name () << "_ptr in (void) const;" << nl;
- *ch << local_name () << "_ptr &inout (void);" << nl;
- *ch << local_name () << "_ptr &out (void);" << nl;
- *ch << local_name () << "_ptr _retn (void);" << nl;
+ *ch << interface_name << "_ptr in (void) const;" << nl;
+ *ch << interface_name << "_ptr &inout (void);" << nl;
+ *ch << interface_name << "_ptr &out (void);" << nl;
+ *ch << interface_name << "_ptr _retn (void);" << nl;
// generate an additional member function that returns the underlying pointer
- *ch << local_name () << "_ptr ptr (void) const;\n";
+ *ch << interface_name << "_ptr ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
@@ -423,7 +432,7 @@ be_interface::gen_var_defn (void)
// private
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "_ptr ptr_;\n";
+ *ch << interface_name << "_ptr ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -431,21 +440,33 @@ be_interface::gen_var_defn (void)
return 0;
}
-// implementation of the _var class. All of these get generated in the inline
-// file
+// implementation of the _var class. All of these get generated in the
+// inline file.
+// If the argument is 0, then use the name in <this>, otherwise use
+// the name given. Just making the class more useful.
int
-be_interface::gen_var_impl (void)
+be_interface::gen_var_impl (char *interface_local_name,
+ char *interface_full_name)
{
TAO_OutStream *ci; // output stream
TAO_NL nl; // end line
char fname [NAMEBUFSIZE]; // to hold the full and
char lname [NAMEBUFSIZE]; // local _var names
+ // Decide on the names to use.
+ // Even if one argument is 0, there is no point using the
+ // arguments. Let us then use the name in this node.
+ if (interface_local_name == 0 || interface_full_name == 0)
+ {
+ interface_local_name = local_name ()->get_string ();
+ interface_full_name = (char *) this->fullname ();
+ }
+
ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_var", this->fullname ());
+ ACE_OS::sprintf (fname, "%s_var", interface_full_name);
ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+ ACE_OS::sprintf (lname, "%s_var", interface_local_name);
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -453,8 +474,8 @@ be_interface::gen_var_impl (void)
ci = cg->client_inline ();
// generate the var implementation in the inline file
- // Depending upon the data type, there are some differences which we account
- // for over here.
+ // Depending upon the data type, there are some differences which we
+ // account for over here.
ci->indent (); // start with whatever was our current indent level
@@ -467,13 +488,13 @@ be_interface::gen_var_impl (void)
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname <<
" (void) // default constructor" << nl;
- *ci << " " << ": ptr_ (" << this->name () << "::_nil ())" << nl;
+ *ci << " " << ": ptr_ (" << interface_full_name << "::_nil ())" << nl;
*ci << "{}\n\n";
// constr from a _ptr
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr p)" << nl;
+ *ci << fname << "::" << lname << " (" << interface_full_name << "_ptr p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
@@ -482,7 +503,7 @@ be_interface::gen_var_impl (void)
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << interface_full_name << "_ptr " << nl;
*ci << fname << "::ptr (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -495,7 +516,7 @@ be_interface::gen_var_impl (void)
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << fname <<
" &p) // copy constructor" << nl;
- *ci << " : ptr_ (" << name () << "::_duplicate (p.ptr ()))" << nl;
+ *ci << " : ptr_ (" << interface_full_name << "::_duplicate (p.ptr ()))" << nl;
*ci << "{}\n\n";
// destructor
@@ -511,7 +532,7 @@ be_interface::gen_var_impl (void)
// assignment operator
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
+ *ci << fname << "::operator= (" << interface_full_name <<
"_ptr p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -542,7 +563,7 @@ be_interface::gen_var_impl (void)
// other extra methods - cast operator ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
+ *ci << fname << "::operator const " << interface_full_name <<
"_ptr &() const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -552,7 +573,7 @@ be_interface::gen_var_impl (void)
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << "_ptr &() // cast " << nl;
+ *ci << fname << "::operator " << interface_full_name << "_ptr &() // cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -561,7 +582,7 @@ be_interface::gen_var_impl (void)
// operator->
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << interface_full_name << "_ptr " << nl;
*ci << fname << "::operator-> (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -571,7 +592,7 @@ be_interface::gen_var_impl (void)
// in, inout, out, and _retn
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr" << nl;
+ *ci << "ACE_INLINE " << interface_full_name << "_ptr" << nl;
*ci << fname << "::in (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -580,7 +601,7 @@ be_interface::gen_var_impl (void)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr &" << nl;
+ *ci << "ACE_INLINE " << interface_full_name << "_ptr &" << nl;
*ci << fname << "::inout (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -589,24 +610,24 @@ be_interface::gen_var_impl (void)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr &" << nl;
+ *ci << "ACE_INLINE " << interface_full_name << "_ptr &" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << this->name () << "::_nil ();" << nl;
+ *ci << "this->ptr_ = " << interface_full_name << "::_nil ();" << nl;
*ci << "return this->ptr_;\n";
ci->decr_indent ();
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << interface_full_name << "_ptr " << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "// yield ownership of managed obj reference" << nl;
- *ci << this->name () << "_ptr val = this->ptr_;" << nl;
- *ci << "this->ptr_ = " << this->name () << "::_nil ();" << nl;
+ *ci << interface_full_name << "_ptr val = this->ptr_;" << nl;
+ *ci << "this->ptr_ = " << interface_full_name << "::_nil ();" << nl;
*ci << "return val;\n";
ci->decr_indent ();
*ci << "}\n\n";
@@ -614,18 +635,27 @@ be_interface::gen_var_impl (void)
return 0;
}
-// generate the _out definition
+// Generate the out definition. If <interface_name> is not 0, generate
+// the out defn for that name. Otherwise, do it for the interface you
+// are visiting (this).
int
-be_interface::gen_out_defn (void)
+be_interface::gen_out_defn (char *interface_name)
{
TAO_OutStream *ch; // output stream
TAO_NL nl; // end line
char namebuf [NAMEBUFSIZE]; // to hold the _out name
+
+ // Decide which name to use.
+ if (interface_name == 0)
+ interface_name = this->local_name ()->get_string ();
+ // Create the buffer with the name of the out class.
ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (namebuf, "%s_out", local_name ()->get_string ());
+ ACE_OS::sprintf (namebuf,
+ "%s_out",
+ interface_name);
- // retrieve a singleton instance of the code generator
+ // Retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
ch = cg->client_header ();
@@ -642,9 +672,9 @@ be_interface::gen_out_defn (void)
// No default constructor
// constructor from a pointer
- *ch << namebuf << " (" << local_name () << "_ptr &);" << nl;
+ *ch << namebuf << " (" << interface_name << "_ptr &);" << nl;
// constructor from a _var &
- *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ *ch << namebuf << " (" << interface_name << "_var &);" << nl;
// constructor from a _out &
*ch << namebuf << " (const " << namebuf << " &);" << nl;
// assignment operator from a _out &
@@ -652,39 +682,52 @@ be_interface::gen_out_defn (void)
// assignment operator from a pointer &, cast operator, ptr fn, operator
// -> and any other extra operators
// only interface allows assignment from var &
- *ch << namebuf << " &operator= (const " << local_name () << "_var &);" << nl;
- *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " &operator= (const " << interface_name << "_var &);" << nl;
+ *ch << namebuf << " &operator= (" << interface_name << "_ptr);" << nl;
// cast
- *ch << "operator " << local_name () << "_ptr &();" << nl;
+ *ch << "operator " << interface_name << "_ptr &();" << nl;
// ptr fn
- *ch << local_name () << "_ptr &ptr (void);" << nl;
+ *ch << interface_name << "_ptr &ptr (void);" << nl;
// operator ->
- *ch << local_name () << "_ptr operator-> (void);" << nl;
+ *ch << interface_name << "_ptr operator-> (void);" << nl;
*ch << "\n";
ch->decr_indent ();
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "_ptr &ptr_;\n";
+ *ch << interface_name << "_ptr &ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
return 0;
}
+
+// Generate the out class definition. If <interface_name> is not 0,
+// generate the out defn for that name. Otherwise, do it for the
+// interface you are visiting (this).
int
-be_interface::gen_out_impl (void)
+be_interface::gen_out_impl (char *interface_local_name,
+ char *interface_full_name)
{
TAO_OutStream *ci; // output stream
TAO_NL nl; // end line
char fname [NAMEBUFSIZE]; // to hold the full and
char lname [NAMEBUFSIZE]; // local _out names
+ // Even if one argument is 0, there is no point using the
+ // arguments. Let us then use the name in this node.
+ if (interface_local_name == 0 || interface_full_name == 0)
+ {
+ interface_local_name = local_name ()->get_string ();
+ interface_full_name = (char *) this->fullname ();
+ }
+
ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_out", this->fullname ());
+ ACE_OS::sprintf (fname, "%s_out", interface_full_name);
ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+ ACE_OS::sprintf (lname, "%s_out", interface_local_name);
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -705,24 +748,24 @@ be_interface::gen_out_impl (void)
// constr from a _ptr
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr &p)" << nl;
+ *ci << fname << "::" << lname << " (" << interface_full_name << "_ptr &p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{\n";
ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
+ *ci << "this->ptr_ = " << interface_full_name << "::_nil ();\n";
ci->decr_indent ();
*ci << "}\n\n";
// constructor from _var &
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name () <<
+ *ci << fname << "::" << lname << " (" << interface_full_name <<
"_var &p) // constructor from _var" << nl;
*ci << " : ptr_ (p.out ())" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
+ *ci << "this->ptr_ = " << interface_full_name << "::_nil ();\n";
ci->decr_indent ();
*ci << "}\n\n";
@@ -749,11 +792,11 @@ be_interface::gen_out_impl (void)
// assignment operator from _var
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << this->name () <<
+ *ci << fname << "::operator= (const " << interface_full_name <<
"_var &p)" << nl;
*ci << "{\n";
ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "::_duplicate (p.ptr ());" << nl;
+ *ci << "this->ptr_ = " << interface_full_name << "::_duplicate (p.ptr ());" << nl;
*ci << "return *this;\n";
ci->decr_indent ();
*ci << "}\n\n";
@@ -761,7 +804,7 @@ be_interface::gen_out_impl (void)
// assignment operator from _ptr
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name () <<
+ *ci << fname << "::operator= (" << interface_full_name <<
"_ptr p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -773,7 +816,7 @@ be_interface::gen_out_impl (void)
// other extra methods - cast operator ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name () <<
+ *ci << fname << "::operator " << interface_full_name <<
"_ptr &() // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -783,7 +826,7 @@ be_interface::gen_out_impl (void)
// ptr function
ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
+ *ci << "ACE_INLINE " << interface_full_name << "_ptr &" << nl;
*ci << fname << "::ptr (void) // ptr" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -793,7 +836,7 @@ be_interface::gen_out_impl (void)
// operator->
ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << interface_full_name << "_ptr " << nl;
*ci << fname << "::operator-> (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp
index 8540bed1c97..48676cb5193 100644
--- a/TAO/TAO_IDL/be/be_visitor_factory.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp
@@ -248,6 +248,9 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_AMI:
return new be_visitor_args_arglist_ami (new_ctx);
+
+ case TAO_CodeGen::TAO_AMI_HANDLER_FWD_CH:
+ return new be_visitor_ami_handler_fwd_ch (new_ctx);
// #endif /* TAO_IDL_HAS_AMI */
case TAO_CodeGen::TAO_STRUCT_CH:
diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp
index bf02a0675fc..942f6b00291 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp
@@ -41,5 +41,5 @@
#include "be_visitor_interface/cdr_op_ch.cpp"
#include "be_visitor_interface/cdr_op_ci.cpp"
#include "be_visitor_interface/cdr_op_cs.cpp"
-
+#include "be_visitor_interface/ami_handler_fwd_ch.cpp"
ACE_RCSID(be, be_visitor_interface, "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ch.cpp
new file mode 100644
index 00000000000..0e5a8cb8c6f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ch.cpp
@@ -0,0 +1,127 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_handler_fwd_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating fwd declaration code for the AMI Handler
+// interface.
+//
+// = AUTHOR
+// Aniruddha Gokhale and Alexander Babu Arulanthu
+// <alex@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_interface_fwd.h"
+
+ACE_RCSID(be_visitor_ami_handler_fwd, ami_handler_fwd_ch, "$Id$")
+
+
+// ********************************************************************
+// Visitor implementation generating fwd declaration code for the AMI
+// Handler interface.
+// ********************************************************************
+
+be_visitor_ami_handler_fwd_ch::be_visitor_ami_handler_fwd_ch (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_ami_handler_fwd_ch::~be_visitor_ami_handler_fwd_ch (void)
+{
+}
+
+// visit the interface node and its scope
+int
+be_visitor_ami_handler_fwd_ch::visit_interface (be_interface *node)
+{
+ // Grab the out stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // Generate code, if the client header is not generated already.
+ if (!node->cli_hdr_gen () && !node->imported ())
+ {
+ // start from the current indentation.
+ os->indent ();
+
+ // Generate forward declaration class.
+ *os << "class "
+ << "AMI_" << node->local_name () << "_Handler" << ";"
+ << be_nl;
+
+ // Create a string "AMI_<interface name>_Handler". We can use
+ // this for defining all _Var, _out,etc.
+ char *interface_name = 0;
+ ACE_NEW_RETURN (interface_name,
+ char [ACE_OS::strlen ("AMI_") +
+ ACE_OS::strlen (node->flatname ()) +
+ ACE_OS::strlen ("_Handler") +
+ // end of string
+ 1],
+ 0);
+ ACE_OS::sprintf (interface_name,
+ "AMI_%s_Handler",
+ node->flatname ());
+
+ // Generate the ifdefined macro for the _ptr type.
+ os->gen_ifdef_macro (interface_name, "_ptr");
+
+ // Generate the _ptr declaration
+ *os << "typedef "
+ << "AMI_" << node->local_name () << "_Handler"
+ << " *"
+ << "AMI_" << node->local_name () << "_Handler" << "_ptr;"
+ << be_nl;
+
+ // Generate the endif.
+ os->gen_endif ();
+
+ // Generate the var class.
+
+ // Enclose under an ifdef macro
+ os->gen_ifdef_macro (interface_name, "_var");
+
+ // Generate the _var declaration.
+ if (node->gen_var_defn (interface_name) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_handler_fwd_ch::"
+ "visit_interface_fwd - "
+ "codegen for _var failed\n"), -1);
+ }
+
+ // Gen an endif.
+ os->gen_endif ();
+
+ // Generate the our class.
+
+ // Enclose under an ifdef macro.
+ os->gen_ifdef_macro (interface_name, "_out");
+
+ // Generate the _out declaration - ORBOS/97-05-15 pg 16-20
+ // spec.
+ if (node->gen_out_defn (interface_name) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ami_handler_fwd_ch::"
+ "visit_interface_fwd - "
+ "codegen for _out failed\n"), -1);
+ }
+
+ // Generate the endif macro.
+ os->gen_endif ();
+ }
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ci.cpp
new file mode 100644
index 00000000000..731d502538f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ci.cpp
@@ -0,0 +1,64 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_handler_fwd_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Ami_Handler_Fwd node in the client inline.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_ami_handler_fwd.h"
+
+ACE_RCSID(be_visitor_ami_handler_fwd, ami_handler_fwd_ci, "$Id$")
+
+
+// ********************************************************************
+// Visitor implementation for the Ami_Handler_Fwd type
+// This one for the client inline file
+// ********************************************************************
+
+be_visitor_ami_handler_fwd_ci::be_visitor_ami_handler_fwd_ci (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_ami_handler_fwd_ci::~be_visitor_ami_handler_fwd_ci (void)
+{
+}
+
+// visit the Ami_Handler_Fwd_ci node and its scope
+int
+be_visitor_ami_handler_fwd_ci::visit_interface (be_interface *node)
+{
+ if (!node->cli_inline_gen () && !node->imported ())
+ {
+#if 0
+ // We don't generate any code here.....
+
+ // It is possible to generate the definitions for the _var and
+ // _out types, but if we do that then the _duplicate() and
+ // _nil() methods cannot be inlined.
+
+ // Since these classes will be generated once the forward
+ // declaration is resolved there is really no problem here
+#endif /* 0 */
+
+ node->cli_inline_gen (I_TRUE);
+ }
+ 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 89f264d9671..35b7b6ed990 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -49,11 +49,47 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
if (!node->cli_hdr_gen () && !node->imported ()) // not already generated and
// not imported
{
-
+ // Generate the AMI Reply Handler's forward declaration code, if
+ // the option is enabled, for this interface.
+
+ // #if defined (TAO_IDL_HAS_AMI)
+ if (1)
+ {
+ // Set the context.
+ be_visitor_context ctx (*this->ctx_);
+
+ // Set the state.
+ ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_FWD_CH);
+
+ // Create the visitor.
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "Bad visitor\n"),
+ -1);
+ }
+
+ // call the visitor on this interface.
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "code gen for ami handler fwd failed\n"),
+ -1);
+ }
+ delete visitor;
+ }
+
+ // Grab the stream.
os = this->ctx_->stream ();
-
+
// == STEP 1: generate the class name and class names we inherit ==
-
+
// generate the ifdefined macro for the _ptr type
os->gen_ifdef_macro (node->flatname (), "_ptr");
diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp
index 18b5d80cb4c..14147f76b08 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd.cpp
@@ -28,6 +28,5 @@
#include "be_visitor_interface_fwd/interface_fwd_ch.cpp"
#include "be_visitor_interface_fwd/interface_fwd_ci.cpp"
#include "be_visitor_interface_fwd/cdr_op_ci.cpp"
-
ACE_RCSID(be, be_visitor_interface_fwd, "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
index 71ed8c459f7..a1d6f6a1cd1 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
@@ -187,7 +187,6 @@ be_visitor_operation_arglist::visit_argument (be_argument *node)
delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_arglist::"
-
"visit_argument - "
"codegen for arglist failed\n"),
-1);
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index f0b316b7bee..dc751f8aa81 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -272,15 +272,15 @@ public:
TAO_OBV_OPERATION_ARGLIST_COLLOCATED_SH, // ... for collocated server
TAO_OBV_OPERATION_ARGLIST_OTHERS, // ... for all other cases
- TAO_OPERATION_AMI, // Visit the operation for
- // AMI generation.
+ // Emitting code for AMI.
+ TAO_OPERATION_AMI, // AMI stub generation.
TAO_OPERATION_ARGLIST_AMI, // AMI stubs in client header
TAO_OPERATION_ARG_AMI, // AMI stub.
TAO_ARGUMENT_AMI, // Argument in AMI stub.
TAO_ARGUMENT_ARGLIST_AMI, // Arg list in AMI stub.
+ TAO_AMI_HANDLER_FWD_CH, // FWD decl for AMI handler.
-
- // emitting code for root
+ // Emitting code for root.
TAO_ROOT_CH,
TAO_ROOT_CI,
TAO_ROOT_CS,
diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h
index 3a1cccd7baa..c9c5faaa546 100644
--- a/TAO/TAO_IDL/be_include/be_interface.h
+++ b/TAO/TAO_IDL/be_include/be_interface.h
@@ -54,28 +54,36 @@ public:
~be_interface (void);
// dtor
- virtual int gen_var_defn (void);
- // generate the _var class definition
-
+ virtual int gen_var_defn (char *interface_name = 0);
+ // generate the var definition. If <interface_name> is not 0, generate
+ // the var defn for that name. Otherwise, do it for the interface you
+ // are visiting (this).
+
virtual void gen_def_ctors (TAO_OutStream* os);
//call the default constructors of all the base classes
-
-
virtual void gen_copy_ctors (TAO_OutStream* os);
//call the copy constructors of all the base classes
- virtual int gen_var_impl (void);
- // generate the implementation for the _var class
+ virtual int gen_var_impl (char *interface_local_name = 0,
+ char *interface_full_name = 0);
+ // Generate the implementation for the _var class.
+ // If any one of the argument is 0, then use the name in <this>,
+ // otherwise use the name given. Just making the class more useful.
- virtual int gen_out_defn (void);
- // generate the _out class definition
+ virtual int gen_out_defn (char *interface_name = 0);
+ // Generate the out class definition. If <interface_name> is not 0,
+ // generate the out defn for that name. Otherwise, do it for the
+ // interface you are visiting (this).
- virtual int gen_out_impl (void);
- // generate the _out implementation
+ virtual int gen_out_impl (char *interface_local_name = 0,
+ char *interface_full_name = 0);
+ // Generate the out class implementation.
+ // If any one of the argument is 0, then use the name giin this
+ // node, else use the arguments.
const char *full_skel_name (void);
- // retrieve the fully scoped skel class name
+ // Retrieve the fully scoped skel class name.
//
// Each interface (to fix names "T") also defines two help classes,
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h
index e67eeba6b12..a4c7544d7bd 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h
@@ -41,5 +41,5 @@
#include "be_visitor_interface/cdr_op_cs.h"
#include "be_visitor_interface/tie_sh.h"
#include "be_visitor_interface/tie_si.h"
-
+#include "be_visitor_interface/ami_handler_fwd_ch.h"
#endif /* _BE_VISITOR_INTERFACE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ch.h
new file mode 100644
index 00000000000..b495ed84e2f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ch.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_fwd_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface Forward node.
+// This one provides code generation for interface forward node.
+//
+// = AUTHOR
+// Aniruddha Gokhale and Alexander Babu Arulanthu
+// <alex@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_AMI_HANDLER_FWD_CH_H_
+#define _BE_INTERFACE_AMI_HANDLER_FWD_CH_H_
+
+class be_visitor_ami_handler_fwd_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_ami_handler_fwd_ch
+ //
+ // = DESCRIPTION
+ // This visitor visits the an interface and generates fwd
+ // declaration code for the AMI Handler interface.
+ //
+ //
+public:
+ be_visitor_ami_handler_fwd_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_ami_handler_fwd_ch (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface.
+};
+
+#endif /* _BE_INTERFACE_AMI_HANDLER_FWD_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ci.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ci.h
new file mode 100644
index 00000000000..ecd01235f01
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ci.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// ami_handler_fwd_ci.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Interface Forward node.
+// This one provides code generation for interface forward node.
+//
+// = AUTHOR
+// Aniruddha Gokhale and Alexander Babu Arulanthu
+// <alex@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_AMI_HANDLER_FWD_CI_H_
+#define _BE_INTERFACE_AMI_HANDLER_FWD_CI_H_
+
+class be_visitor_ami_handler_fwd_ci : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_ami_handler_fwd_ci
+ //
+ // = DESCRIPTION
+ // This visitor visits the interface to generate the forward
+ // declration code for the AMI reply handler.
+ //
+ //
+public:
+ be_visitor_ami_handler_fwd_ci (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_ami_handler_fwd_ci (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface.
+
+};
+
+#endif /* _BE_INTERFACE_INTERFACE_FWD_CH_I_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h
index 34bea04cac1..0294553503b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ch.h
@@ -44,7 +44,6 @@ public:
virtual int visit_interface (be_interface *node);
// set the right context and make a visitor
-
};
#endif /* _BE_INTERFACE_INTERFACE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h
index dafe44c68f8..a32da4c3de0 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h
@@ -28,5 +28,4 @@
#include "be_visitor_interface_fwd/interface_fwd_ch.h"
#include "be_visitor_interface_fwd/interface_fwd_ci.h"
#include "be_visitor_interface_fwd/cdr_op_ci.h"
-
#endif /* TAO_BE_VISITOR_INTERFACE_FWD_H */