summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1997-11-02 19:39:34 +0000
committergokhale <asgokhale@users.noreply.github.com>1997-11-02 19:39:34 +0000
commit51de1d11db040cebde5ddb9d7196908734075299 (patch)
tree35ba056cad712ad8a4d94efc9edc866741e8e949
parentb6bcee0152fd518f121a69267c1524a471254d29 (diff)
downloadATCD-51de1d11db040cebde5ddb9d7196908734075299.tar.gz
Fixed problems with passing obj references
CVS: CVS:
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp475
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp1472
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp197
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp454
-rw-r--r--TAO/TAO_IDL/be/be_module.cpp34
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp727
-rw-r--r--TAO/TAO_IDL/be/be_state.cpp306
-rw-r--r--TAO/TAO_IDL/be/be_string.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp491
-rw-r--r--TAO/TAO_IDL/be/be_type.cpp32
-rw-r--r--TAO/TAO_IDL/be/be_typedef.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp491
-rw-r--r--TAO/TAO_IDL/be_include/be_array.h30
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h21
-rw-r--r--TAO/TAO_IDL/be_include/be_interface.h22
-rw-r--r--TAO/TAO_IDL/be_include/be_interface_fwd.h22
-rw-r--r--TAO/TAO_IDL/be_include/be_sequence.h12
-rw-r--r--TAO/TAO_IDL/be_include/be_structure.h22
-rw-r--r--TAO/TAO_IDL/be_include/be_type.h12
-rw-r--r--TAO/TAO_IDL/be_include/be_union.h22
22 files changed, 3231 insertions, 1710 deletions
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
index 274fec01247..c5d0d37c645 100644
--- a/TAO/TAO_IDL/be/be_array.cpp
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -441,6 +441,481 @@ be_array::gen_server_inline (void)
return 0;
}
+// generate the var defn
+int
+be_array::gen_var_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ be_state *s; // code gen state
+ char namebuf [NAMEBUFSIZE]; // names
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_var", this->local_name ()->get_string ());
+
+ // 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).
+ // Depending upon the data type, there are some differences which we account
+ // for over here.
+
+ ch->indent (); // start with whatever was our current indent level
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+ // default constr
+ *ch << namebuf << " (void); // default constructor" << nl;
+ // constr
+ *ch << namebuf << " (" << local_name () << "_slice *);" << nl;
+ // copy constructor
+ *ch << namebuf << " (const " << namebuf <<
+ " &); // copy constructor" << nl;
+ // destructor
+ *ch << "~" << namebuf << " (void); // destructor" << nl;
+ *ch << nl;
+ // assignment operator from a pointer
+ *ch << namebuf << " &operator= (" << local_name () << "_slice *);" << nl;
+ // assignment from _var
+ *ch << namebuf << " &operator= (const " << namebuf <<
+ " &);" << nl;
+
+ // arrow operator
+ // nothing here
+ *ch << nl;
+
+ // other extra types (cast operators, [] operator, and others)
+ // overloaded [] operator
+ *ch << namebuf << "_slice &operator[] (CORBA::ULong index);" << nl;
+ *ch << "const " << namebuf <<
+ "_slice &operator[] (CORBA::ULong index) const;" << nl;
+
+ // cast operators
+ *ch << "operator const " << local_name () << "_slice *&() const;" << nl;
+ *ch << "operator " << local_name () << "_slice *&();" << 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
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ch << "const " << local_name () << " in (void) const;" << nl;
+ *ch << local_name () << " inout (void);" << nl;
+ *ch << local_name () << " out (void);" << nl;
+ *ch << local_name () << "_slice *_retn (void);" << nl;
+ }
+ else
+ {
+ *ch << "const " << local_name () << " in (void) const;" << nl;
+ *ch << local_name () << " inout (void);" << nl;
+ *ch << local_name () << "_slice *&out (void);" << nl;
+ *ch << local_name () << " *_retn (void);" << nl;
+ }
+
+ // generate an additional member function that returns the underlying pointer
+
+ *ch << local_name () << "_slice *ptr (void) const;\n";
+
+ *ch << "\n";
+ ch->decr_indent ();
+
+ // generate the private section
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << "_slice *ptr_;\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+
+ return 0;
+}
+
+// implementation of the _var class. All of these get generated in the inline
+// file
+int
+be_array::gen_var_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_var", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ // generate the var implementation in the inline file
+
+ ci->indent (); // start with whatever was our current indent level
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ be_array *b;
+
+ b = be_array::narrow_from_decl (this);
+ // default constr
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname <<
+ " (void) // default constructor" << nl;
+ *ci << "\t" << ": ptr_ ((" << name () << "_slice *)0)" << nl;
+ *ci << "{}\n\n";
+
+ // constr from a _slice *
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << "_slice *p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{}\n\n";
+
+ // copy constructor (deep copy)
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (const " << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = " << this->name () << "_dup (p.ptr_);\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // destructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::~" << lname << " (void) // destructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << this->name () << "_free (this->ptr_);\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << this->name () <<
+ "_slice p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "// is what we own the same that is being assigned to us?" <<
+ nl;
+ *ci << "if (this->ptr_ != p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "// delete our stuff and assume ownership of p" << nl;
+ *ci << this->name () << "_free (this->ptr_);" << nl;
+ *ci << "this->ptr_ = p;\n";
+ ci->decr_indent ();
+ *ci << "}" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _var
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (this != &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "// not assigning to ourselves" << nl;
+ *ci << this->name () << "_free (this->ptr_); // free old stuff" << nl;
+ *ci << "this->ptr_ = " << this->name () <<
+ "_dup (p.ptr_);// deep copy\n";
+ ci->decr_indent ();
+ *ci << "}" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - cast operators ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator const " << name () <<
+ "_slice *&() const // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << name () << "_slice *&() // cast " << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // two operator []s instead of ->
+ ci->indent ();
+ *ci << "ACE_INLINE const" << name () << "_slice &" << nl;
+ *ci << fname << "::operator[] (CORBA::ULong index) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_[index];\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << "_slice &" << nl;
+ *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_[index];\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // in, inout, out, and _retn
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << nl;
+ *ci << fname << "::in (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << nl;
+ *ci << fname << "::inout (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << nl;
+ *ci << fname << "::out (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << "_slice " << nl;
+ *ci << fname << "::_retn (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->val;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // the additional ptr () member function
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << "_slice *" << nl;
+ *ci << fname << "::ptr (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ return 0;
+}
+
+// generate the _out definition
+int
+be_array::gen_out_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ char namebuf [NAMEBUFSIZE]; // to hold the _out name
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ch = cg->client_header ();
+
+ // generate the out definition (always in the client header)
+ ch->indent (); // start with whatever was our current indent level
+
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+
+ // No default constructor
+
+ // constructor from a pointer
+ *ch << namebuf << " (" << local_name () << "_slice *&);" << nl;
+ // constructor from a _var &
+ *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ // constructor from a _out &
+ *ch << namebuf << " (" << namebuf << " &);" << nl;
+ // assignment operator from a _out &
+ *ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
+ // assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators
+ // assignment from slice *
+ *ch << namebuf << " &operator= (" << local_name () << "_slice *);" << nl;
+ // cast
+ *ch << "operator " << local_name () << "_slice *&();" << nl;
+ // ptr fn
+ *ch << local_name () << "_slice *&ptr (void);" << nl;
+ // operator [] instead of ->
+ *ch << namebuf << "_slice &operator[] (CORBA::ULong index);" << nl;
+ *ch << "const " << namebuf <<
+ "_slice &operator[] (CORBA::ULong index) const;" << nl;
+
+ *ch << "\n";
+ ch->decr_indent ();
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << "_slice *&ptr_;" << nl;
+ *ch << "// assignment from T_var not allowed" << nl;
+ *ch << "void operator= (const " << local_name () << "_var &);\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+ return 0;
+}
+
+int
+be_array::gen_out_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_out", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ // generate the out implementation in the inline file
+
+ ci->indent (); // start with whatever was our current indent level
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ be_array *b;
+
+ b = be_array::narrow_from_decl (this);
+ // constr from a pointer to slice
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << "_slice *&p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // constructor from _var &
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () <<
+ "_var &p) // constructor from _var" << nl;
+ *ci << "\t: ptr_ (p.out ())" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << this->name () << "_free (this->ptr_);" << nl;
+ *ci << "this->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "\t: ptr_ (p.ptr_)" << nl;
+ *ci << "{}\n\n";
+
+ // assignment operator from _out &
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p.ptr_;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment from _var is not allowed by a private declaration
+
+ // assignment operator from _ptr
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << this->name () <<
+ "_slice *p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << this->name () <<
+ "_slice *&() // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // ptr function
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << "_slice *&" << nl;
+ *ci << fname << "::ptr (void) // ptr" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // operator [] instead of ->
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << "_slice &" << nl;
+ *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_[index];\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ return 0;
+}
+
// generate the _var definition for ourself
int
be_array::gen_forany_defn (void)
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 5bfb32f92c0..03ccc8b86a4 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -87,14 +87,17 @@ TAO_CodeGen::make_state (void)
return TAO_BE_STATE_ARGUMENT::instance ();
case TAO_TYPEDEF_CH:
case TAO_TYPEDEF_CS:
+ case TAO_TYPEDEF_CI:
return TAO_BE_STATE_TYPEDEF::instance ();
case TAO_ARRAY_DEFN_CH:
case TAO_ARRAY_OTHER_CH:
case TAO_ARRAY_DEFN_CI:
return TAO_BE_STATE_ARRAY::instance ();
case TAO_SEQUENCE_BASE_CH:
+ case TAO_SEQUENCE_BASE_CS:
case TAO_SEQUENCE_BASE_CI:
case TAO_SEQUENCE_BODY_CH:
+ case TAO_SEQUENCE_BODY_CS:
case TAO_SEQUENCE_BODY_CI:
return TAO_BE_STATE_SEQUENCE::instance ();
default:
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index bfc900f191b..e242c719b0a 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -29,7 +29,6 @@ be_decl::be_decl (void)
srv_hdr_gen_ (I_FALSE),
srv_skel_gen_ (I_FALSE),
srv_inline_gen_ (I_FALSE),
- seq_names_ (NULL),
fullname_ (0),
flatname_ (0),
repoID_ (0),
@@ -48,7 +47,6 @@ be_decl::be_decl (AST_Decl::NodeType type, UTL_ScopedName *n, UTL_StrList
srv_hdr_gen_ (I_FALSE),
srv_skel_gen_ (I_FALSE),
srv_inline_gen_ (I_FALSE),
- seq_names_ (NULL),
fullname_ (0),
size_type_ (be_decl::FIXED), // everybody is fixed size to start with
encap_len_ (-1)
@@ -342,6 +340,7 @@ be_decl::repoID (void)
return this->repoID_;
}
+// converts a string name into an array of 4 byte longs
int
be_decl::tc_name2long (const char *name, long *&larr, long &arrlen)
{
@@ -370,1475 +369,6 @@ be_decl::tc_name2long (const char *name, long *&larr, long &arrlen)
return 0;
}
-
-// *****************************
-// CODE GENERATION
-// *****************************
-
-// generate the _var definition for ourself
-int
-be_decl::gen_var_defn (void)
-{
- 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 ());
-
- // 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).
- // Depending upon the data type, there are some differences which we account
- // for over here.
-
- ch->indent (); // start with whatever was our current indent level
- *ch << "class " << namebuf << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
- // default constr
- *ch << namebuf << " (void); // default constructor" << nl;
- // constr
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *ch << namebuf << " (" << local_name () << "_ptr);" << nl;
- break;
- case AST_Decl::NT_array:
- *ch << namebuf << " (" << local_name () << "_slice *);" << nl;
- break;
- default: // others
- *ch << namebuf << " (" << local_name () << " *);" << nl;
- }
- // copy constructor
- *ch << namebuf << " (const " << namebuf <<
- " &); // copy constructor" << nl;
- // destructor
- *ch << "~" << namebuf << " (void); // destructor" << nl;
- *ch << nl;
- // assignment operator from a pointer
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
- break;
- case AST_Decl::NT_array:
- *ch << namebuf << " &operator= (" << local_name () << "_slice *);" << nl;
- break;
- default: // others
- *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
- }
- // assignment from _var
- *ch << namebuf << " &operator= (const " << namebuf <<
- " &);" << nl;
-
- // arrow operator
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *ch << local_name () << "_ptr operator-> (void) const;" << nl;
- break;
- case AST_Decl::NT_array:
- // nothing here
- break;
- default: // others
- *ch << local_name () << " *operator-> (void);" << nl;
- *ch << "const " << local_name () << " *operator-> (void) const;" << nl;
- }
- *ch << nl;
-
- // other extra types (cast operators, [] operator, and others)
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- // cast operators
- *ch << "operator const " << local_name () << "_ptr &() const;" << nl;
- *ch << "operator " << local_name () << "_ptr &();" << nl;
- break;
- case AST_Decl::NT_array:
- // overloaded [] operator
- *ch << namebuf << "_slice &operator[] (CORBA::ULong index);" << nl;
- *ch << "const " << namebuf <<
- "_slice &operator[] (CORBA::ULong index) const;" << nl;
-
- // cast operators
- *ch << "operator const " << local_name () << "_slice *&() const;" << nl;
- *ch << "operator " << local_name () << "_slice *&();" << nl;
- break;
- case AST_Decl::NT_struct:
- case AST_Decl::NT_union:
- *ch << "operator const " << local_name () << " &() const;" << nl;
- *ch << "operator " << local_name () << " &();" << nl;
- *ch << "operator " << local_name () << " &() const;" << nl;
- break;
- case AST_Decl::NT_sequence:
- {
- be_sequence *bs = be_sequence::narrow_from_decl (this);
- be_type *bt = be_type::narrow_from_decl (bs->base_type ());
-
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (bt);
-
- // cast operator
- *ch << "operator const " << local_name () << " &() const;" << nl;
- *ch << "operator " << local_name () << " &();" << nl;
- *ch << "operator " << local_name () << " &() const;" << nl;
-
- // overloaded [] operator. The const version is not required
- // bt->gen_type ();
- // XXXASG
- *ch << " &operator[] (CORBA::ULong index);" << 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
- switch (this->node_type ())
- {
- case AST_Decl::NT_struct:
- case AST_Decl::NT_union:
- if (this->size_type () == be_decl::FIXED)
- {
- *ch << "const " << local_name () << " &in (void) const;" << nl;
- *ch << local_name () << " &inout (void);" << nl;
- *ch << local_name () << " &out (void);" << nl;
- *ch << local_name () << " _retn (void);" << nl;
- }
- else
- {
- *ch << "const " << local_name () << " &in (void) const;" << nl;
- *ch << local_name () << " &inout (void);" << nl;
- *ch << local_name () << " *&out (void);" << nl;
- *ch << local_name () << " *_retn (void);" << nl;
- }
- break;
- case AST_Decl::NT_sequence:
- *ch << "const " << local_name () << " &in (void) const;" << nl;
- *ch << local_name () << " &inout (void);" << nl;
- *ch << local_name () << " *&out (void);" << nl;
- *ch << local_name () << " *_retn (void);" << nl;
- break;
- case AST_Decl::NT_array:
- if (this->size_type () == be_decl::FIXED)
- {
- *ch << "const " << local_name () << " in (void) const;" << nl;
- *ch << local_name () << " inout (void);" << nl;
- *ch << local_name () << " out (void);" << nl;
- *ch << local_name () << "_slice *_retn (void);" << nl;
- }
- else
- {
- *ch << "const " << local_name () << " in (void) const;" << nl;
- *ch << local_name () << " inout (void);" << nl;
- *ch << local_name () << "_slice *&out (void);" << nl;
- *ch << local_name () << " *_retn (void);" << nl;
- }
- break;
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *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;
- default:
- break;
- }
-
- // generate an additional member function that returns the underlying pointer
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *ch << local_name () << "_ptr ptr (void) const;\n";
- break;
- case AST_Decl::NT_array:
- *ch << local_name () << "_slice *ptr (void) const;\n";
- break;
- default:
- *ch << local_name () << " *ptr(void) const;\n";
- }
-
-
- *ch << "\n";
- ch->decr_indent ();
-
- // generate the private section
- *ch << "private:\n";
- ch->incr_indent ();
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *ch << local_name () << "_ptr ptr_;\n";
- break;
- case AST_Decl::NT_array:
- *ch << local_name () << "_slice *ptr_;\n";
- break;
- default:
- *ch << local_name () << " *ptr_;\n";
- }
-
- ch->decr_indent ();
- *ch << "};\n\n";
-
- return 0;
-}
-
-// implementation of the _var class. All of these get generated in the inline
-// file
-int
-be_decl::gen_var_impl (void)
-{
- 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', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_var", this->fullname ());
-
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
- cg->outstream (ci);
-
- // generate the var implementation in the inline file
- // 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
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for class " << fname << nl;
- *ci << "// *************************************************************\n\n";
-
- // due to some differences with the way with which the _var is defined, we
- // handle code generation in a switch statement
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- // default constr
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname <<
- " (void) // default constructor" << nl;
- *ci << "\t" << ": ptr_ (" << this->name () << "::_nil ())" << nl;
- *ci << "{}\n\n";
-
- // constr from a _ptr
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr p)" << nl;
- *ci << "\t: ptr_ (p)" << nl;
- *ci << "{}\n\n";
-
- // copy constructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname <<
- " &p) // copy constructor" << nl;
- *ci << "\t: ptr_ (" << name () << "::_duplicate (p.ptr_))" << nl;
- *ci << "{}\n\n";
-
- // destructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::~" << lname << " (void) // destructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
- "_ptr p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from _var
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname <<
- " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (this != &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << name () << "::_duplicate (p.ptr_);\n";
- ci->decr_indent ();
- *ci << "}" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
- "_ptr &() const // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << "_ptr &() // cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator->
- ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
- *ci << fname << "::operator-> (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // in, inout, out, and _retn
- ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr" << nl;
- *ci << fname << "::in (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr &" << nl;
- *ci << fname << "::inout (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << 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 << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << 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 << "return val;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // the additional ptr () member function
- ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
- *ci << fname << "::ptr (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- break;
- case AST_Decl::NT_array:
- {
- be_array *b;
-
- b = be_array::narrow_from_decl (this);
- // default constr
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname <<
- " (void) // default constructor" << nl;
- *ci << "\t" << ": ptr_ ((" << name () << "_slice *)0)" << nl;
- *ci << "{}\n\n";
-
- // constr from a _slice *
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_slice *p)" << nl;
- *ci << "\t: ptr_ (p)" << nl;
- *ci << "{}\n\n";
-
- // copy constructor (deep copy)
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname <<
- " &p) // copy constructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "_dup (p.ptr_);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // destructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::~" << lname << " (void) // destructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << this->name () << "_free (this->ptr_);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name () <<
- "_slice p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "// is what we own the same that is being assigned to us?" <<
- nl;
- *ci << "if (this->ptr_ != p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "// delete our stuff and assume ownership of p" << nl;
- *ci << this->name () << "_free (this->ptr_);" << nl;
- *ci << "this->ptr_ = p;\n";
- ci->decr_indent ();
- *ci << "}" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from _var
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname <<
- " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (this != &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "// not assigning to ourselves" << nl;
- *ci << this->name () << "_free (this->ptr_); // free old stuff" << nl;
- *ci << "this->ptr_ = " << this->name () <<
- "_dup (p.ptr_);// deep copy\n";
- ci->decr_indent ();
- *ci << "}" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - cast operators ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
- "_slice *&() const // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << "_slice *&() // cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // two operator []s instead of ->
- ci->indent ();
- *ci << "ACE_INLINE const" << name () << "_slice &" << nl;
- *ci << fname << "::operator[] (CORBA::ULong index) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_[index];\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << "_slice &" << nl;
- *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_[index];\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // in, inout, out, and _retn
- ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
- *ci << fname << "::in (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
- *ci << fname << "::inout (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
- *ci << fname << "::out (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << "_slice " << nl;
- *ci << fname << "::_retn (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->val;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // the additional ptr () member function
- ci->indent ();
- *ci << "ACE_INLINE " << name () << "_slice *" << nl;
- *ci << fname << "::ptr (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- } // end of case ARRAY
- break;
- case AST_Decl::NT_struct:
- case AST_Decl::NT_union:
- // default constr
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname <<
- " (void) // default constructor" << nl;
- *ci << "\t" << ": ptr_ (0)" << nl;
- *ci << "{}\n\n";
-
- // constr from a pointer
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << " *p)" << nl;
- *ci << "\t: ptr_ (p)" << nl;
- *ci << "{}\n\n";
-
- // copy constructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname <<
- " &p) // copy constructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (p.ptr_)" << nl;
- *ci << "\tthis->ptr_ = new " << this->name () << "(*p.ptr_);" << nl;
- *ci << "else" << nl;
- *ci << "\tthis->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // destructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::~" << lname << " (void) // destructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from a pointer
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
- " *p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from _var
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname <<
- " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (this != &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = new " << this->name () << " (*p.ptr_);\n";
- ci->decr_indent ();
- *ci << "}" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // two arrow operators
- ci->indent ();
- *ci << "ACE_INLINE const " << this->name () << " *" << nl;
- *ci << fname << "::operator-> (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << " *" << nl;
- *ci << fname << "::operator-> (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - 3 cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
- " &() const // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() // cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() const// cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // in, inout, out, and _retn
- ci->indent ();
- *ci << "ACE_INLINE const " << name () << " &" << nl;
- *ci << fname << "::in (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " &" << nl;
- *ci << fname << "::inout (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // the out is handled differently based on our size type
- ci->indent ();
- if (this->size_type () == be_decl::VARIABLE)
- {
- *ci << "// mapping for variable size " << nl;
- *ci << "ACE_INLINE " << name () << " *&" << nl;
- *ci << fname << "::out (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = 0;" << nl;
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
- *ci << fname << "::_retn (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << this->name () << " *tmp = this->ptr_;" << nl;
- *ci << "this->ptr_ = 0;" << nl;
- *ci << "return tmp;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- }
- else
- {
- *ci << "// mapping for fixed size " << nl;
- *ci << "ACE_INLINE " << name () << " &" << nl;
- *ci << fname << "::out (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << nl;
- *ci << fname << "::_retn (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // the additional ptr () member function
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
- *ci << fname << "::ptr (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- }
- break;
- case AST_Decl::NT_sequence:
- {
- be_sequence *bs = be_sequence::narrow_from_decl (this);
- be_type *bt = be_type::narrow_from_decl (bs->base_type ());
-
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (bt);
-
- // default constr
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname <<
- " (void) // default constructor" << nl;
- *ci << "\t" << ": ptr_ (0)" << nl;
- *ci << "{}\n\n";
-
- // constr from a _ptr
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr p)" << nl;
- *ci << "\t: ptr_ (p)" << nl;
- *ci << "{}\n\n";
-
- // copy constructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname <<
- " &p) // copy constructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (p.ptr_)" << nl;
- *ci << "\tthis->ptr_ = new " << this->name () << "(*p.ptr_);" << nl;
- *ci << "else" << nl;
- *ci << "\tthis->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // destructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::~" << lname << " (void) // destructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from a pointer
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
- " *p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from _var
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname <<
- "_var &p) // deep copy" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (this != &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = new " << this->name () << " (*p.ptr_);\n";
- ci->decr_indent ();
- *ci << "}" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // two arrow operators
- ci->indent ();
- *ci << "ACE_INLINE const " << fname << " *" << nl;
- *ci << fname << "::operator-> (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " *" << nl;
- *ci << fname << "::operator-> (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - 3 cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
- " &() const // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() // cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() const// cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator []
- ci->indent ();
- *ci << "ACE_INLINE ";
- //bt->gen_type ();
- // XXXASG
- *ci << " " << nl;
- *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_->operator[] (index);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // in, inout, out, and _retn
- ci->indent ();
- *ci << "ACE_INLINE const " << name () << " &" << nl;
- *ci << fname << "::in (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " &" << nl;
- *ci << fname << "::inout (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "// mapping for variable size " << nl;
- *ci << "ACE_INLINE " << name () << " *&" << nl;
- *ci << fname << "::out (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = 0;" << nl;
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
- *ci << fname << "::_retn (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << this->name () << " *tmp = this->ptr_;" << nl;
- *ci << "this->ptr_ = 0;" << nl;
- *ci << "return tmp;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // the additional ptr () member function
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
- *ci << fname << "::ptr (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- } // end of case for sequence
- } // end of switch
- return 0;
-}
-
-// generate the _out definition
-int
-be_decl::gen_out_defn (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // to hold the _out name
-
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (namebuf, "%s_out", local_name ()->get_string ());
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
-
- // generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level
-
- *ch << "class " << namebuf << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
-
- // No default constructor
-
- // constructor from a pointer
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *ch << namebuf << " (" << local_name () << "_ptr &);" << nl;
- break;
- case AST_Decl::NT_array:
- *ch << namebuf << " (" << local_name () << "_slice *&);" << nl;
- break;
- default: // others
- *ch << namebuf << " (" << local_name () << " *&);" << nl;
- }
- // constructor from a _var &
- *ch << namebuf << " (" << local_name () << "_var &);" << nl;
- // constructor from a _out &
- *ch << namebuf << " (" << namebuf << " &);" << nl;
- // assignment operator from a _out &
- *ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- // only interface allows assignment from var &
- *ch << namebuf << " &operator= (const " << local_name () << "_var &);" << nl;
- *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
- // cast
- *ch << "operator " << local_name () << "_ptr &();" << nl;
- // ptr fn
- *ch << local_name () << "_ptr &ptr (void);" << nl;
- // operator ->
- *ch << local_name () << "_ptr operator-> (void);" << nl;
- break;
- case AST_Decl::NT_array:
- // assignment from slice *
- *ch << namebuf << " &operator= (" << local_name () << "_slice *);" << nl;
- // cast
- *ch << "operator " << local_name () << "_slice *&();" << nl;
- // ptr fn
- *ch << local_name () << "_slice *&ptr (void);" << nl;
- // operator [] instead of ->
- *ch << namebuf << "_slice &operator[] (CORBA::ULong index);" << nl;
- *ch << "const " << namebuf <<
- "_slice &operator[] (CORBA::ULong index) const;" << nl;
- break;
- default: // others
- // assignment
- *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
- // operator ()
- *ch << "operator " << local_name () << " *&();" << nl;
- // ptr fn
- *ch << local_name () << " *&ptr (void);" << nl;
- // operator ->
- *ch << local_name () << " *operator-> (void);" << nl;
-
- if (this->node_type () == AST_Decl::NT_sequence)
- {
- be_sequence *bs = be_sequence::narrow_from_decl (this);
- be_type *bt = be_type::narrow_from_decl (bs->base_type ());
-
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (bt);
-
- // overloaded [] operator only for sequence. The const version is not
- // required
- // bt->gen_type ();
- // XXXASG
-
- *ch << " &operator[] (CORBA::ULong index);" << nl;
- }
- }
- *ch << "\n";
- ch->decr_indent ();
- *ch << "private:\n";
- ch->incr_indent ();
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *ch << local_name () << "_ptr &ptr_;\n";
- break;
- case AST_Decl::NT_array:
- *ch << local_name () << "_slice *&ptr_;" << nl;
- *ch << "// assignment from T_var not allowed" << nl;
- *ch << "void operator= (const " << local_name () << "_var &);\n";
- break;
- default:
- *ch << local_name () << " *&ptr_;" << nl;
- *ch << "// assignment from T_var not allowed" << nl;
- *ch << "void operator= (const " << local_name () << "_var &);\n";
- }
-
- ch->decr_indent ();
- *ch << "};\n\n";
- return 0;
-}
-
-int
-be_decl::gen_out_impl (void)
-{
- 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', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_out", this->fullname ());
-
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
- cg->outstream (ci);
-
- // generate the var implementation in the inline file
- // 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
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for class " << fname << nl;
- *ci << "// *************************************************************\n\n";
-
- // due to some differences with the way with which the _var is defined, we
- // handle code generation in a switch statement
- switch (this->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- // constr from a _ptr
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr &p)" << nl;
- *ci << "\t: ptr_ (p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // constructor from _var &
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name () <<
- "_var &p) // constructor from _var" << nl;
- *ci << "\t: ptr_ (p.out ())" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // copy constructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << fname <<
- " &p) // copy constructor" << nl;
- *ci << "\t: ptr_ (p.ptr_)" << nl;
- *ci << "{}\n\n";
-
- // assignment operator from _out &
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << fname <<
- " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p.ptr_;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from _var
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << this->name () <<
- "_var &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "::_duplicate (p.ptr ());" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from _ptr
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name () <<
- "_ptr p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name () <<
- "_ptr &() // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // ptr function
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
- *ci << fname << "::ptr (void) // ptr" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator->
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
- *ci << fname << "::operator-> (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- break;
- case AST_Decl::NT_array:
- {
- be_array *b;
-
- b = be_array::narrow_from_decl (this);
- // constr from a pointer to slice
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_slice *&p)" << nl;
- *ci << "\t: ptr_ (p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // constructor from _var &
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name () <<
- "_var &p) // constructor from _var" << nl;
- *ci << "\t: ptr_ (p.out ())" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << this->name () << "_free (this->ptr_);" << nl;
- *ci << "this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // copy constructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << fname <<
- " &p) // copy constructor" << nl;
- *ci << "\t: ptr_ (p.ptr_)" << nl;
- *ci << "{}\n\n";
-
- // assignment operator from _out &
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << fname <<
- " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p.ptr_;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment from _var is not allowed by a private declaration
-
- // assignment operator from _ptr
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name () <<
- "_slice *p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name () <<
- "_slice *&() // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // ptr function
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_slice *&" << nl;
- *ci << fname << "::ptr (void) // ptr" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator [] instead of ->
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_slice &" << nl;
- *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_[index];\n";
- ci->decr_indent ();
- *ci << "}\n\n";
- }
- break;
- default: // others
- // constr from a pointer
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << " *&p)" << nl;
- *ci << "\t: ptr_ (p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // constructor from _var &
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name () <<
- "_var &p) // constructor from _var" << nl;
- *ci << "\t: ptr_ (p.out ())" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // copy constructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << fname <<
- " &p) // copy constructor" << nl;
- *ci << "\t: ptr_ (p.ptr_)" << nl;
- *ci << "{}\n\n";
-
- // assignment operator from _out &
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << fname <<
- " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p.ptr_;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment from _var is not allowed by a private declaration
-
- // assignment operator from pointer
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name () <<
- " *p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name () <<
- " *&() // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // ptr function
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << " *&" << nl;
- *ci << fname << "::ptr (void) // ptr" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator ->
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << " *" << nl;
- *ci << fname << "::operator-> (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // sequence has an additional method
- if (this->node_type () == AST_Decl::NT_sequence)
- {
- be_type *bt;
- bt = be_type::narrow_from_decl (be_sequence::narrow_from_decl
- (this)->base_type ());
-
- ci->indent ();
- *ci << "ACE_INLINE ";
- *ci << bt->name ();
- //bt->gen_type ();
- // XXXASG
- *ci << nl;
- *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_->operator[] (index);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
- }
- } // end of switch
-
- return 0;
-}
-
-idl_bool
-be_decl::lookup_seq_name (Identifier *id)
-{
- UTL_IdListActiveIterator *i;
-
- if (!this->seq_names_) // no list
- return I_FALSE;
-
- i = new UTL_IdListActiveIterator (this->seq_names_);
- while (!(i->is_done ()))
- {
- if (ACE_OS::strcmp (i->item ()->get_string (), id->get_string ()) == 0)
- return I_TRUE; // found
- i->next ();
- }
- delete i;
- return I_FALSE; // not found
-}
-
-idl_bool
-be_decl::add_seq_name (Identifier *id)
-{
- // we do not check if the name exists or not. This is based on the assumption
- // that callers have made sure to call a lookup
- this->seq_names_ = new UTL_IdList (id, this->seq_names_);
- return I_TRUE;
-}
-
idl_bool
be_decl::is_nested (void)
{
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index bd7ed11c5cc..5e8f58a31af 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -559,8 +559,8 @@ int be_interface::gen_server_skeletons (void)
// code for the skeleton constructor
*ss << "const CORBA::String repoID = \"" << this->repoID () << "\"; // repository ID" << nl;
*ss << "IIOP_Object *data; // Actual object reference" << nl;
- *ss << "CORBA::ORB_ptr orb = TAO_ORB_Core_instance ()->orb (); " <<
- "// underlying ORB" << nl;
+ *ss << "TAO_ORB_Core *ocp = TAO_ORB_Core_instance (); " <<
+ "// underlying ORB core instance" << nl;
*ss << "CORBA::POA_ptr oa = TAO_ORB_Core_instance ()->root_poa (); " <<
"// underlying OA" << nl;
*ss << "this->optable_ = &tao_" << local_name () << "_optable;" << nl <<
@@ -569,7 +569,7 @@ int be_interface::gen_server_skeletons (void)
*ss << "data = new IIOP_Object (CORBA::string_dup (repoID));" << nl;
*ss << "data->profile.iiop_version.major = IIOP::MY_MAJOR;" << nl;
*ss << "data->profile.iiop_version.minor = IIOP::MY_MINOR;" << nl;
- *ss << "const ACE_INET_Addr &addr = orb->params ()->addr ();" << nl;
+ *ss << "const ACE_INET_Addr &addr = ocp->orb_params ()->addr ();" << nl;
*ss << "data->profile.host = ACE_OS::strdup (" <<
"addr.get_host_name ());" << nl;
*ss << "data->profile.port = addr.get_port_number ();" << nl;
@@ -579,8 +579,8 @@ int be_interface::gen_server_skeletons (void)
"data->profile.object_key.length;" << nl;
*ss << "data->profile.object_key.buffer = " <<
"new CORBA::Octet [(size_t)data->profile.object_key.length+1];" << nl;
- *ss << "ACE_OS::memcpy (data->profile.object_key.buffer, obj_name, " <<
- "data->profile.object_key.length); // set the obj key" << nl;
+ *ss << "ACE_OS::strcpy ((char *)data->profile.object_key.buffer, obj_name);"
+ << " // set the object key" << nl;
*ss << "this->set_parent (data); // store the IIOP obj ref with us" <<
nl;
*ss << "this->sub_ = this; // set the most derived type to be us" << nl;
@@ -799,13 +799,11 @@ be_interface::gen_server_inline (void)
return 0;
}
-#if 0 // XXXASG - TODO
// generate the var definition
int
be_interface::gen_var_defn (void)
{
TAO_OutStream *ch; // output stream
- long i; // loop index
TAO_NL nl; // end line
char namebuf [NAMEBUFSIZE]; // names
@@ -863,6 +861,9 @@ be_interface::gen_var_defn (void)
*ch << local_name () << "_ptr &out (void);" << nl;
*ch << local_name () << "_ptr _retn (void);" << nl;
+ // generate an additional member function that returns the underlying pointer
+ *ch << local_name () << "_ptr ptr (void) const;\n";
+
*ch << "\n";
ch->decr_indent ();
@@ -883,7 +884,6 @@ int
be_interface::gen_var_impl (void)
{
TAO_OutStream *ci; // output stream
- long i; // loop index
TAO_NL nl; // end line
char fname [NAMEBUFSIZE]; // to hold the full and
char lname [NAMEBUFSIZE]; // local _var names
@@ -925,12 +925,25 @@ be_interface::gen_var_impl (void)
*ci << "\t: 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.
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << fname << "::ptr (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
// copy constructor
ci->indent ();
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << fname <<
" &p) // copy constructor" << nl;
- *ci << "\t: ptr_ (" << name () << "::_duplicate (p))" << nl;
+ *ci << "\t: ptr_ (" << name () << "::_duplicate (p.ptr ()))" << nl;
*ci << "{}\n\n";
// destructor
@@ -967,7 +980,7 @@ be_interface::gen_var_impl (void)
*ci << "{\n";
ci->incr_indent ();
*ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << name () << "::_duplicate (p);\n";
+ *ci << "this->ptr_ = " << name () << "::_duplicate (p.ptr ());\n";
ci->decr_indent ();
*ci << "}" << nl;
*ci << "return *this;\n";
@@ -1045,6 +1058,7 @@ be_interface::gen_var_impl (void)
*ci << "return val;\n";
ci->decr_indent ();
*ci << "}\n\n";
+
return 0;
}
@@ -1053,7 +1067,6 @@ int
be_interface::gen_out_defn (void)
{
TAO_OutStream *ch; // output stream
- long i; // loop index
TAO_NL nl; // end line
char namebuf [NAMEBUFSIZE]; // to hold the _out name
@@ -1075,9 +1088,169 @@ be_interface::gen_out_defn (void)
// No default constructor
+ // constructor from a pointer
+ *ch << namebuf << " (" << local_name () << "_ptr &);" << nl;
+ // constructor from a _var &
+ *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ // constructor from a _out &
+ *ch << namebuf << " (" << namebuf << " &);" << nl;
+ // assignment operator from a _out &
+ *ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
+ // 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;
+ // cast
+ *ch << "operator " << local_name () << "_ptr &();" << nl;
+ // ptr fn
+ *ch << local_name () << "_ptr &ptr (void);" << nl;
+ // operator ->
+ *ch << local_name () << "_ptr operator-> (void);" << nl;
+
+ *ch << "\n";
+ ch->decr_indent ();
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << "_ptr &ptr_;\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+ return 0;
+}
+
+int
+be_interface::gen_out_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_out", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ // generate the var implementation in the inline file
+ // 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
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // constr from a _ptr
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << "_ptr &p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // constructor from _var &
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () <<
+ "_var &p) // constructor from _var" << nl;
+ *ci << "\t: ptr_ (p.out ())" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "CORBA::release (this->ptr_);" << nl;
+ *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "\t: ptr_ (p.ptr_)" << nl;
+ *ci << "{}\n\n";
+
+ // assignment operator from _out &
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p.ptr_;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _var
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << this->name () <<
+ "_var &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = " << this->name () << "::_duplicate (p.ptr ());" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _ptr
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << this->name () <<
+ "_ptr p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << this->name () <<
+ "_ptr &() // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // ptr function
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
+ *ci << fname << "::ptr (void) // ptr" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // operator->
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
+ *ci << fname << "::operator-> (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
return 0;
}
-#endif
// generate typecode.
// Typecode for interface comprises the enumerated value followed by the
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
index 137c116587d..e05c67e7bf7 100644
--- a/TAO/TAO_IDL/be/be_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -111,7 +111,6 @@ int
be_interface_fwd::gen_client_inline (void)
{
TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -160,6 +159,459 @@ be_interface_fwd::gen_server_inline (void)
return 0;
}
+// generate the var definition
+int
+be_interface_fwd::gen_var_defn (void)
+{
+ 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 ());
+
+ // 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).
+ // Depending upon the data type, there are some differences which we account
+ // for over here.
+
+ ch->indent (); // start with whatever was our current indent level
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+
+ // default constr
+ *ch << namebuf << " (void); // default constructor" << nl;
+ *ch << namebuf << " (" << local_name () << "_ptr);" << nl;
+
+ // copy constructor
+ *ch << namebuf << " (const " << namebuf <<
+ " &); // copy constructor" << nl;
+
+ // destructor
+ *ch << "~" << namebuf << " (void); // destructor" << nl;
+ *ch << nl;
+
+ // assignment operator from a pointer
+ *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
+
+ // assignment from _var
+ *ch << namebuf << " &operator= (const " << namebuf <<
+ " &);" << nl;
+
+ // arrow operator
+ *ch << local_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 << "// 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;
+
+ // generate an additional member function that returns the underlying pointer
+ *ch << local_name () << "_ptr ptr (void) const;\n";
+
+ *ch << "\n";
+ ch->decr_indent ();
+
+ // private
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << "_ptr ptr_;\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+
+ return 0;
+}
+
+// implementation of the _var class. All of these get generated in the inline
+// file
+int
+be_interface_fwd::gen_var_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_var", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ // generate the var implementation in the inline file
+ // 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
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // default constr
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname <<
+ " (void) // default constructor" << nl;
+ *ci << "\t" << ": ptr_ (" << this->name () << "::_nil ())" << nl;
+ *ci << "{}\n\n";
+
+ // constr from a _ptr
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << "_ptr p)" << nl;
+ *ci << "\t: 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.
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << fname << "::ptr (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (const " << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "\t: ptr_ (" << name () << "::_duplicate (p))" << nl;
+ *ci << "{}\n\n";
+
+ // destructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::~" << lname << " (void) // destructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "CORBA::release (this->ptr_);\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << name () <<
+ "_ptr p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "CORBA::release (this->ptr_);" << nl;
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _var
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (this != &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "CORBA::release (this->ptr_);" << nl;
+ *ci << "this->ptr_ = " << name () << "::_duplicate (p);\n";
+ ci->decr_indent ();
+ *ci << "}" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator const " << name () <<
+ "_ptr &() const // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << name () << "_ptr &() // cast " << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // operator->
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << fname << "::operator-> (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // in, inout, out, and _retn
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << "_ptr" << nl;
+ *ci << fname << "::in (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << "_ptr &" << nl;
+ *ci << fname << "::inout (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << 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 << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << 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 << "return val;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ return 0;
+}
+
+// generate the _out definition
+int
+be_interface_fwd::gen_out_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ char namebuf [NAMEBUFSIZE]; // to hold the _out name
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ch = cg->client_header ();
+
+ // generate the out definition (always in the client header)
+ ch->indent (); // start with whatever was our current indent level
+
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+
+ // No default constructor
+
+ // constructor from a pointer
+ *ch << namebuf << " (" << local_name () << "_ptr &);" << nl;
+ // constructor from a _var &
+ *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ // constructor from a _out &
+ *ch << namebuf << " (" << namebuf << " &);" << nl;
+ // assignment operator from a _out &
+ *ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
+ // 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;
+ // cast
+ *ch << "operator " << local_name () << "_ptr &();" << nl;
+ // ptr fn
+ *ch << local_name () << "_ptr &ptr (void);" << nl;
+ // operator ->
+ *ch << local_name () << "_ptr operator-> (void);" << nl;
+
+ *ch << "\n";
+ ch->decr_indent ();
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << "_ptr &ptr_;\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+
+ return 0;
+}
+
+int
+be_interface_fwd::gen_out_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_out", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ // generate the var implementation in the inline file
+ // 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
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // constr from a _ptr
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << "_ptr &p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // constructor from _var &
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () <<
+ "_var &p) // constructor from _var" << nl;
+ *ci << "\t: ptr_ (p.out ())" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "CORBA::release (this->ptr_);" << nl;
+ *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "\t: ptr_ (p.ptr_)" << nl;
+ *ci << "{}\n\n";
+
+ // assignment operator from _out &
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p.ptr_;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _var
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << this->name () <<
+ "_var &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = " << this->name () << "::_duplicate (p.ptr ());" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _ptr
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << this->name () <<
+ "_ptr p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << this->name () <<
+ "_ptr &() // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // ptr function
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
+ *ci << fname << "::ptr (void) // ptr" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // operator->
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
+ *ci << fname << "::operator-> (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ return 0;
+}
int
be_interface_fwd::gen_typecode (void)
{
diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp
index 612fc5f9147..e9cddfab94a 100644
--- a/TAO/TAO_IDL/be/be_module.cpp
+++ b/TAO/TAO_IDL/be/be_module.cpp
@@ -2,7 +2,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_module.cpp
//
@@ -12,9 +12,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#include "idl.h"
@@ -32,21 +32,13 @@ be_module::be_module (UTL_ScopedName *n, UTL_StrList *p)
: AST_Decl (AST_Decl::NT_module, n, p),
UTL_Scope (AST_Decl::NT_module)
{
- // computes the repoID
- compute_repoID ();
-
- // computes the fully scoped name
- compute_fullname ();
-
- // compute the flattened fully scoped name
- compute_flatname ();
}
// ----------------------------------------
// CODE GENERATION METHODS
// ----------------------------------------
-// generate the client header
+// generate the client header
int be_module::gen_client_header (void)
{
TAO_OutStream *ch; // output stream
@@ -77,7 +69,7 @@ int be_module::gen_client_header (void)
// that only legal syntactic elements appear in our scope.
if (be_scope::gen_client_header () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_module::gen_client_header\n"));
+ ACE_ERROR ((LM_ERROR, "be_module::gen_client_header\n"));
ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
return -1;
}
@@ -97,7 +89,7 @@ int be_module::gen_client_stubs (void)
// gen code for elements in the scope
if (be_scope::gen_client_stubs () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_module::gen_client_stubs\n"));
+ ACE_ERROR ((LM_ERROR, "be_module::gen_client_stubs\n"));
ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
return -1;
}
@@ -138,7 +130,7 @@ int be_module::gen_server_header (void)
if (be_scope::gen_server_header () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_module::gen_server_header\n"));
+ ACE_ERROR ((LM_ERROR, "be_module::gen_server_header\n"));
ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
return -1;
}
@@ -157,7 +149,7 @@ int be_module::gen_server_skeletons (void)
if (be_scope::gen_server_skeletons () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_module::gen_server_skeletons\n"));
+ ACE_ERROR ((LM_ERROR, "be_module::gen_server_skeletons\n"));
ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
return -1;
}
@@ -166,7 +158,7 @@ int be_module::gen_server_skeletons (void)
}
// Generates the client-side inline information
-int
+int
be_module::gen_client_inline (void)
{
// retrieve a singleton instance of the code generator
@@ -176,7 +168,7 @@ be_module::gen_client_inline (void)
// gen code for elements in the scope
if (be_scope::gen_client_inline () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_module::gen_client_inline\n"));
+ ACE_ERROR ((LM_ERROR, "be_module::gen_client_inline\n"));
ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
return -1;
}
@@ -186,7 +178,7 @@ be_module::gen_client_inline (void)
}
// Generates the server-side inline
-int
+int
be_module::gen_server_inline (void)
{
// retrieve a singleton instance of the code generator
@@ -196,7 +188,7 @@ be_module::gen_server_inline (void)
// gen code for elements in the scope
if (be_scope::gen_server_inline () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_module::gen_server_inline\n"));
+ ACE_ERROR ((LM_ERROR, "be_module::gen_server_inline\n"));
ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
return -1;
}
@@ -209,5 +201,3 @@ be_module::gen_server_inline (void)
IMPL_NARROW_METHODS3 (be_module, AST_Module, be_scope, be_decl)
IMPL_NARROW_FROM_DECL (be_module)
IMPL_NARROW_FROM_SCOPE (be_module)
-
-
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
index d9aa791dfaf..a0e1b0d8204 100644
--- a/TAO/TAO_IDL/be/be_operation.cpp
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -633,9 +633,23 @@ be_operation::gen_server_skeletons (void)
if (!bpd || (bpd->pt () != AST_PredefinedType::PT_void))
{
// not a void type
- *ss << "result = new CORBA::Any (" << rt->tc_name () <<
- ", retval, 1); // ORB owns" << nl;
- *ss << "req.result (result, env);" << nl;
+ switch (rt->node_type ())
+ {
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ {
+ *ss << "result = new CORBA::Any (" << rt->tc_name () <<
+ ", retval, 0); // ORB does not own" << nl;
+ *ss << "req.result (result, env);" << nl;
+ }
+ break;
+ default:
+ {
+ *ss << "result = new CORBA::Any (" << rt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ *ss << "req.result (result, env);" << nl;
+ }
+ }
#if 0
cg->push (TAO_CodeGen::TAO_OPERATION_RESULT_SS);
s = cg->make_state ();
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index 44d657a4d3c..0bb42e1173b 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -58,8 +58,6 @@ be_sequence::create_name (void)
UTL_ScopedName *n = NULL;
be_decl *d; // may point to a typedef node
be_decl *scope; // scope in which we are defined
- be_type *t; // our base type
- AST_Expression *v; // our bounds
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -131,7 +129,6 @@ be_sequence::gen_client_header (void)
TAO_OutStream *ch; // output stream
TAO_NL nl; // end line
be_type *bt; // type node
- be_decl *d; // temporary
be_state *s; // state based code gen object
if (!this->cli_hdr_gen_)
@@ -277,18 +274,42 @@ be_sequence::gen_client_stubs (void)
{
TAO_OutStream *cs; // output stream
TAO_NL nl; // end line
-
+ be_type *bt; // base type
+ be_state *s; //state object
if (!this->cli_stub_gen_)
{
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CS); // set current code gen state
cs = cg->client_stubs ();
- // pass info
- cg->outstream (cs);
- cg->node (this);
+
+ // retrieve base type
+ bt = be_type::narrow_from_decl (this->base_type ());
+ if (!bt)
+ return -1;
+
+ cg->push (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
+ s = cg->make_state ();
+
+ // generate stubs for our base type if it itself is a sequence
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_client_stubs - base type code gen\n"), -1);
+ }
+ cg->pop ();
+
+ // generate the methods of the sequence C++ mapping
+ cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CS);
+ s = cg->make_state ();
+
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_client_stubs - invalid state\n"), -1);
+ }
+
// generate the typecode information here
cs->indent (); // start from current indentation level
*cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
@@ -312,30 +333,91 @@ be_sequence::gen_client_stubs (void)
cg->pop ();
this->cli_stub_gen_ = I_TRUE;
-
}
return 0;
}
-int
-be_sequence::gen_server_header (void)
-{
- return 0;
-}
-
-int
-be_sequence::gen_server_skeletons (void)
-{
- return 0;
-}
-
// Generates the client-side inline information
int
be_sequence::gen_client_inline (void)
{
+ TAO_OutStream *ci; // output stream
+ TAO_NL nl; // end line
+ be_state *s; // code gen state
+ be_type *bt; // base type
+
if (!this->cli_inline_gen_)
{
- be_type *bt;
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+
+ // retrieve base type
+ bt = be_type::narrow_from_decl (this->base_type ());
+ if (!bt)
+ return -1;
+
+ cg->push (TAO_CodeGen::TAO_SEQUENCE_BASE_CI);
+ s = cg->make_state ();
+
+ // generate inline methods for our base type if it itself is a sequence
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_client_inline - base type code gen\n"), -1);
+ }
+ cg->pop ();
+
+ // generate the methods of the sequence C++ mapping
+ cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CI);
+ s = cg->make_state ();
+
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_client_inline - invalid state\n"), -1);
+ }
+
+ // the allocbuf method
+ ci->indent ();
+ *ci << "ACE_INLINE ";
+ if (s->gen_code (bt, this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence - base type code gen failure\n"), -1);
+ }
+ *ci << " *" << nl;
+ *ci << this->name () << "::allocbuf (CORBA::ULong nelems)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return new ";
+ if (s->gen_code (bt, this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence - base type code gen failure\n"), -1);
+ }
+ *ci << "[nelems]; // allocate from heap\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // freebuf method
+ ci->indent ();
+ *ci << "ACE_INLINE void" << nl;
+ *ci << this->name () << "::freebuf (";
+ if (s->gen_code (bt, this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence - base type code gen failure\n"), -1);
+ }
+ *ci << " *seq)" << nl;
+ *ci << "{\n";
+ ci->indent ();
+ *ci << "delete [] seq;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // default constructor
if (this->gen_var_impl () == -1)
{
@@ -348,23 +430,24 @@ be_sequence::gen_client_inline (void)
return -1;
}
- // if our base type is an anonymous sequence, we generate its client
- // inline methods
- bt = be_type::narrow_from_decl (this->base_type ());
- if (bt->node_type () == AST_Decl::NT_sequence)
- {
- if (bt->gen_client_inline () == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "be_sequence: inline code gen for base type seq failed\n"));
- return -1;
- }
- }
this->cli_inline_gen_ = I_TRUE;
+ cg->pop ();
}
return 0;
}
+int
+be_sequence::gen_server_header (void)
+{
+ return 0;
+}
+
+int
+be_sequence::gen_server_skeletons (void)
+{
+ return 0;
+}
+
// Generates the server-side inline
int
be_sequence::gen_server_inline (void)
@@ -372,6 +455,582 @@ be_sequence::gen_server_inline (void)
// nothing to be done
return 0;
}
+
+// generate the _var definition for ourself
+int
+be_sequence::gen_var_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ char namebuf [NAMEBUFSIZE]; // names
+ be_state *s; // code gen state
+ be_type *bt; // base type
+
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_var", this->local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ch = cg->client_header ();
+ cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CH);
+ s = cg->make_state ();
+
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_var_defn - invalid state obj\n"), -1);
+ }
+
+ // retrieve base type
+ bt = be_type::narrow_from_decl (this->base_type ());
+
+ // generate the var definition (always in the client header).
+ // Depending upon the data type, there are some differences which we account
+ // for over here.
+
+ ch->indent (); // start with whatever was our current indent level
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+ // default constr
+ *ch << namebuf << " (void); // default constructor" << nl;
+ // constr
+ *ch << namebuf << " (" << this->local_name () << " *);" << nl;
+ // copy constructor
+ *ch << namebuf << " (const " << namebuf <<
+ " &); // copy constructor" << nl;
+ // destructor
+ *ch << "~" << namebuf << " (void); // destructor" << nl;
+ *ch << nl;
+ // assignment operator from a pointer
+ *ch << namebuf << " &operator= (" << this->local_name () << " *);" << nl;
+ // assignment from _var
+ *ch << namebuf << " &operator= (const " << namebuf <<
+ " &);" << nl;
+
+ // arrow operator
+ *ch << this->local_name () << " *operator-> (void);" << nl;
+ *ch << "const " << this->local_name () << " *operator-> (void) const;" << nl;
+ *ch << nl;
+
+ // other extra types (cast operators, [] operator, and others)
+
+ // cast operator
+ *ch << "operator const " << this->local_name () << " &() const;" << nl;
+ *ch << "operator " << this->local_name () << " &();" << nl;
+ *ch << "operator " << this->local_name () << " &() const;" << nl;
+
+ // overloaded [] operator. The const version is not required for sequences
+
+ // gen code for base return type
+ if (s->gen_code (bt, this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_var_impl - base type codegen failed\n"), -1);
+ }
+ *ch << " &operator[] (CORBA::ULong index);" << 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 << "const " << this->local_name () << " &in (void) const;" << nl;
+ *ch << this->local_name () << " &inout (void);" << nl;
+ *ch << this->local_name () << " *&out (void);" << nl;
+ *ch << this->local_name () << " *_retn (void);" << nl;
+
+ // generate an additional member function that returns the underlying pointer
+ *ch << this->local_name () << " *ptr (void) const;\n";
+
+ *ch << "\n";
+ ch->decr_indent ();
+
+ // generate the private section
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << this->local_name () << " *ptr_;\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+ cg->pop ();
+
+ return 0;
+}
+
+// implementation of the _var class. All of these get generated in the inline
+// file
+int
+be_sequence::gen_var_impl (void)
+{
+ TAO_OutStream *ci; // output stream
+ TAO_NL nl; // end line
+ char fname [NAMEBUFSIZE]; // to hold the full and
+ char lname [NAMEBUFSIZE]; // local _var names
+ be_state *s; // code gen state
+ be_type *bt; // base type
+
+
+ ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_var", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_var", this->local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+
+ cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CI);
+ s = cg->make_state ();
+
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_var_impl - invalid state obj\n"), -1);
+ }
+
+ // retrieve base type
+ bt = be_type::narrow_from_decl (this->base_type ());
+
+ // generate the var implementation in the inline file
+ ci->indent (); // start with whatever was our current indent level
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // default constr
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname <<
+ " (void) // default constructor" << nl;
+ *ci << "\t" << ": ptr_ (0)" << nl;
+ *ci << "{}\n\n";
+
+ // constr from a _ptr
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << "_ptr p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (const " << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (p.ptr_)" << nl;
+ *ci << "\tthis->ptr_ = new " << this->name () << "(*p.ptr_);" << nl;
+ *ci << "else" << nl;
+ *ci << "\tthis->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // destructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::~" << lname << " (void) // destructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from a pointer
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << name () <<
+ " *p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _var
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << fname <<
+ "_var &p) // deep copy" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (this != &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = new " << this->name () << " (*p.ptr_);\n";
+ ci->decr_indent ();
+ *ci << "}" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // two arrow operators
+ ci->indent ();
+ *ci << "ACE_INLINE const " << fname << " *" << nl;
+ *ci << fname << "::operator-> (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " *" << nl;
+ *ci << fname << "::operator-> (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - 3 cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator const " << name () <<
+ " &() const // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << name () << " &() // cast " << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << name () << " &() const// cast " << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // operator []
+ ci->indent ();
+ *ci << "ACE_INLINE ";
+ // gen code for base return type
+ if (s->gen_code (bt, this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_var_impl - base type codegen failed\n"), -1);
+ }
+ *ci << " " << nl;
+ *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_->operator[] (index);\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // in, inout, out, and _retn
+ ci->indent ();
+ *ci << "ACE_INLINE const " << name () << " &" << nl;
+ *ci << fname << "::in (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << fname << "::inout (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "// mapping for variable size " << nl;
+ *ci << "ACE_INLINE " << name () << " *&" << nl;
+ *ci << fname << "::out (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;" << nl;
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << fname << "::_retn (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << this->name () << " *tmp = this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;" << nl;
+ *ci << "return tmp;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // the additional ptr () member function
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << fname << "::ptr (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ cg->pop ();
+
+ return 0;
+}
+
+// generate the _out definition
+int
+be_sequence::gen_out_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ char namebuf [NAMEBUFSIZE]; // to hold the _out name
+ be_state *s; // code gen state
+ be_type *bt; // base type
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_out", this->local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ch = cg->client_header ();
+ cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CH);
+ s = cg->make_state ();
+
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_out_defn - invalid state obj\n"), -1);
+ }
+
+ // retrieve base type
+ bt = be_type::narrow_from_decl (this->base_type ());
+
+ // generate the out definition (always in the client header)
+ ch->indent (); // start with whatever was our current indent level
+
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+
+ // No default constructor
+
+ // constructor from a pointer
+ *ch << namebuf << " (" << this->local_name () << " *&);" << nl;
+ // constructor from a _var &
+ *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
+ // constructor from a _out &
+ *ch << namebuf << " (" << namebuf << " &);" << nl;
+ // assignment operator from a _out &
+ *ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
+ // assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators
+ // assignment
+ *ch << namebuf << " &operator= (" << this->local_name () << " *);" << nl;
+ // operator ()
+ *ch << "operator " << this->local_name () << " *&();" << nl;
+ // ptr fn
+ *ch << this->local_name () << " *&ptr (void);" << nl;
+ // operator ->
+ *ch << this->local_name () << " *operator-> (void);" << nl;
+
+ // overloaded [] operator only for sequence. The const version is not
+ // required
+
+ // gen code for base return type
+ if (s->gen_code (bt, this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_var_impl - base type codegen failed\n"), -1);
+ }
+ *ch << " &operator[] (CORBA::ULong index);" << nl;
+ *ch << "\n";
+ ch->decr_indent ();
+ *ch << "private:\n";
+ ch->incr_indent ();
+
+ *ch << this->local_name () << " *&ptr_;" << nl;
+ *ch << "// assignment from T_var not allowed" << nl;
+ *ch << "void operator= (const " << this->local_name () << "_var &);\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+
+ cg->pop ();
+ return 0;
+}
+
+int
+be_sequence::gen_out_impl (void)
+{
+ TAO_OutStream *ci; // output stream
+ TAO_NL nl; // end line
+ char fname [NAMEBUFSIZE]; // to hold the full and
+ char lname [NAMEBUFSIZE]; // local _out names
+ be_state *s; // code gen state
+ be_type *bt; // base type
+
+
+ ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_out", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_out", this->local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+
+ cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CI);
+ s = cg->make_state ();
+
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_out_impl - invalid state obj\n"), -1);
+ }
+
+ // retrieve base type
+ bt = be_type::narrow_from_decl (this->base_type ());
+
+ // generate the out implementation in the inline file
+
+ ci->indent (); // start with whatever was our current indent level
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // constr from a pointer
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << " *&p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // constructor from _var &
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () <<
+ "_var &p) // constructor from _var" << nl;
+ *ci << "\t: ptr_ (p.out ())" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "\t: ptr_ (p.ptr_)" << nl;
+ *ci << "{}\n\n";
+
+ // assignment operator from _out &
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p.ptr_;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment from _var is not allowed by a private declaration
+
+ // assignment operator from pointer
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << this->name () <<
+ " *p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << this->name () <<
+ " *&() // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // ptr function
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << " *&" << nl;
+ *ci << fname << "::ptr (void) // ptr" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // operator ->
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
+ *ci << fname << "::operator-> (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // sequence has an additional method
+ ci->indent ();
+ *ci << "ACE_INLINE ";
+ // gen code for base return type
+ if (s->gen_code (bt, this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_sequence::gen_out_impl - base type codegen failed\n"), -1);
+ }
+ *ci << nl;
+ *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_->operator[] (index);\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ cg->pop ();
+ return 0;
+}
+
// generate typecode.
// Typecode for sequences comprises the enumerated value followed by the
// encapsulation of the parameters
diff --git a/TAO/TAO_IDL/be/be_state.cpp b/TAO/TAO_IDL/be/be_state.cpp
index 3121fa44769..3f77edc6416 100644
--- a/TAO/TAO_IDL/be/be_state.cpp
+++ b/TAO/TAO_IDL/be/be_state.cpp
@@ -978,7 +978,10 @@ be_state_operation::gen_code (be_type *bt, be_decl *d, be_type *type)
break;
case TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_SS:
{
- *os << bt->name () << "_ptr retval;"; // callee allocates
+ // *os << bt->name () << "_ptr retval;"; // callee
+ // allocates
+ // some stupid problems arising out of casting to the bt->name type
+ *os << "CORBA::Object_ptr retval;" << nl; // callee allocates
}
break;
case TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS:
@@ -2186,32 +2189,48 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
TAO_NL nl; // end line
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
be_typedef *tdef; // typedef node
+ be_decl *scope; // enclosing scope in which the typedef occurs
switch (cg->state ())
{
case TAO_CodeGen::TAO_TYPEDEF_CH:
- {
- be_decl *scope; // enclosing scope in which the typedef occurs
+ os = cg->client_header (); // set the stream to be the client header
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_CI:
+ os = cg->client_inline ();
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_CS:
+ os = cg->client_stubs ();
+ break;
+ default:
+ return -1;
+ } // end of outermost switch
- os = cg->client_header (); // set the stream to be the client header
- tdef = be_typedef::narrow_from_decl (d); // downcast to typedef node
- if (!tdef)
- return -1;
- // pass the typedef node, just in case it is needed
- cg->node (tdef);
+ tdef = be_typedef::narrow_from_decl (d); // downcast to typedef node
+ if (!tdef)
+ return -1;
- scope = be_decl::narrow_from_decl (ScopeAsDecl (tdef->defined_in ()));
+ // pass the typedef node, just in case it is needed
+ cg->node (tdef);
- if (!type) // not a recursive call
- type = bt;
- else // recursively called thru a typedef. "type" will have the most primitive
- // base class of the typedef
- ACE_ASSERT (bt->node_type () == AST_Decl::NT_typedef);
+ scope = be_decl::narrow_from_decl (ScopeAsDecl (tdef->defined_in ()));
- switch (type->node_type ())
+ if (!type) // not a recursive call
+ type = bt;
+ else // recursively called thru a typedef. "type" will have the most primitive
+ // base class of the typedef
+ ACE_ASSERT (bt->node_type () == AST_Decl::NT_typedef);
+
+
+ switch (type->node_type ())
+ {
+ case AST_Decl::NT_interface: // type is an obj reference
+ case AST_Decl::NT_interface_fwd: // type is an obj reference
+ {
+ switch (cg->state ())
{
- case AST_Decl::NT_interface: // type is an obj reference
+ case TAO_CodeGen::TAO_TYPEDEF_CH:
{
os->indent (); // start from current indentation
@@ -2226,7 +2245,16 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
d->local_name () << "_out;\n\n";
}
break;
- case AST_Decl::NT_pre_defined: // type is predefined type
+ default: // nothing to do for other cases
+ break;
+ } // end of switch state
+ }
+ break;
+ case AST_Decl::NT_pre_defined: // type is predefined type
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_TYPEDEF_CH:
{
be_predefined_type *pd = be_predefined_type::narrow_from_decl (bt);
@@ -2239,35 +2267,46 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
if (pd->pt () == AST_PredefinedType::PT_any)
{
*os << nl;
- *os << "typedef " << bt->name () << "_var " << d->local_name () << "_var;";
+ *os << "typedef " << bt->name () << "_var " << d->local_name
+ () << "_var;";
}
else if (pd->pt () == AST_PredefinedType::PT_pseudo)
{
// pseudo object
- *os << "typedef " << bt->nested_type_name (scope, "_ptr") << " " <<
- d->local_name () << "_ptr;" << nl;
- *os << "typedef " << bt->nested_type_name (scope, "_var") << " " <<
- d->local_name () << "_var;" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_ptr") <<
+ " " << d->local_name () << "_ptr;" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_var") <<
+ " " << d->local_name () << "_var;" << nl;
}
- *os << "typedef " << bt->nested_type_name (scope, "_out") << " " <<
- d->local_name () << "_out;\n\n";
- }
+ *os << "typedef " << bt->nested_type_name (scope, "_out") << " "
+ << d->local_name () << "_out;\n\n";
+ } // end of case
+ break;
+ default: // nothing to do for other cases
break;
- case AST_Decl::NT_string: // type is a string
+ } // end switch
+ }
+ break;
+ case AST_Decl::NT_string: // type is a string
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_TYPEDEF_CH:
{
os->indent (); // start from current indentation
if (bt->node_type () == AST_Decl::NT_typedef)
{
*os << "typedef " << bt->nested_type_name (scope) << " " <<
d->local_name () << ";" << nl;
- *os << "typedef " << bt->nested_type_name (scope, "_var") << " "
- << d->local_name () << "_var;" << nl;
- *os << "typedef " << bt->nested_type_name (scope, "_out") << " "
- << d->local_name () << "_out;\n\n";
+ *os << "typedef " << bt->nested_type_name (scope, "_var") <<
+ " " << d->local_name () << "_var;" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_out") <<
+ " " << d->local_name () << "_out;\n\n";
}
else
{
- *os << "typedef CORBA::String " << d->local_name () << ";" << nl;
+ *os << "typedef CORBA::String " << d->local_name () << ";" <<
+ nl;
*os << "typedef CORBA::String_var " << d->local_name
() << "_var;" << nl;
*os << "typedef CORBA::String_out " << d->local_name
@@ -2275,7 +2314,16 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
}
}
break;
- case AST_Decl::NT_enum: // type is an enum
+ default: // nothing to do for the rest of the cases
+ break;
+ } // end switch state
+ }
+ break;
+ case AST_Decl::NT_enum: // type is an enum
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_TYPEDEF_CH:
{
os->indent (); // start from current indentation
// if we are not here recursively, then we need to generate the
@@ -2290,12 +2338,21 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
}
*os << "typedef " << bt->nested_type_name (scope) << " " <<
d->local_name () << ";" << nl;
- *os << "typedef " << bt->nested_type_name (scope, "_out") << " " <<
- d->local_name () << "_out;\n\n";
+ *os << "typedef " << bt->nested_type_name (scope, "_out") << " "
+ << d->local_name () << "_out;\n\n";
}
break;
- // these are all anonymous types
- case AST_Decl::NT_array: // type is an array
+ default:
+ break;
+ } // end of switch
+ }
+ break;
+ // these are all anonymous types
+ case AST_Decl::NT_array: // type is an array
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_TYPEDEF_CH:
{
// if we are not here recursively, then we need to generate the
// definition first
@@ -2304,14 +2361,14 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
if (bt->gen_client_header () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_state_typedef - array gen failed\n"), -1);
+ "be_state_typedef - array gen failed\n"), -1);
}
}
os->indent ();
*os << "typedef " << bt->name () << " " << d->local_name () <<
";" << nl;
- *os << "typedef " << bt->name () << "_forany " << d->local_name () <<
- "_forany;" << nl;
+ *os << "typedef " << bt->name () << "_forany " << d->local_name
+ () << "_forany;" << nl;
// typedefs for the auxiliary methods. If we are nested inside
// some scope, these methods become static to the enclosing scope
if (d->is_nested ())
@@ -2328,7 +2385,16 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
"_slice *);\n\n";
}
break;
- case AST_Decl::NT_sequence: // type is a sequence
+ default:
+ break;
+ } // end of switch
+ }
+ break;
+ case AST_Decl::NT_sequence: // type is a sequence
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_TYPEDEF_CH:
{
// if we are not here recursively, then we need to generate the
// definition first
@@ -2337,13 +2403,56 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
if (bt->gen_client_header () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_state_typedef - struct/union/seq gen failed\n"), -1);
+ "be_state_typedef - seq gen failed\n"),
+ -1);
+ }
+ }
+ os->indent (); // start from current indentation
+ *os << "typedef " << bt->nested_type_name (scope, "_var") << " "
+ << d->local_name () << "_var;" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_out") << " "
+ << d->local_name () << "_out;\n\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_CI:
+ {
+ // if we are not here recursively, then we need to generate the
+ // definition first
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ if (bt->gen_client_inline () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_state_typedef - seq gen failed\n"),
+ -1);
+ }
+ }
+ }
+ case TAO_CodeGen::TAO_TYPEDEF_CS:
+ {
+ // if we are not here recursively, then we need to generate the
+ // definition first
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ if (bt->gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_state_typedef - seq gen failed\n"),
+ -1);
}
}
}
+ default:
break;
- case AST_Decl::NT_struct: // type is a struct
- case AST_Decl::NT_union: // type is a union
+ } // end of switch state
+ }
+ break;
+ case AST_Decl::NT_struct: // type is a struct
+ case AST_Decl::NT_union: // type is a union
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_TYPEDEF_CH:
{
// if we are not here recursively, then we need to generate the
// definition first
@@ -2352,43 +2461,71 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
if (bt->gen_client_header () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_state_typedef - struct/union/seq gen failed\n"), -1);
+ "be_state_typedef - struct/union/seq gen failed\n"),
+ -1);
}
}
os->indent (); // start from current indentation
*os << "typedef " << bt->nested_type_name (scope) << " " <<
d->local_name () << ";" << nl;
- *os << "typedef " << bt->nested_type_name (scope, "_var") << " " <<
- d->local_name () << "_var;" << nl;
- *os << "typedef " << bt->nested_type_name (scope, "_out") << " " <<
- d->local_name () << "_out;\n\n";
+ *os << "typedef " << bt->nested_type_name (scope, "_var") << " "
+ << d->local_name () << "_var;" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_out") << " "
+ << d->local_name () << "_out;\n\n";
}
break;
- case AST_Decl::NT_except: // type is an exception
+ case TAO_CodeGen::TAO_TYPEDEF_CI:
{
- // XXXASG TODO: is this allowed ???
+ // if we are not here recursively, then we need to generate the
+ // definition first
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ if (bt->gen_client_inline () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_state_typedef - struct/union/seq gen failed\n"),
+ -1);
+ }
+ }
}
- break;
- case AST_Decl::NT_typedef: // type is a typedef
+ case TAO_CodeGen::TAO_TYPEDEF_CS:
{
- be_type *temp;
- be_typedef *t = be_typedef::narrow_from_decl (bt);
-
- if (!t)
- return -1;
-
- temp = t->primitive_base_type ();
- // make a recursive call
- return this->gen_code (t, tdef, temp);
- } // end of case
+ // if we are not here recursively, then we need to generate the
+ // definition first
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ if (bt->gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_state_typedef - struct/union/seq gen failed\n"),
+ -1);
+ }
+ }
+ }
+ default:
break;
- } // end of switch
- } // end of case TYPEDEF_CH
+ } // end of switch state
+ }
break;
- case TAO_CodeGen::TAO_TYPEDEF_CI:
- os = cg->client_inline ();
+ case AST_Decl::NT_except: // type is an exception
+ {
+ // XXXASG TODO: is this allowed ???
+ }
break;
- } // end of outermost switch
+ case AST_Decl::NT_typedef: // type is a typedef
+ {
+ be_type *temp;
+ be_typedef *t = be_typedef::narrow_from_decl (bt);
+
+ if (!t)
+ return -1;
+
+ temp = t->primitive_base_type ();
+ // make a recursive call
+ return this->gen_code (t, tdef, temp);
+ } // end of case
+ break;
+ } // end of switch
return 0;
}
@@ -2502,7 +2639,6 @@ int
be_state_sequence::gen_code (be_type *bt, be_decl *d, be_type *type)
{
TAO_OutStream *os = 0; // output stream
- TAO_NL nl; // end line
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
be_sequence *seq;
@@ -2510,18 +2646,22 @@ be_state_sequence::gen_code (be_type *bt, be_decl *d, be_type *type)
if (!seq)
return -1;
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (nl);
-
switch (cg->state ())
{
case TAO_CodeGen::TAO_SEQUENCE_BASE_CH:
case TAO_CodeGen::TAO_SEQUENCE_BODY_CH:
os = cg->client_header (); // get client header stream
break;
+ case TAO_CodeGen::TAO_SEQUENCE_BASE_CS:
+ case TAO_CodeGen::TAO_SEQUENCE_BODY_CS:
+ os = cg->client_stubs (); // get client stubs stream
+ break;
+ case TAO_CodeGen::TAO_SEQUENCE_BASE_CI:
case TAO_CodeGen::TAO_SEQUENCE_BODY_CI:
os = cg->client_inline (); // get client inline stream
break;
+ default:
+ return -1;
}
if (!type) // not a recursive call
@@ -2539,6 +2679,8 @@ be_state_sequence::gen_code (be_type *bt, be_decl *d, be_type *type)
switch (cg->state ())
{
case TAO_CodeGen::TAO_SEQUENCE_BASE_CH:
+ case TAO_CodeGen::TAO_SEQUENCE_BASE_CS:
+ case TAO_CodeGen::TAO_SEQUENCE_BASE_CI:
break;
default:
*os << bt->name () << "_var";
@@ -2554,6 +2696,8 @@ be_state_sequence::gen_code (be_type *bt, be_decl *d, be_type *type)
switch (cg->state ())
{
case TAO_CodeGen::TAO_SEQUENCE_BASE_CH:
+ case TAO_CodeGen::TAO_SEQUENCE_BASE_CS:
+ case TAO_CodeGen::TAO_SEQUENCE_BASE_CI:
break;
default:
*os << bt->name ();
@@ -2573,6 +2717,24 @@ be_state_sequence::gen_code (be_type *bt, be_decl *d, be_type *type)
}
}
break;
+ case TAO_CodeGen::TAO_SEQUENCE_BASE_CS:
+ {
+ // generate the base type sequence
+ if (bt->gen_client_stubs () == -1)
+ {
+ return -1;
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_SEQUENCE_BASE_CI:
+ {
+ // generate the base type sequence
+ if (bt->gen_client_inline () == -1)
+ {
+ return -1;
+ }
+ }
+ break;
default:
{
*os << bt->name ();
diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp
index f2c84fe4c3e..d864354bdd0 100644
--- a/TAO/TAO_IDL/be/be_string.cpp
+++ b/TAO/TAO_IDL/be/be_string.cpp
@@ -36,18 +36,6 @@ be_string::be_string (AST_Expression *v)
NULL)
{
this->size_type (be_decl::VARIABLE); // we are always variable length
-
- // computes the repoID
- compute_repoID ();
-
- // computes the fully scoped name
- compute_fullname ();
-
- // computes the fully scoped typecode name
- compute_tc_name ();
-
- // compute the flattened fully scoped name
- compute_flatname ();
}
// overriden method
@@ -76,18 +64,6 @@ be_string::be_string (AST_Expression *v, long wide)
NULL)
{
this->size_type (be_decl::VARIABLE); // always the case
-
- // computes the repoID
- compute_repoID ();
-
- // computes the fully scoped name
- compute_fullname ();
-
- // computes the fully scoped typecode name
- compute_tc_name ();
-
- // compute the flattened fully scoped name
- compute_flatname ();
}
// Code generation
diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp
index 4f1dca63e4a..2fa7e94c8d1 100644
--- a/TAO/TAO_IDL/be/be_structure.cpp
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -248,6 +248,497 @@ be_structure::gen_server_inline (void)
return 0;
}
+// generate the _var definition for ourself
+int
+be_structure::gen_var_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ be_state *s; // code gen state
+ char namebuf [NAMEBUFSIZE]; // names
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_var", this->local_name ()->get_string ());
+
+ // 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).
+ // Depending upon the data type, there are some differences which we account
+ // for over here.
+
+ ch->indent (); // start with whatever was our current indent level
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+ // default constr
+ *ch << namebuf << " (void); // default constructor" << nl;
+ // constr
+ *ch << namebuf << " (" << local_name () << " *);" << nl;
+ // copy constructor
+ *ch << namebuf << " (const " << namebuf <<
+ " &); // copy constructor" << nl;
+ // destructor
+ *ch << "~" << namebuf << " (void); // destructor" << nl;
+ *ch << nl;
+ // assignment operator from a pointer
+ *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
+ // assignment from _var
+ *ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
+
+ // arrow operator
+ *ch << local_name () << " *operator-> (void);" << nl;
+ *ch << "const " << local_name () << " *operator-> (void) const;" << nl;
+ *ch << nl;
+
+ // other extra types (cast operators, [] operator, and others)
+ *ch << "operator const " << local_name () << " &() const;" << nl;
+ *ch << "operator " << local_name () << " &();" << nl;
+ *ch << "operator " << local_name () << " &() const;" << 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
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ch << "const " << local_name () << " &in (void) const;" << nl;
+ *ch << local_name () << " &inout (void);" << nl;
+ *ch << local_name () << " &out (void);" << nl;
+ *ch << local_name () << " _retn (void);" << nl;
+ }
+ else
+ {
+ *ch << "const " << local_name () << " &in (void) const;" << nl;
+ *ch << local_name () << " &inout (void);" << nl;
+ *ch << local_name () << " *&out (void);" << nl;
+ *ch << local_name () << " *_retn (void);" << nl;
+ }
+
+ // generate an additional member function that returns the underlying pointer
+ *ch << local_name () << " *ptr(void) const;\n";
+
+ *ch << "\n";
+ ch->decr_indent ();
+
+ // generate the private section
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << " *ptr_;\n";
+ ch->decr_indent ();
+ *ch << "};\n\n";
+
+ return 0;
+}
+
+// implementation of the _var class. All of these get generated in the inline
+// file
+int
+be_structure::gen_var_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_var", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ ci->indent (); // start with whatever was our current indent level
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // default constr
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname <<
+ " (void) // default constructor" << nl;
+ *ci << "\t" << ": ptr_ (0)" << nl;
+ *ci << "{}\n\n";
+
+ // constr from a pointer
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << " *p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (const " << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (p.ptr_)" << nl;
+ *ci << "\tthis->ptr_ = new " << this->name () << "(*p.ptr_);" << nl;
+ *ci << "else" << nl;
+ *ci << "\tthis->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // destructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::~" << lname << " (void) // destructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from a pointer
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << name () <<
+ " *p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _var
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (this != &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = new " << this->name () << " (*p.ptr_);\n";
+ ci->decr_indent ();
+ *ci << "}" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // two arrow operators
+ ci->indent ();
+ *ci << "ACE_INLINE const " << this->name () << " *" << nl;
+ *ci << fname << "::operator-> (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
+ *ci << fname << "::operator-> (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - 3 cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator const " << name () <<
+ " &() const // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << name () << " &() // cast " << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << name () << " &() const// cast " << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // in, inout, out, and _retn
+ ci->indent ();
+ *ci << "ACE_INLINE const " << name () << " &" << nl;
+ *ci << fname << "::in (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << fname << "::inout (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // the out is handled differently based on our size type
+ ci->indent ();
+ if (this->size_type () == be_decl::VARIABLE)
+ {
+ *ci << "// mapping for variable size " << nl;
+ *ci << "ACE_INLINE " << name () << " *&" << nl;
+ *ci << fname << "::out (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;" << nl;
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << fname << "::_retn (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << this->name () << " *tmp = this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;" << nl;
+ *ci << "return tmp;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ }
+ else
+ {
+ *ci << "// mapping for fixed size " << nl;
+ *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << fname << "::out (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << nl;
+ *ci << fname << "::_retn (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // the additional ptr () member function
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << fname << "::ptr (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ }
+
+ return 0;
+}
+
+// generate the _out definition
+int
+be_structure::gen_out_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ char namebuf [NAMEBUFSIZE]; // to hold the _out name
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ch = cg->client_header ();
+
+ // generate the out definition (always in the client header)
+ ch->indent (); // start with whatever was our current indent level
+
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+
+ // No default constructor
+
+ // constructor from a pointer
+ *ch << namebuf << " (" << local_name () << " *&);" << nl;
+ // constructor from a _var &
+ *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ // constructor from a _out &
+ *ch << namebuf << " (" << namebuf << " &);" << nl;
+ // assignment operator from a _out &
+ *ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
+ // assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators
+ // assignment
+ *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
+ // operator ()
+ *ch << "operator " << local_name () << " *&();" << nl;
+ // ptr fn
+ *ch << local_name () << " *&ptr (void);" << nl;
+ // operator ->
+ *ch << local_name () << " *operator-> (void);" << nl;
+
+ *ch << "\n";
+ ch->decr_indent ();
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << " *&ptr_;" << nl;
+ *ch << "// assignment from T_var not allowed" << nl;
+ *ch << "void operator= (const " << local_name () << "_var &);\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+ return 0;
+}
+
+int
+be_structure::gen_out_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_out", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ // generate the var implementation in the inline file
+
+ ci->indent (); // start with whatever was our current indent level
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // constr from a pointer
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << " *&p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // constructor from _var &
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () <<
+ "_var &p) // constructor from _var" << nl;
+ *ci << "\t: ptr_ (p.out ())" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "\t: ptr_ (p.ptr_)" << nl;
+ *ci << "{}\n\n";
+
+ // assignment operator from _out &
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p.ptr_;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment from _var is not allowed by a private declaration
+
+ // assignment operator from pointer
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << this->name () <<
+ " *p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << this->name () <<
+ " *&() // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // ptr function
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << " *&" << nl;
+ *ci << fname << "::ptr (void) // ptr" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // operator ->
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
+ *ci << fname << "::operator-> (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+
+ return 0;
+}
+
// generate typecode.
// Typecode for structures comprises the enumerated value followed by the
// encapsulation of the parameters
diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp
index 486a3106c90..dee65c4664b 100644
--- a/TAO/TAO_IDL/be/be_type.cpp
+++ b/TAO/TAO_IDL/be/be_type.cpp
@@ -150,6 +150,38 @@ be_type::nested_type_name (be_decl *d, char *suffix)
return macro;
}
+// *****************************
+// CODE GENERATION
+// *****************************
+
+// generate the _var definition for ourself
+int
+be_type::gen_var_defn (void)
+{
+ return 0;
+}
+
+// implementation of the _var class. All of these get generated in the inline
+// file
+int
+be_type::gen_var_impl (void)
+{
+ return 0;
+}
+
+// generate the _out definition
+int
+be_type::gen_out_defn (void)
+{
+ return 0;
+}
+
+int
+be_type::gen_out_impl (void)
+{
+ return 0;
+}
+
// Narrowing
IMPL_NARROW_METHODS2 (be_type, AST_Type, be_decl)
IMPL_NARROW_FROM_DECL (be_type)
diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp
index 766c1ca3019..a51f947a967 100644
--- a/TAO/TAO_IDL/be/be_typedef.cpp
+++ b/TAO/TAO_IDL/be/be_typedef.cpp
@@ -67,7 +67,8 @@ be_typedef::gen_client_header (void)
s = cg->make_state ();
bt = be_type::narrow_from_decl (this->base_type ());
- // first generate the mapping for our type
+ // first generate the mapping for our type. As a side effect, also
+ // generate the mapping for the typedef
if (!s || !bt || (s->gen_code (bt, this) == -1))
{
ACE_ERROR ((LM_ERROR, "be_typedef: error generating code for base type\n"));
@@ -86,10 +87,7 @@ be_typedef::gen_client_stubs (void)
TAO_OutStream *cs; // output stream
TAO_NL nl; // end line
be_type *bt;
-
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (bt);
- ACE_UNUSED_ARG (nl);
+ be_state *s; // state based code gen object
if (!this->cli_stub_gen_)
{
@@ -98,12 +96,23 @@ be_typedef::gen_client_stubs (void)
cg->push (TAO_CodeGen::TAO_TYPEDEF_CS); // set current code gen state
cs = cg->client_stubs ();
- // pass info
- cg->outstream (cs);
+
cg->node (this); // pass ourselves. For typedefs, this is very important,
// because other nodes's code generation may depend on
// whether they were typedefed or not.
+ s = cg->make_state ();
+
+ bt = be_type::narrow_from_decl (this->base_type ());
+ // first generate the mapping for our type. As a side effect, also
+ // generate the mapping for the typedef
+ if (!s || !bt || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR ((LM_ERROR, "be_typedef: error generating code for base type\n"));
+ return -1;
+ }
+
+#if 0
// generate the typecode information here
cs->indent (); // start from current indentation level
*cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
@@ -127,6 +136,7 @@ be_typedef::gen_client_stubs (void)
", CORBA::B_FALSE);" << nl;
*cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" <<
this->flatname () << ";\n\n";
+#endif
this->cli_stub_gen_ = I_TRUE;
cg->pop ();
}
@@ -134,18 +144,6 @@ be_typedef::gen_client_stubs (void)
return 0;
}
-int
-be_typedef::gen_server_header (void)
-{
- return 0;
-}
-
-int
-be_typedef::gen_server_skeletons (void)
-{
- return 0;
-}
-
// Generates the client-side inline information
int
be_typedef::gen_client_inline (void)
@@ -153,7 +151,7 @@ be_typedef::gen_client_inline (void)
be_type *bt; // type node
be_state *s; // state based code gen object
- if (!this->cli_hdr_gen_) // not already generated
+ if (!this->cli_inline_gen_) // not already generated
{
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -171,11 +169,23 @@ be_typedef::gen_client_inline (void)
}
cg->pop ();
- this->cli_hdr_gen_ = I_TRUE;
+ this->cli_inline_gen_ = I_TRUE;
}
return 0;
}
+int
+be_typedef::gen_server_header (void)
+{
+ return 0;
+}
+
+int
+be_typedef::gen_server_skeletons (void)
+{
+ return 0;
+}
+
// Generates the server-side inline
int
be_typedef::gen_server_inline (void)
diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp
index 35d5855549b..6b71e29469f 100644
--- a/TAO/TAO_IDL/be/be_union.cpp
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -459,6 +459,497 @@ be_union::gen_server_inline (void)
// Typecode for union comprises the enumerated value followed by the
// encapsulation of the parameters
+// generate the _var definition for ourself
+int
+be_union::gen_var_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ be_state *s; // code gen state
+ char namebuf [NAMEBUFSIZE]; // names
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_var", this->local_name ()->get_string ());
+
+ // 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).
+ // Depending upon the data type, there are some differences which we account
+ // for over here.
+
+ ch->indent (); // start with whatever was our current indent level
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+ // default constr
+ *ch << namebuf << " (void); // default constructor" << nl;
+ // constr
+ *ch << namebuf << " (" << local_name () << " *);" << nl;
+ // copy constructor
+ *ch << namebuf << " (const " << namebuf <<
+ " &); // copy constructor" << nl;
+ // destructor
+ *ch << "~" << namebuf << " (void); // destructor" << nl;
+ *ch << nl;
+ // assignment operator from a pointer
+ *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
+ // assignment from _var
+ *ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
+
+ // arrow operator
+ *ch << local_name () << " *operator-> (void);" << nl;
+ *ch << "const " << local_name () << " *operator-> (void) const;" << nl;
+ *ch << nl;
+
+ // other extra types (cast operators, [] operator, and others)
+ *ch << "operator const " << local_name () << " &() const;" << nl;
+ *ch << "operator " << local_name () << " &();" << nl;
+ *ch << "operator " << local_name () << " &() const;" << 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
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ch << "const " << local_name () << " &in (void) const;" << nl;
+ *ch << local_name () << " &inout (void);" << nl;
+ *ch << local_name () << " &out (void);" << nl;
+ *ch << local_name () << " _retn (void);" << nl;
+ }
+ else
+ {
+ *ch << "const " << local_name () << " &in (void) const;" << nl;
+ *ch << local_name () << " &inout (void);" << nl;
+ *ch << local_name () << " *&out (void);" << nl;
+ *ch << local_name () << " *_retn (void);" << nl;
+ }
+
+ // generate an additional member function that returns the underlying pointer
+ *ch << local_name () << " *ptr(void) const;\n";
+
+ *ch << "\n";
+ ch->decr_indent ();
+
+ // generate the private section
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << " *ptr_;\n";
+ ch->decr_indent ();
+ *ch << "};\n\n";
+
+ return 0;
+}
+
+// implementation of the _var class. All of these get generated in the inline
+// file
+int
+be_union::gen_var_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_var", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ ci->indent (); // start with whatever was our current indent level
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // default constr
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname <<
+ " (void) // default constructor" << nl;
+ *ci << "\t" << ": ptr_ (0)" << nl;
+ *ci << "{}\n\n";
+
+ // constr from a pointer
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << " *p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (const " << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (p.ptr_)" << nl;
+ *ci << "\tthis->ptr_ = new " << this->name () << "(*p.ptr_);" << nl;
+ *ci << "else" << nl;
+ *ci << "\tthis->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // destructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::~" << lname << " (void) // destructor" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from a pointer
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << name () <<
+ " *p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment operator from _var
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (this != &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = new " << this->name () << " (*p.ptr_);\n";
+ ci->decr_indent ();
+ *ci << "}" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // two arrow operators
+ ci->indent ();
+ *ci << "ACE_INLINE const " << this->name () << " *" << nl;
+ *ci << fname << "::operator-> (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
+ *ci << fname << "::operator-> (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - 3 cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator const " << name () <<
+ " &() const // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << name () << " &() // cast " << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << name () << " &() const// cast " << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // in, inout, out, and _retn
+ ci->indent ();
+ *ci << "ACE_INLINE const " << name () << " &" << nl;
+ *ci << fname << "::in (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << fname << "::inout (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // the out is handled differently based on our size type
+ ci->indent ();
+ if (this->size_type () == be_decl::VARIABLE)
+ {
+ *ci << "// mapping for variable size " << nl;
+ *ci << "ACE_INLINE " << name () << " *&" << nl;
+ *ci << fname << "::out (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;" << nl;
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << fname << "::_retn (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << this->name () << " *tmp = this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;" << nl;
+ *ci << "return tmp;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ }
+ else
+ {
+ *ci << "// mapping for fixed size " << nl;
+ *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << fname << "::out (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << nl;
+ *ci << fname << "::_retn (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return *this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // the additional ptr () member function
+ ci->indent ();
+ *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << fname << "::ptr (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ }
+
+ return 0;
+}
+
+// generate the _out definition
+int
+be_union::gen_out_defn (void)
+{
+ TAO_OutStream *ch; // output stream
+ TAO_NL nl; // end line
+ char namebuf [NAMEBUFSIZE]; // to hold the _out name
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (namebuf, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ch = cg->client_header ();
+
+ // generate the out definition (always in the client header)
+ ch->indent (); // start with whatever was our current indent level
+
+ *ch << "class " << namebuf << nl;
+ *ch << "{" << nl;
+ *ch << "public:\n";
+ ch->incr_indent ();
+
+ // No default constructor
+
+ // constructor from a pointer
+ *ch << namebuf << " (" << local_name () << " *&);" << nl;
+ // constructor from a _var &
+ *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ // constructor from a _out &
+ *ch << namebuf << " (" << namebuf << " &);" << nl;
+ // assignment operator from a _out &
+ *ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
+ // assignment operator from a pointer &, cast operator, ptr fn, operator
+ // -> and any other extra operators
+ // assignment
+ *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
+ // operator ()
+ *ch << "operator " << local_name () << " *&();" << nl;
+ // ptr fn
+ *ch << local_name () << " *&ptr (void);" << nl;
+ // operator ->
+ *ch << local_name () << " *operator-> (void);" << nl;
+
+ *ch << "\n";
+ ch->decr_indent ();
+ *ch << "private:\n";
+ ch->incr_indent ();
+ *ch << local_name () << " *&ptr_;" << nl;
+ *ch << "// assignment from T_var not allowed" << nl;
+ *ch << "void operator= (const " << local_name () << "_var &);\n";
+
+ ch->decr_indent ();
+ *ch << "};\n\n";
+ return 0;
+}
+
+int
+be_union::gen_out_impl (void)
+{
+ 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', NAMEBUFSIZE);
+ ACE_OS::sprintf (fname, "%s_out", this->fullname ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ ci = cg->client_inline ();
+ cg->outstream (ci);
+
+ // generate the var implementation in the inline file
+
+ ci->indent (); // start with whatever was our current indent level
+
+ *ci << "// *************************************************************"
+ << nl;
+ *ci << "// Inline operations for class " << fname << nl;
+ *ci << "// *************************************************************\n\n";
+
+ // constr from a pointer
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << name () << " *&p)" << nl;
+ *ci << "\t: ptr_ (p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // constructor from _var &
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () <<
+ "_var &p) // constructor from _var" << nl;
+ *ci << "\t: ptr_ (p.out ())" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "this->ptr_ = 0;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // copy constructor
+ ci->indent ();
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (" << fname <<
+ " &p) // copy constructor" << nl;
+ *ci << "\t: ptr_ (p.ptr_)" << nl;
+ *ci << "{}\n\n";
+
+ // assignment operator from _out &
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << fname <<
+ " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p.ptr_;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // assignment from _var is not allowed by a private declaration
+
+ // assignment operator from pointer
+ ci->indent ();
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (" << this->name () <<
+ " *p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "this->ptr_ = p;" << nl;
+ *ci << "return *this;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // other extra methods - cast operator ()
+ ci->indent ();
+ *ci << "ACE_INLINE " << nl;
+ *ci << fname << "::operator " << this->name () <<
+ " *&() // cast" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // ptr function
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << " *&" << nl;
+ *ci << fname << "::ptr (void) // ptr" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+ // operator ->
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
+ *ci << fname << "::operator-> (void)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
+
+ return 0;
+}
+
int
be_union::gen_typecode (void)
{
diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h
index 21ef94ba0aa..d03d20e03fe 100644
--- a/TAO/TAO_IDL/be_include/be_array.h
+++ b/TAO/TAO_IDL/be_include/be_array.h
@@ -2,7 +2,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_array.h
//
@@ -12,9 +12,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#if !defined (BE_ARRAY_H)
@@ -53,6 +53,24 @@ public:
virtual int gen_server_inline (void);
// Generates the server-side inlines for the array
+ virtual int gen_var_defn (void);
+ // generate the _var class definition
+
+ virtual int gen_var_impl (void);
+ // generate the implementation for the _var class
+
+ virtual int gen_out_defn (void);
+ // generate the _out class definition
+
+ virtual int gen_out_impl (void);
+ // generate the _out implementation
+
+ virtual int gen_forany_defn (void);
+ // the forany class
+
+ virtual int gen_forany_impl (void);
+ // the forany impl
+
virtual int gen_typecode (void);
// generate the typecode
@@ -65,12 +83,6 @@ public:
virtual long tc_encap_len (void);
// return length of encapsulation
- virtual int gen_forany_defn (void);
- // the forany class
-
- virtual int gen_forany_impl (void);
- // the forany impl
-
// Narrowing
DEF_NARROW_METHODS2 (be_array, AST_Array, be_type);
DEF_NARROW_FROM_DECL (be_array);
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
index 95cc29ae1c5..b351042b521 100644
--- a/TAO/TAO_IDL/be_include/be_decl.h
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -51,18 +51,6 @@ public:
~be_decl (void);
// destructor
- virtual int gen_var_defn (void);
- // generate the _var class definition
-
- virtual int gen_var_impl (void);
- // generate the implementation for the _var class
-
- virtual int gen_out_defn (void);
- // generate the _out class definition
-
- virtual int gen_out_impl (void);
- // generate the _out implementation
-
virtual int gen_client_header (void) = 0;
// Generates the client-side header information for the decl
@@ -81,12 +69,6 @@ public:
virtual int gen_server_inline (void) = 0;
// Generates the server-side inlines for the decl
- virtual idl_bool lookup_seq_name (Identifier *);
- // lookup a name inside a list of generated seq names
-
- virtual idl_bool add_seq_name (Identifier *);
- // add a generated seq name to a list.
-
virtual void size_type (SIZE_TYPE);
// set the size type
@@ -145,9 +127,6 @@ protected:
idl_bool srv_skel_gen_;
idl_bool srv_inline_gen_;
- UTL_IdList *seq_names_;
- // list of generated sequence names in the current scope
-
char *fullname_;
// our full scoped name
diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h
index 8e14606c539..2e997dc0685 100644
--- a/TAO/TAO_IDL/be_include/be_interface.h
+++ b/TAO/TAO_IDL/be_include/be_interface.h
@@ -3,7 +3,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_interface.h
//
@@ -13,9 +13,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#if !defined (TAO_BE_INTERFACE_H)
@@ -44,13 +44,13 @@ public:
// <ih>, the number of inherited interfaces <nih>, and any prgmas <p>
virtual int gen_client_header (void);
- // Generates the client-side header information for the interface
+ // Generates the client-side header information for the interface
virtual int gen_client_stubs (void);
// Generates the client-side stubs for the interface
virtual int gen_server_header (void);
- // Generates the server-side header information for the interface
+ // Generates the server-side header information for the interface
virtual int gen_server_skeletons (void);
// Generates the server-side skeletons for the interface
@@ -61,6 +61,18 @@ public:
virtual int gen_server_inline (void);
// Generates the server-side inlines for the interface
+ virtual int gen_var_defn (void);
+ // generate the _var class definition
+
+ virtual int gen_var_impl (void);
+ // generate the implementation for the _var class
+
+ virtual int gen_out_defn (void);
+ // generate the _out class definition
+
+ virtual int gen_out_impl (void);
+ // generate the _out implementation
+
const char *full_skel_name (void);
// retrieve the fully scoped skel class name
diff --git a/TAO/TAO_IDL/be_include/be_interface_fwd.h b/TAO/TAO_IDL/be_include/be_interface_fwd.h
index edc4f870577..1453bfeb95d 100644
--- a/TAO/TAO_IDL/be_include/be_interface_fwd.h
+++ b/TAO/TAO_IDL/be_include/be_interface_fwd.h
@@ -3,7 +3,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_interface.h
//
@@ -13,9 +13,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#if !defined (BE_INTERFACE_FWD_H)
@@ -41,13 +41,13 @@ public:
// constructor
virtual int gen_client_header (void);
- // Generates the client-side header information for the interface
+ // Generates the client-side header information for the interface
virtual int gen_client_stubs (void);
// Generates the client-side stubs for the interface
virtual int gen_server_header (void);
- // Generates the server-side header information for the interface
+ // Generates the server-side header information for the interface
virtual int gen_server_skeletons (void);
// Generates the server-side skeletons for the interface
@@ -58,6 +58,18 @@ public:
virtual int gen_server_inline (void);
// Generates the server-side inlines for the interface
+ virtual int gen_var_defn (void);
+ // generate the _var class definition
+
+ virtual int gen_var_impl (void);
+ // generate the implementation for the _var class
+
+ virtual int gen_out_defn (void);
+ // generate the _out class definition
+
+ virtual int gen_out_impl (void);
+ // generate the _out implementation
+
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h
index 03f5602b8bb..ba95b7f41aa 100644
--- a/TAO/TAO_IDL/be_include/be_sequence.h
+++ b/TAO/TAO_IDL/be_include/be_sequence.h
@@ -64,6 +64,18 @@ public:
virtual int gen_server_inline (void);
// Generates the server-side inlines for the sequence
+ virtual int gen_var_defn (void);
+ // generate the _var class definition
+
+ virtual int gen_var_impl (void);
+ // generate the implementation for the _var class
+
+ virtual int gen_out_defn (void);
+ // generate the _out class definition
+
+ virtual int gen_out_impl (void);
+ // generate the _out implementation
+
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_structure.h b/TAO/TAO_IDL/be_include/be_structure.h
index 4ed579d3c00..295cb69a660 100644
--- a/TAO/TAO_IDL/be_include/be_structure.h
+++ b/TAO/TAO_IDL/be_include/be_structure.h
@@ -3,7 +3,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_structure.h
//
@@ -13,9 +13,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#if !defined (BE_STRUCTURE_H)
@@ -38,13 +38,13 @@ public:
// constructor
virtual int gen_client_header (void);
- // Generates the client-side header information for the struct
+ // Generates the client-side header information for the struct
virtual int gen_client_stubs (void);
// Generates the client-side stubs for the struct
virtual int gen_server_header (void);
- // Generates the server-side header information for the struct
+ // Generates the server-side header information for the struct
virtual int gen_server_skeletons (void);
// Generates the server-side skeletons for the struct
@@ -55,6 +55,18 @@ public:
virtual int gen_server_inline (void);
// Generates the server-side inlines for the struct
+ virtual int gen_var_defn (void);
+ // generate the _var class definition
+
+ virtual int gen_var_impl (void);
+ // generate the implementation for the _var class
+
+ virtual int gen_out_defn (void);
+ // generate the _out class definition
+
+ virtual int gen_out_impl (void);
+ // generate the _out implementation
+
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_type.h b/TAO/TAO_IDL/be_include/be_type.h
index f9c9843acec..a4cc6b5b17c 100644
--- a/TAO/TAO_IDL/be_include/be_type.h
+++ b/TAO/TAO_IDL/be_include/be_type.h
@@ -53,6 +53,18 @@ public:
virtual int gen_server_inline (void) = 0;
// Generates the server-side inlines for the type
+ virtual int gen_var_defn (void);
+ // generate the _var class definition
+
+ virtual int gen_var_impl (void);
+ // generate the implementation for the _var class
+
+ virtual int gen_out_defn (void);
+ // generate the _out class definition
+
+ virtual int gen_out_impl (void);
+ // generate the _out implementation
+
virtual int gen_typecode (void) = 0;
// generate the typecode description
diff --git a/TAO/TAO_IDL/be_include/be_union.h b/TAO/TAO_IDL/be_include/be_union.h
index cc146acd9d6..74bc6d46927 100644
--- a/TAO/TAO_IDL/be_include/be_union.h
+++ b/TAO/TAO_IDL/be_include/be_union.h
@@ -2,7 +2,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_union.h
//
@@ -12,9 +12,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#if !defined (BE_UNION_H)
@@ -37,13 +37,13 @@ public:
// constructor
virtual int gen_client_header (void);
- // Generates the client-side header information for the union
+ // Generates the client-side header information for the union
virtual int gen_client_stubs (void);
// Generates the client-side stubs for the union
virtual int gen_server_header (void);
- // Generates the server-side header information for the union
+ // Generates the server-side header information for the union
virtual int gen_server_skeletons (void);
// Generates the server-side skeletons for the union
@@ -54,6 +54,18 @@ public:
virtual int gen_server_inline (void);
// Generates the server-side inlines for the union
+ virtual int gen_var_defn (void);
+ // generate the _var class definition
+
+ virtual int gen_var_impl (void);
+ // generate the implementation for the _var class
+
+ virtual int gen_out_defn (void);
+ // generate the _out class definition
+
+ virtual int gen_out_impl (void);
+ // generate the _out implementation
+
virtual int gen_typecode (void);
// generate the typecode