summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_interface_fwd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_interface_fwd.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp190
1 files changed, 94 insertions, 96 deletions
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
index 4a1489c2859..93aea8ea920 100644
--- a/TAO/TAO_IDL/be/be_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -25,37 +25,34 @@
ACE_RCSID(be, be_interface_fwd, "$Id$")
+/*
+ * BE_InterfaceFwd
+ */
+
be_interface_fwd::be_interface_fwd (void)
{
- // Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (be_decl::VARIABLE); // always the case
}
be_interface_fwd::be_interface_fwd (AST_Interface *dummy,
- UTL_ScopedName *n,
- UTL_StrList *p)
- : AST_InterfaceFwd (dummy,
- n,
- p),
- AST_Decl (AST_Decl::NT_interface_fwd,
- n,
- p)
+ UTL_ScopedName *n, UTL_StrList *p)
+ : AST_InterfaceFwd (dummy, n, p),
+ AST_Decl (AST_Decl::NT_interface_fwd, n, p)
{
- // Always the case.
- this->size_type (be_decl::VARIABLE);
+ this->size_type (be_decl::VARIABLE); // always the case
}
be_interface_fwd::~be_interface_fwd (void)
{
}
-// Generate the var definition.
+// generate the var definition
int
be_interface_fwd::gen_var_defn (char *)
{
- TAO_OutStream *ch = 0;
- TAO_NL nl;
- char namebuf [NAMEBUFSIZE];
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ char namebuf [NAMEBUFSIZE]; // names
ACE_OS::memset (namebuf,
'\0',
@@ -65,67 +62,67 @@ be_interface_fwd::gen_var_defn (char *)
"%s_var",
this->local_name ()->get_string ());
- ch = tao_cg->client_header ();
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ch = cg->client_header ();
- // Generate the var definition (always in the client header).
+ // generate the var definition (always in the client header).
// Depending upon the data type, there are some differences which we account
// for over here.
- // Start with whatever was our current indent level.
- ch->indent ();
- *ch << "class " << be_global->stub_export_macro ()
+ ch->indent (); // start with whatever was our current indent level
+ *ch << "class " << idl_global->stub_export_macro ()
<< " " << namebuf << " : public TAO_Base_var" << nl;
*ch << "{" << nl;
*ch << "public:\n";
ch->incr_indent ();
- // Default constructor.
+ // default constr
*ch << namebuf << " (void); // default constructor" << nl;
- *ch << namebuf << " (" << this->local_name () << "_ptr p)"
- << " : ptr_ (p) {} " << nl;
+ *ch << namebuf << " (" << this->local_name () << "_ptr);" << nl;
- // Copy constructor.
+ // copy constructor
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
- // Destructor.
+ // destructor
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // Assignment operator from a pointer.
+ // assignment operator from a pointer
*ch << namebuf << " &operator= (" << this->local_name ()
<< "_ptr);" << nl;
- // Assignment from _var.
+ // assignment from _var
*ch << namebuf << " &operator= (const " << namebuf <<
" &);" << nl;
- // Arrow operator.
+ // arrow operator
*ch << this->local_name () << "_ptr operator-> (void) const;" << nl;
*ch << nl;
- // Other extra types (cast operators, [] operator, and others).
+ // other extra types (cast operators, [] operator, and others)
*ch << "operator const " << this->local_name ()
<< "_ptr &() const;" << nl;
*ch << "operator " << this->local_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.
+ // the return types of in, out, inout, and _retn are based on the parameter
+ // passing rules and the base type
*ch << this->local_name () << "_ptr in (void) const;" << nl;
*ch << this->local_name () << "_ptr &inout (void);" << nl;
*ch << this->local_name () << "_ptr &out (void);" << nl;
*ch << this->local_name () << "_ptr _retn (void);" << nl;
- // Generate an additional member function that returns the
- // underlying pointer.
+ // generate an additional member function that returns the underlying pointer
*ch << this->local_name () << "_ptr ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
- // Private.
+ // private
*ch << "private:\n";
ch->incr_indent ();
*ch << this->local_name () << "_ptr ptr_;" << nl;
@@ -139,16 +136,16 @@ be_interface_fwd::gen_var_defn (char *)
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
int
be_interface_fwd::gen_var_impl (char *,
char *)
{
- TAO_OutStream *ci = 0;
- TAO_NL nl;
- char fname [NAMEBUFSIZE]; // To hold the full and
- char lname [NAMEBUFSIZE]; // local _var names.
+ TAO_OutStream *ci; // output stream
+ TAO_NL nl; // end line
+ char fname [NAMEBUFSIZE]; // to hold the full and
+ char lname [NAMEBUFSIZE]; // local _var names
ACE_OS::memset (fname,
'\0',
@@ -166,28 +163,37 @@ be_interface_fwd::gen_var_impl (char *,
"%s_var",
this->local_name ()->get_string ());
- ci = tao_cg->client_inline ();
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
- // Generate the var implementation in the inline file
+ // generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- // Start with whatever was our current indent level.
- ci->indent ();
+ ci->indent (); // start with whatever was our current indent level
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // Default constructor.
+ // default constr
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname <<
" (void) // default constructor" << nl;
*ci << " " << ": ptr_ (" << this->name () << "::_nil ())" << nl;
*ci << "{}\n\n";
- // The additional ptr () member function. This member function must be
+ // constr from a _ptr
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () << "_ptr p)" << nl;
+ *ci << " : ptr_ (p)" << nl;
+ *ci << "{}\n\n";
+
+ // the additional ptr () member function. This member function must be
// defined before the remaining member functions including the copy
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
@@ -200,7 +206,7 @@ be_interface_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // Copy constructor.
+ // copy constructor
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << fname <<
@@ -209,7 +215,7 @@ be_interface_fwd::gen_var_impl (char *,
*ci << " ptr_ (" << this->local_name () << "::_duplicate (p.ptr ()))" << nl;
*ci << "{}\n\n";
- // Destructor.
+ // destructor
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::~" << lname << " (void) // destructor" << nl;
@@ -219,7 +225,7 @@ be_interface_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // Assignment operator.
+ // assignment operator
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->name () <<
@@ -232,7 +238,7 @@ be_interface_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // Assignment operator from _var.
+ // assignment operator from _var
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << fname <<
@@ -251,7 +257,7 @@ be_interface_fwd::gen_var_impl (char *,
ci->decr_indent ();
*ci << "}\n\n";
- // Other extra methods - cast operator ().
+ // other extra methods - cast operator ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator const " << this->name () <<
@@ -327,13 +333,13 @@ be_interface_fwd::gen_var_impl (char *,
return 0;
}
-// Generate the _out definition.
+// generate the _out definition
int
be_interface_fwd::gen_out_defn (char *)
{
- TAO_OutStream *ch;
- TAO_NL nl;
- char namebuf [NAMEBUFSIZE];
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ char namebuf [NAMEBUFSIZE]; // to hold the _out name
ACE_OS::memset (namebuf,
'\0',
@@ -343,12 +349,15 @@ be_interface_fwd::gen_out_defn (char *)
"%s_out",
this->local_name ()->get_string ());
- ch = tao_cg->client_header ();
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- // Generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level.
+ ch = cg->client_header ();
- *ch << "class " << be_global->stub_export_macro ()
+ // generate the out definition (always in the client header)
+ ch->indent (); // start with whatever was our current indent level
+
+ *ch << "class " << idl_global->stub_export_macro ()
<< " " << namebuf << nl;
*ch << "{" << nl;
*ch << "public:\n";
@@ -356,32 +365,25 @@ be_interface_fwd::gen_out_defn (char *)
// No default constructor
- // Constructor from a pointer.
+ // constructor from a pointer
*ch << namebuf << " (" << this->local_name () << "_ptr &);" << nl;
-
- // Constructor from a _var &.
+ // constructor from a _var &
*ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
-
- // Constructor from a _out &.
+ // constructor from a _out &
*ch << namebuf << " (const " << namebuf << " &);" << nl;
-
- // Assignment operator from a _out &.
+ // assignment operator from a _out &
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
-
- // Assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators.
- // Only interface allows assignment from var &.
+ // 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 "
<< this->local_name () << "_var &);" << nl;
*ch << namebuf << " &operator= ("
<< this->local_name () << "_ptr);" << nl;
-
// cast
*ch << "operator " << this->local_name () << "_ptr &();" << nl;
-
// ptr fn
*ch << this->local_name () << "_ptr &ptr (void);" << nl;
-
// operator ->
*ch << this->local_name () << "_ptr operator-> (void);" << nl;
@@ -400,10 +402,10 @@ be_interface_fwd::gen_out_defn (char *)
int
be_interface_fwd::gen_out_impl (char *, char *)
{
- TAO_OutStream *ci = 0;
- TAO_NL nl;
- char fname [NAMEBUFSIZE]; // To hold the full and
- char lname [NAMEBUFSIZE]; // local _out names.
+ TAO_OutStream *ci; // output stream
+ TAO_NL nl; // end line
+ char fname [NAMEBUFSIZE]; // to hold the full and
+ char lname [NAMEBUFSIZE]; // local _out names
ACE_OS::memset (fname,
'\0',
@@ -421,21 +423,23 @@ be_interface_fwd::gen_out_impl (char *, char *)
"%s_out",
this->local_name ()->get_string ());
- ci = tao_cg->client_inline ();
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
- // Generate the var implementation in the inline file
+ // generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- // Start with whatever was our current indent level.
- ci->indent ();
+ ci->indent (); // start with whatever was our current indent level
*ci << "// *************************************************************"
<< nl;
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- // Constructor from a _ptr.
+ // constr from a _ptr
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " ("
@@ -447,7 +451,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // Constructor from _var &.
+ // constructor from _var &
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (" << this->name () <<
@@ -460,7 +464,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // Copy constructor.
+ // copy constructor
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << fname <<
@@ -469,7 +473,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
<< "&,p).ptr_)" << nl;
*ci << "{}\n\n";
- // Assignment operator from _out &.
+ // assignment operator from _out &
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << fname <<
@@ -481,7 +485,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // Assignment operator from _var.
+ // assignment operator from _var
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << this->name () <<
@@ -494,7 +498,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // Assignment operator from _ptr.
+ // assignment operator from _ptr
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->name () <<
@@ -506,7 +510,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // Other extra methods - cast operator ().
+ // other extra methods - cast operator ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
*ci << fname << "::operator " << this->name () <<
@@ -527,7 +531,7 @@ be_interface_fwd::gen_out_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
- // operator->
+ // operator->
ci->indent ();
*ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::operator-> (void)" << nl;
@@ -540,12 +544,6 @@ be_interface_fwd::gen_out_impl (char *, char *)
return 0;
}
-void
-be_interface_fwd::destroy (void)
-{
- // Do nothing.
-}
-
int
be_interface_fwd::accept (be_visitor *visitor)
{