summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2007-03-05 09:46:48 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2007-03-05 09:46:48 +0000
commited5d61110203cb279d80875e85a1fb296adca7bf (patch)
treeae91e109a7ce2628fc41afbb669239114e850b67
parent16a1101d5443d43af4d34f857141fd1786f097a2 (diff)
downloadATCD-ed5d61110203cb279d80875e85a1fb296adca7bf.tar.gz
Mon Mar 5 09:44:32 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
-rw-r--r--TAO/ChangeLog28
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_constructor_cs.cpp328
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp45
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union_branch/public_constructor_cs.h66
-rw-r--r--TAO/tao/Bounded_Object_Reference_Sequence_T.h6
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp4
-rw-r--r--TAO/tao/Makefile.am1
-rw-r--r--TAO/tao/ORB_Core.cpp6
-rw-r--r--TAO/tao/Object_Reference_Const_Sequence_Element_T.h85
-rw-r--r--TAO/tao/String_Const_Sequence_Element_T.h3
-rw-r--r--TAO/tao/Unbounded_Object_Reference_Sequence_T.h17
-rw-r--r--TAO/tao/tao.mpc1
16 files changed, 574 insertions, 38 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 77ef8dfc3f4..60765742c1d 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,31 @@
+Mon Mar 5 09:44:32 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
+
+ * tao/Bounded_Object_Reference_Sequence_T.h:
+ * tao/EndpointPolicy/EndpointPolicy_Factory.cpp:
+ * tao/Makefile.am:
+ * tao/Object_Reference_Const_Sequence_Element_T.h:
+ * tao/String_Const_Sequence_Element_T.h:
+ * tao/tao.mpc:
+ * tao/Unbounded_Object_Reference_Sequence_T.h:
+ Fixed bugzilla 2829, make it possible to use .in()
+ on the element returned by const operator [] for an
+ object reference sequence
+
+ * tao/ORB_Core.cpp:
+ layout change
+
+ * TAO_IDL/be/be_visitor_union/union_cs.cpp
+ * TAO_IDL/be/be_visitor_union_branch.cpp
+ * TAO_IDL/be/be_visitor_union_branch/public_constructor_cs.cpp
+ * TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
+ * TAO_IDL/be_include/be_codegen.h
+ * TAO_IDL/be_include/be_visitor_union_branch.h
+ * TAO_IDL/be_include/be_visitor_union_branch/public_constructor_cs.h
+ Fixed bugzilla 2839, when an union is created by default
+ and the discriminator is for a value that is allocated
+ from the heap then allocate a value else we get
+ a crash when marshaling this default union
+
Fri Mar 2 22:15:32 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
* tests/DSI_AMI_Gateway/test_dsi.cpp:
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
index 3405d6c8fb9..bab9c2a18ac 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
@@ -137,6 +137,20 @@ int be_visitor_union_cs::visit_union (be_union *node)
*os << ";";
+ if (dv.computed_ == 0)
+ {
+ *os << be_nl;
+ be_visitor_union_branch_public_constructor_cs const_visitor (this->ctx_);
+ if (ub->accept (&const_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_cs::"
+ "visit union - "
+ "codegen for constructor failed\n"),
+ -1);
+ }
+ }
+
*os << be_uidt_nl << "}" << be_nl << be_nl;
this->ctx_->state (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
index 80aedbb4775..0759cc2a9b4 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch.cpp
@@ -47,6 +47,7 @@
#include "be_visitor_union_branch/private_ch.cpp"
#include "be_visitor_union_branch/public_assign_cs.cpp"
+#include "be_visitor_union_branch/public_constructor_cs.cpp"
#include "be_visitor_union_branch/public_reset_cs.cpp"
#include "be_visitor_union_branch/public_ch.cpp"
#include "be_visitor_union_branch/public_ci.cpp"
@@ -56,6 +57,6 @@
#include "be_visitor_union_branch/serializer_op_ch.cpp"
#include "be_visitor_union_branch/serializer_op_cs.cpp"
-ACE_RCSID (be,
- be_visitor_union_branch,
+ACE_RCSID (be,
+ be_visitor_union_branch,
"$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_constructor_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_constructor_cs.cpp
new file mode 100644
index 00000000000..c225deac5b0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_constructor_cs.cpp
@@ -0,0 +1,328 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_constructor_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Union Branch for the constructor operator
+//
+// = AUTHOR
+// Johnny Willemsen
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_union_branch,
+ public_constructor_cs,
+ "$Id$")
+
+// **********************************************
+// visitor for union_branch in the client stubs file generating the code for
+// the copy ctor and assignment operator
+// **********************************************
+
+// constructor
+be_visitor_union_branch_public_constructor_cs::
+be_visitor_union_branch_public_constructor_cs (be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+// destructor
+be_visitor_union_branch_public_constructor_cs::
+~be_visitor_union_branch_public_constructor_cs (void)
+{
+}
+
+// visit the union_branch node
+int
+be_visitor_union_branch_public_constructor_cs::visit_union_branch (
+ be_union_branch *node)
+{
+ // first generate the type information
+ be_type *bt = be_type::narrow_from_decl (node->field_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_constructor_cs::"
+ "visit_union_branch - "
+ "Bad union_branch type\n"
+ ), -1);
+ }
+
+ this->ctx_->node (node); // save the node
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_constructor_cs::"
+ "visit_union_branch - "
+ "codegen for union_branch type failed\n"
+ ), -1);
+ }
+
+ return 0;
+}
+
+// =visit operations on all possible data types that a union_branch can be
+
+int
+be_visitor_union_branch_public_constructor_cs::visit_array (be_array *node)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch (); // get union branch
+ be_union *bu =
+ this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_constructor_cs::"
+ "visit_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // for anonymous arrays, the type name has a _ prepended. We compute the
+ // full_name with or without the underscore and use it later on.
+ char fname [NAMEBUFSIZE]; // to hold the full and
+
+ // save the node's local name and full name in a buffer for quick use later
+ // on
+ ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
+
+ if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
+ && bt->is_child (bu)) // bt is defined inside the union
+ {
+ // for anonymous arrays ...
+ // we have to generate a name for us that has an underscope prepended to
+ // our local name. This needs to be inserted after the parents's name
+
+ if (bt->is_nested ())
+ {
+ be_decl *parent = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
+ ACE_OS::sprintf (fname, "%s::_%s", parent->full_name (),
+ bt->local_name ()->get_string ());
+ }
+ else
+ {
+ ACE_OS::sprintf (fname, "_%s", bt->full_name ());
+ }
+ }
+ else
+ {
+ // typedefed node
+ ACE_OS::sprintf (fname, "%s", bt->full_name ());
+ }
+
+ // set the discriminant to the appropriate label
+ *os << "this->u_." << ub->local_name ()
+ << "_ = " << be_idt_nl
+ << fname << "_alloc ();" << be_uidt << be_uidt;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_constructor_cs::visit_predefined_type (
+ be_predefined_type *node
+ )
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch (); // get union branch
+ be_union *bu =
+ this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_constructor_cs::"
+ "visit_predefined_type - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // set the discriminant to the appropriate label
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_any:
+ *os << "ACE_NEW (" << be_idt << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << ");" << be_uidt;
+
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_constructor_cs::visit_sequence (be_sequence *node)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch (); // get union branch
+ be_union *bu =
+ this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_constructor_cs::"
+ "visit_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "ACE_NEW (" << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << ");" << be_uidt;
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_constructor_cs::visit_structure (be_structure *node)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch (); // get union branch
+ be_union *bu =
+ this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_constructor_cs::"
+ "visit_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ if (bt->size_type () == be_type::VARIABLE || node->has_constructor ())
+ {
+ *os << "ACE_NEW (" << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << ");" << be_uidt;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_constructor_cs::visit_typedef (be_typedef *node)
+{
+ this->ctx_->alias (node); // save the typedef node for use in code generation
+ // as we visit the base type
+
+ // the node to be visited in the base primitve type that gets typedefed
+ be_type *bt = node->primitive_base_type ();
+
+ if (!bt || (bt->accept (this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_constructor_cs::"
+ "visit_typedef - "
+ "Bad primitive type\n"
+ ), -1);
+ }
+
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_union_branch_public_constructor_cs::visit_union (be_union *node)
+{
+ be_union_branch *ub =
+ this->ctx_->be_node_as_union_branch (); // get union branch
+ be_union *bu =
+ this->ctx_->be_scope_as_union (); // get the enclosing union backend
+ be_type *bt;
+
+ // Check if we are visiting this node via a visit to a typedef node.
+ if (this->ctx_->alias ())
+ {
+ bt = this->ctx_->alias ();
+ }
+ else
+ {
+ bt = node;
+ }
+
+ if (!ub || !bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_branch_public_constructor_cs::"
+ "visit_array - "
+ "bad context information\n"
+ ), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "ACE_NEW (" << be_idt_nl
+ << "this->u_." << ub->local_name () << "_," << be_nl
+ << bt->name () << ");" << be_uidt;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
index 37a40381b20..fc433bf9d42 100644
--- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp
@@ -18,8 +18,8 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_union_branch,
- public_reset_cs,
+ACE_RCSID (be_visitor_union_branch,
+ public_reset_cs,
"$Id$")
// *****************************************************
@@ -41,8 +41,7 @@ be_visitor_union_branch_public_reset_cs::
// visit the union_branch node
int
be_visitor_union_branch_public_reset_cs::visit_union_branch (
- be_union_branch *node
- )
+ be_union_branch *node)
{
TAO_OutStream *os = this->ctx_->stream ();
be_type *bt = be_type::narrow_from_decl (node->field_type ());
@@ -52,14 +51,14 @@ be_visitor_union_branch_public_reset_cs::visit_union_branch (
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cs::"
"visit_union_branch - "
- "Bad union_branch type\n"),
+ "Bad union_branch type\n"),
-1);
}
this->ctx_->node (node); // save the node
-
+
*os << be_nl;
-
+
for (unsigned long i = 0; i < node->label_list_length (); ++i)
{
// check if we are printing the default case
@@ -84,7 +83,7 @@ be_visitor_union_branch_public_reset_cs::visit_union_branch (
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_cs::"
"visit_union_branch - "
- "codegen for union_branch type failed\n"),
+ "codegen for union_branch type failed\n"),
-1);
}
@@ -114,7 +113,7 @@ be_visitor_union_branch_public_reset_cs::visit_array (be_array *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_enum - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -124,8 +123,8 @@ be_visitor_union_branch_public_reset_cs::visit_array (be_array *node)
// save the node's local name and full name in a buffer for quick use later
// on
- ACE_OS::memset (fname,
- '\0',
+ ACE_OS::memset (fname,
+ '\0',
NAMEBUFSIZE);
if (bt->node_type () != AST_Decl::NT_typedef // not a typedef
@@ -174,7 +173,7 @@ be_visitor_union_branch_public_reset_cs::visit_enum (be_enum *)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_enum - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -197,7 +196,7 @@ be_visitor_union_branch_public_reset_cs::visit_interface (be_interface *)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_interface - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -225,7 +224,7 @@ be_visitor_union_branch_public_reset_cs::visit_interface_fwd (be_interface_fwd *
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_interface_fwd - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -253,7 +252,7 @@ be_visitor_union_branch_public_reset_cs::visit_valuebox (be_valuebox *)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_valuebox - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -281,7 +280,7 @@ be_visitor_union_branch_public_reset_cs::visit_valuetype (be_valuetype *)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_valuetype - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -309,7 +308,7 @@ be_visitor_union_branch_public_reset_cs::visit_valuetype_fwd (be_valuetype_fwd *
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_valuetype_fwd - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -339,7 +338,7 @@ be_visitor_union_branch_public_reset_cs::visit_predefined_type (
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_predefined_type - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -395,7 +394,7 @@ be_visitor_union_branch_public_reset_cs::visit_sequence (be_sequence *)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_sequence - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -424,7 +423,7 @@ be_visitor_union_branch_public_reset_cs::visit_string (be_string *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_string - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -471,7 +470,7 @@ be_visitor_union_branch_public_reset_cs::visit_structure (be_structure *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_structure - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
@@ -505,7 +504,7 @@ be_visitor_union_branch_public_reset_cs::visit_typedef (be_typedef *node)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_typedef - "
- "Bad primitive type\n"),
+ "Bad primitive type\n"),
-1);
}
@@ -526,7 +525,7 @@ be_visitor_union_branch_public_reset_cs::visit_union (be_union *)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_union_branch_public_reset_cs::"
"visit_union - "
- "bad context information\n"),
+ "bad context information\n"),
-1);
}
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index eb5d05505a3..c2d2158ea23 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -207,7 +207,7 @@ public:
TAO_TC_DEFN_ENCAP_LEN, // encap size computation
TAO_TC_DEFN_SCOPE_LEN, // scope size computation
- // Means we are not generating the assignment operator.
+ // Means we are generating the copy constructor
TAO_UNION_COPY_CONSTRUCTOR,
// Generating the _var template parameter in sequence of arrays.
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
index 3fffe3fa0cf..860ec5c5363 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch.h
@@ -28,6 +28,7 @@
#include "be_visitor_union_branch/public_ci.h"
#include "be_visitor_union_branch/public_cs.h"
#include "be_visitor_union_branch/public_assign_cs.h"
+#include "be_visitor_union_branch/public_constructor_cs.h"
#include "be_visitor_union_branch/public_reset_cs.h"
#include "be_visitor_union_branch/private_ch.h"
#include "be_visitor_union_branch/cdr_op_ch.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_constructor_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_constructor_cs.h
new file mode 100644
index 00000000000..fc42f3d814c
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_union_branch/public_constructor_cs.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// public_constructor_cs.h
+//
+// = DESCRIPTION
+// Visitor for the Union class.
+// This one generates code for the constructor of the union class
+//
+// = AUTHOR
+// Johnny Willemsen
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_UNION_BRANCH_PUBLIC_CONSTRUCTOR_CS_H_
+#define _BE_VISITOR_UNION_BRANCH_PUBLIC_CONSTRUCTOR_CS_H_
+
+class be_visitor_union_branch_public_constructor_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_union_branch_public_constructor_cs
+ //
+ // = DESCRIPTION
+ // This is used to generate the body of the constructor
+ //
+public:
+ be_visitor_union_branch_public_constructor_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_branch_public_constructor_cs (void);
+ // destructor
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit the union_branch node
+
+ // =visit operations on all possible data types that a union_branch can be
+
+ virtual int visit_array (be_array *node);
+ // visit array type
+
+ virtual int visit_predefined_type (be_predefined_type *node);
+ // visit predefined type
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence type
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure type
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedefed type
+
+ virtual int visit_union (be_union *node);
+ // visit union type
+};
+
+#endif /* _BE_VISITOR_UNION_BRANCH_PUBLIC_CONSTRUCTOR_CS_H_ */
diff --git a/TAO/tao/Bounded_Object_Reference_Sequence_T.h b/TAO/tao/Bounded_Object_Reference_Sequence_T.h
index 9754820576c..cc7c576e85a 100644
--- a/TAO/tao/Bounded_Object_Reference_Sequence_T.h
+++ b/TAO/tao/Bounded_Object_Reference_Sequence_T.h
@@ -13,6 +13,7 @@
#include "Object_Reference_Traits_T.h"
#include "Generic_Sequence_T.h"
#include "Object_Reference_Sequence_Element_T.h"
+#include "Object_Reference_Const_Sequence_Element_T.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -32,6 +33,7 @@ public:
typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits;
typedef details::object_reference_sequence_element<element_traits> element_type;
+ typedef details::object_reference_const_sequence_element<element_traits> const_element_type;
typedef element_type subscript_type;
typedef value_type const & const_subscript_type;
@@ -62,8 +64,8 @@ public:
implementation_type::range::check_length(length, MAX);
impl_.length(length);
}
- inline value_type const & operator[](CORBA::ULong i) const {
- return impl_[i];
+ inline const_element_type operator[](CORBA::ULong i) const {
+ return const_element_type(impl_[i], release());
}
inline element_type operator[](CORBA::ULong i) {
return element_type(impl_[i], release());
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp
index 02bc3148811..602dcd48f75 100644
--- a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp
@@ -56,7 +56,7 @@ TAO_EndpointPolicy_Factory::create_policy (
TAO_Endpoint_Value_Impl const * const evi =
dynamic_cast <TAO_Endpoint_Value_Impl const *> (
- (*endpoint_list)[idx]);
+ (*endpoint_list)[idx].in ());
if (!evi)
continue;
@@ -69,7 +69,7 @@ TAO_EndpointPolicy_Factory::create_policy (
found_one = evi->validate_acceptor (*acceptor);
}
}
-
+
// There is no endpoint policy value matches an endpoint the ORB
// is listening on. A CORBA::PolicyError exception with a
// PolicyErrorCode of UNSUPPORTED_POLICY_VALUE is raised.
diff --git a/TAO/tao/Makefile.am b/TAO/tao/Makefile.am
index 6fb4215847d..94021756257 100644
--- a/TAO/tao/Makefile.am
+++ b/TAO/tao/Makefile.am
@@ -1253,6 +1253,7 @@ nobase_include_HEADERS = \
Object_Ref_Table.h \
Object_Ref_Table.inl \
Object_Reference_Sequence_Element_T.h \
+ Object_Reference_Const_Sequence_Element_T.h \
Object_Reference_Traits_Base_T.h \
Object_Reference_Traits_T.h \
Object_T.cpp \
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 6b33edeb0f2..10db2c27840 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -2704,8 +2704,7 @@ TAO_ORB_Core::resolve_rir (const char *name
}
else
{
- TAO_Connector_Registry *conn_reg =
- this->connector_registry ();
+ TAO_Connector_Registry *conn_reg = this->connector_registry ();
// Obtain the appropriate object key delimiter for the
// specified protocol.
@@ -2997,8 +2996,7 @@ int
TAO_ORB_Core::add_tss_cleanup_func (ACE_CLEANUP_FUNC cleanup,
size_t &slot_id)
{
- return this->tss_cleanup_funcs_.register_cleanup_function (cleanup,
- slot_id);
+ return this->tss_cleanup_funcs_.register_cleanup_function (cleanup, slot_id);
}
void
diff --git a/TAO/tao/Object_Reference_Const_Sequence_Element_T.h b/TAO/tao/Object_Reference_Const_Sequence_Element_T.h
new file mode 100644
index 00000000000..85aa49526e3
--- /dev/null
+++ b/TAO/tao/Object_Reference_Const_Sequence_Element_T.h
@@ -0,0 +1,85 @@
+#ifndef guard_object_const_reference_sequence_element_hpp
+#define guard_object_const_reference_sequence_element_hpp
+/**
+ * @file
+ *
+ * @brief Implement the type returned by const operator[] in object_reference
+ * sequences.
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen
+ */
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename obj_ref_traits>
+class object_reference_const_sequence_element
+{
+public:
+ typedef typename obj_ref_traits::object_type object_reference_type;
+ typedef object_reference_type * value_type;
+ typedef object_reference_type const * const_value_type;
+ typedef typename obj_ref_traits::object_type_var object_reference_var;
+
+public:
+ object_reference_const_sequence_element(
+ value_type const & e, CORBA::Boolean release)
+ : element_(&e)
+ , release_(release)
+ {
+ }
+
+ object_reference_const_sequence_element(
+ object_reference_const_sequence_element const & rhs)
+ : element_(rhs.element_)
+ , release_(rhs.release_)
+ {
+ }
+
+ ~object_reference_const_sequence_element()
+ {
+ }
+
+ inline operator const_value_type() const
+ {
+ return *element_;
+ }
+
+ inline object_reference_type * const in (void) const {
+ return *this->element_;
+ }
+
+ inline value_type operator->() const
+ {
+ return *this->element_;
+ }
+
+ inline CORBA::Boolean release() const
+ {
+ return this->release_;
+ }
+
+private:
+ // This function is not implemented
+ object_reference_const_sequence_element();
+ object_reference_const_sequence_element & operator=(
+ object_reference_const_sequence_element const & rhs);
+
+private:
+ value_type const * const element_;
+ CORBA::Boolean release_;
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_object_const_reference_sequence_element_hpp
diff --git a/TAO/tao/String_Const_Sequence_Element_T.h b/TAO/tao/String_Const_Sequence_Element_T.h
index 909eca4f7bd..a5a26b5a872 100644
--- a/TAO/tao/String_Const_Sequence_Element_T.h
+++ b/TAO/tao/String_Const_Sequence_Element_T.h
@@ -53,7 +53,8 @@ public:
return *this->element_;
}
- inline const character_type *in (void) const {
+ inline const character_type *in (void) const
+ {
return *this->element_;
}
diff --git a/TAO/tao/Unbounded_Object_Reference_Sequence_T.h b/TAO/tao/Unbounded_Object_Reference_Sequence_T.h
index 37c1b73a251..50d1ae9fd9b 100644
--- a/TAO/tao/Unbounded_Object_Reference_Sequence_T.h
+++ b/TAO/tao/Unbounded_Object_Reference_Sequence_T.h
@@ -13,6 +13,7 @@
#include "Object_Reference_Traits_T.h"
#include "Generic_Sequence_T.h"
#include "Object_Reference_Sequence_Element_T.h"
+#include "Object_Reference_Const_Sequence_Element_T.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -31,6 +32,7 @@ public:
typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits;
typedef details::object_reference_sequence_element<element_traits> element_type;
+ typedef details::object_reference_const_sequence_element<element_traits> const_element_type;
typedef element_type subscript_type;
typedef value_type const & const_subscript_type;
@@ -50,29 +52,36 @@ public:
: impl_(maximum, length, data, release)
{}
- /* Use default ctor, operator= and dtor */
+ /// @copydoc details::generic_sequence::maximum
inline CORBA::ULong maximum() const {
return impl_.maximum();
}
+ /// @copydoc details::generic_sequence::release
inline CORBA::Boolean release() const {
return impl_.release();
}
+ /// @copydoc details::generic_sequence::length
inline CORBA::ULong length() const {
return impl_.length();
}
+ /// @copydoc details::generic_sequence::length
inline void length(CORBA::ULong length) {
impl_.length(length);
}
- inline value_type const & operator[](CORBA::ULong i) const {
- return impl_[i];
+ /// @copydoc details::generic_sequence::operator[]
+ inline const_element_type operator[](CORBA::ULong i) const {
+ return const_element_type (impl_[i], release());
}
+ /// @copydoc details::generic_sequence::operator[]
inline element_type operator[](CORBA::ULong i) {
return element_type(impl_[i], release());
}
+ /// @copydoc details::generic_sequence::get_buffer
inline value_type const * get_buffer() const {
return impl_.get_buffer();
}
+ /// @copydoc details::generic_sequence::replace
inline void replace(
CORBA::ULong maximum,
CORBA::ULong length,
@@ -80,9 +89,11 @@ public:
CORBA::Boolean release = false) {
impl_.replace(maximum, length, data, release);
}
+ /// @copydoc details::generic_sequence::get_buffer(CORBA::Boolean)
inline value_type * get_buffer(CORBA::Boolean orphan = false) {
return impl_.get_buffer(orphan);
}
+ /// @copydoc details::generic_sequence::swap
inline void swap(unbounded_object_reference_sequence & rhs) throw() {
impl_.swap(rhs.impl_);
}
diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc
index 2a9e98287f4..123e5d8f471 100644
--- a/TAO/tao/tao.mpc
+++ b/TAO/tao/tao.mpc
@@ -426,6 +426,7 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, tao_v
Object_Ref_Table.h
Object_T.h
Object_Reference_Sequence_Element_T.h
+ Object_Reference_Const_Sequence_Element_T.h
Objref_VarOut_T.h
Object_Reference_Traits_Base_T.h
Object_Reference_Traits_T.h