summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-12-30 22:14:18 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-12-30 22:14:18 +0000
commitbf1baf1b82902dd51b3fe96144fe2fa4805eb779 (patch)
tree1fcccbca93a5baa65386186610119c09b750da71
parent11a2b664896885822b7f66043ce40e7a291f7737 (diff)
downloadATCD-bf1baf1b82902dd51b3fe96144fe2fa4805eb779.tar.gz
Modifying generation of _var members according to fixed or
variable size of contained type(s) and/or cosmetic changes.
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp131
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp219
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp236
-rw-r--r--TAO/TAO_IDL/be/be_valuetype.cpp244
-rw-r--r--TAO/TAO_IDL/be/be_valuetype_fwd.cpp129
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp73
10 files changed, 758 insertions, 383 deletions
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 84eb6e70686..539fc5b01ea 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -333,13 +333,15 @@ be_interface::gen_copy_ctors_helper (be_interface* node, be_interface* base, TAO
{
if(first)
{
- *os << idl_global->impl_class_prefix () << base->flat_name () << idl_global->impl_class_suffix () << " (t)"
+ *os << idl_global->impl_class_prefix () << base->flat_name ()
+ << idl_global->impl_class_suffix () << " (t)"
<< ", " << base->full_skel_name () << " (t)";
first = 0;
}
else
{
- *os << ", " << idl_global->impl_class_prefix () << base->flat_name () << idl_global->impl_class_suffix () << " (t)"
+ *os << ", " << idl_global->impl_class_prefix () << base->flat_name ()
+ << idl_global->impl_class_suffix () << " (t)"
<< ", " << base->full_skel_name () << " (t)"; ;
}
@@ -372,12 +374,14 @@ be_interface::gen_def_ctors_helper (be_interface* node, be_interface* base, TAO_
{
if(first)
{
- *os << idl_global->impl_class_prefix () << base->flat_name () << idl_global->impl_class_suffix () << " ()";
+ *os << idl_global->impl_class_prefix () << base->flat_name ()
+ << idl_global->impl_class_suffix () << " ()";
first = 0;
}
else
{
- *os << ", " << idl_global->impl_class_prefix () << base->flat_name () << idl_global->impl_class_suffix () << " ()";
+ *os << ", " << idl_global->impl_class_prefix () << base->flat_name ()
+ << idl_global->impl_class_suffix () << " ()";
}
}
@@ -407,7 +411,10 @@ be_interface::gen_var_defn (char* interface_name)
interface_name = (char *) this->local_name ();
// Buffer with name of the var class.
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
ACE_OS::sprintf (namebuf,
"%s_var",
interface_name);
@@ -503,11 +510,21 @@ be_interface::gen_var_impl (char *interface_local_name,
interface_full_name = (char *) this->full_name ();
}
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_var", interface_full_name);
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", interface_local_name);
+ ACE_OS::sprintf (fname,
+ "%s_var",
+ interface_full_name);
+
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (lname,
+ "%s_var",
+ interface_local_name);
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
index 61e1f97642c..bdf5d2e93b1 100644
--- a/TAO/TAO_IDL/be/be_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -54,8 +54,13 @@ be_interface_fwd::gen_var_defn (char *)
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 ());
+ 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 ();
@@ -75,7 +80,7 @@ be_interface_fwd::gen_var_defn (char *)
// default constr
*ch << namebuf << " (void); // default constructor" << nl;
- *ch << namebuf << " (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_ptr);" << nl;
// copy constructor
*ch << namebuf << " (const " << namebuf <<
@@ -86,31 +91,33 @@ be_interface_fwd::gen_var_defn (char *)
*ch << nl;
// assignment operator from a pointer
- *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " &operator= (" << this->local_name ()
+ << "_ptr);" << nl;
// assignment from _var
*ch << namebuf << " &operator= (const " << namebuf <<
" &);" << nl;
// arrow operator
- *ch << local_name () << "_ptr operator-> (void) const;" << nl;
+ *ch << this->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 << "operator const " << this->local_name ()
+ << "_ptr &() const;" << nl;
+ *ch << "operator " << this->local_name () << "_ptr &();" << nl;
*ch << "// in, inout, out, _retn " << nl;
// the return types of in, out, inout, and _retn are based on the parameter
// passing rules and the base type
- *ch << local_name () << "_ptr in (void) const;" << nl;
- *ch << local_name () << "_ptr &inout (void);" << nl;
- *ch << local_name () << "_ptr &out (void);" << nl;
- *ch << local_name () << "_ptr _retn (void);" << nl;
+ *ch << this->local_name () << "_ptr in (void) const;" << nl;
+ *ch << this->local_name () << "_ptr &inout (void);" << nl;
+ *ch << this->local_name () << "_ptr &out (void);" << nl;
+ *ch << this->local_name () << "_ptr _retn (void);" << nl;
// generate an additional member function that returns the underlying pointer
- *ch << local_name () << "_ptr ptr (void) const;\n";
+ *ch << this->local_name () << "_ptr ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
@@ -118,7 +125,7 @@ be_interface_fwd::gen_var_defn (char *)
// private
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "_ptr ptr_;\n";
+ *ch << this->local_name () << "_ptr ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -129,18 +136,29 @@ be_interface_fwd::gen_var_defn (char *)
// implementation of the _var class. All of these get generated in the inline
// file
int
-be_interface_fwd::gen_var_impl (char *, char *)
+be_interface_fwd::gen_var_impl (char *,
+ char *)
{
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (fname,
+ "%s_var",
+ this->full_name ());
+
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+ 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 ();
@@ -168,7 +186,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
// constr from a _ptr
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () << "_ptr p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
@@ -177,7 +195,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::ptr (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -190,7 +208,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << fname <<
" &p) // copy constructor" << nl;
- *ci << " : ptr_ (" << name () << "::_duplicate (p.ptr ()))" << nl;
+ *ci << " : ptr_ (" << this->name () << "::_duplicate (p.ptr ()))" << nl;
*ci << "{}\n\n";
// destructor
@@ -206,7 +224,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
// assignment operator
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
+ *ci << fname << "::operator= (" << this->name () <<
"_ptr p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -227,7 +245,8 @@ be_interface_fwd::gen_var_impl (char *, char *)
*ci << "{\n";
ci->incr_indent ();
*ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << name () << "::_duplicate (p.ptr ());\n";
+ *ci << "this->ptr_ = " << this->name ()
+ << "::_duplicate (p.ptr ());\n";
ci->decr_indent ();
*ci << "}" << nl;
*ci << "return *this;\n";
@@ -237,7 +256,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
// other extra methods - cast operator ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
+ *ci << fname << "::operator const " << this->name () <<
"_ptr &() const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -247,7 +266,8 @@ be_interface_fwd::gen_var_impl (char *, char *)
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << "_ptr &() // cast " << nl;
+ *ci << fname << "::operator " << this->name ()
+ << "_ptr &() // cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -256,7 +276,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
// operator->
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::operator-> (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -266,7 +286,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
// in, inout, out, and _retn
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr" << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr" << nl;
*ci << fname << "::in (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -275,7 +295,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr &" << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
*ci << fname << "::inout (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -284,7 +304,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr &" << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -295,7 +315,7 @@ be_interface_fwd::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -317,8 +337,13 @@ be_interface_fwd::gen_out_defn (char *)
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 ());
+ 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 ();
@@ -337,9 +362,9 @@ be_interface_fwd::gen_out_defn (char *)
// No default constructor
// constructor from a pointer
- *ch << namebuf << " (" << local_name () << "_ptr &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_ptr &);" << nl;
// constructor from a _var &
- *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
// constructor from a _out &
*ch << namebuf << " (const " << namebuf << " &);" << nl;
// assignment operator from a _out &
@@ -347,20 +372,22 @@ be_interface_fwd::gen_out_defn (char *)
// assignment operator from a pointer &, cast operator, ptr fn, operator
// -> and any other extra operators
// only interface allows assignment from var &
- *ch << namebuf << " &operator= (const " << local_name () << "_var &);" << nl;
- *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " &operator= (const "
+ << this->local_name () << "_var &);" << nl;
+ *ch << namebuf << " &operator= ("
+ << this->local_name () << "_ptr);" << nl;
// cast
- *ch << "operator " << local_name () << "_ptr &();" << nl;
+ *ch << "operator " << this->local_name () << "_ptr &();" << nl;
// ptr fn
- *ch << local_name () << "_ptr &ptr (void);" << nl;
+ *ch << this->local_name () << "_ptr &ptr (void);" << nl;
// operator ->
- *ch << local_name () << "_ptr operator-> (void);" << nl;
+ *ch << this->local_name () << "_ptr operator-> (void);" << nl;
*ch << "\n";
ch->decr_indent ();
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "_ptr &ptr_;\n";
+ *ch << this->local_name () << "_ptr &ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -376,11 +403,21 @@ be_interface_fwd::gen_out_impl (char *, char *)
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (fname,
+ "%s_out",
+ this->full_name ());
+
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+ 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 ();
@@ -401,7 +438,8 @@ be_interface_fwd::gen_out_impl (char *, char *)
// constr from a _ptr
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr &p)" << nl;
+ *ci << fname << "::" << lname << " ("
+ << this->name () << "_ptr &p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -450,7 +488,8 @@ be_interface_fwd::gen_out_impl (char *, char *)
"_var &p)" << nl;
*ci << "{\n";
ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "::_duplicate (p.ptr ());" << nl;
+ *ci << "this->ptr_ = " << this->name ()
+ << "::_duplicate (p.ptr ());" << nl;
*ci << "return *this;\n";
ci->decr_indent ();
*ci << "}\n\n";
diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp
index dded28bb580..50d013310cd 100644
--- a/TAO/TAO_IDL/be/be_structure.cpp
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -33,7 +33,8 @@ be_structure::be_structure (void)
{
}
-be_structure::be_structure (UTL_ScopedName *n, UTL_StrList *p)
+be_structure::be_structure (UTL_ScopedName *n,
+ UTL_StrList *p)
: AST_Decl (AST_Decl::NT_struct, n, p),
UTL_Scope (AST_Decl::NT_struct),
member_count_ (-1)
@@ -52,15 +53,18 @@ be_structure::compute_member_count (void)
if (this->nmembers () > 0)
{
// instantiate a scope iterator.
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ si = new UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls);
while (!(si->is_done ()))
{
this->member_count_++;
si->next ();
} // end of while
+
delete si; // free the iterator object
}
+
return 0;
}
@@ -82,8 +86,13 @@ be_structure::gen_var_defn (char *)
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 ());
+ 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 ();
@@ -91,8 +100,8 @@ be_structure::gen_var_defn (char *)
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.
+ // Depending upon the data type, there are some differences which
+ // we account for here.
ch->indent (); // start with whatever was our current indent level
*ch << "class " << idl_global->stub_export_macro ()
@@ -103,47 +112,72 @@ be_structure::gen_var_defn (char *)
// default constr
*ch << namebuf << " (void); // default constructor" << nl;
// constr
- *ch << namebuf << " (" << local_name () << " *);" << nl;
+ *ch << namebuf << " (" << this->local_name () << " *);" << nl;
// copy constructor
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
+
+ // fixed-size types only
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ch << namebuf << " (const " << this->local_name ()
+ << " &); // fixed-size types only" << nl;
+ }
+
// destructor
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
// assignment operator from a pointer
- *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
+ *ch << namebuf << " &operator= (" << this->local_name () << " *);" << nl;
// assignment from _var
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
+ // fixed-size types only
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ch << namebuf << " &operator= (const " << this->local_name ()
+ << " &); // fixed-size types only" << nl;
+ }
+
// arrow operator
*ch << local_name () << " *operator-> (void);" << nl;
- *ch << "const " << local_name () << " *operator-> (void) const;" << nl;
+ *ch << "const " << this->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 << "operator const " << this->local_name () << " &() const;" << nl;
+ *ch << "operator " << this->local_name () << " &();" << nl;
+ *ch << "operator " << this->local_name () << " &() const;" << nl;
+
+ if (this->size_type () == be_decl::VARIABLE)
+ {
+ *ch << "operator " << this->local_name ()
+ << " *&(); // variable-size types only" << nl;
+ }
+
+ *ch << nl;
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
+ // the return types of in, out, inout, and _retn are based on the
+ // parameter passing rules and the base type
if (this->size_type () == be_decl::FIXED)
{
- *ch << "const " << local_name () << " &in (void) const;" << nl;
+ *ch << "const " << this->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 << "const " << this->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";
+ // generate an additional member function
+ // that returns the underlying pointer
+ *ch << this->local_name () << " *ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
@@ -151,17 +185,17 @@ be_structure::gen_var_defn (char *)
// generate the private section
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << " *ptr_;\n";
+ *ch << this->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
+// Implementation of the _var class, generated in the inline file.
int
-be_structure::gen_var_impl (char *, char *)
+be_structure::gen_var_impl (char *,
+ char *)
{
TAO_OutStream *ci; // output stream
TAO_NL nl; // end line
@@ -196,7 +230,7 @@ be_structure::gen_var_impl (char *, char *)
// constr from a pointer
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << " *p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () << " *p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
@@ -208,12 +242,28 @@ be_structure::gen_var_impl (char *, char *)
*ci << "{\n";
ci->incr_indent ();
*ci << "if (p.ptr_)" << nl;
- *ci << " ACE_NEW (this->ptr_, " << this->name () << " (*p.ptr_));" << nl;
+ *ci << " ACE_NEW (this->ptr_, " << this->name ()
+ << " (*p.ptr_));" << nl;
*ci << "else" << nl;
*ci << " this->ptr_ = 0;\n";
ci->decr_indent ();
*ci << "}\n\n";
+ // fixed-size types only
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ci << "// fixed-size types only" << nl;
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (const "
+ << this->name () << " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "ACE_NEW (this->ptr_, " << this->name ()
+ << " (p));\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+ }
+
// destructor
ci->indent ();
*ci << "ACE_INLINE" << nl;
@@ -227,7 +277,7 @@ be_structure::gen_var_impl (char *, char *)
// assignment operator from a pointer
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
+ *ci << fname << "::operator= (" << this->name () <<
" *p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -248,13 +298,37 @@ be_structure::gen_var_impl (char *, char *)
*ci << "{\n";
ci->incr_indent ();
*ci << "delete this->ptr_;" << nl;
- *ci << "ACE_NEW_RETURN (this->ptr_, " << this->name () << " (*p.ptr_), *this);\n";
+ *ci << "ACE_NEW_RETURN (this->ptr_, " << this->name ()
+ << " (*p.ptr_), *this);\n";
ci->decr_indent ();
*ci << "}" << nl;
*ci << "return *this;\n";
ci->decr_indent ();
*ci << "}\n\n";
+ // fixed-size types only
+ if (this->size_type () == be_decl::FIXED)
+ {
+ ci->indent ();
+ *ci << "// fixed-size types only" << nl;
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << this->name ()
+ << " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (this->ptr_ != &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "ACE_NEW_RETURN (this->ptr_, "
+ << this->name () << " (p), *this);\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;
@@ -276,8 +350,8 @@ be_structure::gen_var_impl (char *, char *)
// other extra methods - 3 cast operator ()
ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::operator const " << this->name () <<
" &() const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -286,8 +360,9 @@ be_structure::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() // cast " << nl;
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::operator " << this->name ()
+ << " &() // cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return *this->ptr_;\n";
@@ -295,17 +370,33 @@ be_structure::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() const// cast " << nl;
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::operator " << this->name ()
+ << " &() const // cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return *this->ptr_;\n";
ci->decr_indent ();
*ci << "}\n\n";
+ // variable-size types only
+ if (this->size_type () == be_decl::VARIABLE)
+ {
+ ci->indent ();
+ *ci << "// variable-size types only" << nl;
+ *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";
+ }
+
// in, inout, out, and _retn
ci->indent ();
- *ci << "ACE_INLINE const " << name () << " &" << nl;
+ *ci << "ACE_INLINE const " << this->name () << " &" << nl;
*ci << fname << "::in (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -314,7 +405,7 @@ be_structure::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << "ACE_INLINE " << this->name () << " &" << nl;
*ci << fname << "::inout (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -327,7 +418,7 @@ be_structure::gen_var_impl (char *, char *)
if (this->size_type () == be_decl::VARIABLE)
{
*ci << "// mapping for variable size " << nl;
- *ci << "ACE_INLINE " << name () << " *&" << nl;
+ *ci << "ACE_INLINE " << this->name () << " *&" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -338,7 +429,7 @@ be_structure::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -352,7 +443,7 @@ be_structure::gen_var_impl (char *, char *)
else
{
*ci << "// mapping for fixed size " << nl;
- *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << "ACE_INLINE " << this->name () << " &" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -361,7 +452,7 @@ be_structure::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << nl;
+ *ci << "ACE_INLINE " << this->name () << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -373,7 +464,7 @@ be_structure::gen_var_impl (char *, char *)
// the additional ptr () member function
ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
*ci << fname << "::ptr (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -392,8 +483,13 @@ be_structure::gen_out_defn (char *)
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 ());
+ 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 ();
@@ -412,9 +508,9 @@ be_structure::gen_out_defn (char *)
// No default constructor
// constructor from a pointer
- *ch << namebuf << " (" << local_name () << " *&);" << nl;
+ *ch << namebuf << " (" << this->local_name () << " *&);" << nl;
// constructor from a _var &
- *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
// constructor from a _out &
*ch << namebuf << " (const " << namebuf << " &);" << nl;
// assignment operator from a _out &
@@ -422,13 +518,14 @@ be_structure::gen_out_defn (char *)
// assignment operator from a pointer &, cast operator, ptr fn, operator
// -> and any other extra operators
// assignment
- *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
+ *ch << namebuf << " &operator= ("
+ << this->local_name () << " *);" << nl;
// operator ()
- *ch << "operator " << local_name () << " *&();" << nl;
+ *ch << "operator " << this->local_name () << " *&();" << nl;
// ptr fn
- *ch << local_name () << " *&ptr (void);" << nl;
+ *ch << this->local_name () << " *&ptr (void);" << nl;
// operator ->
- *ch << local_name () << " *operator-> (void);" << nl;
+ *ch << this->local_name () << " *operator-> (void);" << nl;
*ch << "\n";
ch->decr_indent ();
@@ -436,7 +533,7 @@ be_structure::gen_out_defn (char *)
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 << "void operator= (const " << this->local_name () << "_var &);\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -444,18 +541,29 @@ be_structure::gen_out_defn (char *)
}
int
-be_structure::gen_out_impl (char *, char *)
+be_structure::gen_out_impl (char *,
+ char *)
{
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+ ACE_OS::sprintf (fname,
+ "%s_out",
+ this->full_name ());
+
+ 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 ();
@@ -474,7 +582,7 @@ be_structure::gen_out_impl (char *, char *)
// constr from a pointer
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << " *&p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () << " *&p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -576,7 +684,8 @@ be_structure::compute_size_type (void)
{
// if there are elements in this scope
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ si = new UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls);
// instantiate a scope iterator.
while (!(si->is_done ()))
diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp
index 5755d2a588c..73706631c79 100644
--- a/TAO/TAO_IDL/be/be_union.cpp
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -35,7 +35,9 @@ be_union::be_union (void)
this->has_constructor (I_TRUE); // always the case
}
-be_union::be_union (AST_ConcreteType *dt, UTL_ScopedName *n, UTL_StrList *p)
+be_union::be_union (AST_ConcreteType *dt,
+ UTL_ScopedName *n,
+ UTL_StrList *p)
: AST_Union (dt, n, p),
AST_Structure (AST_Decl::NT_union, n, p),
AST_Decl (AST_Decl::NT_union, n, p),
@@ -59,7 +61,8 @@ be_union::compute_member_count (void)
if (this->nmembers () > 0)
{
// instantiate a scope iterator.
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ si = new UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls);
while (!(si->is_done ()))
{
@@ -88,7 +91,8 @@ be_union::compute_default_index (void)
if (this->nmembers () > 0)
{
// instantiate a scope iterator.
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ si = new UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls);
while (!(si->is_done ()))
{
@@ -143,8 +147,13 @@ be_union::gen_var_defn (char *)
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 ());
+ 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 ();
@@ -164,47 +173,72 @@ be_union::gen_var_defn (char *)
// default constr
*ch << namebuf << " (void); // default constructor" << nl;
// constr
- *ch << namebuf << " (" << local_name () << " *);" << nl;
+ *ch << namebuf << " (" << this->local_name () << " *);" << nl;
// copy constructor
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
+
+ // fixed-size types only
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ch << namebuf << " (const " << this->local_name ()
+ << " &); // fixed-size types only" << nl;
+ }
+
// destructor
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
// assignment operator from a pointer
- *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
+ *ch << namebuf << " &operator= ("
+ << this->local_name () << " *);" << nl;
// assignment from _var
*ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
+ // fixed-size types only
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ch << namebuf << " &operator= (const " << this->local_name ()
+ << " &); // fixed-size types only" << nl;
+ }
+
// arrow operator
*ch << local_name () << " *operator-> (void);" << nl;
- *ch << "const " << local_name () << " *operator-> (void) const;" << nl;
+ *ch << "const " << this->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 << "operator const " << this->local_name () << " &() const;" << nl;
+ *ch << "operator " << this->local_name () << " &();" << nl;
+ *ch << "operator " << this->local_name () << " &() const;" << nl;
+
+ if (this->size_type () == be_decl::VARIABLE)
+ {
+ *ch << "operator " << this->local_name ()
+ << " *&(); // variable-size types only" << nl;
+ }
+
+ *ch << 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;
+ *ch << this->local_name () << " &inout (void);" << nl;
+ *ch << this->local_name () << " &out (void);" << nl;
+ *ch << this->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;
+ *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 << local_name () << " *ptr(void) const;\n";
+ *ch << this->local_name () << " *ptr(void) const;\n";
*ch << "\n";
ch->decr_indent ();
@@ -212,7 +246,7 @@ be_union::gen_var_defn (char *)
// generate the private section
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << " *ptr_;\n";
+ *ch << this->local_name () << " *ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -222,18 +256,29 @@ be_union::gen_var_defn (char *)
// implementation of the _var class. All of these get generated in the inline
// file
int
-be_union::gen_var_impl (char *, char *)
+be_union::gen_var_impl (char *,
+ char *)
{
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+ ACE_OS::sprintf (fname,
+ "%s_var",
+ this->full_name ());
+
+ 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 ();
@@ -257,7 +302,7 @@ be_union::gen_var_impl (char *, char *)
// constr from a pointer
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << " *p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () << " *p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
@@ -275,6 +320,21 @@ be_union::gen_var_impl (char *, char *)
ci->decr_indent ();
*ci << "}\n\n";
+ // fixed-size types only
+ if (this->size_type () == be_decl::FIXED)
+ {
+ *ci << "// fixed-size types only" << nl;
+ *ci << "ACE_INLINE" << nl;
+ *ci << fname << "::" << lname << " (const "
+ << this->name () << " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "ACE_NEW (this->ptr_, " << this->name ()
+ << " (p));\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+ }
+
// destructor
ci->indent ();
*ci << "ACE_INLINE" << nl;
@@ -288,7 +348,7 @@ be_union::gen_var_impl (char *, char *)
// assignment operator from a pointer
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
+ *ci << fname << "::operator= (" << this->name () <<
" *p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -309,13 +369,37 @@ be_union::gen_var_impl (char *, char *)
*ci << "{\n";
ci->incr_indent ();
*ci << "delete this->ptr_;" << nl;
- *ci << "ACE_NEW_RETURN (this->ptr_, " << this->name () << " (*p.ptr_), *this);\n";
+ *ci << "ACE_NEW_RETURN (this->ptr_, " << this->name ()
+ << " (*p.ptr_), *this);\n";
ci->decr_indent ();
*ci << "}" << nl;
*ci << "return *this;\n";
ci->decr_indent ();
*ci << "}\n\n";
+ // fixed-size types only
+ if (this->size_type () == be_decl::FIXED)
+ {
+ ci->indent ();
+ *ci << "// fixed-size types only" << nl;
+ *ci << "ACE_INLINE " << fname << " &" << nl;
+ *ci << fname << "::operator= (const " << this->name ()
+ << " &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "if (this->ptr_ != &p)" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "delete this->ptr_;" << nl;
+ *ci << "ACE_NEW_RETURN (this->ptr_, "
+ << this->name () << " (p), *this);\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;
@@ -338,8 +422,8 @@ be_union::gen_var_impl (char *, char *)
// other extra methods - 3 cast operator ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
- " &() const // cast" << nl;
+ *ci << fname << "::operator const " << this->name ()
+ << " &() const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return *this->ptr_;\n";
@@ -348,7 +432,7 @@ be_union::gen_var_impl (char *, char *)
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() // cast " << nl;
+ *ci << fname << "::operator " << this->name () << " &() // cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return *this->ptr_;\n";
@@ -357,16 +441,32 @@ be_union::gen_var_impl (char *, char *)
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() const// cast " << nl;
+ *ci << fname << "::operator " << this->name ()
+ << " &() const// cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return *this->ptr_;\n";
ci->decr_indent ();
*ci << "}\n\n";
+ // variable-size types only
+ if (this->size_type () == be_decl::VARIABLE)
+ {
+ ci->indent ();
+ *ci << "// variable-size types only" << nl;
+ *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";
+ }
+
// in, inout, out, _retn, and ptr
ci->indent ();
- *ci << "ACE_INLINE const " << name () << " &" << nl;
+ *ci << "ACE_INLINE const " << this->name () << " &" << nl;
*ci << fname << "::in (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -375,7 +475,7 @@ be_union::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << "ACE_INLINE " << this->name () << " &" << nl;
*ci << fname << "::inout (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -388,7 +488,7 @@ be_union::gen_var_impl (char *, char *)
if (this->size_type () == be_decl::VARIABLE)
{
*ci << "// mapping for variable size " << nl;
- *ci << "ACE_INLINE " << name () << " *&" << nl;
+ *ci << "ACE_INLINE " << this->name () << " *&" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -399,7 +499,7 @@ be_union::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -413,7 +513,7 @@ be_union::gen_var_impl (char *, char *)
else
{
*ci << "// mapping for fixed size " << nl;
- *ci << "ACE_INLINE " << name () << " &" << nl;
+ *ci << "ACE_INLINE " << this->name () << " &" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -422,7 +522,7 @@ be_union::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << nl;
+ *ci << "ACE_INLINE " << this->name () << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -433,7 +533,7 @@ be_union::gen_var_impl (char *, char *)
// the additional ptr () member function
ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
+ *ci << "ACE_INLINE " << this->name () << " *" << nl;
*ci << fname << "::ptr (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -452,8 +552,13 @@ be_union::gen_out_defn (char *)
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 ());
+ 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 ();
@@ -472,9 +577,9 @@ be_union::gen_out_defn (char *)
// No default constructor
// constructor from a pointer
- *ch << namebuf << " (" << local_name () << " *&);" << nl;
+ *ch << namebuf << " (" << this->local_name () << " *&);" << nl;
// constructor from a _var &
- *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
// constructor from a _out &
*ch << namebuf << " (const " << namebuf << " &);" << nl;
// assignment operator from a _out &
@@ -482,21 +587,21 @@ be_union::gen_out_defn (char *)
// assignment operator from a pointer &, cast operator, ptr fn, operator
// -> and any other extra operators
// assignment
- *ch << namebuf << " &operator= (" << local_name () << " *);" << nl;
+ *ch << namebuf << " &operator= (" << this->local_name () << " *);" << nl;
// operator ()
*ch << "operator " << local_name () << " *&();" << nl;
// ptr fn
- *ch << local_name () << " *&ptr (void);" << nl;
+ *ch << this->local_name () << " *&ptr (void);" << nl;
// operator ->
- *ch << local_name () << " *operator-> (void);" << nl;
+ *ch << this->local_name () << " *operator-> (void);" << nl;
*ch << "\n";
ch->decr_indent ();
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << " *&ptr_;" << nl;
+ *ch << this->local_name () << " *&ptr_;" << nl;
*ch << "// assignment from T_var not allowed" << nl;
- *ch << "void operator= (const " << local_name () << "_var &);\n";
+ *ch << "void operator= (const " << this->local_name () << "_var &);\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -504,18 +609,29 @@ be_union::gen_out_defn (char *)
}
int
-be_union::gen_out_impl (char *, char *)
+be_union::gen_out_impl (char *,
+ char *)
{
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+ ACE_OS::sprintf (fname,
+ "%s_out",
+ this->full_name ());
+
+ 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 ();
@@ -534,7 +650,7 @@ be_union::gen_out_impl (char *, char *)
// constr from a pointer
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << " *&p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () << " *&p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -636,7 +752,8 @@ be_union::compute_size_type (void)
{
// if there are elements in this scope
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ si = new UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls);
// instantiate a scope iterator.
while (!(si->is_done ()))
@@ -755,11 +872,13 @@ be_union::compute_default_value (void)
// instantiate a scope iterator.
UTL_ScopeActiveIterator *si
- = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ = new UTL_ScopeActiveIterator (this,
+ UTL_Scope::IK_decls);
while (!(si->is_done ()))
{
// get the next AST decl node
- be_union_branch *ub = be_union_branch::narrow_from_decl (si->item ());
+ be_union_branch *ub =
+ be_union_branch::narrow_from_decl (si->item ());
if (ub)
{
// if the label is a case label, increment by 1
@@ -767,8 +886,7 @@ be_union::compute_default_value (void)
i < ub->label_list_length ();
++i)
{
- if (ub->label (i)->label_kind () ==
- AST_UnionLabel::UL_label)
+ if (ub->label (i)->label_kind () == AST_UnionLabel::UL_label)
total_case_members++;
}
}
diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp
index 205a8909a02..178c958c907 100644
--- a/TAO/TAO_IDL/be/be_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype.cpp
@@ -68,7 +68,8 @@ be_valuetype::~be_valuetype (void)
}
void
-be_valuetype::redefine (AST_Interface *from, UTL_StrList *p)
+be_valuetype::redefine (AST_Interface *from,
+ UTL_StrList *p)
{
this->AST_Interface::redefine (from, p);
abstract_ = from->is_abstract_valuetype();
@@ -104,7 +105,8 @@ be_valuetype::set_abstract_valuetype ()
void
be_valuetype::compute_fullobvskelname (void)
{
- this->compute_full_skel_name ("OBV_", this->full_obv_skel_name_);
+ this->compute_full_skel_name ("OBV_",
+ this->full_obv_skel_name_);
}
@@ -128,8 +130,13 @@ be_valuetype::gen_var_defn (char *)
TAO_NL nl; // end line
char namebuf [NAMEBUFSIZE]; // names
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (namebuf, "%s_var", this->local_name ());
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (namebuf,
+ "%s_var",
+ this->local_name ());
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -149,8 +156,9 @@ be_valuetype::gen_var_defn (char *)
// default constr
*ch << namebuf << " (void); // default constructor" << nl;
- *ch << namebuf << " (" << local_name () << "*);" << nl;
- *ch << namebuf << " (const " << local_name () << "*); // (TAO extension)" << nl;
+ *ch << namebuf << " (" << this->local_name () << "*);" << nl;
+ *ch << namebuf << " (const " << this->local_name ()
+ << "*); // (TAO extension)" << nl;
// copy constructor
*ch << namebuf << " (const " << namebuf <<
@@ -161,7 +169,8 @@ be_valuetype::gen_var_defn (char *)
*ch << nl;
// assignment operator from a pointer
- *ch << namebuf << " &operator= (" << local_name () << "*);" << nl;
+ *ch << namebuf << " &operator= (" << this->local_name ()
+ << "*);" << nl;
// assignment from _var
*ch << namebuf << " &operator= (const " << namebuf <<
@@ -173,23 +182,20 @@ be_valuetype::gen_var_defn (char *)
*ch << nl;
// other extra types (cast operators, [] operator, and others)
- *ch << "operator const " << local_name () << "* () const;" << nl;
- *ch << "operator " << local_name () << "* ();" << nl;
+ *ch << "operator const " << this->local_name ()
+ << "* () const;" << nl;
+ *ch << "operator " << this->local_name () << "* ();" << nl;
-/* %! &() or () ?
- *ch << "operator const " << local_name () << "* &() const;" << nl;
- *ch << "operator " << local_name () << "* &();" << 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 () << "* in (void) const;" << nl;
- *ch << local_name () << "* &inout (void);" << nl;
- *ch << local_name () << "* &out (void);" << nl;
- *ch << local_name () << "* _retn (void);" << nl;
+ *ch << 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 << local_name () << "* ptr (void) const;\n";
+ *ch << this->local_name () << "* ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
@@ -197,7 +203,7 @@ be_valuetype::gen_var_defn (char *)
// private
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "* ptr_;\n";
+ *ch << this->local_name () << "* ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -208,18 +214,29 @@ be_valuetype::gen_var_defn (char *)
// implementation of the _var class. All of these get generated in the inline
// file
int
-be_valuetype::gen_var_impl (char *, char *)
+be_valuetype::gen_var_impl (char *,
+ char *)
{
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (fname,
+ "%s_var",
+ this->full_name ());
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", local_name ());
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (lname,
+ "%s_var",
+ this->local_name ());
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -247,7 +264,7 @@ be_valuetype::gen_var_impl (char *, char *)
// constr from a pointer
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "* p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () << "* p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
@@ -256,8 +273,9 @@ be_valuetype::gen_var_impl (char *, char *)
// which reclaims amguity between T(T*) and T(const T_var &)
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << name () << "* p)" << nl;
- *ci << " : ptr_ (ACE_const_cast(" << name() << "*, p))" << nl;
+ *ci << fname << "::" << lname << " (const "
+ << this->name () << "* p)" << nl;
+ *ci << " : ptr_ (ACE_const_cast(" << this->name () << "*, p))" << nl;
*ci << "{}\n\n";
// the additional ptr () member function. This member function must be
@@ -265,7 +283,7 @@ be_valuetype::gen_var_impl (char *, char *)
// 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 () << "* " << nl;
+ *ci << "ACE_INLINE " << this->name () << "* " << nl;
*ci << fname << "::ptr (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -296,7 +314,7 @@ be_valuetype::gen_var_impl (char *, char *)
// assignment operator
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
+ *ci << fname << "::operator= (" << this->name () <<
"* p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -317,7 +335,7 @@ be_valuetype::gen_var_impl (char *, char *)
*ci << "{\n";
ci->incr_indent ();
*ci << "CORBA::remove_ref (this->ptr_);" << nl
- << local_name() << "* tmp = p.ptr ();" << be_nl
+ << this->local_name() << "* tmp = p.ptr ();" << be_nl
<< "CORBA::add_ref (tmp);" << be_nl
<< "this->ptr_ = tmp;\n";
ci->decr_indent ();
@@ -329,8 +347,8 @@ be_valuetype::gen_var_impl (char *, char *)
// other extra methods - cast operator ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
- "* () const // cast" << nl; // %! &() ?
+ *ci << fname << "::operator const " << this->name ()
+ << "* () const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -339,7 +357,8 @@ be_valuetype::gen_var_impl (char *, char *)
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << "* () // cast " << nl; // %! &()?
+ *ci << fname << "::operator " << this->name ()
+ << "* () // cast " << nl; // %! &()?
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -348,7 +367,7 @@ be_valuetype::gen_var_impl (char *, char *)
// operator->
ci->indent ();
- *ci << "ACE_INLINE " << name () << "* " << nl;
+ *ci << "ACE_INLINE " << this->name () << "* " << nl;
*ci << fname << "::operator-> (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -358,7 +377,7 @@ be_valuetype::gen_var_impl (char *, char *)
// in, inout, out, and _retn
ci->indent ();
- *ci << "ACE_INLINE " << name () << "*" << nl;
+ *ci << "ACE_INLINE " << this->name () << "*" << nl;
*ci << fname << "::in (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -367,7 +386,7 @@ be_valuetype::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "* &" << nl;
+ *ci << "ACE_INLINE " << this->name () << "* &" << nl;
*ci << fname << "::inout (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -376,7 +395,7 @@ be_valuetype::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "* &" << nl;
+ *ci << "ACE_INLINE " << this->name () << "* &" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -387,12 +406,12 @@ be_valuetype::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "* " << nl;
+ *ci << "ACE_INLINE " << this->name () << "* " << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "// yield ownership of managed obj reference" << nl;
- *ci << local_name () << "* tmp = this->ptr_;" << nl;
+ *ci << this->local_name () << "* tmp = this->ptr_;" << nl;
*ci << "this->ptr_ = 0;" << nl;
*ci << "return tmp;\n";
ci->decr_indent ();
@@ -409,8 +428,13 @@ be_valuetype::gen_out_defn (char *)
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 ());
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (namebuf,
+ "%s_out",
+ this->local_name ());
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -429,9 +453,9 @@ be_valuetype::gen_out_defn (char *)
// No default constructor
// constructor from a pointer
- *ch << namebuf << " (" << local_name () << "* &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "* &);" << nl;
// constructor from a _var &
- *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
// constructor from a _out &
*ch << namebuf << " (const " << namebuf << " &);" << nl;
// assignment operator from a _out &
@@ -439,20 +463,22 @@ be_valuetype::gen_out_defn (char *)
// 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 () << "*);" << nl;
+ *ch << namebuf << " &operator= (const " << this->local_name ()
+ << "_var &);" << nl;
+ *ch << namebuf << " &operator= (" << this->local_name ()
+ << "*);" << nl;
// cast
- *ch << "operator " << local_name () << "* &();" << nl;
+ *ch << "operator " << this->local_name () << "* &();" << nl;
// ptr fn
- *ch << local_name () << "* &ptr (void);" << nl;
+ *ch << this->local_name () << "* &ptr (void);" << nl;
// operator ->
- *ch << local_name () << "* operator-> (void);" << nl;
+ *ch << this->local_name () << "* operator-> (void);" << nl;
*ch << "\n";
ch->decr_indent ();
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "* &ptr_;\n";
+ *ch << this->local_name () << "* &ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -467,11 +493,21 @@ be_valuetype::gen_out_impl (char *, char *)
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", local_name ());
+ ACE_OS::sprintf (fname,
+ "%s_out",
+ this->full_name ());
+
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (lname,
+ "%s_out",
+ this->local_name ());
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -492,7 +528,8 @@ be_valuetype::gen_out_impl (char *, char *)
// constr from a pointer
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "* &p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name ()
+ << "* &p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -593,105 +630,6 @@ be_valuetype::gen_out_impl (char *, char *)
return 0;
}
-#if 0
-// generate typecode.
-// Typecode for interface comprises the enumerated value followed by the
-// encapsulation of the parameters
-
-int
-be_valuetype::gen_typecode (void)
-{
- ACE_ASSERT(0);
-
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- cs = cg->client_stubs ();
- cs->indent (); // start from whatever indentation level we were at
-
- *cs << "CORBA::tk_objref, // typecode kind" << nl;
- *cs << this->tc_encap_len () << ", // encapsulation length\n";
- // now emit the encapsulation
- return this->gen_encapsulation ();
-}
-
-// generate encapsulation
-// An encapsulation for ourselves will be necessary when we are part of some
-// other IDL type and a typecode for that other type is being generated. This
-// will comprise our typecode kind. IDL types with parameters will additionally
-// have the encapsulation length and the entire typecode description
-int
-be_valuetype::gen_encapsulation (void)
-{
- ACE_ASSERT (0);
-
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- long i, arrlen;
- ACE_UINT32 *arr;
-
- cs = cg->client_stubs ();
- cs->indent (); // start from whatever indentation level we were at
-
- // XXXASG - byte order must be based on what m/c we are generating code -
- // TODO
- *cs << "TAO_ENCAP_BYTE_ORDER, // byte order" << nl;
- // generate repoID
- *cs << (ACE_OS::strlen (this->repoID ())+1) << ", ";
- (void)this->tc_name2long (this->repoID (), arr, arrlen);
- for (i=0; i < arrlen; i++)
- {
- cs->print ("ACE_NTOHL (0x%x), ", arr[i]);
- }
- *cs << " // repository ID = " << this->repoID () << nl;
- // generate name
- *cs << (ACE_OS::strlen (this->local_name ()->get_string ())+1) << ", ";
- (void)this->tc_name2long(this->local_name ()->get_string (), arr, arrlen);
- for (i=0; i < arrlen; i++)
- {
- cs->print ("ACE_NTOHL (0x%x), ", arr[i]);
- }
- *cs << " // name = " << this->local_name () << ",\n";
-
- return 0;
-}
-
-// compute size of typecode
-long
-be_valuetype::tc_size (void)
-{
- ACE_ASSERT (0);
-
- return 4 + 4 + this->tc_encap_len ();
-}
-
-// compute the encapsulation length
-long
-be_valuetype::tc_encap_len (void)
-{
- ACE_ASSERT (0);
-
- if (this->encap_len_ == -1) // not computed yet
- {
- long slen;
-
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (slen);
-
- this->encap_len_ = 4; // holds the byte order flag
-
- this->encap_len_ += this->repoID_encap_len (); // for repoID
-
- // do the same thing for the local name
- this->encap_len_ += this->name_encap_len ();
-
- }
- return this->encap_len_;
-}
-#endif
-
// for building the pre and postfix of private data fields
const char*
be_valuetype::field_pd_prefix ()
diff --git a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
index 13ece989e86..d6165e74e31 100644
--- a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
@@ -66,8 +66,13 @@ be_valuetype_fwd::gen_var_defn (char *)
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 ());
+ 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 ();
@@ -87,7 +92,7 @@ be_valuetype_fwd::gen_var_defn (char *)
// default constr
*ch << namebuf << " (void); // default constructor" << nl;
- *ch << namebuf << " (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_ptr);" << nl;
// copy constructor
*ch << namebuf << " (const " << namebuf <<
@@ -98,31 +103,33 @@ be_valuetype_fwd::gen_var_defn (char *)
*ch << nl;
// assignment operator from a pointer
- *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " &operator= (" << this->local_name ()
+ << "_ptr);" << nl;
// assignment from _var
*ch << namebuf << " &operator= (const " << namebuf <<
" &);" << nl;
// arrow operator
- *ch << local_name () << "_ptr operator-> (void) const;" << nl;
+ *ch << this->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 << "operator const " << this->local_name ()
+ << "_ptr &() const;" << nl;
+ *ch << "operator " << this->local_name () << "_ptr &();" << nl;
*ch << "// in, inout, out, _retn " << nl;
// the return types of in, out, inout, and _retn are based on the parameter
// passing rules and the base type
- *ch << local_name () << "_ptr in (void) const;" << nl;
- *ch << local_name () << "_ptr &inout (void);" << nl;
- *ch << local_name () << "_ptr &out (void);" << nl;
- *ch << local_name () << "_ptr _retn (void);" << nl;
+ *ch << this->local_name () << "_ptr in (void) const;" << nl;
+ *ch << this->local_name () << "_ptr &inout (void);" << nl;
+ *ch << this->local_name () << "_ptr &out (void);" << nl;
+ *ch << this->local_name () << "_ptr _retn (void);" << nl;
// generate an additional member function that returns the underlying pointer
- *ch << local_name () << "_ptr ptr (void) const;\n";
+ *ch << this->local_name () << "_ptr ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
@@ -130,7 +137,7 @@ be_valuetype_fwd::gen_var_defn (char *)
// private
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "_ptr ptr_;\n";
+ *ch << this->local_name () << "_ptr ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -141,7 +148,8 @@ be_valuetype_fwd::gen_var_defn (char *)
// implementation of the _var class. All of these get generated in the inline
// file
int
-be_valuetype_fwd::gen_var_impl (char *, char *)
+be_valuetype_fwd::gen_var_impl (char *,
+ char *)
{
ACE_ASSERT (0);
TAO_OutStream *ci; // output stream
@@ -149,11 +157,21 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (fname,
+ "%s_var",
+ this->full_name ());
+
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+ 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 ();
@@ -181,7 +199,8 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
// constr from a _ptr
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name ()
+ << "_ptr p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{}\n\n";
@@ -190,7 +209,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::ptr (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -203,7 +222,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname << " (const " << fname <<
" &p) // copy constructor" << nl;
- *ci << " : ptr_ (" << name () << "::_duplicate (p.ptr ()))" << nl;
+ *ci << " : ptr_ (" << this->name () << "::_duplicate (p.ptr ()))" << nl;
*ci << "{}\n\n";
// destructor
@@ -219,7 +238,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
// assignment operator
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
+ *ci << fname << "::operator= (" << this->name () <<
"_ptr p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -250,7 +269,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
// other extra methods - cast operator ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
+ *ci << fname << "::operator const " << this->name () <<
"_ptr &() const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -260,7 +279,8 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << "_ptr &() // cast " << nl;
+ *ci << fname << "::operator " << this->name ()
+ << "_ptr &() // cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -269,7 +289,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
// operator->
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::operator-> (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -279,7 +299,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
// in, inout, out, and _retn
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr" << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr" << nl;
*ci << fname << "::in (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -288,7 +308,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr &" << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
*ci << fname << "::inout (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -297,7 +317,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr &" << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -308,7 +328,7 @@ be_valuetype_fwd::gen_var_impl (char *, char *)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_ptr " << nl;
+ *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -331,8 +351,13 @@ be_valuetype_fwd::gen_out_defn (char *)
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 ());
+ 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 ();
@@ -351,9 +376,9 @@ be_valuetype_fwd::gen_out_defn (char *)
// No default constructor
// constructor from a pointer
- *ch << namebuf << " (" << local_name () << "_ptr &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_ptr &);" << nl;
// constructor from a _var &
- *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
// constructor from a _out &
*ch << namebuf << " (const " << namebuf << " &);" << nl;
// assignment operator from a _out &
@@ -361,20 +386,22 @@ be_valuetype_fwd::gen_out_defn (char *)
// assignment operator from a pointer &, cast operator, ptr fn, operator
// -> and any other extra operators
// only valuetype allows assignment from var &
- *ch << namebuf << " &operator= (const " << local_name () << "_var &);" << nl;
- *ch << namebuf << " &operator= (" << local_name () << "_ptr);" << nl;
+ *ch << namebuf << " &operator= (const " << this->local_name ()
+ << "_var &);" << nl;
+ *ch << namebuf << " &operator= (" << this->local_name ()
+ << "_ptr);" << nl;
// cast
- *ch << "operator " << local_name () << "_ptr &();" << nl;
+ *ch << "operator " << this->local_name () << "_ptr &();" << nl;
// ptr fn
- *ch << local_name () << "_ptr &ptr (void);" << nl;
+ *ch << this->local_name () << "_ptr &ptr (void);" << nl;
// operator ->
- *ch << local_name () << "_ptr operator-> (void);" << nl;
+ *ch << this->local_name () << "_ptr operator-> (void);" << nl;
*ch << "\n";
ch->decr_indent ();
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "_ptr &ptr_;\n";
+ *ch << this->local_name () << "_ptr &ptr_;\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -383,7 +410,8 @@ be_valuetype_fwd::gen_out_defn (char *)
}
int
-be_valuetype_fwd::gen_out_impl (char *, char *)
+be_valuetype_fwd::gen_out_impl (char *,
+ char *)
{
ACE_ASSERT (0);
TAO_OutStream *ci; // output stream
@@ -391,11 +419,21 @@ be_valuetype_fwd::gen_out_impl (char *, char *)
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->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (fname,
+ "%s_out",
+ this->full_name ());
+
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", local_name ()->get_string ());
+ 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 ();
@@ -416,7 +454,8 @@ be_valuetype_fwd::gen_out_impl (char *, char *)
// constr from a _ptr
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_ptr &p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name ()
+ << "_ptr &p)" << nl;
*ci << " : ptr_ (p)" << nl;
*ci << "{\n";
ci->incr_indent ();
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
index e711f35aae2..1bce1789c7b 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
@@ -320,7 +320,11 @@ be_visitor_array_ch::gen_var_defn (be_array *node)
// cast operators
*os << "operator " << namebuf << "_slice * const &() const;"
<< be_nl;
- *os << "operator " << namebuf << "_slice *&();" << be_nl;
+
+ if (node->size_type () == be_decl::VARIABLE)
+ {
+ *os << "operator " << namebuf << "_slice *&();" << be_nl;
+ }
// Non-spec helper function used if array is a sequence element.
*os << "//Calls " << namebuf << "_copy "
@@ -331,7 +335,16 @@ be_visitor_array_ch::gen_var_defn (be_array *node)
// in, inout, out and _retn
*os << "// in, inout, out, _retn " << be_nl;
*os << "const " << namebuf << "_slice *in (void) const;" << be_nl;
- *os << namebuf << "_slice *inout (void);" << be_nl;
+
+ if (node->size_type () == be_decl::FIXED)
+ {
+ *os << namebuf << "_slice *inout (void);" << be_nl;
+ }
+ else
+ {
+ *os << namebuf << "_slice *&inout (void);" << be_nl;
+ }
+
*os << namebuf << "_slice *&out (void);" << be_nl;
*os << namebuf << "_slice *_retn (void);" << be_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp
index ecee4a519d6..08f1db01fe6 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp
@@ -239,12 +239,16 @@ be_visitor_array_ci::gen_var_impl (be_array *node)
*os << "return this->ptr_;" << be_uidt_nl;
*os << "}\n\n";
- os->indent ();
- *os << "ACE_INLINE " << be_nl;
- *os << fname << "::operator " << nodename << "_slice *&() // cast " << be_nl;
- *os << "{" << be_idt_nl;
- *os << "return this->ptr_;" << be_uidt_nl;
- *os << "}\n\n";
+ if (node->size_type () == be_decl::VARIABLE)
+ {
+ os->indent ();
+ *os << "ACE_INLINE " << be_nl;
+ *os << fname << "::operator " << nodename
+ << "_slice *&() // cast " << be_nl;
+ *os << "{" << be_idt_nl;
+ *os << "return this->ptr_;" << be_uidt_nl;
+ *os << "}\n\n";
+ }
// two operator []s instead of ->
os->indent ();
@@ -290,7 +294,15 @@ be_visitor_array_ci::gen_var_impl (be_array *node)
*os << "}\n\n";
os->indent ();
- *os << "ACE_INLINE " << nodename << "_slice *" << be_nl;
+ if (node->size_type () == be_decl::FIXED)
+ {
+ *os << "ACE_INLINE " << nodename << "_slice *" << be_nl;
+ }
+ else
+ {
+ *os << "ACE_INLINE " << nodename << "_slice * &" << be_nl;
+ }
+
*os << fname << "::inout (void)" << be_nl;
*os << "{" << be_idt_nl;
*os << "return this->ptr_;" << be_uidt_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
index 9f9eaef19e5..6d3a4b62438 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
@@ -461,8 +461,13 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
char namebuf [NAMEBUFSIZE]; // names
be_type *bt; // base type
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (namebuf, "%s_var", node->local_name ()->get_string ());
+ ACE_OS::memset (namebuf,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (namebuf,
+ "%s_var",
+ node->local_name ()->get_string ());
os = this->ctx_->stream ();
@@ -500,6 +505,14 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
// copy constructor
*os << namebuf << " (const " << namebuf <<
" &); // copy constructor" << be_nl;
+
+ // fixed-size base types only
+ if (bt->size_type () == be_decl::FIXED)
+ {
+ *os << namebuf << " (const " << node->local_name ()
+ << " &); // fixed-size base types only" << be_nl;
+ }
+
// destructor
*os << "~" << namebuf << " (void); // destructor" << be_nl;
*os << be_nl;
@@ -509,6 +522,13 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
*os << namebuf << " &operator= (const " << namebuf <<
" &);" << be_nl;
+ // fixed-size base types only
+ if (bt->size_type () == be_decl::FIXED)
+ {
+ *os << namebuf << " &operator= (const " << node->local_name ()
+ << " &); // fixed-size base types only" << be_nl;
+ }
+
// arrow operator
*os << node->local_name () << " *operator-> (void);" << be_nl;
*os << "const " << node->local_name () << " *operator-> (void) const;" << be_nl;
@@ -521,6 +541,13 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node)
*os << "operator " << node->local_name () << " &();" << be_nl;
*os << "operator " << node->local_name () << " &() const;" << be_nl;
+ if (bt->size_type () == be_decl::VARIABLE)
+ {
+ *os << "operator " << node->local_name ()
+ << " *&(); // variable-size base types only" << be_nl;
+ }
+
+ *os << be_nl;
// overloaded [] operator. The const version is not required for sequences
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH);
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp
index c63264c6df9..2254e9e9646 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp
@@ -180,11 +180,21 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
be_type *bt; // base type
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_var", node->full_name ());
+ ACE_OS::memset (fname,
+ '\0',
+ NAMEBUFSIZE);
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", node->local_name ()->get_string ());
+ ACE_OS::sprintf (fname,
+ "%s_var",
+ node->full_name ());
+
+ ACE_OS::memset (lname,
+ '\0',
+ NAMEBUFSIZE);
+
+ ACE_OS::sprintf (lname,
+ "%s_var",
+ node->local_name ()->get_string ());
os = this->ctx_->stream ();
@@ -234,6 +244,21 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
os->decr_indent ();
*os << "}\n\n";
+ // fixed-size base types only
+ if (bt->size_type () == be_decl::FIXED)
+ {
+ *os << "// fixed-size base types only" << be_nl;
+ *os << "ACE_INLINE" << be_nl;
+ *os << fname << "::" << lname << " (const "
+ << node->name () << " &p)" << be_nl;
+ *os << "{\n";
+ os->incr_indent ();
+ *os << "ACE_NEW (this->ptr_, " << node->name ()
+ << " (p));\n";
+ os->decr_indent ();
+ *os << "}\n\n";
+ }
+
// destructor
os->indent ();
*os << "ACE_INLINE" << be_nl;
@@ -276,6 +301,29 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
os->decr_indent ();
*os << "}\n\n";
+ // fixed-size base types only
+ if (bt->size_type () == be_decl::FIXED)
+ {
+ os->indent ();
+ *os << "// fixed-size types only" << be_nl;
+ *os << "ACE_INLINE " << fname << " &" << be_nl;
+ *os << fname << "::operator= (const " << node->name ()
+ << " &p)" << be_nl;
+ *os << "{\n";
+ os->incr_indent ();
+ *os << "if (this->ptr_ != &p)" << be_nl;
+ *os << "{\n";
+ os->incr_indent ();
+ *os << "delete this->ptr_;" << be_nl;
+ *os << "ACE_NEW_RETURN (this->ptr_, "
+ << node->name () << " (p), *this);\n";
+ os->decr_indent ();
+ *os << "}" << be_nl;
+ *os << "return *this;\n";
+ os->decr_indent ();
+ *os << "}\n\n";
+ }
+
// two arrow operators
os->indent ();
*os << "ACE_INLINE const " << node->name () << " *" << be_nl;
@@ -317,13 +365,28 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node)
os->indent ();
*os << "ACE_INLINE " << be_nl;
- *os << fname << "::operator " << node->name () << " &() const// cast " << be_nl;
+ *os << fname << "::operator " << node->name () << " &() const // cast " << be_nl;
*os << "{\n";
os->incr_indent ();
*os << "return *this->ptr_;\n";
os->decr_indent ();
*os << "}\n\n";
+ // variable-size base types only
+ if (bt->size_type () == be_decl::VARIABLE)
+ {
+ os->indent ();
+ *os << "// variable-size types only" << be_nl;
+ *os << "ACE_INLINE" << be_nl;
+ *os << fname << "::operator " << node->name ()
+ << " *&() // cast " << be_nl;
+ *os << "{\n";
+ os->incr_indent ();
+ *os << "return this->ptr_;\n";
+ os->decr_indent ();
+ *os << "}\n\n";
+ }
+
// operator []
os->indent ();
*os << "ACE_INLINE ";