summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-12-31 17:34:56 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-12-31 17:34:56 +0000
commit941741da484ba50c4577fc53e9be6eea300fa2a5 (patch)
tree6ed27dc6a4b35eca1e746e6fc13ba844b6d390f6 /TAO/TAO_IDL/be
parent0e20a37f9509ca5f382c0f7bc8306de6e3949fed (diff)
downloadATCD-941741da484ba50c4577fc53e9be6eea300fa2a5.tar.gz
ChangeLogTag: Mon Dec 31 11:01:29 2001 Jeff Parsons <parsons@cs.wustl.edu>
Diffstat (limited to 'TAO/TAO_IDL/be')
-rw-r--r--TAO/TAO_IDL/be/Makefile.am3
-rw-r--r--TAO/TAO_IDL/be/be_argument.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_constant.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_enum.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_enum_val.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_exception.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_factory.cpp66
-rw-r--r--TAO/TAO_IDL/be/be_field.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_generator.cpp109
-rw-r--r--TAO/TAO_IDL/be/be_global.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_interface_strategy.cpp34
-rw-r--r--TAO/TAO_IDL/be/be_module.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_native.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_predefined_type.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_root.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_scope.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_string.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_tmplinst.cpp47
-rw-r--r--TAO/TAO_IDL/be/be_type.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_typedef.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_valuetype.cpp514
-rw-r--r--TAO/TAO_IDL/be/be_valuetype_fwd.cpp518
-rw-r--r--TAO/TAO_IDL/be/be_visitor.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp474
-rw-r--r--TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp121
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_factory.cpp28
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp69
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp61
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp45
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp49
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp76
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp264
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp359
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp84
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp110
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp124
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp196
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp52
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp127
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp53
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp93
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp115
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp48
79 files changed, 2645 insertions, 1901 deletions
diff --git a/TAO/TAO_IDL/be/Makefile.am b/TAO/TAO_IDL/be/Makefile.am
index 48c819054d1..39e7c1f3b71 100644
--- a/TAO/TAO_IDL/be/Makefile.am
+++ b/TAO/TAO_IDL/be/Makefile.am
@@ -82,7 +82,8 @@ libbe_la_SOURCES = \
be_visitor_union.cpp \
be_visitor_union_branch.cpp \
be_visitor_valuetype.cpp \
- be_visitor_valuetype_fwd.cpp
+ be_visitor_valuetype_fwd.cpp \
+ tmplinst.cpp
dist-hook:
diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp
index 0cadc03fefc..0030e0882ce 100644
--- a/TAO/TAO_IDL/be/be_argument.cpp
+++ b/TAO/TAO_IDL/be/be_argument.cpp
@@ -31,19 +31,15 @@ be_argument::be_argument (void)
be_argument::be_argument (AST_Argument::Direction d,
AST_Type *ft,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
: AST_Argument (d,
ft,
- n,
- p),
+ n),
AST_Field (AST_Decl::NT_argument,
ft,
- n,
- p),
+ n),
AST_Decl (AST_Decl::NT_argument,
- n,
- p)
+ n)
{
}
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
index 04a32cf5e51..4771a00999d 100644
--- a/TAO/TAO_IDL/be/be_array.cpp
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -42,7 +42,6 @@ be_array::be_array (UTL_ScopedName *n,
abstract),
AST_Decl (AST_Decl::NT_array,
n,
- 0,
I_TRUE),
COMMON_Base (local,
abstract),
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index 7aa6986a4c8..b7bde916774 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -41,22 +41,18 @@ be_attribute::be_attribute (void)
be_attribute::be_attribute (idl_bool ro,
AST_Type *ft,
UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
: AST_Attribute (ro,
ft,
n,
- p,
local,
abstract),
AST_Field (AST_Decl::NT_attr,
ft,
- n,
- p),
+ n),
AST_Decl (AST_Decl::NT_attr,
- n,
- p),
+ n),
COMMON_Base (local,
abstract)
{
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 05ce50c41d8..7d072ad5590 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -1286,10 +1286,3 @@ TAO_CodeGen::gen_standard_include (TAO_OutStream *stream,
<< end_delimiter << "\n";
}
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>;
-template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>
-#pragma instantiate ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp
index 23b5a9759d0..74db9dcea4d 100644
--- a/TAO/TAO_IDL/be/be_constant.cpp
+++ b/TAO/TAO_IDL/be/be_constant.cpp
@@ -32,15 +32,12 @@ be_constant::be_constant (void)
be_constant::be_constant (AST_Expression::ExprType et,
AST_Expression *v,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
: AST_Constant (et,
v,
- n,
- p),
+ n),
AST_Decl (AST_Decl::NT_const,
- n,
- p)
+ n)
{
this->size_type (be_decl::FIXED);
}
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index f191d095623..4616f4c9dd9 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -49,11 +49,9 @@ be_decl::be_decl (void)
// Constructor
be_decl::be_decl (AST_Decl::NodeType type,
- UTL_ScopedName *n,
- UTL_StrList *pragmas)
+ UTL_ScopedName *n)
: AST_Decl (type,
- n,
- pragmas),
+ n),
cli_hdr_gen_ (I_FALSE),
cli_stub_gen_ (I_FALSE),
cli_inline_gen_ (I_FALSE),
@@ -583,6 +581,8 @@ be_decl::scope (void)
return be_enum::narrow_from_decl (d);
case AST_Decl::NT_op:
return be_operation::narrow_from_decl (d);
+ case AST_Decl::NT_factory:
+ return be_factory::narrow_from_decl (d);
case AST_Decl::NT_sequence:
return be_sequence::narrow_from_decl (d);
default:
diff --git a/TAO/TAO_IDL/be/be_enum.cpp b/TAO/TAO_IDL/be/be_enum.cpp
index 19713ec8fce..61a761908f8 100644
--- a/TAO/TAO_IDL/be/be_enum.cpp
+++ b/TAO/TAO_IDL/be/be_enum.cpp
@@ -31,16 +31,13 @@ be_enum::be_enum (void)
}
be_enum::be_enum (UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
: AST_Enum (n,
- p,
local,
abstract),
AST_Decl (AST_Decl::NT_enum,
- n,
- p),
+ n),
UTL_Scope (AST_Decl::NT_enum),
COMMON_Base (local,
abstract)
diff --git a/TAO/TAO_IDL/be/be_enum_val.cpp b/TAO/TAO_IDL/be/be_enum_val.cpp
index 34bdaab781d..467182d36b8 100644
--- a/TAO/TAO_IDL/be/be_enum_val.cpp
+++ b/TAO/TAO_IDL/be/be_enum_val.cpp
@@ -30,16 +30,13 @@ be_enum_val::be_enum_val (void)
}
be_enum_val::be_enum_val (unsigned long v,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
: AST_Constant (AST_Expression::EV_ulong,
AST_Decl::NT_enum_val,
new AST_Expression(v),
- n,
- p),
+ n),
AST_Decl (AST_Decl::NT_enum_val,
- n,
- p)
+ n)
{
}
diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp
index 5581a1c2fc6..84edf8dd324 100644
--- a/TAO/TAO_IDL/be/be_exception.cpp
+++ b/TAO/TAO_IDL/be/be_exception.cpp
@@ -32,15 +32,12 @@ be_exception::be_exception (void)
}
be_exception::be_exception (UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
: AST_Decl (AST_Decl::NT_except,
- n,
- p),
+ n),
AST_Structure (AST_Decl::NT_except,
n,
- p,
local,
abstract),
UTL_Scope (AST_Decl::NT_except),
diff --git a/TAO/TAO_IDL/be/be_factory.cpp b/TAO/TAO_IDL/be/be_factory.cpp
new file mode 100644
index 00000000000..f34748ac21a
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_factory.cpp
@@ -0,0 +1,66 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_factory.cpp
+//
+// = DESCRIPTION
+// Extension of class AST_Factory that provides additional means for C++
+// mapping.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc.
+// and
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+ACE_RCSID(be, be_factory, "$Id$")
+
+be_factory::be_factory (void)
+{
+}
+
+be_factory::be_factory (UTL_ScopedName *n)
+ :
+ AST_Factory (n),
+
+ AST_Decl (AST_Decl::NT_factory,
+ n),
+ UTL_Scope (AST_Decl::NT_factory),
+ COMMON_Base (1,
+ 0) //@@ Always local, never abstract
+{
+}
+
+
+be_factory::~be_factory (void)
+{
+}
+
+void
+be_factory::destroy (void)
+{
+ // Call the destroy methods of our base classes.
+ be_scope::destroy ();
+ be_decl::destroy ();
+}
+
+int
+be_factory::accept (be_visitor *visitor)
+{
+ return visitor->visit_factory (this);
+}
+
+// Narrowing
+IMPL_NARROW_METHODS3 (be_factory, AST_Factory, be_scope, be_decl)
+IMPL_NARROW_FROM_DECL (be_factory)
+IMPL_NARROW_FROM_SCOPE (be_factory)
diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp
index c0ab867c8bc..e013b6c55e6 100644
--- a/TAO/TAO_IDL/be/be_field.cpp
+++ b/TAO/TAO_IDL/be/be_field.cpp
@@ -31,15 +31,12 @@ be_field::be_field (void)
be_field::be_field (AST_Type *ft,
UTL_ScopedName *n,
- UTL_StrList *p,
Visibility vis)
: AST_Field (ft,
n,
- p,
vis),
AST_Decl (AST_Decl::NT_field,
- n,
- p),
+ n),
COMMON_Base (ft->is_local (),
ft->is_abstract ())
{
diff --git a/TAO/TAO_IDL/be/be_generator.cpp b/TAO/TAO_IDL/be/be_generator.cpp
index 54e45fdbc16..e22b03879cf 100644
--- a/TAO/TAO_IDL/be/be_generator.cpp
+++ b/TAO/TAO_IDL/be/be_generator.cpp
@@ -77,13 +77,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
ACE_RCSID(be, be_generator, "$Id$")
AST_Root *
-be_generator::create_root (UTL_ScopedName *n,
- UTL_StrList *p)
+be_generator::create_root (UTL_ScopedName *n)
{
be_root *retval = 0;
ACE_NEW_RETURN (retval,
- be_root (n,
- p),
+ be_root (n),
0);
return retval;
@@ -91,14 +89,12 @@ be_generator::create_root (UTL_ScopedName *n,
AST_PredefinedType *
be_generator::create_predefined_type (AST_PredefinedType::PredefinedType t,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
{
be_predefined_type *retval = 0;
ACE_NEW_RETURN (retval,
be_predefined_type (t,
- n,
- p),
+ n),
0);
return retval;
@@ -106,8 +102,7 @@ be_generator::create_predefined_type (AST_PredefinedType::PredefinedType t,
AST_Module *
be_generator::create_module (UTL_Scope *s,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
{
AST_Decl *d = 0;
AST_Module *m = 0;
@@ -123,8 +118,7 @@ be_generator::create_module (UTL_Scope *s,
// members to the new module's scope.
AST_Module *retval = 0;
ACE_NEW_RETURN (retval,
- be_module (n,
- p),
+ be_module (n),
0);
@@ -195,7 +189,6 @@ be_generator::create_interface (UTL_ScopedName *n,
long nih,
AST_Interface **ih_flat,
long nih_flat,
- UTL_StrList *p,
idl_bool l,
idl_bool a)
{
@@ -206,7 +199,6 @@ be_generator::create_interface (UTL_ScopedName *n,
nih,
ih_flat,
nih_flat,
- p,
l,
a),
0);
@@ -216,7 +208,6 @@ be_generator::create_interface (UTL_ScopedName *n,
AST_InterfaceFwd *
be_generator::create_interface_fwd (UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
@@ -227,11 +218,9 @@ be_generator::create_interface_fwd (UTL_ScopedName *n,
-1,
0,
0,
- p,
local,
abstract),
- n,
- p),
+ n),
0);
return retval;
@@ -240,59 +229,40 @@ be_generator::create_interface_fwd (UTL_ScopedName *n,
AST_Interface *
be_generator::create_valuetype (UTL_ScopedName *n,
AST_Interface **ih,
- long nih,
- UTL_StrList *p)
+ long nih)
{
-#ifdef IDL_HAS_VALUETYPE
be_valuetype *retval = 0;
ACE_NEW_RETURN (retval,
be_valuetype (n,
ih,
- nih,
- p),
+ nih),
0);
return retval;
-#else
- ACE_ERROR_RETURN ((LM_ERROR,
- "Valuetype support not enabled\n"),
- 0);
-#endif /* IDL_HAS_VALUETYPE */
}
AST_InterfaceFwd *
-be_generator::create_valuetype_fwd (UTL_ScopedName *n,
- UTL_StrList *p)
+be_generator::create_valuetype_fwd (UTL_ScopedName *n)
{
-#ifdef IDL_HAS_VALUETYPE
be_valuetype_fwd *retval = 0;
ACE_NEW_RETURN (retval,
be_valuetype_fwd (this->create_valuetype (n,
0,
- -1,
- p),
- n,
- p),
+ -1),
+ n),
0);
return retval;
-#else
- ACE_ERROR_RETURN ((LM_ERROR,
- "Valuetype support not enabled\n"),
- 0);
-#endif /* IDL_HAS_VALUETYPE */
}
AST_Exception *
be_generator::create_exception (UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
be_exception *retval = 0;
ACE_NEW_RETURN (retval,
be_exception (n,
- p,
local,
abstract),
0);
@@ -302,14 +272,12 @@ be_generator::create_exception (UTL_ScopedName *n,
AST_Structure *
be_generator::create_structure (UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
be_structure *retval = 0;
ACE_NEW_RETURN (retval,
be_structure (n,
- p,
local,
abstract),
0);
@@ -319,14 +287,12 @@ be_generator::create_structure (UTL_ScopedName *n,
AST_Enum *
be_generator::create_enum (UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
be_enum *retval = 0;
ACE_NEW_RETURN (retval,
be_enum (n,
- p,
local,
abstract),
0);
@@ -338,7 +304,6 @@ AST_Operation *
be_generator::create_operation (AST_Type *rt,
AST_Operation::Flags fl,
UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
@@ -347,7 +312,6 @@ be_generator::create_operation (AST_Type *rt,
be_operation (rt,
fl,
n,
- p,
local,
abstract),
0);
@@ -358,14 +322,12 @@ be_generator::create_operation (AST_Type *rt,
AST_Field *
be_generator::create_field (AST_Type *ft,
UTL_ScopedName *n,
- UTL_StrList *p,
AST_Field::Visibility vis)
{
be_field *retval = 0;
ACE_NEW_RETURN (retval,
be_field (ft,
n,
- p,
vis),
0);
@@ -375,15 +337,13 @@ be_generator::create_field (AST_Type *ft,
AST_Argument *
be_generator::create_argument (AST_Argument::Direction d,
AST_Type *ft,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
{
be_argument *retval = 0;
ACE_NEW_RETURN (retval,
be_argument (d,
ft,
- n,
- p),
+ n),
0);
return retval;
@@ -393,7 +353,6 @@ AST_Attribute *
be_generator::create_attribute (idl_bool ro,
AST_Type *ft,
UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
@@ -402,7 +361,6 @@ be_generator::create_attribute (idl_bool ro,
be_attribute (ro,
ft,
n,
- p,
local,
abstract),
0);
@@ -413,7 +371,6 @@ be_generator::create_attribute (idl_bool ro,
AST_Union *
be_generator::create_union (AST_ConcreteType *dt,
UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
@@ -421,7 +378,6 @@ be_generator::create_union (AST_ConcreteType *dt,
ACE_NEW_RETURN (retval,
be_union (dt,
n,
- p,
local,
abstract),
0);
@@ -432,15 +388,13 @@ be_generator::create_union (AST_ConcreteType *dt,
AST_UnionBranch *
be_generator::create_union_branch (UTL_LabelList *ll,
AST_Type *ft,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
{
be_union_branch *retval = 0;
ACE_NEW_RETURN (retval,
be_union_branch (ll,
ft,
- n,
- p),
+ n),
0);
return retval;
@@ -462,15 +416,13 @@ be_generator::create_union_label (AST_UnionLabel::UnionLabel ul,
AST_Constant *
be_generator::create_constant (AST_Expression::ExprType et,
AST_Expression *ev,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
{
be_constant *retval = 0;
ACE_NEW_RETURN (retval,
be_constant (et,
ev,
- n,
- p),
+ n),
0);
return retval;
@@ -607,14 +559,12 @@ be_generator::create_expr (double d)
AST_EnumVal *
be_generator::create_enum_val (unsigned long v,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
{
be_enum_val *retval = 0;
ACE_NEW_RETURN (retval,
be_enum_val (v,
- n,
- p),
+ n),
0);
return retval;
@@ -682,7 +632,6 @@ be_generator::create_wstring (AST_Expression *v)
AST_Typedef *
be_generator::create_typedef (AST_Type *bt,
UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
{
@@ -690,7 +639,6 @@ be_generator::create_typedef (AST_Type *bt,
ACE_NEW_RETURN (retval,
be_typedef (bt,
n,
- p,
local,
abstract),
0);
@@ -699,13 +647,22 @@ be_generator::create_typedef (AST_Type *bt,
}
AST_Native *
-be_generator::create_native (UTL_ScopedName *n,
- UTL_StrList *p)
+be_generator::create_native (UTL_ScopedName *n)
{
be_native *retval = 0;
ACE_NEW_RETURN (retval,
- be_native (n,
- p),
+ be_native (n),
+ 0);
+
+ return retval;
+}
+
+AST_Factory *
+be_generator::create_factory (UTL_ScopedName *n)
+{
+ be_factory *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_factory (n),
0);
return retval;
diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp
index 9a36eb232e0..4c883e1dea7 100644
--- a/TAO/TAO_IDL/be/be_global.cpp
+++ b/TAO/TAO_IDL/be/be_global.cpp
@@ -828,24 +828,3 @@ BE_GlobalData::destroy (void)
{
}
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-
-template class ACE_Node <be_interface *>;
-template class ACE_Unbounded_Queue <be_interface *>;
-template class ACE_Unbounded_Queue_Iterator <be_interface *>;
-
-template class ACE_Node <be_interface_fwd *>;
-template class ACE_Unbounded_Queue <be_interface_fwd *>;
-template class ACE_Unbounded_Queue_Iterator <be_interface_fwd *>;
-
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-#pragma instantiate ACE_Node <be_interface *>
-#pragma instantiate ACE_Unbounded_Queue <be_interface *>
-#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface *>
-
-#pragma instantiate ACE_Node <be_interface_fwd *>
-#pragma instantiate ACE_Unbounded_Queue <be_interface_fwd *>
-#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface_fwd *>
-
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index aeeb44fe819..a3baea7fc02 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -28,7 +28,6 @@
ACE_RCSID(be, be_interface, "$Id$")
-
// Default constructor.
be_interface::be_interface (void)
: skel_count_ (0),
@@ -47,7 +46,6 @@ be_interface::be_interface (UTL_ScopedName *n,
long nih,
AST_Interface **ih_flat,
long nih_flat,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
: AST_Interface (n,
@@ -55,12 +53,10 @@ be_interface::be_interface (UTL_ScopedName *n,
nih,
ih_flat,
nih_flat,
- p,
local,
abstract),
AST_Decl (AST_Decl::NT_interface,
- n,
- p),
+ n),
UTL_Scope (AST_Decl::NT_interface),
COMMON_Base (local,
abstract),
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
index fa14d82cbb8..bb1f0a88717 100644
--- a/TAO/TAO_IDL/be/be_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -32,14 +32,11 @@ be_interface_fwd::be_interface_fwd (void)
}
be_interface_fwd::be_interface_fwd (AST_Interface *dummy,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
: AST_InterfaceFwd (dummy,
- n,
- p),
+ n),
AST_Decl (AST_Decl::NT_interface_fwd,
- n,
- p)
+ n)
{
// Always the case.
this->size_type (be_decl::VARIABLE);
diff --git a/TAO/TAO_IDL/be/be_interface_strategy.cpp b/TAO/TAO_IDL/be/be_interface_strategy.cpp
index 3f8eba1a1cc..d0175436120 100644
--- a/TAO/TAO_IDL/be/be_interface_strategy.cpp
+++ b/TAO/TAO_IDL/be/be_interface_strategy.cpp
@@ -24,23 +24,23 @@
ACE_RCSID(be, be_interface_strategy, "$Id$")
- be_interface_strategy::be_interface_strategy (be_interface *node,
- Strategy_Kind strategy_type)
- : local_name_(0),
- full_name_(0),
- flat_name_(0),
- repoID_(0),
- full_skel_name_(0),
- full_coll_name_(0),
- local_coll_name_(0),
- relative_skel_name_(0),
- node_ (node),
- cached_type_ (-1),
- strategy_type_ (strategy_type)
-{
-}
-
-be_interface_strategy::~be_interface_strategy ()
+be_interface_strategy::be_interface_strategy (be_interface *node,
+ Strategy_Kind strategy_type)
+ : local_name_(0),
+ full_name_(0),
+ flat_name_(0),
+ repoID_(0),
+ full_skel_name_(0),
+ full_coll_name_(0),
+ local_coll_name_(0),
+ relative_skel_name_(0),
+ node_ (node),
+ cached_type_ (-1),
+ strategy_type_ (strategy_type)
+{
+}
+
+be_interface_strategy::~be_interface_strategy (void)
{
if (this->local_name_ != 0)
delete [] this->local_name_;
diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp
index 32c7d3bf60c..d808eaee384 100644
--- a/TAO/TAO_IDL/be/be_module.cpp
+++ b/TAO/TAO_IDL/be/be_module.cpp
@@ -29,13 +29,10 @@ be_module::be_module (void)
{
}
-be_module::be_module (UTL_ScopedName *n,
- UTL_StrList *p)
- : AST_Module (n,
- p),
+be_module::be_module (UTL_ScopedName *n)
+ : AST_Module (n),
AST_Decl (AST_Decl::NT_module,
- n,
- p),
+ n),
UTL_Scope (AST_Decl::NT_module)
{
}
diff --git a/TAO/TAO_IDL/be/be_native.cpp b/TAO/TAO_IDL/be/be_native.cpp
index dc82c776c8f..cd1065cb7aa 100644
--- a/TAO/TAO_IDL/be/be_native.cpp
+++ b/TAO/TAO_IDL/be/be_native.cpp
@@ -27,13 +27,10 @@ be_native::be_native (void)
{
}
-be_native::be_native (UTL_ScopedName *n,
- UTL_StrList *p)
- : AST_Native (n,
- p),
+be_native::be_native (UTL_ScopedName *n)
+ : AST_Native (n),
AST_Decl (AST_Decl::NT_native,
- n,
- p)
+ n)
{
}
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
index d470bef61b1..0e251e7f8ab 100644
--- a/TAO/TAO_IDL/be/be_operation.cpp
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -34,18 +34,15 @@ be_operation::be_operation (void)
be_operation::be_operation (AST_Type *rt,
AST_Operation::Flags fl,
UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
: AST_Operation (rt,
fl,
n,
- p,
local,
abstract),
AST_Decl (AST_Decl::NT_op,
- n,
- p),
+ n),
UTL_Scope (AST_Decl::NT_op),
COMMON_Base (local,
abstract)
diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp
index 4110de644f8..a5263719724 100644
--- a/TAO/TAO_IDL/be/be_predefined_type.cpp
+++ b/TAO/TAO_IDL/be/be_predefined_type.cpp
@@ -30,14 +30,11 @@ be_predefined_type::be_predefined_type (void)
}
be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
: AST_PredefinedType (t,
- n,
- p),
+ n),
AST_Decl (AST_Decl::NT_pre_defined,
n,
- p,
I_TRUE)
{
// Generate a new Scoped Name for us such that we belong to the CORBA
diff --git a/TAO/TAO_IDL/be/be_root.cpp b/TAO/TAO_IDL/be/be_root.cpp
index 626f13ebdf3..d3a9048f596 100644
--- a/TAO/TAO_IDL/be/be_root.cpp
+++ b/TAO/TAO_IDL/be/be_root.cpp
@@ -31,13 +31,10 @@ be_root::be_root (void)
}
// Constructor used to build the root of the abstract syntax tree (AST).
-be_root::be_root (UTL_ScopedName *n,
- UTL_StrList *p)
- : AST_Root (n,
- p),
+be_root::be_root (UTL_ScopedName *n)
+ : AST_Root (n),
AST_Decl (AST_Decl::NT_root,
- n,
- p),
+ n),
UTL_Scope (AST_Decl::NT_root)
{
diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp
index 3f26593323e..277aad714f1 100644
--- a/TAO/TAO_IDL/be/be_scope.cpp
+++ b/TAO/TAO_IDL/be/be_scope.cpp
@@ -61,6 +61,8 @@ be_scope::decl (void)
return be_enum::narrow_from_scope (this);
case AST_Decl::NT_op:
return be_operation::narrow_from_scope (this);
+ case AST_Decl::NT_factory:
+ return be_factory::narrow_from_scope (this);
default:
return (be_decl *)0;
}
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index b166fc951f7..fa8e37aec83 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -45,7 +45,6 @@ be_sequence::be_sequence (AST_Expression *v,
abstract),
AST_Decl (AST_Decl::NT_sequence,
0,
- 0,
I_TRUE),
COMMON_Base (t->is_local () || local,
abstract),
@@ -220,8 +219,27 @@ be_sequence::managed_type (void)
{
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ {
+ int is_valuetype = 0;
+ be_interface *bf = be_interface::narrow_from_decl (prim_type);
+ if (bf != 0)
+ is_valuetype = bf->is_valuetype ();
+ else
+ {
+ be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (prim_type);
+ if (bff != 0)
+ is_valuetype = bff->is_valuetype ();
+ }
+ if (is_valuetype)
+ {
+ this->mt_ = be_sequence::MNG_VALUE;
+ }
+ else
+ {
this->mt_ = be_sequence::MNG_OBJREF;
+ }
break;
+ }
case AST_Decl::NT_string:
this->mt_ = be_sequence::MNG_STRING;
break;
@@ -340,6 +358,21 @@ be_sequence::instance_name ()
this->max_size ()->ev ()->u.ulval);
}
break;
+ case be_sequence::MNG_VALUE:
+ if (this->unbounded ())
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Unbounded_Valuetype_Sequence_%s",
+ this->flat_name ());
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_Valuetype_Sequence_%s_%lu",
+ this->flat_name (),
+ this->max_size ()->ev ()->u.ulval);
+ }
+ break;
case be_sequence::MNG_STRING:
if (this->unbounded ())
{
diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp
index cb0c7518dbb..ea293d78f01 100644
--- a/TAO/TAO_IDL/be/be_string.cpp
+++ b/TAO/TAO_IDL/be/be_string.cpp
@@ -36,7 +36,6 @@ be_string::be_string (AST_Expression *v)
AST_Decl (AST_Decl::NT_string,
new UTL_ScopedName (new Identifier ("string"),
0),
- 0,
I_TRUE)
{
// Always the case.
@@ -54,7 +53,6 @@ be_string::be_string (AST_Expression *v,
0)
: new UTL_ScopedName (new Identifier ("wstring"),
0),
- 0,
I_TRUE)
{
// Always the case.
diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp
index 2612da8d7ff..0530a2db8bf 100644
--- a/TAO/TAO_IDL/be/be_structure.cpp
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -30,12 +30,10 @@ be_structure::be_structure (void)
}
be_structure::be_structure (UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
: AST_Decl (AST_Decl::NT_struct,
- n,
- p),
+ n),
UTL_Scope (AST_Decl::NT_struct),
COMMON_Base (local,
abstract)
diff --git a/TAO/TAO_IDL/be/be_tmplinst.cpp b/TAO/TAO_IDL/be/be_tmplinst.cpp
new file mode 100644
index 00000000000..b288ffdb3c6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_tmplinst.cpp
@@ -0,0 +1,47 @@
+// $Id$
+
+#include "ace/ACE.h"
+#include "be_visitor_typecode/typecode_defn.h"
+#include "be_stream_factory.h"
+#include "be_visitor_factory.h"
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>;
+template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
+template class ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
+template class ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
+
+template class ACE_Node <be_interface *>;
+template class ACE_Unbounded_Queue <be_interface *>;
+template class ACE_Unbounded_Queue_Iterator <be_interface *>;
+
+template class ACE_Node<be_visitor_typecode_defn::QNode*>;
+template class ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*>;
+template class ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*>;
+
+template class ACE_Node <be_interface_fwd *>;
+template class ACE_Unbounded_Queue <be_interface_fwd *>;
+template class ACE_Unbounded_Queue_Iterator <be_interface_fwd *>;
+
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>
+#pragma instantiate ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
+#pragma instantiate ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
+#pragma instantiate ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
+
+#pragma instantiate ACE_Node <be_interface *>
+#pragma instantiate ACE_Unbounded_Queue <be_interface *>
+#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface *>
+
+#pragma instantiate ACE_Node<be_visitor_typecode_defn::QNode*>
+#pragma instantiate ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*>
+#pragma instantiate ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*>
+
+#pragma instantiate ACE_Node <be_interface_fwd *>
+#pragma instantiate ACE_Unbounded_Queue <be_interface_fwd *>
+#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface_fwd *>
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp
index 756def6f12d..ec34b33ad20 100644
--- a/TAO/TAO_IDL/be/be_type.cpp
+++ b/TAO/TAO_IDL/be/be_type.cpp
@@ -32,11 +32,9 @@ be_type::be_type (void)
}
be_type::be_type (AST_Decl::NodeType nt,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
: AST_Decl (nt,
- n,
- p),
+ n),
tc_name_ (0),
nested_type_name_ (0)
{
diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp
index 42d2fb763c2..14533244c72 100644
--- a/TAO/TAO_IDL/be/be_typedef.cpp
+++ b/TAO/TAO_IDL/be/be_typedef.cpp
@@ -33,19 +33,15 @@ be_typedef::be_typedef (void)
be_typedef::be_typedef (AST_Type *bt,
UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
- : AST_Typedef (bt,
- n,
- p,
- bt->is_local () || local,
+ : AST_Typedef (bt,
+ n,
+ bt->is_local () || local,
abstract),
- AST_Decl (AST_Decl::NT_typedef,
- n,
- p),
-
- COMMON_Base (bt->is_local () || local,
+ AST_Decl (AST_Decl::NT_typedef,
+ n),
+ COMMON_Base (bt->is_local () || local,
abstract)
{
}
diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp
index 72e630495b4..36ba45049ae 100644
--- a/TAO/TAO_IDL/be/be_union.cpp
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -34,22 +34,18 @@ be_union::be_union (void)
be_union::be_union (AST_ConcreteType *dt,
UTL_ScopedName *n,
- UTL_StrList *p,
idl_bool local,
idl_bool abstract)
: AST_Union (dt,
n,
- p,
local,
abstract),
AST_Structure (AST_Decl::NT_union,
n,
- p,
local,
abstract),
AST_Decl (AST_Decl::NT_union,
- n,
- p),
+ n),
UTL_Scope (AST_Decl::NT_union),
COMMON_Base (local,
abstract)
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
index 0d20ee99a56..b1c5c0d8835 100644
--- a/TAO/TAO_IDL/be/be_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -31,19 +31,15 @@ be_union_branch::be_union_branch (void)
be_union_branch::be_union_branch (UTL_LabelList *ll,
AST_Type *ft,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
: AST_UnionBranch (ll,
ft,
- n,
- p),
+ n),
AST_Field (AST_Decl::NT_union_branch,
ft,
- n,
- p),
+ n),
AST_Decl (AST_Decl::NT_union_branch,
- n,
- p),
+ n),
COMMON_Base (ft->is_local (),
ft->is_abstract ())
{
diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp
index e2edec79ca7..3098c97a0e3 100644
--- a/TAO/TAO_IDL/be/be_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype.cpp
@@ -23,8 +23,6 @@
#include "idl_extern.h"
#include "be.h"
-#ifdef IDL_HAS_VALUETYPE
-
ACE_RCSID(be, be_valuetype, "$Id$")
// Default constructor.
@@ -52,14 +50,12 @@ be_valuetype::be_valuetype (void)
be_valuetype::be_valuetype (UTL_ScopedName *n,
AST_Interface **ih,
long nih,
- UTL_StrList *p,
idl_bool set_abstract)
: be_interface (n,
ih,
nih,
0,
0,
- p,
0,
set_abstract),
AST_Interface (n,
@@ -67,12 +63,10 @@ be_valuetype::be_valuetype (UTL_ScopedName *n,
nih,
0,
0,
- p,
0,
set_abstract),
AST_Decl (AST_Decl::NT_interface, // It's like an interface.
- n,
- p),
+ n),
UTL_Scope (AST_Decl::NT_interface),
COMMON_Base (0,
set_abstract),
@@ -103,11 +97,9 @@ be_valuetype::~be_valuetype (void)
}
void
-be_valuetype::redefine (AST_Interface *from,
- UTL_StrList *p)
+be_valuetype::redefine (AST_Interface *from)
{
- this->AST_Interface::redefine (from,
- p);
+ this->AST_Interface::redefine (from);
this->is_abstract_ = from->is_abstract_valuetype ();
}
@@ -128,7 +120,6 @@ be_valuetype::compute_fullobvskelname (void)
this->full_obv_skel_name_);
}
-
// Retrieve the fully scoped skeleton name.
const char*
be_valuetype::full_obv_skel_name (void)
@@ -141,8 +132,6 @@ be_valuetype::full_obv_skel_name (void)
return this->full_obv_skel_name_;
}
-
-
// Generate the var definition.
int
be_valuetype::gen_var_defn (char *)
@@ -232,7 +221,7 @@ int
be_valuetype::gen_var_impl (char *,
char *)
{
- TAO_OutStream *ci = 0;
+ TAO_OutStream *cs = 0;
TAO_NL be_nl;
// To hold the full and local _var names.
@@ -255,183 +244,178 @@ be_valuetype::gen_var_impl (char *,
"%s_var",
this->local_name ());
- ci = tao_cg->client_inline ();
+ cs = tao_cg->client_inline ();
// Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
- ci->indent (); // start with whatever was our current indent level
+ cs->indent (); // start with whatever was our current indent level
- *ci << "// *************************************************************"
+ *cs << "// *************************************************************"
<< be_nl;
- *ci << "// Inline operations for class " << fname << be_nl;
- *ci << "// *************************************************************\n\n";
+ *cs << "// Inline operations for class " << fname << be_nl;
+ *cs << "// *************************************************************\n\n";
// Default constructor.
- *ci << "ACE_INLINE" << be_nl;
- *ci << fname << "::" << lname <<
+ *cs << "ACE_INLINE" << be_nl;
+ *cs << fname << "::" << lname <<
" (void) // default constructor" << be_nl;
- *ci << " " << ": ptr_ (0)" << be_nl;
- *ci << "{}\n\n";
+ *cs << " " << ": ptr_ (0)" << be_nl;
+ *cs << "{}\n\n";
// Constructor from a pointer.
- ci->indent ();
- *ci << "ACE_INLINE" << be_nl;
- *ci << fname << "::" << lname << " ("
+ cs->indent ();
+ *cs << "ACE_INLINE" << be_nl;
+ *cs << fname << "::" << lname << " ("
<< this->local_name () << "* p)" << be_nl;
- *ci << " : ptr_ (p)" << be_nl;
- *ci << "{}\n\n";
+ *cs << " : ptr_ (p)" << be_nl;
+ *cs << "{}\n\n";
// Constructor from a const pointer.
// TAO extension - it appears that there are problems with at least g++
// which reclaims amguity between T(T*) and T(const T_var &)
- ci->indent ();
- *ci << "ACE_INLINE" << be_nl;
- *ci << fname << "::" << lname << " (const "
+ cs->indent ();
+ *cs << fname << "::" << lname << " (const "
<< this->local_name () << "* p)" << be_nl;
- *ci << " : ptr_ (ACE_const_cast("
+ *cs << " : ptr_ (ACE_const_cast("
<< this->local_name () << "*, p))" << be_nl;
- *ci << "{}\n\n";
+ *cs << "{}\n\n";
// The additional ptr () member function. This member function must be
// defined before the remaining member functions including the copy
// constructor because this inline function is used elsewhere. Hence to make
// inlining of this function possible, we must define it before its use.
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "* " << be_nl;
- *ci << fname << "::ptr (void) const" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ cs->indent ();
+ *cs << this->name () << "* " << be_nl;
+ *cs << fname << "::ptr (void) const" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Copy constructor.
- ci->indent ();
- *ci << "ACE_INLINE" << be_nl;
- *ci << fname << "::" << lname << " (const " << lname <<
+ cs->indent ();
+ *cs << fname << "::" << lname << " (const " << lname <<
" &p) // copy constructor" << be_nl;
- *ci << "{" << be_idt_nl
+ *cs << "{" << be_idt_nl
<< "CORBA::add_ref (p.ptr ());" << be_nl
<< "this->ptr_ = p.ptr ();" << be_uidt_nl
<< "}\n\n";
// Destructor.
- ci->indent ();
- *ci << "ACE_INLINE" << be_nl;
- *ci << fname << "::~" << lname << " (void) // destructor" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::remove_ref (this->ptr_);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ cs->indent ();
+ *cs << fname << "::~" << lname << " (void) // destructor" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "CORBA::remove_ref (this->ptr_);\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Assignment operator.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << be_nl;
- *ci << fname << "::operator= (" << this->local_name ()
+ cs->indent ();
+ *cs << fname << " &" << be_nl;
+ *cs << fname << "::operator= (" << this->local_name ()
<< "* p)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::remove_ref (this->ptr_);" << be_nl;
- *ci << "this->ptr_ = p;" << be_nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "CORBA::remove_ref (this->ptr_);" << be_nl;
+ *cs << "this->ptr_ = p;" << be_nl;
+ *cs << "return *this;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Assignment operator from _var.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << be_nl;
- *ci << fname << "::operator= (const " << lname
+ cs->indent ();
+ *cs << fname << " &" << be_nl;
+ *cs << fname << "::operator= (const " << lname
<< " &p)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (this != &p)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::remove_ref (this->ptr_);" << be_nl
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "if (this != &p)" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "CORBA::remove_ref (this->ptr_);" << be_nl
<< this->local_name() << "* tmp = p.ptr ();" << be_nl
<< "CORBA::add_ref (tmp);" << be_nl
<< "this->ptr_ = tmp;\n";
- ci->decr_indent ();
- *ci << "}" << be_nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ cs->decr_indent ();
+ *cs << "}" << be_nl;
+ *cs << "return *this;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Other extra methods - cast operator ().
- ci->indent ();
- *ci << "ACE_INLINE " << be_nl;
- *ci << fname << "::operator const " << this->name ()
+ cs->indent ();
+ *cs << fname << "::operator const " << this->name ()
<< "* () const // cast" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << be_nl;
- *ci << fname << "::operator " << this->name ()
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
+
+ cs->indent ();
+ *cs << fname << "::operator " << this->name ()
<< "* () // cast " << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// operator->
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "* " << be_nl;
- *ci << fname << "::operator-> (void) const" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ cs->indent ();
+ *cs << this->name () << "* " << be_nl;
+ *cs << fname << "::operator-> (void) const" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// in, inout, out, and _retn.
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "*" << be_nl;
- *ci << fname << "::in (void) const" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "* &" << be_nl;
- *ci << fname << "::inout (void)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "* &" << be_nl;
- *ci << fname << "::out (void)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::remove_ref (this->ptr_);" << be_nl;
- *ci << "this->ptr_ = 0;" << be_nl;
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "* " << be_nl;
- *ci << fname << "::_retn (void)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "// yield ownership of managed obj reference" << be_nl;
- *ci << this->local_name () << "* tmp = this->ptr_;" << be_nl;
- *ci << "this->ptr_ = 0;" << be_nl;
- *ci << "return tmp;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ cs->indent ();
+ *cs << this->name () << "*" << be_nl;
+ *cs << fname << "::in (void) const" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
+
+ cs->indent ();
+ *cs << this->name () << "* &" << be_nl;
+ *cs << fname << "::inout (void)" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
+
+ cs->indent ();
+ *cs << this->name () << "* &" << be_nl;
+ *cs << fname << "::out (void)" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "CORBA::remove_ref (this->ptr_);" << be_nl;
+ *cs << "this->ptr_ = 0;" << be_nl;
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
+
+ cs->indent ();
+ *cs << this->name () << "* " << be_nl;
+ *cs << fname << "::_retn (void)" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "// yield ownership of managed obj reference" << be_nl;
+ *cs << this->local_name () << "* tmp = this->ptr_;" << be_nl;
+ *cs << "this->ptr_ = 0;" << be_nl;
+ *cs << "return tmp;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
return 0;
}
@@ -504,7 +488,7 @@ int
be_valuetype::gen_out_impl (char *,
char *)
{
- TAO_OutStream *ci = 0;
+ TAO_OutStream *cs = 0;
TAO_NL be_nl;
// To hold the full and local _out names.
@@ -527,121 +511,202 @@ be_valuetype::gen_out_impl (char *,
"%s_out",
this->local_name ());
- ci = tao_cg->client_inline ();
+ cs = tao_cg->client_inline ();
// Generate the var implementation in the inline file
// Depending upon the data type, there are some differences which we account
// for over here.
// Start with whatever was our current indent level.
- ci->indent ();
+ cs->indent ();
- *ci << "// *************************************************************"
+ *cs << "// *************************************************************"
<< be_nl;
- *ci << "// Inline operations for class " << fname << be_nl;
- *ci << "// *************************************************************\n\n";
+ *cs << "// Inline operations for class " << fname << be_nl;
+ *cs << "// *************************************************************\n\n";
// Constructor from a pointer.
- ci->indent ();
- *ci << "ACE_INLINE" << be_nl;
- *ci << fname << "::" << lname << " (" << this->local_name ()
+ cs->indent ();
+ *cs << fname << "::" << lname << " (" << this->local_name ()
<< "* &p)" << be_nl;
- *ci << " : ptr_ (p)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ *cs << " : ptr_ (p)" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "this->ptr_ = 0;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Constructor from _var &.
- ci->indent ();
- *ci << "ACE_INLINE" << be_nl;
- *ci << fname << "::" << lname << " (" << this->local_name ()
+ cs->indent ();
+ *cs << fname << "::" << lname << " (" << this->local_name ()
<< "_var &p) // constructor from _var" << be_nl;
- *ci << " : ptr_ (p.out ())" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::remove_ref (this->ptr_);" << be_nl;
- *ci << "this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ *cs << " : ptr_ (p.out ())" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "CORBA::remove_ref (this->ptr_);" << be_nl;
+ *cs << "this->ptr_ = 0;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Copy constructor.
- ci->indent ();
- *ci << "ACE_INLINE" << be_nl;
- *ci << fname << "::" << lname << " (const " << lname
+ cs->indent ();
+ *cs << fname << "::" << lname << " (const " << lname
<< " &p) // copy constructor" << be_nl;
- *ci << " : ptr_ (ACE_const_cast (" << lname << "&,p).ptr_)" << be_nl;
- *ci << "{}\n\n";
+ *cs << " : ptr_ (ACE_const_cast (" << lname << "&,p).ptr_)" << be_nl;
+ *cs << "{}\n\n";
// Assignment operator from _out &.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << be_nl;
- *ci << fname << "::operator= (const " << lname <<
+ cs->indent ();
+ *cs << fname << " &" << be_nl;
+ *cs << fname << "::operator= (const " << lname <<
" &p)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = ACE_const_cast (" << lname << "&,p).ptr_;" << be_nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "this->ptr_ = ACE_const_cast (" << lname << "&,p).ptr_;" << be_nl;
+ *cs << "return *this;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Assignment operator from _var.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << be_nl;
- *ci << fname << "::operator= (const " << this->local_name ()
+ cs->indent ();
+ *cs << fname << " &" << be_nl;
+ *cs << fname << "::operator= (const " << this->local_name ()
<< "_var &p)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << this->local_name () << "* tmp = p.ptr ();" << be_nl
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << this->local_name () << "* tmp = p.ptr ();" << be_nl
<< "CORBA::add_ref (tmp);" << be_nl
<< "this->ptr_ = tmp;" << be_nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ *cs << "return *this;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Assignment operator from *.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << be_nl;
- *ci << fname << "::operator= (" << this->local_name ()
+ cs->indent ();
+ *cs << fname << " &" << be_nl;
+ *cs << fname << "::operator= (" << this->local_name ()
<< "* p)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p;" << be_nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "this->ptr_ = p;" << be_nl;
+ *cs << "return *this;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// Other extra methods - cast operator ().
- ci->indent ();
- *ci << "ACE_INLINE " << be_nl;
- *ci << fname << "::operator " << this->name ()
+ cs->indent ();
+ *cs << fname << "::operator " << this->name ()
<< "* &() // cast" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// ptr function.
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "* &" << be_nl;
- *ci << fname << "::ptr (void) // ptr" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ cs->indent ();
+ *cs << this->name () << "* &" << be_nl;
+ *cs << fname << "::ptr (void) // ptr" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
// operator->
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "* " << be_nl;
- *ci << fname << "::operator-> (void)" << be_nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
+ cs->indent ();
+ *cs << this->name () << "* " << be_nl;
+ *cs << fname << "::operator-> (void)" << be_nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "return this->ptr_;\n";
+ cs->decr_indent ();
+ *cs << "}\n\n";
+
+ return 0;
+}
+
+int
+be_valuetype::gen_helper_header (char* ,
+ char* )
+{
+ TAO_OutStream *os = 0;
+
+ os = tao_cg->client_header ();
+
+ *os << "//@@ Boris: begin experimental" << be_nl
+ << "TAO_NAMESPACE CORBA" << be_nl
+ << "{"
+ << be_idt_nl
+ << "void add_ref (" << this->full_name () << " *);" << be_nl
+ << "void remove_ref (" << this->full_name () << " *);"
+ << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_NAMESPACE_CLOSE" << be_nl
+ << "//@@ Boris: end experimental" << be_nl << be_nl;
+
+ return 0;
+}
+
+int
+be_valuetype::gen_helper_inline (char* ,
+ char* )
+{
+ TAO_OutStream *os = 0;
+
+ os = tao_cg->client_inline ();
+
+ *os << "//@@ Boris: begin experimental" << be_nl
+ << "TAO_NAMESPACE CORBA" << be_nl
+ << "{"
+ << be_idt_nl
+ << "void add_ref (" << this->full_name () << " *);" << be_nl
+ << "void remove_ref (" << this->full_name () << " *);"
+ << be_uidt_nl
+ << "}" << be_nl
+ << "TAO_NAMESPACE_CLOSE" << be_nl
+ << "//@@ Boris: end experimental" << be_nl << be_nl;
+
+ return 0;
+}
+
+
+int
+be_valuetype::gen_helper_stubs (char* ,
+ char* )
+{
+ TAO_OutStream *os = 0;
+
+ os = tao_cg->client_stubs ();
+
+ *os << "//@@ Boris: begin experimental" << be_nl
+ // add_ref
+ << "void" << be_nl
+ << "CORBA::add_ref (" << this->full_name () << " * vt)" << be_nl
+ << "{"
+ << be_idt_nl
+ << "if (vt != 0)" << be_nl
+ << "{"
+ << be_idt_nl
+ << "vt->_add_ref ();"
+ << be_uidt_nl
+ << "}"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl
+ // remove_ref
+ << "void" << be_nl
+ << "CORBA::remove_ref (" << this->full_name () << " * vt)" << be_nl
+ << "{"
+ << be_idt_nl
+ << "if (vt != 0)" << be_nl
+ << "{"
+ << be_idt_nl
+ << "vt->_remove_ref ();"
+ << be_uidt_nl
+ << "}"
+ << be_uidt_nl
+ << "}" << be_nl << be_nl
+ << "//@@ Boris: end experimental" << be_nl;
return 0;
}
@@ -690,4 +755,3 @@ IMPL_NARROW_METHODS1 (be_valuetype, be_interface)
IMPL_NARROW_FROM_DECL (be_valuetype)
IMPL_NARROW_FROM_SCOPE (be_valuetype)
-#endif /* IDL_HAS_VALUETYPE */
diff --git a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
index 894febbcccc..8c7452fb4ed 100644
--- a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp
@@ -25,8 +25,6 @@
#include "idl_extern.h"
#include "be.h"
-#ifdef IDL_HAS_VALUETYPE
-
ACE_RCSID(be, be_valuetype_fwd, "$Id$")
be_valuetype_fwd::be_valuetype_fwd (void)
@@ -34,17 +32,13 @@ be_valuetype_fwd::be_valuetype_fwd (void)
}
be_valuetype_fwd::be_valuetype_fwd (AST_Interface *dummy,
- UTL_ScopedName *n,
- UTL_StrList *p)
+ UTL_ScopedName *n)
: be_interface_fwd (dummy,
- n,
- p),
+ n),
AST_InterfaceFwd (dummy,
- n,
- p),
+ n),
AST_Decl (AST_Decl::NT_interface_fwd,
- n,
- p)
+ n)
{
}
@@ -59,509 +53,6 @@ be_valuetype_fwd::set_abstract_valuetype (void)
this->full_definition ()->set_abstract_valuetype ();
}
-// Generate the var definition
-int
-be_valuetype_fwd::gen_var_defn (char *)
-{
- ACE_ASSERT (0);
- TAO_OutStream *ch = 0;
- TAO_NL nl;
- char namebuf [NAMEBUFSIZE];
-
- ACE_OS::memset (namebuf,
- '\0',
- NAMEBUFSIZE);
-
- ACE_OS::sprintf (namebuf,
- "%s_var",
- this->local_name ()->get_string ());
-
- ch = tao_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.
-
- // Start with whatever was our current indent level.
- ch->indent ();
- *ch << "class " << be_global->stub_export_macro ()
- << " " << namebuf << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
-
- // Default constructor.
- *ch << namebuf << " (void); // default constructor" << nl;
- *ch << namebuf << " (" << this->local_name () << "_ptr);" << nl;
-
- // Copy constructor.
- *ch << namebuf << " (const " << namebuf <<
- " &); // copy constructor" << nl;
-
- // Destructor.
- *ch << "~" << namebuf << " (void); // destructor" << nl;
- *ch << nl;
-
- // Assignment operator from a pointer.
- *ch << namebuf << " &operator= (" << this->local_name ()
- << "_ptr);" << nl;
-
- // Assignment from _var.
- *ch << namebuf << " &operator= (const " << namebuf <<
- " &);" << nl;
-
- // Arrow operator.
- *ch << this->local_name () << "_ptr operator-> (void) const;" << nl;
-
- *ch << nl;
-
- // Other extra types (cast operators, [] operator, and others).
- *ch << "operator const " << this->local_name ()
- << "_ptr &() const;" << nl;
- *ch << "operator " << this->local_name () << "_ptr &();" << nl;
-
- *ch << "// in, inout, out, _retn " << nl;
- // The return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type.
- *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 << this->local_name () << "_ptr ptr (void) const;\n";
-
- *ch << "\n";
- ch->decr_indent ();
-
- // Private.
- *ch << "private:\n";
- ch->incr_indent ();
- *ch << this->local_name () << "_ptr ptr_;\n";
-
- ch->decr_indent ();
- *ch << "};\n\n";
-
- return 0;
-}
-
-// Implementation of the _var class. All of these get generated in the inline
-// file.
-int
-be_valuetype_fwd::gen_var_impl (char *,
- char *)
-{
- ACE_ASSERT (0);
- TAO_OutStream *ci = 0;
- TAO_NL nl;
-
- // To hold the full and local _var names.
- char fname [NAMEBUFSIZE];
- char lname [NAMEBUFSIZE];
-
- 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",
- this->local_name ()->get_string ());
-
- ci = tao_cg->client_inline ();
-
- // Generate the var implementation in the inline file
- // Depending upon the data type, there are some differences which we account
- // for over here.
-
- // Start with whatever was our current indent level.
- ci->indent ();
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for class " << fname << nl;
- *ci << "// *************************************************************\n\n";
-
- // Default constructor.
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname
- << " (void) // default constructor" << nl;
- *ci << " " << ": ptr_ (" << this->name () << "::_nil ())" << nl;
- *ci << "{}\n\n";
-
- // Constructor from a _ptr.
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name ()
- << "_ptr p)" << nl;
- *ci << " : ptr_ (p)" << nl;
- *ci << "{}\n\n";
-
- // The additional ptr () member function. This member function must be
- // defined before the remaining member functions including the copy
- // constructor because this inline function is used elsewhere. Hence to make
- // inlining of this function possible, we must define it before its use.
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
- *ci << fname << "::ptr (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Copy constructor.
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname
- << " &p) // copy constructor" << nl;
- *ci << " : ptr_ (" << this->name () << "::_duplicate (p.ptr ()))" << nl;
- *ci << "{}\n\n";
-
- // Destructor.
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::~" << lname << " (void) // destructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Assignment operator.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name ()
- << "_ptr p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Assignment operator from _var.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname
- << " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (this != &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << name () << "::_duplicate (p.ptr ());\n";
- ci->decr_indent ();
- *ci << "}" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Other extra methods - cast operator ().
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << this->name ()
- << "_ptr &() const // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name ()
- << "_ptr &() // cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator->
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
- *ci << fname << "::operator-> (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // in, inout, out, and _retn.
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr" << nl;
- *ci << fname << "::in (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
- *ci << fname << "::inout (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
- *ci << fname << "::out (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << this->name () << "::_nil ();" << nl;
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
- *ci << fname << "::_retn (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "// yield ownership of managed obj reference" << nl;
- *ci << this->name () << "_ptr val = this->ptr_;" << nl;
- *ci << "this->ptr_ = " << this->name () << "::_nil ();" << nl;
- *ci << "return val;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- return 0;
-}
-
-// Generate the _out definition.
-int
-be_valuetype_fwd::gen_out_defn (char *)
-{
- ACE_ASSERT (0);
- TAO_OutStream *ch = 0;
- TAO_NL nl;
- char namebuf [NAMEBUFSIZE];
-
- ACE_OS::memset (namebuf,
- '\0',
- NAMEBUFSIZE);
-
- ACE_OS::sprintf (namebuf,
- "%s_out",
- this->local_name ()->get_string ());
-
- ch = tao_cg->client_header ();
-
- // Generate the out definition (always in the client header).
-
- // Start with whatever was our current indent level.
- ch->indent ();
-
- *ch << "class " << be_global->stub_export_macro ()
- << " " << namebuf << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
-
- // No default constructor.
-
- // Constructor from a pointer.
- *ch << namebuf << " (" << this->local_name () << "_ptr &);" << nl;
-
- // Constructor from a _var &.
- *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
-
- // Constructor from a _out &.
- *ch << namebuf << " (const " << namebuf << " &);" << nl;
-
- // Assignment operator from a _out &.
- *ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
-
- // Assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators.
- // Only valuetype allows assignment from var &.
- *ch << namebuf << " &operator= (const " << this->local_name ()
- << "_var &);" << nl;
- *ch << namebuf << " &operator= (" << this->local_name ()
- << "_ptr);" << nl;
-
- // Cast.
- *ch << "operator " << this->local_name () << "_ptr &();" << nl;
-
- // ptr function.
- *ch << this->local_name () << "_ptr &ptr (void);" << nl;
-
- // operator ->
- *ch << this->local_name () << "_ptr operator-> (void);" << nl;
-
- *ch << "\n";
- ch->decr_indent ();
- *ch << "private:\n";
- ch->incr_indent ();
- *ch << this->local_name () << "_ptr &ptr_;\n";
-
- ch->decr_indent ();
- *ch << "};" << be_nl << be_nl;
-
- return 0;
-}
-
-int
-be_valuetype_fwd::gen_out_impl (char *,
- char *)
-{
- ACE_ASSERT (0);
- TAO_OutStream *ci = 0;
- TAO_NL nl;
-
- // To hold the full and local _out names.
- char fname [NAMEBUFSIZE];
- char lname [NAMEBUFSIZE];
-
- ACE_OS::memset (fname,
- '\0',
- NAMEBUFSIZE);
-
- 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 ());
-
- ci = tao_cg->client_inline ();
-
- // Generate the var implementation in the inline file
- // Depending upon the data type, there are some differences which we account
- // for over here.
-
- // Start with whatever was our current indent level.
- ci->indent ();
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for class " << fname << nl;
- *ci << "// *************************************************************\n\n";
-
- // Constructor from a _ptr.
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name ()
- << "_ptr &p)" << nl;
- *ci << " : ptr_ (p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Constructor from _var &.
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name ()
- << "_var &p) // constructor from _var" << nl;
- *ci << " : ptr_ (p.out ())" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "CORBA::release (this->ptr_);" << nl;
- *ci << "this->ptr_ = " << this->name () << "::_nil ();\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Copy constructor.
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname
- << " &p) // copy constructor" << nl;
- *ci << " : ptr_ (ACE_const_cast (" << fname
- << "&,p).ptr_)" << nl;
- *ci << "{}\n\n";
-
- // Assignment operator from _out &.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname
- << " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = ACE_const_cast (" << fname << "&,p).ptr_;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Assignment operator from _var.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << this->name ()
- << "_var &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "::_duplicate (p.ptr ());" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Assignment operator from _ptr.
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name ()
- << "_ptr p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // Other extra methods - cast operator ().
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name ()
- << "_ptr &() // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // ptr function.
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl;
- *ci << fname << "::ptr (void) // ptr" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator->
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << "_ptr " << nl;
- *ci << fname << "::operator-> (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- return 0;
-}
-
int
be_valuetype_fwd::accept (be_visitor *visitor)
{
@@ -572,4 +63,3 @@ be_valuetype_fwd::accept (be_visitor *visitor)
IMPL_NARROW_METHODS1 (be_valuetype_fwd, be_interface_fwd)
IMPL_NARROW_FROM_DECL (be_valuetype_fwd)
-#endif /* IDL_HAS_VALUETYPE */
diff --git a/TAO/TAO_IDL/be/be_visitor.cpp b/TAO/TAO_IDL/be/be_visitor.cpp
index 999042799ea..440c1f9a3b3 100644
--- a/TAO/TAO_IDL/be/be_visitor.cpp
+++ b/TAO/TAO_IDL/be/be_visitor.cpp
@@ -71,7 +71,6 @@ int be_visitor::visit_interface_fwd (be_interface_fwd *)
return 0;
}
-#ifdef IDL_HAS_VALUETYPE
int be_visitor::visit_valuetype (be_valuetype *)
{
return 0;
@@ -81,7 +80,11 @@ int be_visitor::visit_valuetype_fwd (be_valuetype_fwd *)
{
return 0;
}
-#endif /* IDL_HAS_VALUETYPE */
+
+int be_visitor::visit_factory (be_factory *)
+{
+ return 0;
+}
int be_visitor::visit_structure (be_structure *)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
index 2fa7340918d..90e1ed10b13 100644
--- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
@@ -60,7 +60,9 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node)
{
if (!node->imported () && !node->is_local ())
{
- AST_Module *module = AST_Module::narrow_from_scope (node->defined_in ());
+ AST_Module *module =
+ AST_Module::narrow_from_scope (node->defined_in ());
+
if (!module)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_amh_pre_proc::"
@@ -121,7 +123,9 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node)
/*
// Set the strategy
be_interface_strategy *old_strategy =
- excep_holder->set_strategy (new be_interface_ami_exception_holder_strategy (excep_holder));
+ excep_holder->set_strategy (
+ new be_interface_ami_exception_holder_strategy (excep_holder)
+ );
if (old_strategy)
delete old_strategy;
*/
@@ -135,7 +139,8 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node)
-1);
}
- be_interface *response_handler = this->create_response_handler (node, excep_holder);
+ be_interface *response_handler =
+ this->create_response_handler (node, excep_holder);
if (response_handler)
{
response_handler->set_defined_in (node->defined_in ());
@@ -247,7 +252,9 @@ be_visitor_amh_pre_proc::visit_attribute (be_attribute *node)
// Retrieve the strategy set by the visit operation
be_operation_strategy *set_operation_strategy =
- set_operation->set_strategy (new be_operation_default_strategy (set_operation));
+ set_operation->set_strategy (
+ new be_operation_default_strategy (set_operation)
+ );
// Assign it to the attribute as set_operation strategy
if (set_operation_strategy)
@@ -260,7 +267,9 @@ be_visitor_amh_pre_proc::visit_attribute (be_attribute *node)
this->visit_operation (get_operation);
be_operation_strategy *get_operation_strategy =
- get_operation->set_strategy (new be_operation_default_strategy (get_operation));
+ get_operation->set_strategy (
+ new be_operation_default_strategy (get_operation)
+ );
if (get_operation_strategy)
delete node->set_get_strategy (get_operation_strategy);
@@ -275,8 +284,8 @@ be_valuetype *
be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
{
- // Create a virtual module named "Messaging" and an valuetype "ExceptionHolder"
- // from which we inherit.
+ // Create a virtual module named "Messaging" and a valuetype
+ // "ExceptionHolder" from which we inherit.
UTL_ScopedName *inherit_name =
new UTL_ScopedName (new Identifier ("Messaging"),
0);
@@ -290,10 +299,10 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
0);
inherit_vt->set_name (inherit_name);
- be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"),
- 0),
- 0);
-
+ be_module *msg =
+ new be_module (new UTL_ScopedName (new Identifier ("Messaging"),
+ 0));
+
// Notice the valuetype "ExceptionHolder" that it is defined in the
// "Messaging" module
inherit_vt->set_defined_in (msg);
@@ -305,17 +314,20 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
node->name ()->last_component ()->get_string(),
"");
- UTL_ScopedName *excep_holder_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- excep_holder_name->last_component ()->replace_string (excep_holder_local_name.rep ());
+ UTL_ScopedName *excep_holder_name =
+ ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
+ excep_holder_name->last_component ()->replace_string (
+ excep_holder_local_name.rep ()
+ );
AST_Interface_ptr *p_intf = new AST_Interface_ptr[1];
p_intf[0] = ACE_static_cast (AST_Interface *, inherit_vt);
- be_valuetype *excep_holder = new be_valuetype (excep_holder_name, // name
- p_intf, // list of inherited
- 1, // number of inherited
- 0, // pragmas
- 0); // set abstract
+ be_valuetype *excep_holder =
+ new be_valuetype (excep_holder_name, // name
+ p_intf, // list of inherited
+ 1, // number of inherited
+ 0); // set abstract
excep_holder->set_name (excep_holder_name);
// Now our customized valuetype is created, we have to
@@ -333,15 +345,18 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
while (!si->is_done ())
{
AST_Decl *d = si->item ();
+
if (!d)
{
delete si;
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::visit_interface - "
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "visit_interface - "
"bad node in this scope\n"),
0);
}
+
be_decl *op = be_decl::narrow_from_decl (d);
if (d->node_type () == AST_Decl::NT_attr)
@@ -388,8 +403,11 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node)
node->name ()->last_component ()->get_string(),
"");
- UTL_ScopedName *amh_class_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- amh_class_name->last_component ()->replace_string (amh_class_local_name.rep ());
+ UTL_ScopedName *amh_class_name =
+ ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
+ amh_class_name->last_component ()->replace_string (
+ amh_class_local_name.rep ()
+ );
// AST_Interface_ptr *p_intf = new AST_Interface_ptr[1];
@@ -399,7 +417,6 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node)
0, // number of inherited
0, // list of ancestors
0, // number of ancestors
- 0, // pragmas
0, // non-local
0); // non-abstract
amh_class->set_name (amh_class_name);
@@ -437,7 +454,8 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node)
if (!attribute)
return 0;
- /* be_operation *get_operation = this->generate_get_operation (attribute);
+ /*
+ be_operation *get_operation = this->generate_get_operation (attribute);
this->create_response_handler_operation (get_operation,
response_handler);
@@ -497,20 +515,22 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node)
node->name ()->last_component ()->get_string(),
"ResponseHandler");
- UTL_ScopedName *rh_class_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- rh_class_name->last_component ()->replace_string (rh_class_local_name.rep ());
+ UTL_ScopedName *rh_class_name =
+ ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
+ rh_class_name->last_component ()->replace_string (
+ rh_class_local_name.rep ()
+ );
// AST_Interface_ptr *p_intf = new AST_Interface_ptr[1];
be_interface *rh_class =
new be_interface (rh_class_name, // name
- 0, // list of inherited
- 0, // number of inherited
- 0, // list of ancestors
- 0, // number of ancestors
- 0, // pragmas
- 0, // non-local
- 0); // non-abstract
+ 0, // list of inherited
+ 0, // number of inherited
+ 0, // list of ancestors
+ 0, // number of ancestors
+ 0, // non-local
+ 0); // non-abstract
rh_class->set_name (rh_class_name);
return rh_class;
@@ -531,21 +551,18 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
return 0;
// Create the return type, which is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier ("void"), //1, 0, I_FALSE),
- 0),
- 0);
-
- ACE_CString original_op_name (node
- ->name ()
- ->last_component ()
- ->get_string ());
-
- UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, amh_class->name ()-> copy ());
- op_name->nconc (new UTL_ScopedName (
- new Identifier (
- original_op_name.rep ()),
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
+
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+
+ UTL_ScopedName *op_name =
+ ACE_static_cast (UTL_ScopedName *, amh_class->name ()-> copy ());
+ op_name->nconc (new UTL_ScopedName (new Identifier (original_op_name.rep ()),
0));
// Create the operation
@@ -553,14 +570,14 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
AST_Operation::OP_noflags,
op_name,
0,
- 0,
0);
operation->set_name (op_name);
ACE_CString new_op_name = ACE_CString ("reply_") + original_op_name;
- UTL_ScopedName *rtop_name = ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ());
+ UTL_ScopedName *rtop_name =
+ ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ());
op_name->last_component ()->replace_string (new_op_name.rep ());
// Create the operation
@@ -568,7 +585,6 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
AST_Operation::OP_noflags,
rtop_name,
0,
- 0,
0);
rtoperation->set_name (op_name);
@@ -600,7 +616,8 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
{
delete si;
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::create_response_handler_operation - "
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "create_response_handler_operation - "
"bad node in this scope\n"),
-1);
@@ -614,8 +631,7 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
// Create the argument
be_argument *arg = new be_argument (original_arg->direction (),
original_arg->field_type (),
- original_arg->name (),
- 0);
+ original_arg->name ());
operation->add_argument_to_scope (arg);
}
@@ -625,8 +641,7 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
// Create the argument
be_argument *arg = new be_argument (original_arg->direction (),
original_arg->field_type (),
- original_arg->name (),
- 0);
+ original_arg->name ());
rtoperation->add_argument_to_scope (arg);
}
@@ -657,8 +672,10 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
be_interface *
-be_visitor_amh_pre_proc::create_response_handler (be_interface *node,
- be_valuetype * /*excep_holder*/)
+be_visitor_amh_pre_proc::create_response_handler (
+ be_interface *node,
+ be_valuetype * /*excep_holder*/
+ )
{
// Generate 'Stock::AMH_QuoterResponseHandler'
ACE_CString class_name (node->client_enclosing_scope ());
@@ -668,14 +685,14 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node,
UTL_ScopedName *inherit_name =
new UTL_ScopedName (new Identifier (class_name.rep ()),
0);
- be_interface *inherit_intf = new be_interface (inherit_name,
- 0, // inherited interfaces
- 0, // number of inherited interfaces
- 0, // ancestors
- 0, // number of ancestors
- 0, // pragmas
- 1, // not local
- 0); // not abstract
+ be_interface *inherit_intf =
+ new be_interface (inherit_name,
+ 0, // inherited interfaces
+ 0, // number of inherited interfaces
+ 0, // ancestors
+ 0, // number of ancestors
+ 0, // not local
+ 0); // not abstract
inherit_intf->set_name (inherit_name);
// Generate 'TAO_AMH_ResponseHandler': This is fixed and same for any RH.
@@ -683,14 +700,14 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node,
UTL_ScopedName *tao_inherit_name =
new UTL_ScopedName (new Identifier (tao_rh_name.rep ()),
0);
- be_interface *tao_inherit_intf = new be_interface (tao_inherit_name,
- 0, // inherited interfaces
- 0, // number of inherited interfaces
- 0, // ancestors
- 0, // number of ancestors
- 0, // pragmas
- 1, // not local
- 0); // not abstract
+ be_interface *tao_inherit_intf =
+ new be_interface (tao_inherit_name,
+ 0, // inherited interfaces
+ 0, // number of inherited interfaces
+ 0, // ancestors
+ 0, // number of ancestors
+ 1, // not local
+ 0); // not abstract
tao_inherit_intf->set_name (tao_inherit_name);
@@ -702,8 +719,11 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node,
node->name ()->last_component ()->get_string(),
"ResponseHandler");
- UTL_ScopedName *response_handler_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- response_handler_name->last_component ()->replace_string (response_handler_local_name.rep ());
+ UTL_ScopedName *response_handler_name =
+ ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
+ response_handler_name->last_component ()->replace_string (
+ response_handler_local_name.rep ()
+ );
AST_Interface_ptr *p_intf = new AST_Interface_ptr[2];
p_intf[0] = ACE_static_cast (AST_Interface *, inherit_intf);
@@ -714,8 +734,7 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node,
p_intf, // list of inherited
2, // number of inherited
p_intf, // list of ancestors
- 2, // number of ancestors
- 0, // pragmas
+ 1, // number of ancestors
0, // non-local
0); // non-abstract
response_handler->set_name (response_handler_name);
@@ -740,7 +759,8 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node,
{
delete si;
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::visit_interface - "
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "visit_interface - "
"bad node in this scope\n"),
0);
@@ -751,17 +771,20 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node,
be_attribute *attribute = be_attribute::narrow_from_decl (d);
if (!attribute)
- return 0;
- /*
- be_operation *get_operation = this->generate_get_operation (attribute);
- this->create_response_handler_operation (get_operation,
- response_handler);
+ {
+ return 0;
+ }
+/*
+ be_operation *get_operation =
+ this->generate_get_operation (attribute);
+ this->create_response_handler_operation (get_operation,
+ response_handler);
- this->create_excep_operation (get_operation,
- response_handler,
- excep_holder);
+ this->create_excep_operation (get_operation,
+ response_handler,
+ excep_holder);
- if (!attribute->readonly ())
+ if (!attribute->readonly ())
{
be_operation *set_operation = this->generate_set_operation (attribute);
this->create_response_handler_operation (set_operation,
@@ -771,26 +794,29 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node,
response_handler,
excep_holder);
}
- */
+*/
}
else
{
-
be_operation* operation = be_operation::narrow_from_decl (d);
+
if (operation)
{
this->create_response_handler_operation (operation,
response_handler);
- /* this->create_excep_operation (be_operation::narrow_from_decl (d),
- response_handler,
- excep_holder);
+ /*
+ this->create_excep_operation (be_operation::narrow_from_decl (d),
+ response_handler,
+ excep_holder);
*/
}
}
+
si->next ();
} // end of while loop
+
delete si;
} // end of if
@@ -816,36 +842,35 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node,
}
// Create the return type, which is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier ("void"),
- 0),
- 0);
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
// Name the operation properly
UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *,
excep_holder->name ()-> copy ());
ACE_CString new_local_name ("raise_");
+
if (operation_kind == SET_OPERATION)
- new_local_name += "set_";
+ {
+ new_local_name += "set_";
+ }
else if (operation_kind == GET_OPERATION)
- new_local_name += "get_";
- new_local_name += node
- ->name ()
- ->last_component ()
- ->get_string ();
-
- op_name->nconc (new UTL_ScopedName (
- new Identifier (
- new_local_name.rep ()),
+ {
+ new_local_name += "get_";
+ }
+
+ new_local_name += node->name ()->last_component ()->get_string ();
+
+ op_name->nconc (new UTL_ScopedName (new Identifier (new_local_name.rep ()),
0));
be_operation *operation = new be_operation (rt,
AST_Operation::OP_noflags,
op_name,
0,
- 0,
0);
operation->set_name (op_name);
operation->set_defined_in (excep_holder);
@@ -865,9 +890,14 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node,
// Set the proper strategy
be_operation_strategy *old_strategy =
- operation->set_strategy (new be_operation_ami_exception_holder_raise_strategy (operation));
+ operation->set_strategy (
+ new be_operation_ami_exception_holder_raise_strategy (operation)
+ );
+
if (old_strategy)
- delete old_strategy;
+ {
+ delete old_strategy;
+ }
// After having generated the operation we insert it into the
// exceptionholder valuetype.
@@ -876,171 +906,43 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node,
return 0;
}
-/*
-be_operation *
-be_visitor_amh_pre_proc::create_sendc_operation (be_operation *node,
-int for_arguments)
-{
-if (node->flags () == AST_Operation::OP_oneway)
-// We do nothing for oneways!
-return 0;
-
-// Create the return type, which is "void"
-be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
-new UTL_ScopedName
-(new Identifier ("void", 1, 0, I_FALSE),
-0),
-0);
-
-// Create the new name
-// Prepend "sendc_" to the name of the operation
-ACE_CString original_op_name (node
-->name ()
-->last_component ()
-->get_string ());
-ACE_CString new_op_name = ACE_CString ("sendc_") + original_op_name;
-
-UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ());
-op_name->last_component ()->replace_string (new_op_name.rep ());
-
-// Create the operation
-be_operation * op = new be_operation (rt,
-AST_Operation::OP_noflags,
-op_name,
-0,
-0,
-0);
-
-// Create the first argument, which is a Response Handler
-
-if (for_arguments)
-{
-// Create the field type
-be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl ();
-
-// Add the pre- and suffix
-ACE_CString excep_holder_name;
-this->generate_name (excep_holder_name,
-"AMI_",
-parent
-->name ()
-->last_component ()
-->get_string (),
-"Handler");
-UTL_ScopedName *field_name = ACE_static_cast (UTL_ScopedName *, parent->name ()->copy ());
-field_name->last_component ()->replace_string (excep_holder_name.rep ());
-be_interface *field_type= new be_interface (field_name,
-0,
-0,
-0,
-0,
-0,
-0,
-0);
-field_type->set_defined_in (node->defined_in ());
-
-// Create the argument
-be_argument *arg = new be_argument (AST_Argument::dir_IN,
-field_type, // is also a valuetype
-new UTL_ScopedName (
-new Identifier (
-"ami_handler",
-1,
-0,
-I_FALSE
-),
-0
-),
-0);
-
-// Add the response handler to the argument list
-op->add_argument_to_scope (arg);
-
-}
-
-// Iterate over the arguments and put all the in and inout
-// into the new method.
-if (node->nmembers () > 0)
-{
-// initialize an iterator to iterate thru our scope
-UTL_ScopeActiveIterator *si;
-ACE_NEW_RETURN (si,
-UTL_ScopeActiveIterator (node,
-UTL_Scope::IK_decls),
-0);
-
-// continue until each element is visited
-while (!si->is_done ())
-{
-AST_Decl *d = si->item ();
-if (!d)
-{
-delete si;
-ACE_ERROR_RETURN ((LM_ERROR,
-"(%N:%l) be_visitor_amh_pre_proc::create_sendc_method - "
-"bad node in this scope\n"),
-0);
-
-}
-//be_decl *arg = be_decl::narrow_from_decl (d);
-AST_Argument *original_arg = AST_Argument::narrow_from_decl (d);
-
-if (original_arg->direction () == AST_Argument::dir_IN ||
-original_arg->direction () == AST_Argument::dir_INOUT)
-{
-// Create the argument
-be_argument *arg = new be_argument (AST_Argument::dir_IN,
-original_arg->field_type (),
-original_arg->name (),
-0);
-
-op->add_argument_to_scope (arg);
-}
-si->next ();
-} // end of while loop
-delete si;
-} // end of if
-
-return op;
-}
-*/
-
-
int
-be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node,
- be_interface *response_handler)
+be_visitor_amh_pre_proc::create_response_handler_operation (
+ be_operation *node,
+ be_interface *response_handler
+ )
{
if (!node)
- return -1;
+ {
+ return -1;
+ }
if (node->flags () == AST_Operation::OP_oneway)
- // We do nothing for oneways!
- return 0;
+ {
+ // We do nothing for oneways!
+ return 0;
+ }
// Create the return type, which is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier ("void") //, 1, 0, I_FALSE)
- , 0),
- 0);
-
- ACE_CString original_op_name (node
- ->name ()
- ->last_component ()
- ->get_string ());
-
- UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, response_handler->name ()-> copy ());
- op_name->nconc (new UTL_ScopedName (
- new Identifier (
- original_op_name.rep ()) //, 1, 0, I_FALSE),
- , 0));
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
+
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+
+ UTL_ScopedName *op_name =
+ ACE_static_cast (UTL_ScopedName *, response_handler->name ()-> copy ());
+ op_name->nconc (new UTL_ScopedName (new Identifier (original_op_name.rep ()),
+ 0));
// Create the operation
be_operation *operation = new be_operation (rt,
AST_Operation::OP_noflags,
op_name,
0,
- 0,
0);
operation->set_name (op_name);
@@ -1050,12 +952,11 @@ be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node,
{
// Create the argument
- be_argument *arg = new be_argument (AST_Argument::dir_IN,
- node->return_type (),
- new UTL_ScopedName
- (new Identifier ("return_value") //, 1, 0, I_FALSE)
- , 0),
- 0);
+ be_argument *arg =
+ new be_argument (AST_Argument::dir_IN,
+ node->return_type (),
+ new UTL_ScopedName (new Identifier ("return_value"),
+ 0));
// Add the response handler to the argument list
operation->add_argument_to_scope (arg);
@@ -1076,15 +977,18 @@ be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node,
while (!si->is_done ())
{
AST_Decl *d = si->item ();
+
if (!d)
{
delete si;
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::create_response_handler_operation - "
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "create_response_handler_operation - "
"bad node in this scope\n"),
-1);
}
+
//be_decl *arg = be_decl::narrow_from_decl (d);
AST_Argument *original_arg = AST_Argument::narrow_from_decl (d);
@@ -1094,23 +998,16 @@ be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node,
// Create the argument
be_argument *arg = new be_argument (AST_Argument::dir_IN,
original_arg->field_type (),
- original_arg->name (),
- 0);
+ original_arg->name ());
operation->add_argument_to_scope (arg);
}
si->next ();
} // end of while loop
+
delete si;
} // end of if
- /*
- // Set the proper strategy
- be_operation_strategy *old_strategy =
- operation->set_strategy (new be_operation_ami_handler_response_stub_strategy (operation));
- if (old_strategy)
- delete old_strategy;
-*/
operation->set_defined_in (response_handler);
// We do not copy the exceptions because the exceptions
@@ -1312,7 +1209,6 @@ be_visitor_amh_pre_proc::generate_get_operation (be_attribute *node)
AST_Operation::OP_noflags,
get_name,
0,
- 0,
0);
operation->set_name (get_name);
operation->set_defined_in (node->defined_in ());
@@ -1323,10 +1219,9 @@ be_visitor_amh_pre_proc::generate_get_operation (be_attribute *node)
be_operation *
be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node)
{
- ACE_CString original_op_name (node
- ->name ()
- ->last_component ()
- ->get_string ());
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
ACE_CString new_op_name = ACE_CString ("set_") + original_op_name;
UTL_ScopedName *set_name = ACE_static_cast (UTL_ScopedName *,
@@ -1334,17 +1229,15 @@ be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node)
set_name->last_component ()->replace_string (new_op_name.rep ());
// the return type is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier
- ("void"), 0),
- 0);
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
// argument type is the same as the attribute type
be_argument *arg = new be_argument (AST_Argument::dir_IN,
node->field_type (),
- set_name,
- 0);
+ set_name);
arg->set_name (node->name ());
// create the operation
@@ -1352,7 +1245,6 @@ be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node)
AST_Operation::OP_noflags,
set_name,
0,
- 0,
0);
operation->set_name (set_name);
operation->set_defined_in (node->defined_in ());
diff --git a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
index 2480039d9c1..d0dec09ed9a 100644
--- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
@@ -254,8 +254,7 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node)
inherit_vt->set_name (inherit_name);
be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"),
- 0),
- 0);
+ 0));
// Notice the valuetype "ExceptionHolder" that it is defined in the
// "Messaging" module
@@ -277,7 +276,6 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node)
be_valuetype *excep_holder = new be_valuetype (excep_holder_name, // name
p_intf, // list of inherited
1, // number of inherited
- 0, // pragmas
0); // set abstract
excep_holder->set_name (excep_holder_name);
@@ -359,14 +357,12 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node,
0, // number of inherited interfaces
0, // ancestors
0, // number of ancestors
- 0, // pragmas
0, // not local
0); // not abstract
inherit_intf->set_name (inherit_name);
be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"),
- 0),
- 0);
+ 0));
// Notice the interface "ReplyHandler" that it is defined in the
// "Messaging" module
@@ -392,7 +388,6 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node,
1, // number of inherited
p_intf, // list of ancestors
1, // number of ancestors
- 0, // pragmas
0, // non-local
0); // non-abstract
reply_handler->set_name (reply_handler_name);
@@ -491,11 +486,11 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node,
}
// Create the return type, which is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier ("void"),
- 0),
- 0);
+ be_predefined_type *rt = new be_predefined_type (
+ AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0)
+ );
// Name the operation properly
UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *,
@@ -520,7 +515,6 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node,
AST_Operation::OP_noflags,
op_name,
0,
- 0,
0);
operation->set_name (op_name);
operation->set_defined_in (excep_holder);
@@ -560,11 +554,11 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
return 0;
// Create the return type, which is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier ("void"),
- 0),
- 0);
+ be_predefined_type *rt = new be_predefined_type (
+ AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0)
+ );
// Create the new name
// Prepend "sendc_" to the name of the operation
@@ -582,7 +576,6 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
AST_Operation::OP_noflags,
op_name,
0,
- 0,
0);
// Create the first argument, which is a Reply Handler
@@ -609,20 +602,15 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
0,
0,
0,
- 0,
0);
field_type->set_defined_in (node->defined_in ());
// Create the argument
- be_argument *arg = new be_argument (AST_Argument::dir_IN,
- field_type, // is also a valuetype
- new UTL_ScopedName (
- new Identifier (
- "ami_handler"
- ),
- 0
- ),
- 0);
+ be_argument *arg =
+ new be_argument (AST_Argument::dir_IN,
+ field_type, // is also a valuetype
+ new UTL_ScopedName (new Identifier ("ami_handler"),
+ 0));
// Add the reply handler to the argument list
op->add_argument_to_scope (arg);
@@ -662,8 +650,7 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
// Create the argument
be_argument *arg = new be_argument (AST_Argument::dir_IN,
original_arg->field_type (),
- original_arg->name (),
- 0);
+ original_arg->name ());
op->add_argument_to_scope (arg);
}
@@ -691,11 +678,10 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node,
return 0;
// Create the return type, which is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier ("void"),
- 0),
- 0);
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
ACE_CString original_op_name (node
->name ()
@@ -713,7 +699,6 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node,
AST_Operation::OP_noflags,
op_name,
0,
- 0,
0);
operation->set_name (op_name);
@@ -723,13 +708,11 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node,
{
// Create the argument
- be_argument *arg = new be_argument (AST_Argument::dir_IN,
- node->return_type (),
- new UTL_ScopedName
- (new Identifier
- ("ami_return_val"),
- 0),
- 0);
+ be_argument *arg =
+ new be_argument (AST_Argument::dir_IN,
+ node->return_type (),
+ new UTL_ScopedName (new Identifier ("ami_return_val"),
+ 0));
// Add the reply handler to the argument list
operation->add_argument_to_scope (arg);
@@ -768,8 +751,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node,
// Create the argument
be_argument *arg = new be_argument (AST_Argument::dir_IN,
original_arg->field_type (),
- original_arg->name (),
- 0);
+ original_arg->name ());
operation->add_argument_to_scope (arg);
}
@@ -809,41 +791,32 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node,
return 0;
// Create the return type, which is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier ("void"),
- 0),
- 0);
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
// Create the argument
- be_argument *arg = new be_argument (AST_Argument::dir_IN,
- excep_holder, // is also a valuetype
- new UTL_ScopedName (
- new Identifier (
- "excep_holder"),
- 0),
- 0);
+ be_argument *arg =
+ new be_argument (AST_Argument::dir_IN,
+ excep_holder, // is also a valuetype
+ new UTL_ScopedName (new Identifier ("excep_holder"),
+ 0));
// Create the new name
// Append _execp to the name of the operation
- ACE_CString original_op_name (node
- ->name ()
- ->last_component ()
- ->get_string ());
+ ACE_CString original_op_name (node->name ()->last_component ()->get_string ());
ACE_CString new_op_name = original_op_name + ACE_CString ("_excep");
UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, reply_handler->name ()-> copy ());
- op_name->nconc (new UTL_ScopedName
- (new Identifier
- (new_op_name.rep ()),
- 0));
+ op_name->nconc (new UTL_ScopedName (new Identifier (new_op_name.rep ()),
+ 0));
// create the operation
be_operation *operation = new be_operation (rt,
AST_Operation::OP_noflags,
op_name,
0,
- 0,
0);
operation->set_name (op_name);
operation->add_argument_to_scope (arg);
@@ -983,7 +956,6 @@ be_visitor_ami_pre_proc::generate_get_operation (be_attribute *node)
AST_Operation::OP_noflags,
get_name,
0,
- 0,
0);
operation->set_name (get_name);
operation->set_defined_in (node->defined_in ());
@@ -1005,17 +977,15 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node)
set_name->last_component ()->replace_string (new_op_name.rep ());
// the return type is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier
- ("void"), 0),
- 0);
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
// argument type is the same as the attribute type
be_argument *arg = new be_argument (AST_Argument::dir_IN,
node->field_type (),
- set_name,
- 0);
+ set_name);
arg->set_name (node->name ());
// create the operation
@@ -1023,7 +993,6 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node)
AST_Operation::OP_noflags,
set_name,
0,
- 0,
0);
operation->set_name (set_name);
operation->set_defined_in (node->defined_in ());
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array.cpp b/TAO/TAO_IDL/be/be_visitor_array/array.cpp
index a23feda8a3f..b591c362a4f 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array.cpp
@@ -23,6 +23,7 @@
#include "be.h"
#include "be_visitor_array.h"
+#include "be_visitor_enum.h"
ACE_RCSID(be_visitor_array, array, "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
index 14f61f6631d..556c516f9c9 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
@@ -73,7 +73,6 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
be_operation *op = new be_operation (node->field_type (),
AST_Operation::OP_noflags,
node->name (),
- 0,
node->is_local (),
node->is_abstract ());
op->set_name ((UTL_IdList *) node->name ()->copy ());
@@ -218,22 +217,19 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
// Create the set method.
// the return type is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier
- ("void"), 0),
- 0);
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
// argument type is the same as the attribute type
be_argument *arg = new be_argument (AST_Argument::dir_IN,
node->field_type (),
- node->name (),
- 0);
+ node->name ());
arg->set_name ((UTL_IdList *) node->name ()->copy ());
// create the operation
op = new be_operation (rt,
AST_Operation::OP_noflags,
node->name (),
- 0,
node->is_local (),
node->is_abstract ());
op->set_name ((UTL_IdList *) node->name ()->copy ());
diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp
index b2b91d27be4..7a20344fa03 100644
--- a/TAO/TAO_IDL/be/be_visitor_factory.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp
@@ -262,7 +262,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_INTERFACE_FWD_ANY_OP_CH:
return new be_visitor_interface_fwd_any_op_ch (new_ctx);
-# ifdef IDL_HAS_VALUETYPE
+ // Valuetype-related visitors
case TAO_CodeGen::TAO_VALUETYPE_CH:
return new be_visitor_valuetype_ch (new_ctx);
@@ -271,12 +271,15 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_VALUETYPE_CI:
return new be_visitor_valuetype_ci (new_ctx);
-#if 0
case TAO_CodeGen::TAO_VALUETYPE_FWD_CH:
return new be_visitor_valuetype_fwd_ch (new_ctx);
case TAO_CodeGen::TAO_VALUETYPE_FWD_CI:
return new be_visitor_valuetype_fwd_ci (new_ctx);
-#endif /* 0 */
+
+ case TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH:
+ return new be_visitor_valuetype_fwd_cdr_op_ch (new_ctx);
+ case TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI:
+ return new be_visitor_valuetype_fwd_cdr_op_ci (new_ctx);
case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
return new be_visitor_valuetype_obv_ch (new_ctx);
@@ -304,13 +307,21 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI:
return new be_visitor_valuetype_cdr_op_ci (new_ctx);
case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS:
- return new be_visitor_decl (new_ctx); // noop
+ return new be_visitor_valuetype_cdr_op_cs (new_ctx);
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH:
case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS:
return new be_visitor_decl (new_ctx); // @@ TODO
-# endif /* IDL_HAS_VALUETYPE */
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CH:
+ return new be_visitor_valuetype_init_ch (new_ctx);
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CI:
+ return new be_visitor_valuetype_init_ci (new_ctx);
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_CS:
+ return new be_visitor_valuetype_init_cs (new_ctx);
+
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH:
+ return new be_visitor_valuetype_init_arglist_ch (new_ctx);
case TAO_CodeGen::TAO_STRUCT_CH:
return new be_visitor_structure_ch (new_ctx);
@@ -790,10 +801,3 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx)
}
}
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
-template class ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
-#pragma instantiate ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
index fd4a7b041f9..fc31f03ac39 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
@@ -43,6 +43,12 @@ be_visitor_module::~be_visitor_module (void)
// visit the Module node and its scope
int be_visitor_module::visit_module (be_module *node)
{
+ if (node->nmembers () == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_EMPTY_MODULE,
+ node);
+ }
+
// all we have to do is to visit the scope
if (this->visit_scope (node) == -1)
{
@@ -50,6 +56,7 @@ int be_visitor_module::visit_module (be_module *node)
"(%N:%l) be_visitor_module::visit_module - "
"codegen for scope failed\n"), -1);
}
+
return 0;
}
@@ -473,8 +480,6 @@ be_visitor_module::visit_interface_fwd (be_interface_fwd *node)
return 0;
}
-#ifdef IDL_HAS_VALUETYPE
-
// visit an valuetype
int
be_visitor_module::visit_valuetype (be_valuetype *node)
@@ -583,7 +588,7 @@ be_visitor_module::visit_valuetype (be_valuetype *node)
return 0;
}
-// visit an valuetype_fwd
+// visit a valuetype_fwd
int
be_visitor_module::visit_valuetype_fwd (be_valuetype_fwd *node)
{
@@ -604,21 +609,21 @@ be_visitor_module::visit_valuetype_fwd (be_valuetype_fwd *node)
case TAO_CodeGen::TAO_MODULE_CI:
ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CI);
break;
+ case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH);
+ break;
case TAO_CodeGen::TAO_MODULE_CDR_OP_CI:
ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI);
break;
case TAO_CodeGen::TAO_MODULE_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CS);
- break;
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
- case TAO_CodeGen::TAO_MODULE_CDR_OP_CH:
case TAO_CodeGen::TAO_MODULE_CS:
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
case TAO_CodeGen::TAO_MODULE_SS:
- case TAO_CodeGen::TAO_MODULE_IS:
case TAO_CodeGen::TAO_MODULE_IH:
+ case TAO_CodeGen::TAO_MODULE_IS:
return 0; // nothing to be done
default:
{
@@ -653,8 +658,6 @@ be_visitor_module::visit_valuetype_fwd (be_valuetype_fwd *node)
return 0;
}
-#endif /* IDL_HAS_VALUETYPE */
-
// visit an structure
int
be_visitor_module::visit_structure (be_structure *node)
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
index d57cf009866..9852c8857f5 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -143,7 +143,6 @@ int be_visitor_root::visit_root (be_root *node)
be_visitor *visitor;
be_visitor_context ctx (*this->ctx_);
-#ifdef IDL_HAS_VALUETYPE
// make one more pass over the entire tree and generate the OBV_ namespaces
// and OBV_ classes
@@ -187,7 +186,6 @@ int be_visitor_root::visit_root (be_root *node)
}
delete visitor;
}
-#endif /* IDL_HAS_VALUETYPE */
// The next thing we need to do is make one more pass thru the entire tree
// and generate code for all the <<= and >>= operators for all the
@@ -763,9 +761,7 @@ be_visitor_root::visit_interface_fwd (be_interface_fwd *node)
return 0;
}
-#ifdef IDL_HAS_VALUETYPE
-
-// visit an valuetype
+// visit a valuetype
int
be_visitor_root::visit_valuetype (be_valuetype *node)
{
@@ -901,8 +897,6 @@ be_visitor_root::visit_valuetype_fwd (be_valuetype_fwd *node)
ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI);
break;
case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CS);
- break;
case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
case TAO_CodeGen::TAO_ROOT_CS:
@@ -945,9 +939,7 @@ be_visitor_root::visit_valuetype_fwd (be_valuetype_fwd *node)
return 0;
}
-#endif /* IDL_HAS_VALUETYPE */
-
-// visit an module
+// visit a module
int
be_visitor_root::visit_module (be_module *node)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp
index 8c71efb085c..ae3536245da 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp
@@ -100,6 +100,18 @@ be_visitor_sequence_buffer_type::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_sequence_buffer_type::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_sequence_buffer_type::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
be_visitor_sequence_buffer_type::visit_string (be_string *node)
{
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
index 399992eadfb..3258ee8ddc0 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
@@ -266,6 +266,18 @@ be_visitor_sequence_cdr_op_cs::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_sequence_cdr_op_cs::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_cdr_op_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
be_visitor_sequence_cdr_op_cs::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp
index 7ce182d7966..1232a499956 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp
@@ -142,6 +142,33 @@ be_visitor_sequence_elemtype::visit_interface (be_interface *node)
}
int
+be_visitor_sequence_elemtype::visit_valuetype (be_valuetype *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
+ {
+ *os << "TAO_Valuetype_Manager<";
+ *os << bt->nested_type_name (this->ctx_->scope ()) << ", ";
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var") << ">";
+ }
+ else
+ {
+ *os << "TAO_Valuetype_Manager<";
+ *os << bt->name () << ", ";
+ *os << bt->name () << "_var>";
+ }
+
+ return 0;
+}
+
+int
be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -169,6 +196,33 @@ be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_sequence_elemtype::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_type *bt;
+
+ if (this->ctx_->alias ())
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH)
+ {
+ *os << "TAO_Valuetype_Manager<";
+ *os << bt->nested_type_name (this->ctx_->scope ()) << ",";
+ *os << bt->nested_type_name (this->ctx_->scope (), "_var") << ">";
+ }
+ else
+ {
+ *os << "TAO_Valuetype_Manager<";
+ *os << bt->name () << ",";
+ *os << bt->name () << "_var>";
+ }
+
+ return 0;
+}
+
+int
be_visitor_sequence_elemtype::visit_string (be_string *node)
{
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp
index 7e00afcdf5e..ffdbd9d742d 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp
@@ -113,6 +113,7 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
&& prim && prim->pt () == AST_PredefinedType::PT_pseudo
&& ACE_OS::strcmp (prim->local_name ()->get_string (),
"Object") != 0;
+ int is_valuetype = 0;
// operator[]
if (is_pseudo_object)
@@ -121,6 +122,19 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
}
else
{
+ be_interface *bf = be_interface::narrow_from_decl (pt);
+ if (bf != 0)
+ is_valuetype = bf->is_valuetype ();
+ else
+ {
+ be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
+ if (bff != 0)
+ is_valuetype = bff->is_valuetype ();
+ }
+
+ if (is_valuetype)
+ *os << "TAO_Valuetype_Manager<";
+ else
*os << "TAO_Object_Manager<";
}
@@ -171,7 +185,7 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node)
<< "CORBA::ULong ol" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl;
- if (!is_pseudo_object)
+ if (! (is_pseudo_object || is_valuetype))
{
// Pseudo objects do not require these methods.
*os << "virtual void _downcast (" << be_idt << be_idt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp
index 6d0af4f55a4..73c86e19f8e 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp
@@ -151,7 +151,24 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "buf[i] = ";
- if (bt_is_defined)
+ int is_valuetype = 0;
+ {
+ be_interface *bf = be_interface::narrow_from_decl (pt);
+ if (bf != 0)
+ is_valuetype = bf->is_valuetype ();
+ else
+ {
+ be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
+ if (bff != 0)
+ is_valuetype = bff->is_valuetype ();
+ }
+ }
+
+ if (is_valuetype)
+ {
+ *os << "0;";
+ }
+ else if (bt_is_defined)
{
bt->accept (visitor);
@@ -180,7 +197,14 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "if (buffer[i] != ";
- if (bt_is_defined)
+ if (is_valuetype)
+ {
+ *os << "0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "buffer[i]->_remove_ref ();" << be_nl
+ << "buffer[i] = 0;" << be_uidt_nl;
+ }
+ else if (bt_is_defined)
{
bt->accept (visitor);
@@ -256,9 +280,17 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
*os << "** ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< "for (CORBA::ULong i = 0; i < rhs.length_; i++)" << be_idt_nl
- << "{" << be_idt_nl
- << "tmp1[i] = ";
+ << "{" << be_idt_nl;
+ if (is_valuetype)
+ {
+ *os << "if (tmp2[i] != 0)" << be_idt_nl
+ << "tmp2[i]->_add_ref ();" << be_uidt_nl
+ << "tmp1[i] = tmp2[i];";
+ }
+ else
+ {
+ *os << "tmp1[i] = ";
if (bt_is_defined)
{
bt->accept (visitor);
@@ -269,6 +301,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
{
*os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
}
+ }
*os << be_uidt_nl
<< "}" << be_uidt_nl << be_nl
@@ -304,7 +337,13 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (bt_is_defined)
+ if (is_valuetype)
+ {
+ *os << "if (tmp[i] != 0)" << be_idt_nl
+ << "tmp[i]->_remove_ref ();" << be_uidt_nl
+ << "tmp[i] = 0;";
+ }
+ else if (bt_is_defined)
{
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
@@ -346,9 +385,17 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
*os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< "for (CORBA::ULong i=0; i < rhs.length_; ++i)" << be_idt_nl
- << "{" << be_idt_nl
- << "tmp1[i] = ";
+ << "{" << be_idt_nl;
+ if (is_valuetype)
+ {
+ *os << "if (tmp2[i] != 0)" << be_idt_nl
+ << "tmp2[i]->_add_ref ();" << be_uidt_nl
+ << "tmp1[i] = tmp2[i];";
+ }
+ else
+ {
+ *os << "tmp1[i] = ";
if (bt_is_defined)
{
bt->accept (visitor);
@@ -359,6 +406,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
{
*os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
}
+ }
*os << be_uidt_nl
<< "}" << be_uidt_nl << be_nl
@@ -374,7 +422,6 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
&& prim && prim->pt () == AST_PredefinedType::PT_pseudo
&& ACE_OS::strcmp (prim->local_name ()->get_string (),
"Object") != 0;
-
// operator[].
if (is_pseudo_object)
{
@@ -382,6 +429,9 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
}
else
{
+ if (is_valuetype)
+ *os << "TAO_Valuetype_Manager<";
+ else
*os << "ACE_INLINE TAO_Object_Manager<";
}
@@ -406,6 +456,9 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node)
}
else
{
+ if (is_valuetype)
+ *os << "return TAO_Valuetype_Manager<";
+ else
*os << "return TAO_Object_Manager<";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp
index 5bf1fa9988d..09ca692b39e 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp
@@ -80,6 +80,19 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
bt_is_defined = ibt->is_defined ();
}
+ int is_valuetype = 0;
+ {
+ be_interface *bf = be_interface::narrow_from_decl (pt);
+ if (bf != 0)
+ is_valuetype = bf->is_valuetype ();
+ else
+ {
+ be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
+ if (bff != 0)
+ is_valuetype = bff->is_valuetype ();
+ }
+ }
+
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
@@ -179,7 +192,13 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node)
<< "for (CORBA::ULong i = nl; i < ol; ++i)" << be_nl
<< "{" << be_idt_nl;
- if (bt_is_defined)
+ if (is_valuetype)
+ {
+ *os << "if (tmp[i] != 0)" << be_idt_nl
+ << "tmp[i]->_remove_ref ();" << be_uidt_nl
+ << "tmp[i] = 0;";
+ }
+ else if (bt_is_defined)
{
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp
index eeaa464acf9..e2f621e3aff 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp
@@ -118,6 +118,7 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
&& prim && prim->pt () == AST_PredefinedType::PT_pseudo
&& ACE_OS::strcmp (prim->local_name ()->get_string (),
"Object") != 0;
+ int is_valuetype = 0;
if (is_pseudo_object)
{
@@ -125,6 +126,19 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
}
else
{
+ be_interface *bf = be_interface::narrow_from_decl (pt);
+ if (bf != 0)
+ is_valuetype = bf->is_valuetype ();
+ else
+ {
+ be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
+ if (bff != 0)
+ is_valuetype = bff->is_valuetype ();
+ }
+
+ if (is_valuetype)
+ *os << "TAO_Valuetype_Manager<";
+ else
*os << "TAO_Object_Manager<";
}
@@ -176,7 +190,7 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node)
<< "CORBA::ULong ol" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl;
- if (!is_pseudo_object)
+ if (! (is_pseudo_object || is_valuetype))
{
// Pseudo objects do not require these methods.
*os << "virtual void _downcast (" << be_idt << be_idt_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp
index aefb0f1509a..d3801f4644a 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp
@@ -147,7 +147,24 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "{" << be_idt_nl
<< "buf[i] = ";
- if (bt_is_defined)
+ int is_valuetype = 0;
+ {
+ be_interface *bf = be_interface::narrow_from_decl (pt);
+ if (bf != 0)
+ is_valuetype = bf->is_valuetype ();
+ else
+ {
+ be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
+ if (bff != 0)
+ is_valuetype = bff->is_valuetype ();
+ }
+ }
+
+ if (is_valuetype)
+ {
+ *os << "0;";
+ }
+ else if (bt_is_defined)
{
bt->accept (visitor);
@@ -233,9 +250,17 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
*os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < rhs.length_; ++i)" << be_idt_nl
- << "{" << be_idt_nl
- << "tmp1[i] = ";
+ << "{" << be_idt_nl;
+ if (is_valuetype)
+ {
+ *os << "if (tmp2[i] != 0)" << be_idt_nl
+ << "tmp2[i]->_add_ref ();" << be_uidt_nl
+ << "tmp1[i] = tmp2 [i];";
+ }
+ else
+ {
+ *os << "tmp1[i] = ";
if (bt_is_defined)
{
bt->accept (visitor);
@@ -246,6 +271,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
{
*os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
}
+ }
*os << be_uidt_nl
<< "}" << be_uidt_nl << be_nl
@@ -280,7 +306,13 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_nl
<< "{" << be_idt_nl;
- if (bt_is_defined)
+ if (is_valuetype)
+ {
+ *os << "if (tmp[i] != 0)" << be_idt_nl
+ << "tmp[i]->_remove_ref ();" << be_uidt_nl
+ << "tmp[i] = 0;";
+ }
+ else if (bt_is_defined)
{
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
@@ -329,9 +361,17 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
*os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl
<< be_nl
<< "for (CORBA::ULong i = 0; i < rhs.length_; ++i)" << be_idt_nl
- << "{" << be_idt_nl
- << "tmp1[i] = ";
+ << "{" << be_idt_nl;
+ if (is_valuetype)
+ {
+ *os << "if (tmp2[i] != 0)" << be_idt_nl
+ << "tmp2[i]->_add_ref ();" << be_uidt_nl
+ << "tmp1[i] = tmp2 [i];";
+ }
+ else
+ {
+ *os << "tmp1[i] = ";
if (bt_is_defined)
{
bt->accept (visitor);
@@ -342,7 +382,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
{
*os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);";
}
-
+ }
*os << be_uidt_nl
<< "}" << be_uidt_nl << be_nl
<< "return *this;" << be_uidt_nl
@@ -356,13 +396,15 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
&& prim && prim->pt () == AST_PredefinedType::PT_pseudo
&& ACE_OS::strcmp (prim->local_name ()->get_string (),
"Object") != 0;
-
if (is_pseudo_object)
{
*os << "ACE_INLINE TAO_Pseudo_Object_Manager<";
}
else
{
+ if (is_valuetype)
+ *os << "ACE_INLINE TAO_Valuetype_Manager<";
+ else
*os << "ACE_INLINE TAO_Object_Manager<";
}
@@ -388,6 +430,9 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node)
}
else
{
+ if (is_valuetype)
+ *os << "return TAO_Valuetype_Manager<";
+ else
*os << "return TAO_Object_Manager<";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp
index fc74d1b974c..00d7afbae3b 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp
@@ -79,6 +79,19 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
bt_is_defined = ibt->is_defined ();
}
+ int is_valuetype = 0;
+ {
+ be_interface *bf = be_interface::narrow_from_decl (pt);
+ if (bf != 0)
+ is_valuetype = bf->is_valuetype ();
+ else
+ {
+ be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt);
+ if (bff != 0)
+ is_valuetype = bff->is_valuetype ();
+ }
+ }
+
const char * class_name = node->instance_name ();
static char full_class_name [NAMEBUFSIZE];
@@ -140,9 +153,17 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl
<< "{" << be_idt_nl
<< "if (!this->release_)" << be_idt_nl
- << "{" << be_idt_nl
- << "tmp[i] = ";
+ << "{" << be_idt_nl;
+ if (is_valuetype)
+ {
+ *os << "if (old[i] != 0)" << be_idt_nl
+ << "old[i]->_add_ref ();" << be_uidt_nl
+ << "tmp[i] = old[i];";
+ }
+ else
+ {
+ *os << "tmp[i] = ";
if (bt_is_defined)
{
bt->accept (visitor);
@@ -153,6 +174,7 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
{
*os << "tao_" << pt->flat_name () << "_duplicate (old[i]);";
}
+ }
*os << be_uidt_nl
<< "}" << be_uidt_nl
@@ -187,7 +209,13 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (bt_is_defined)
+ if (is_valuetype)
+ {
+ *os << "if (tmp[i] != 0)" << be_idt_nl
+ << "tmp[i]->_remove_ref ();" << be_uidt_nl
+ << "tmp[i] = 0;";
+ }
+ else if (bt_is_defined)
{
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
@@ -233,7 +261,13 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
<< "for (CORBA::ULong i = nl; i < ol; ++i)" << be_idt_nl
<< "{" << be_idt_nl;
- if (bt_is_defined)
+ if (is_valuetype)
+ {
+ *os << "if (tmp[i] != 0)" << be_idt_nl
+ << "tmp[i]->_remove_ref ();" << be_uidt_nl
+ << "tmp[i] = 0;";
+ }
+ else if (bt_is_defined)
{
*os << "CORBA::release (tmp[i]);" << be_nl
<< "tmp[i] = ";
@@ -256,7 +290,8 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node)
be_predefined_type *prim = be_predefined_type::narrow_from_decl (pt);
- if ((pt->node_type () != AST_Decl::NT_pre_defined) ||
+ if (! is_valuetype
+ && (pt->node_type () != AST_Decl::NT_pre_defined) ||
(prim && (prim->pt () == AST_PredefinedType::PT_pseudo) &&
(!ACE_OS::strcmp (prim->local_name ()->get_string (), "Object"))))
{
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp
index e1abbe883f1..cef298252f5 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp
@@ -108,6 +108,18 @@ be_visitor_sequence_base::visit_interface_fwd (be_interface_fwd *node)
}
int
+be_visitor_sequence_base::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_node (node);
+}
+
+int
+be_visitor_sequence_base::visit_valuetype_fwd (be_valuetype_fwd *node)
+{
+ return this->visit_node (node);
+}
+
+int
be_visitor_sequence_base::visit_string (be_string *)
{
// NO-OP, we have ad-hoc classes from strings.
@@ -163,22 +175,6 @@ be_visitor_sequence_base::visit_typedef (be_typedef *node)
return 0;
}
-#if defined(IDL_HAS_VALUETYPE)
-
-int
-be_visitor_sequence_base::visit_valuetype (be_valuetype *node)
-{
- return this->visit_node (node);
-}
-
-int
-be_visitor_sequence_base::visit_valuetype_fwd (be_valuetype_fwd *node)
-{
- return this->visit_node (node);
-}
-#endif /*IDL_HAS_VALUETYPE*/
-
-
be_visitor_sequence_base_template_args::
be_visitor_sequence_base_template_args (be_visitor_context *ctx,
be_sequence *seq)
@@ -256,6 +252,20 @@ be_visitor_sequence_base_template_args::visit_interface_fwd (
}
int
+be_visitor_sequence_base_template_args::visit_valuetype (be_valuetype *node)
+{
+ return this->visit_interface (node);
+}
+
+int
+be_visitor_sequence_base_template_args::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ return this->visit_interface_fwd (node);
+}
+
+int
be_visitor_sequence_base_template_args::visit_predefined_type (
be_predefined_type *node
)
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 a516a5ab189..a61157f193c 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
@@ -90,6 +90,17 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node)
}
break;
+ case be_sequence::MNG_VALUE:
+ if (node->unbounded ())
+ {
+ *os << "TAO_Unbounded_Valuetype_Sequence<";
+ }
+ else
+ {
+ *os << "TAO_Bounded_Valuetype_Sequence<";
+ }
+
+ break;
case be_sequence::MNG_STRING:
if (node->unbounded ())
{
@@ -225,6 +236,7 @@ be_visitor_sequence_ch::instantiate_sequence (be_sequence *node)
{
case be_sequence::MNG_PSEUDO:
case be_sequence::MNG_OBJREF:
+ case be_sequence::MNG_VALUE:
if (node->unbounded ())
{
this->gen_unbounded_obj_sequence (node);
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 151610e5c37..397f094f9c8 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp
@@ -114,6 +114,7 @@ be_visitor_sequence_ci::instantiate_sequence (be_sequence *node)
{
case be_sequence::MNG_PSEUDO:
case be_sequence::MNG_OBJREF:
+ case be_sequence::MNG_VALUE:
if (node->unbounded ())
{
this->gen_unbounded_obj_sequence (node);
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
index ba0e7ecb4e6..e02b632b837 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp
@@ -83,6 +83,12 @@ be_visitor_sequence_cs::gen_base_sequence_class (be_sequence *node)
else
*os << "TAO_Bounded_Pseudo_Sequence<";
break;
+ case be_sequence::MNG_VALUE:
+ if (node->unbounded ())
+ *os << "TAO_Unbounded_Valuetype_Sequence<";
+ else
+ *os << "TAO_Bounded_Valuetype_Sequence<";
+ break;
case be_sequence::MNG_STRING:
if (node->unbounded ())
*os << "TAO_Unbounded_String_Sequence";
@@ -341,6 +347,7 @@ be_visitor_sequence_cs::instantiate_sequence (be_sequence *node)
{
case be_sequence::MNG_PSEUDO:
case be_sequence::MNG_OBJREF:
+ case be_sequence::MNG_VALUE:
if (node->unbounded ())
this->gen_unbounded_obj_sequence (node);
else
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
index 5012a6f795b..9267ece581e 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
@@ -30,12 +30,3 @@
ACE_RCSID(be, be_visitor_typecode, "$Id$")
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Node<be_visitor_typecode_defn::QNode*>;
-template class ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*>;
-template class ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Node<be_visitor_typecode_defn::QNode*>
-#pragma instantiate ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*>
-#pragma instantiate ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
index 314d324164e..084e20f9aa3 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp
@@ -206,30 +206,37 @@ int
be_visitor_union_cdr_op_ci::pre_process (be_decl *bd)
{
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_SCOPE)
- return 0;
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
be_union_branch* b =
be_union_branch::narrow_from_decl (bd);
- for (unsigned long i = 0;
- i < b->label_list_length ();
- ++i)
+ for (unsigned long i = 0; i < b->label_list_length (); ++i)
{
// check if we are printing the default case
if (b->label (i)->label_kind () == AST_UnionLabel::UL_default)
- *os << "default:";
+ {
+ *os << "default:";
+ }
else
{
*os << "case ";
b->gen_label_value (os, i);
*os << ":";
}
+
if (i == (b->label_list_length () - 1))
- *os << be_idt_nl;
+ {
+ *os << be_idt_nl;
+ }
else
- *os << be_nl;
+ {
+ *os << be_nl;
+ }
}
*os << "{" << be_idt_nl;
@@ -237,10 +244,12 @@ be_visitor_union_cdr_op_ci::pre_process (be_decl *bd)
}
int
-be_visitor_union_cdr_op_ci::post_process (be_decl *)
+be_visitor_union_cdr_op_ci::post_process (be_decl *bd)
{
if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_SCOPE)
- return 0;
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
index 05c2f5658e4..9b587156792 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
@@ -23,8 +23,6 @@
#include "idl_extern.h"
#include "be.h"
-#ifdef IDL_HAS_VALUETYPE
-
#include "be_visitor_valuetype.h"
#include "be_visitor_valuetype/valuetype.cpp"
@@ -36,6 +34,7 @@
#include "be_visitor_valuetype/valuetype_cs.cpp"
#include "be_visitor_valuetype/cdr_op_ch.cpp"
#include "be_visitor_valuetype/cdr_op_ci.cpp"
+#include "be_visitor_valuetype/cdr_op_cs.cpp"
#include "be_visitor_valuetype/marshal_ch.cpp"
#include "be_visitor_valuetype/marshal_cs.cpp"
#include "be_visitor_valuetype/arglist.cpp"
@@ -47,6 +46,10 @@
#include "be_visitor_valuetype/obv_module.cpp"
#include "be_visitor_valuetype/ami_exception_holder_ch.cpp"
#include "be_visitor_valuetype/ami_exception_holder_cs.cpp"
+#include "be_visitor_valuetype/valuetype_init.cpp"
+#include "be_visitor_valuetype/valuetype_init_ch.cpp"
+#include "be_visitor_valuetype/valuetype_init_ci.cpp"
+#include "be_visitor_valuetype/valuetype_init_cs.cpp"
+#include "be_visitor_valuetype/valuetype_init_arglist_ch.cpp"
-#endif /* IDL_HAS_VALUETYPE */
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp
index a448991e636..33aff951ba3 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp
@@ -76,24 +76,6 @@ be_visitor_valuetype_ami_exception_holder_ch::visit_valuetype (be_valuetype *nod
*os << be_uidt_nl
<< "};" << be_nl << be_nl;
-
- // Create code for the valuetype factory
-
- *os << "class " << node->local_name () << "_factory" << be_idt_nl
- << ": public "
- << node->full_name () << "_init" << be_uidt_nl
- << "{" << be_idt_nl
- << "friend class " << node->local_name () << ";" << be_uidt_nl
- << "public:" << be_idt_nl
- << "// create (...) would go here" << be_nl
- << be_uidt_nl << "private:" << be_idt_nl;
-
- *os << "virtual ~" << node->local_name () << "_factory ();" << be_nl << be_nl;
-
- *os << "TAO_OBV_CREATE_RETURN_TYPE (" << node->local_name ()
- << ") create_for_unmarshal ();" << be_nl << be_uidt_nl
- << "};" << be_uidt_nl;
-
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp
index 02bf3872d27..8d22f9cdae1 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp
@@ -70,30 +70,6 @@ be_visitor_valuetype_ami_exception_holder_cs::visit_valuetype (be_valuetype *nod
"codegen for scope failed\n"), -1);
}
-
- // Create the code for the valuetype factory
- os->indent ();
-
- if (node->is_nested () &&
- node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
- *os << "OBV_";
-
- *os << node->full_name () << "_factory::~" << node->local_name () << "_factory ()"
- << "{ }" << be_nl << be_nl;
-
- *os << "TAO_OBV_CREATE_RETURN_TYPE (" << node->local_name () << ")" << be_nl;
-
- if (node->is_nested () &&
- node->defined_in ()->scope_node_type () == AST_Decl::NT_module)
- *os << "OBV_";
-
- *os << node->full_name () << "_factory::create_for_unmarshal ()" << be_nl
- << "{" << be_idt_nl
- << "//return 0;" << be_nl
- << "return new " << node->compute_local_name ("_tao_", "") << ";" << be_uidt_nl
- << "}" << be_nl
- << "\n";
-
return 0;
}
@@ -104,6 +80,7 @@ be_visitor_valuetype_ami_exception_holder_cs::visit_operation (be_operation *nod
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS);
be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
if (!visitor)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -122,6 +99,7 @@ be_visitor_valuetype_ami_exception_holder_cs::visit_operation (be_operation *nod
"codegen for argument list failed\n"),
-1);
}
+
delete visitor;
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
index 16a266dfc79..9e668a4b1ec 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
@@ -102,17 +102,17 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
{
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
// Each method is pure virtual in the Valuetype class.
- *os << " = 0;" << be_uidt_nl;
+ *os << " = 0;" << be_nl;
break;
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH:
break;
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS:
break;
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CH:
- *os << ";\n";
+ *os << ";" << be_nl;
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CS:
default:
- *os << "\n";
+ *os << be_nl;
}
if (!this->ctx_->attribute ()) // hack to get a nice newline
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
index b23d0243509..6d0eb38c78f 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp
@@ -42,20 +42,39 @@ be_visitor_valuetype_cdr_op_ch::~be_visitor_valuetype_cdr_op_ch (void)
int
be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node)
{
- if (node->cli_hdr_cdr_op_gen () || node->imported ())
- return 0;
+ if (node->imported ())
+ {
+ return 0;
+ }
TAO_OutStream *os = this->ctx_->stream ();
+ os->indent (); //start with whatever indentation level we are at now
+
+ if (!node->cli_hdr_cdr_op_gen ())
+ {
+ // Generate helper functions declaration.
+ if (node->gen_helper_header () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cdr_op_ch::"
+ "visit_valuetype - "
+ "codegen for helper functions failed\n"), -1);
+ }
- // generate the CDR << and >> operator declarations (prototypes)
+ // generate the CDR << and >> operator declarations (prototypes)
- os->indent ();
- *os << be_global->stub_export_macro () << " CORBA::Boolean"
- << " operator<< (TAO_OutputCDR &, const " << node->full_name ()
- << " *); // " << be_nl;
- *os << be_global->stub_export_macro () << " CORBA::Boolean"
- << " operator>> (TAO_InputCDR &, "
- << node->full_name () << " *&);\n";
+ os->indent (); //start with whatever indentation level we are at now
+
+ *os << be_global->stub_export_macro ()
+ << "CORBA::Boolean operator<< (TAO_OutputCDR &, const "
+ << node->full_name () << " *);" << be_nl;
+
+ *os << be_global->stub_export_macro ()
+ << "CORBA::Boolean operator>> (TAO_InputCDR &, "
+ << node->full_name () << " *&);" << be_nl;
+
+ node->cli_hdr_cdr_op_gen (1);
+ }
// set the substate as generating code for the types defined in our scope
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE);
@@ -66,17 +85,17 @@ be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node)
"(%N:%l) be_visitor_valuetype_cdr_op_ch::"
"visit_valuetype - "
"codegen for scope failed\n"), -1);
- }
-
+ }
+ //@@ Boris: that's suck!
if (!node->is_abstract_valuetype ())
- { // functions that marshal state
+ {
+ // functions that marshal state
be_visitor_context* new_ctx =
new be_visitor_context (*this->ctx_);
be_visitor_valuetype_marshal_ch visitor (new_ctx);
visitor.visit_valuetype (node);
- }
+ }
- node->cli_hdr_cdr_op_gen (1);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
index 69b995d08c8..074f7c95084 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp
@@ -47,7 +47,37 @@ be_visitor_valuetype_cdr_op_ci::visit_valuetype (be_valuetype *node)
if (node->cli_inline_cdr_op_gen () || node->imported ())
return 0;
+ // Generate helper functions implementation.
+ if (node->gen_helper_inline () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cdr_op_ci::"
+ "visit_valuetype - "
+ "codegen for helper functions failed\n"), -1);
+ }
+
TAO_OutStream *os = this->ctx_->stream ();
+ os->indent (); //start with whatever indentation level we are at now
+
+ // Generate CDR << and >> operator signatures
+
+ //@@ Boris: Can I move this to be_valuetype? (as with _var, _out, etc?)
+
+ //This is just declaration so no ACE_INLINE
+ *os << be_global->stub_export_macro ()
+ << "CORBA::Boolean operator<< (TAO_OutputCDR &, const "
+ << node->full_name () << " *);" << be_nl;
+
+ *os << be_global->stub_export_macro ()
+ << "CORBA::Boolean operator>> (TAO_InputCDR &, "
+ << node->full_name () << " *&);" << be_nl;
+
+
+
+ // Generate marshaling code if any
+
+ // @@ Boris: the next statement is patrue anymore since I moved code
+ // to stubs.
// First generate code for our children. The reason we do this first is
// because the inlined code for our children must be available before we use
@@ -64,50 +94,6 @@ be_visitor_valuetype_cdr_op_ci::visit_valuetype (be_valuetype *node)
"codegen for scope failed\n"), -1);
}
- // set the sub state as generating code for the output operator
- this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
- os->indent ();
- *os << "ACE_INLINE CORBA::Boolean" << be_nl
- << "operator<< (TAO_OutputCDR &strm, const "
- << node->full_name ()
- << " *_tao_valuetype)" << be_nl
- << "{" << be_idt_nl;
- *os << "return CORBA_ValueBase::_tao_marshal (strm," << be_idt_nl
- << "ACE_const_cast (" << node->full_name () << "*, _tao_valuetype)," << be_nl
- << "(ptr_arith_t) &" << node->full_name() <<"::_downcast);"
- << be_uidt<< be_uidt_nl
- << "}\n\n";
-
- // set the substate as generating code for the input operator
- //this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
- *os << "ACE_INLINE CORBA::Boolean" << be_nl
- << "operator>> (TAO_InputCDR &strm, "
- << node->full_name ()
- << " *&_tao_valuetype)" << be_nl
- << "{" << be_idt_nl;
- *os << "return " << node->full_name() << "::_tao_unmarshal (strm, _tao_valuetype);"
-#ifdef obv_marshal_old_version
- *os << "CORBA::ValueBase *ptr;" << be_nl
- << "int retval = CORBA_ValueBase::_tao_unmarshal (strm,"
- << be_idt_nl << "ptr, (ptr_arith_t) &" << node->full_name() <<"::_downcast);"
- << be_uidt_nl
- << "if (retval) {" << be_idt_nl
- << "_tao_valuetype = " << node->full_name() << "::_downcast (ptr);"
- << be_nl << "if (_tao_valuetype) retval = 1;"
- << be_uidt_nl << "}" << be_idt_nl
- << "return retval;"
-#endif /* obv_marshal_old_version */
- << be_uidt_nl
- << "}\n\n";
-
- if (!node->is_abstract_valuetype ())
- { // functions that marshal state
- be_visitor_context* new_ctx =
- new be_visitor_context (*this->ctx_);
- be_visitor_valuetype_marshal_cs visitor (new_ctx);
- visitor.visit_valuetype (node);
- }
-
- node->cli_inline_cdr_op_gen (1);
+ node->cli_inline_cdr_op_gen (I_TRUE);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp
index bfa8140455d..4bd7adf690b 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp
@@ -404,7 +404,7 @@ be_visitor_valuetype_field_cs::visit_valuetype (be_valuetype *node)
<< "* val)// set" << be_nl
<< "{\n";
os->incr_indent ();
- *os << "if (val) val->_add_ref ();" << be_nl
+ *os << "CORBA::add_ref (val);" << be_nl
<< "this->"
<< bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
<< " = val;" << be_uidt_nl;
@@ -455,28 +455,28 @@ be_visitor_valuetype_field_cs::visit_valuetype_fwd (be_valuetype_fwd *node)
// set method
os->indent (); // start from current indentation
*os << "// accessor to set the member" << be_nl
- << this->pre_op() << "void" << be_nl;
- this->op_name(bu,os);
+ << this->pre_op () << "void" << be_nl;
+ this->op_name (bu, os);
*os << "::" << ub->local_name () << " (" << bt->name ()
<< "* val)// set" << be_nl
<< "{\n";
os->incr_indent ();
- *os << "if (val) val->_add_ref ();" << be_nl
+ *os << "CORBA::add_ref (val);" << be_nl
<< "this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix()
<< " = val;" << be_uidt_nl;
*os << "}" << be_nl;
// get method
*os << "// retrieve the member" << be_nl
- << this->pre_op() << bt->name () << "* " << be_nl;
- this->op_name(bu,os);
+ << this->pre_op () << bt->name () << "* " << be_nl;
+ this->op_name (bu, os);
*os << "::" << ub->local_name () << " () const"
<< be_nl
<< "{\n";
os->incr_indent ();
*os << "return this->"
- << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix()
+ << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix()
<< ".ptr ();\n";
os->decr_indent ();
*os << "}\n\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp
index e23026108de..b00c5805a9d 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp
@@ -45,8 +45,8 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node)
TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT);
- os->indent ();
- *os << "ACE_INLINE CORBA::Boolean" << be_nl;
+
+ *os << "CORBA::Boolean" << be_nl;
this->class_name (node, os);
*os << "::_tao_marshal_state (TAO_OutputCDR &strm)" << be_nl
<< "{" << be_idt_nl;
@@ -87,8 +87,8 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node)
// set the substate as generating code for the input operator
this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT);
- os->indent ();
- *os << "ACE_INLINE CORBA::Boolean" << be_nl;
+
+ *os << "CORBA::Boolean" << be_nl;
this->class_name (node, os);
*os << "::_tao_unmarshal_state (TAO_InputCDR &strm)" << be_nl
<< "{" << be_idt_nl;
@@ -133,10 +133,15 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node)
// retrieve the fully scoped skeleton name
void
be_visitor_valuetype_marshal_cs::class_name (be_valuetype *node,
- TAO_OutStream *os)
+ TAO_OutStream *os)
{
if (node->opt_accessor ())
- *os << node->name ();
+ {
+ be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ *os << "ACE_NESTED_CLASS ("
+ << scope->name () << ","
+ << node->local_name () << ")";
+ }
else
*os << node->full_obv_skel_name ();
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
index 6c2793fd9ef..dd059c42b3a 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
@@ -44,7 +44,6 @@ be_visitor_valuetype::visit_valuetype (be_valuetype *)
return -1;
}
-
// visit the scope of the valuetype node
// (in public/private field order)
int
@@ -201,7 +200,6 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
AST_Operation::OP_noflags,
node->name (),
0,
- 0,
0);
op->set_name ((UTL_IdList *) node->name ()->copy ());
if (!op || this->visit_operation (op) == -1)
@@ -219,23 +217,20 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
// the set method.
// the return type is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier
- ("void"), 0),
- 0);
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
// argument type is the same as the attribute type
be_argument *arg = new be_argument (AST_Argument::dir_IN,
node->field_type (),
- node->name (),
- 0);
+ node->name ());
arg->set_name ((UTL_IdList *) node->name ()->copy ());
// create the operation
op = new be_operation (rt,
AST_Operation::OP_noflags,
node->name (),
0,
- 0,
0);
op->set_name ((UTL_IdList *) node->name ()->copy ());
op->add_argument_to_scope (arg);
@@ -419,12 +414,11 @@ be_visitor_valuetype::visit_operation (be_operation *)
int
be_visitor_valuetype::visit_exception (be_exception *)
{
- cerr << "! be_visitor_valuetype::visit_exception() --- not allowed\n";
ACE_ASSERT (0);
return 0;
}
-// visit an structure
+// visit a structure
int
be_visitor_valuetype::visit_structure (be_structure *node)
{
@@ -859,3 +853,249 @@ be_visitor_valuetype::gen_init_impl (be_valuetype *node)
return 0;
}
+
+be_visitor_valuetype::FactoryStyle
+be_visitor_valuetype::determine_factory_style (be_valuetype* node)
+{
+ FactoryStyle factory_style = FS_UNKNOWN;
+
+ if (node == 0)
+ {
+ return factory_style;
+ }
+
+ // Check whether we have at least one operation or not
+ idl_bool have_operation = be_visitor_valuetype::have_operation(node);
+
+
+ idl_bool have_factory = 0;
+
+ // Try only our own scope
+ if (node->nmembers () > 0)
+ {
+ // initialize an iterator to iterate thru our scope
+ UTL_ScopeActiveIterator si (node,
+ UTL_Scope::IK_decls);
+
+ // Continue until each element is visited.
+ for (; !si.is_done (); si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init::"
+ "determine_factory_style"
+ "bad node in this scope\n"),
+ factory_style);
+
+ }
+
+ AST_Decl::NodeType node_type = d->node_type();
+
+ if (node_type == AST_Decl::NT_factory)
+ {
+ have_factory = 1;
+ break;
+ }
+
+ } // end of for loop
+ } // end of if
+
+ if(!have_operation && !have_factory)
+ {
+ factory_style = FS_CONCRETE_FACTORY;
+ }
+ else if(have_operation && !have_factory)
+ {
+ factory_style = FS_NO_FACTORY;
+ }
+ else
+ {
+ factory_style = FS_ABSTRACT_FACTORY;
+ }
+
+ return factory_style;
+}
+
+idl_bool
+be_visitor_valuetype::have_operation(be_valuetype* node)
+{
+ // Check whatever scope we get for operations/attributes
+
+ if (node == 0)
+ {
+ return 0;
+ }
+
+ idl_bool have_operation = 0;
+
+ // Operations are either operations or attributes of:
+ // -its own
+ // -derived (abstract VT | VT | abstract iface | iface)
+ //
+
+ // First try our own scope
+ if (node->nmembers () > 0)
+ {
+ // Initialize an iterator to iterate thru our scope
+ UTL_ScopeActiveIterator si (node,
+ UTL_Scope::IK_decls);
+
+ // Continue until each element is checked.
+ for (; !si.is_done (); si.next())
+ {
+ AST_Decl *d = si.item ();
+
+ if (!d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init::"
+ "has_operation"
+ "bad node in this scope\n"),
+ 0);
+
+ }
+
+ AST_Decl::NodeType node_type = d->node_type();
+
+ if(node_type == AST_Decl::NT_op)
+ {
+ have_operation = 1;
+ continue;
+ }
+
+ if(node_type == AST_Decl::NT_attr)
+ {
+ have_operation = 1;
+ continue;
+ }
+
+ if(node_type == AST_Decl::NT_factory)
+ {
+ continue;
+ }
+
+ if(node_type == AST_Decl::NT_field)
+ {
+ continue;
+ }
+
+ } // end of for loop
+ } // end of if
+
+ //Now traverse inheritance tree.
+ int i; // loop index
+
+ AST_Interface *iface =
+ AST_Interface::narrow_from_scope (node);
+
+ for (i = 0; i < iface->n_inherits (); ++i)
+ {
+ AST_Interface *inherited =
+ AST_Interface::narrow_from_decl (iface->inherits ()[i]);
+
+ if (!inherited || !inherited->is_valuetype())
+ {
+ continue;
+ }
+
+ be_valuetype *vt = be_valuetype::narrow_from_decl(node->inherits ()[i]);
+
+ if (vt != 0)
+ {
+ have_operation = have_operation ||
+ be_visitor_valuetype::have_operation(vt);
+
+ if(have_operation)
+ {
+ break;
+ }
+ }
+ } // end of for loop
+
+ return have_operation;
+}
+
+idl_bool
+be_visitor_valuetype::obv_need_ref_counter (be_valuetype* node)
+{
+ // VT needs RefCounter if it has concrete factory and
+ // none of its base VT has ref_counter
+
+ if (determine_factory_style(node) != FS_CONCRETE_FACTORY)
+ {
+ return 0;
+ }
+
+ // now go thru our base VTs and see if one has already
+
+ int i; // loop index
+
+ for (i = 0; i < node->n_inherits (); ++i)
+ {
+ AST_Interface *inherited =
+ AST_Interface::narrow_from_decl (node->inherits ()[i]);
+
+ if (!inherited || !inherited->is_valuetype())
+ {
+ continue;
+ }
+
+ be_valuetype *vt = be_valuetype::narrow_from_decl(node->inherits ()[i]);
+
+ if (vt != 0)
+ {
+ if (obv_have_ref_counter (vt))
+ {
+ return 0;
+ }
+ }
+ } // end of for loop
+
+ return 1;
+}
+
+idl_bool
+be_visitor_valuetype::obv_have_ref_counter (be_valuetype* node)
+{
+
+ // just try to find a VT with concrete factory in inheritance tree
+ if(node == 0)
+ {
+ return 0;
+ }
+
+ if (determine_factory_style(node) == FS_CONCRETE_FACTORY)
+ {
+ return 1;
+ }
+
+ // now go thru our base VTs
+
+ int i; // loop index
+
+ for (i = 0; i < node->n_inherits (); ++i)
+ {
+ AST_Interface *inherited =
+ AST_Interface::narrow_from_decl (node->inherits ()[i]);
+
+ if (!inherited || !inherited->is_valuetype())
+ {
+ continue;
+ }
+
+ be_valuetype *vt = be_valuetype::narrow_from_decl (node->inherits ()[i]);
+
+ if (vt != 0)
+ {
+ if (obv_have_ref_counter (vt))
+ {
+ return 1;
+ }
+ }
+ } // end of for loop
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
index 8906470b2be..3d9efe86477 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
@@ -45,21 +45,24 @@ be_visitor_valuetype_ch::~be_visitor_valuetype_ch (void)
int
be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
{
- TAO_OutStream *os; // output stream
+ TAO_OutStream *os = this->ctx_->stream ();
if (!node->cli_hdr_gen () && !node->imported ())
{
- os = this->ctx_->stream ();
*os << "// Valuetype class" << be_nl;
// == STEP 1: Generate the class name and class names we inherit ==
// Forward declaration.
*os << "class " << node->local_name () << ";" << be_nl;
+
+ os->gen_ifdef_macro (node->flat_name (), "_ptr");
*os << "typedef " << node->local_name ()
<< " *" << node->local_name () << "_ptr;" << be_nl;
+ os->gen_endif ();
+
// Generate the ifdefined macro for the _var type.
os->gen_ifdef_macro (node->flat_name (), "_var");
@@ -75,10 +78,10 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
os->gen_endif ();
- // Generate the ifdef macro for the _out class.
+ // Generate the ifdef macro for the _out class.
os->gen_ifdef_macro (node->flat_name (), "_out");
- // Generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec.
+ // Generate the _out declaration
if (node->gen_out_defn () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -88,216 +91,232 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
}
// generate the endif macro.
- os->gen_endif ();
-
- // Generate the ifdef macro for the _init class.
- os->gen_ifdef_macro (node->flat_name (), "_init");
-
- // Generate the _init declaration - ptc/98-09-03 20.17.10 p.20-93.
- if (this->gen_init_defn (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ch::"
- "visit_valuetype - "
- "codegen for _init failed\n"), -1);
- }
-
- // Generate the endif macro.
- os->gen_endif ();
+ os->gen_endif ();
+ }
- // Now the valuetype definition itself.
- os->gen_ifdef_macro (node->flat_name ());
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ // Now the valuetype definition itself.
+ os->gen_ifdef_macro (node->flat_name ());
- // Now generate the class definition.
- *os << "class " << be_global->stub_export_macro ()
- << " " << node->local_name ();
+ // Now generate the class definition.
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ();
- // Node valuetype inherits from other valuetypes (OMG 20.17.9)
- // (ordinary (not abstract) interfaces ignored).
+ // Node valuetype inherits from other valuetypes (OMG 20.17.9)
+ // (ordinary (not abstract) interfaces ignored).
- *os << be_idt_nl <<": ";
- int i; // loop index
- int n_inherits_valuetypes = 0;
- idl_bool valuebase_inherited = 0;
+ *os << be_idt_nl <<": ";
+ int i; // loop index
+ int n_inherits_valuetypes = 0;
+ idl_bool valuebase_inherited = 0;
- if (node->n_inherits () > 0)
+ if (node->n_inherits () > 0)
+ {
+ for (i = 0; i < node->n_inherits (); i++)
{
- for (i = 0; i < node->n_inherits (); i++)
+ // %! move is_nested() and nested_type_name() to
+ // AST_Interface, then type AST_Interface can be used
+ be_interface *inherited =
+ be_interface::narrow_from_decl (node->inherits ()[i]);
+
+ if (!inherited->is_valuetype ()
+ && !inherited->is_abstract ())
{
- // %! move is_nested() and nested_type_name() to
- // AST_Interface, then type AST_Interface can be used
- be_interface *inherited =
- be_interface::narrow_from_decl (node->inherits ()[i]);
+ continue;
+ }
- if (!inherited->is_valuetype ()
- && !inherited->is_abstract ())
- {
- continue;
- }
+ ++ n_inherits_valuetypes;
- ++ n_inherits_valuetypes;
+ if (inherited->is_valuetype())
+ {
+ valuebase_inherited = 1;
+ }
- if (inherited->is_valuetype())
- {
- valuebase_inherited = 1;
- }
+ if (n_inherits_valuetypes > 1)
+ {
+ *os << ",";
- if (n_inherits_valuetypes > 1)
+ if (i == 1)
{
- *os << ",";
-
- if (i == 1)
- {
- *os << be_idt_nl;
- }
- else
- {
- *os << be_nl;
- }
+ *os << be_idt_nl;
}
-
- be_decl *scope = 0;
-
- if (inherited->is_nested ())
+ else
{
- // Inherited node is used in the scope of "node" node.
- scope =
- be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ *os << be_nl;
}
+ }
- // Dump the scoped name.
- *os << "public virtual ";
- *os << inherited->nested_type_name (scope);
- } // end of for loop
+ be_decl *scope = 0;
- if (n_inherits_valuetypes > 0)
+ if (inherited->is_nested ())
{
- if (n_inherits_valuetypes > 1)
- {
- *os << be_uidt;
- }
-
- *os << be_uidt_nl;
+ // Inherited node is used in the scope of "node" node.
+ scope =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
}
- }
- if (!valuebase_inherited)
+ // Dump the scoped name.
+ *os << "public virtual ";
+ *os << inherited->nested_type_name (scope);
+ } // end of for loop
+
+ if (n_inherits_valuetypes > 0)
{
- // We do not inherit from any valuetype, hence we do so from the base
- // CORBA::ValueBase class.
if (n_inherits_valuetypes > 1)
{
- *os << ", ";
+ *os << be_uidt;
}
- *os << "public virtual CORBA_ValueBase" << be_uidt_nl;
- }
+ *os << be_uidt_nl;
+ }
+ }
- // Generate the body.
- *os << "{" << be_nl
- << "public:" << be_idt_nl
-
- // Generate the _ptr_type and _var_type typedef
- // but we must protect against certain versions of g++
- << "\n#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
- << be_nl
- << "typedef " << node->local_name () << "* _ptr_type;" << be_nl
- << "typedef " << node->local_name () << "_var _var_type;\n"
- << "#endif /* ! __GNUC__ || g++ >= 2.8 */" << be_nl << be_nl
-
- // Generate the static _downcast operation.
- // (see OMG 20.17.{4,5}).
- << "static " << node->local_name () << "* "
- << "_downcast (CORBA::ValueBase* );" << be_nl
- << "// The address of static _downcast is implicit used as type id\n"
- << be_nl
- << "// (TAO extensions or internals)" << be_nl
- << "static CORBA::Boolean _tao_unmarshal (" << be_idt << be_idt_nl
- << "TAO_InputCDR &," << be_nl
- << node->local_name () << " *&" << be_uidt_nl
- << ");" << be_uidt_nl
- << "virtual const char* "
- << "_tao_obv_repository_id () const;"
- << be_nl
- << "static const char* "
- << "_tao_obv_static_repository_id ();" << be_nl << be_nl;
-
- // Generate code for the valuetype definition.
- if (this->visit_valuetype_scope (node) == -1)
+ if (!valuebase_inherited)
+ {
+ // We do not inherit from any valuetype, hence we do so from the base
+ // CORBA::ValueBase class.
+ if (n_inherits_valuetypes > 1)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_ch::"
- "visit_valuetype - "
- "codegen for scope failed\n"),
- -1);
+ *os << ", ";
}
- // Protected member:
+ *os << "public virtual CORBA_ValueBase" << be_uidt_nl;
+ }
- // Generate the "protected" constructor so that users cannot
- // instantiate us.
- *os << be_uidt_nl << "protected:" << be_idt_nl
- << node->local_name ()
- << " ();" << be_nl
- << "virtual ~" << node->local_name () << " ();\n" << be_nl;
+ // Generate the body.
+ *os << "{" << be_nl
+ << "public:" << be_idt_nl
+
+ // Generate the _ptr_type and _var_type typedef
+ // but we must protect against certain versions of g++
+ << "\n#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
+ << be_nl
+ << "typedef " << node->local_name () << "* _ptr_type;" << be_nl
+ << "typedef " << node->local_name () << "_var _var_type;\n"
+ << "#endif /* ! __GNUC__ || g++ >= 2.8 */" << be_nl << be_nl
+
+ // Generate the static _downcast operation.
+ // (see OMG 20.17.{4,5}).
+ << "static " << node->local_name () << "* "
+ << "_downcast (CORBA::ValueBase* );" << be_nl
+ << "// The address of static _downcast is implicit used as type id\n"
+ << be_nl
+ << "// (TAO extensions or internals)" << be_nl
+ << "static CORBA::Boolean _tao_unmarshal (" << be_idt << be_idt_nl
+ << "TAO_InputCDR &," << be_nl
+ << node->local_name () << " *&" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "virtual const char* "
+ << "_tao_obv_repository_id () const;"
+ << be_nl
+ << "static const char* "
+ << "_tao_obv_static_repository_id ();" << be_nl << be_nl;
+
+ // Generate code for the valuetype definition.
+ if (this->visit_valuetype_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "codegen for scope failed\n"),
+ -1);
+ }
- *os << "// TAO internals" << be_nl
- << "virtual void *_tao_obv_narrow (ptr_arith_t);" << be_nl;
+ // Protected member:
- // Support for marshalling.
- if (!node->is_abstract_valuetype ())
- {
- *os << "virtual CORBA::Boolean "
- << "_tao_marshal_v (TAO_OutputCDR &);" << be_nl;
- *os << "virtual CORBA::Boolean "
- << "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl;
- // %! optimize _downcast away: extra parameter with type info
- // set (void *) in CDR Stream with the right derived pointer.
- }
+ // Generate the "protected" constructor so that users cannot
+ // instantiate us.
+ *os << be_uidt_nl << "protected:" << be_idt_nl
+ << node->local_name ()
+ << " ();" << be_nl
+ << "virtual ~" << node->local_name () << " ();\n" << be_nl;
+ *os << "// TAO internals" << be_nl
+ << "virtual void *_tao_obv_narrow (ptr_arith_t);" << be_nl;
+
+ // Support for marshalling.
+ if (!node->is_abstract_valuetype ())
+ {
+ *os << "virtual CORBA::Boolean "
+ << "_tao_marshal_v (TAO_OutputCDR &);" << be_nl;
+ *os << "virtual CORBA::Boolean "
+ << "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl;
+ // %! optimize _downcast away: extra parameter with type info
+ // set (void *) in CDR Stream with the right derived pointer.
+ }
- // Private member:
- // Private copy constructor and assignment operator. These are not
- // allowed, hence they are private.
- *os << be_uidt_nl << "private:" << be_idt_nl;
- *os << node->local_name () << " (const " << node->local_name () << " &);"
- << be_nl
- << "void operator= (const " << node->local_name () << " &);"
- << be_nl;
+ // Private member:
+
+ // Private copy constructor and assignment operator. These are not
+ // allowed, hence they are private.
+ *os << be_uidt_nl << "private:" << be_idt_nl;
+ *os << node->local_name () << " (const " << node->local_name () << " &);"
+ << be_nl
+ << "void operator= (const " << node->local_name () << " &);"
+ << be_nl;
// Map fields to private data (if optimizing).
- if (node->opt_accessor ())
+ if (node->opt_accessor ())
+ {
+ *os << be_uidt_nl << "protected:" << be_idt_nl;
+ *os << "CORBA::Boolean "
+ << "_tao_marshal_state (TAO_OutputCDR &);" << be_nl
+ << "CORBA::Boolean "
+ << "_tao_unmarshal_state (TAO_InputCDR &);"
+ << be_uidt_nl << be_nl;
+ *os << "private:" << be_idt_nl;
+ this->gen_pd (node);
+ }
+ else // Need a way to access the state of derived OBV_ classes.
+ {
+ if (!node->is_abstract_valuetype ())
{
*os << be_uidt_nl << "protected:" << be_idt_nl;
- *os << "CORBA::Boolean "
- << "_tao_marshal_state (TAO_OutputCDR &);" << be_nl
- << "CORBA::Boolean "
- << "_tao_unmarshal_state (TAO_InputCDR &);"
- << be_uidt_nl << be_nl;
- *os << "private:" << be_idt_nl;
- this->gen_pd (node);
- }
- else // Need a way to access the state of derived OBV_ classes.
- {
- if (!node->is_abstract_valuetype ())
- {
- *os << be_uidt_nl << "protected:" << be_idt_nl;
- *os << "virtual CORBA::Boolean _tao_marshal__"
- << node->flat_name () << " (TAO_OutputCDR &) = 0;"
- << be_nl;
- *os << "virtual CORBA::Boolean _tao_unmarshal__"
- << node->flat_name () << " (TAO_InputCDR &) = 0;"
- << be_nl;
- }
+ *os << "virtual CORBA::Boolean _tao_marshal__"
+ << node->flat_name () << " (TAO_OutputCDR &) = 0;"
+ << be_nl;
+ *os << "virtual CORBA::Boolean _tao_unmarshal__"
+ << node->flat_name () << " (TAO_InputCDR &) = 0;"
+ << be_nl;
}
+ }
- *os << be_uidt_nl << "};" << be_nl;
- os->gen_endif ();
+ *os << be_uidt_nl << "};" << be_nl;
+ os->gen_endif ();
+
+
+ // Generate the _init -related declarations.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CH);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "NULL visitor.\n"
+ ), -1);
+ }
- node->cli_hdr_gen (I_TRUE);
+ if (visitor->visit_valuetype(node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "failed to generate _init construct.\n"
+ ), -1);
}
+ delete visitor;
+
+ node->cli_hdr_gen (I_TRUE);
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp
index 6ee52bcc6f9..584f1777f9d 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp
@@ -49,6 +49,7 @@ be_visitor_valuetype_ci::visit_valuetype (be_valuetype *node)
if (node->cli_inline_gen () || node->imported ())
return 0;
+ //@@ What is that?
// need to access it in visit_field ()
if (node->opt_accessor ())
this->opt_accessor_ = 1;
@@ -74,37 +75,40 @@ be_visitor_valuetype_ci::visit_valuetype (be_valuetype *node)
<< "return \"" << node->repoID () << "\";" << be_uidt_nl
<< "}\n\n";
- // generate the ifdefined macro for the _var type
- os->gen_ifdef_macro (node->flat_name (), "_var");
- if (node->gen_var_impl () == -1)
+ // generate inline methods for elements of our scope
+ if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ci::"
"visit_valuetype - "
- "codegen for _var failed\n"), -1);
+ "codegen for scope failed\n"), -1);
}
- os->gen_endif ();
- // generate the ifdefined macro for the _out type
- os->gen_ifdef_macro (node->flat_name (), "_out");
- if (node->gen_out_impl () == -1)
+ // Generate the _init -related code.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CI);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ci::"
"visit_valuetype - "
- "codegen for _out failed\n"), -1);
+ "NULL visitor.\n"
+ ), -1);
}
- os->gen_endif ();
-
- // generate inline methods for elements of our scope
- if (this->visit_scope (node) == -1)
+
+ if (visitor->visit_valuetype(node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_ci::"
"visit_valuetype - "
- "codegen for scope failed\n"), -1);
+ "failed to generate _init construct.\n"
+ ), -1);
}
+ delete visitor;
+
return 0;
}
@@ -119,6 +123,7 @@ be_visitor_valuetype_ci::visit_field (be_field *node)
new be_visitor_valuetype_field_cs (ctx);
visitor->in_obv_space_ = 0;
visitor->setenclosings ("ACE_INLINE ");
+
if (visitor->visit_field (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -127,7 +132,9 @@ be_visitor_valuetype_ci::visit_field (be_field *node)
"visit_field failed\n"
), -1);
}
+
delete visitor;
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
index c7dc7f9b12d..29f150dc868 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
@@ -47,12 +47,33 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
TAO_OutStream *os; // output stream
if (node->cli_stub_gen () || node->imported ())
- return 0;
+ {
+ return 0;
+ }
os = this->ctx_->stream ();
os->indent (); // start with whatever indentation level we are at
+ // Generate methods for _var class
+ if (node->gen_var_impl () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_valuetype - "
+ "codegen for _var failed\n"), -1);
+ }
+
+ // Generate methods for _out class
+ if (node->gen_out_impl () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_valuetype - "
+ "codegen for _out failed\n"), -1);
+ }
+
+
// The _downcast method // %! use ACE_xxx_cast here ?
*os << node->name() << "* " << node->name()
<< "::_downcast (CORBA::ValueBase* v)" << be_nl
@@ -80,15 +101,18 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
// Find the possible base classes.
int n_inherits_downcastable = 0;
+
for (int i = 0; i < node->n_inherits (); i++)
{
AST_Interface *inherited =
AST_Interface::narrow_from_decl (node->inherits ()[i]);
+
if (inherited->is_valuetype())
{
++n_inherits_downcastable;
*os << "if (rval == 0)" << be_idt_nl
<< "rval = ";
+
if (inherited->defined_in ()->scope_node_type () == AST_Decl::NT_module)
{
be_decl *scope = be_scope::narrow_from_scope (inherited->defined_in ())->decl ();
@@ -97,7 +121,10 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
<< inherited->local_name () << ")";
}
else
- *os << inherited->name ();
+ {
+ *os << inherited->name ();
+ }
+
*os << "::_tao_obv_narrow (type_id);" << be_uidt_nl;
}
}
@@ -109,14 +136,17 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
if (!node->is_abstract_valuetype ())
{
// The virtual _tao_marshal_v method
- *os << "CORBA::Boolean " << node->name()
+ *os << "CORBA::Boolean " << node->name ()
<< "::_tao_marshal_v (TAO_OutputCDR & strm)"
<< be_nl
<< "{" << be_idt_nl
<< "return ";
if (node->opt_accessor ())
{
- *os << node->name ()
+ be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ *os << "ACE_NESTED_CLASS ("
+ << scope->name () << ","
+ << node->local_name () << ")"
<<"::_tao_marshal_state (strm);" << be_uidt_nl;
}
else
@@ -124,17 +154,21 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
*os << "this->_tao_marshal__" << node->flat_name ()
<< " (strm);" << be_uidt_nl;
}
+
*os << "}\n" << be_nl;
// The virtual _tao_unmarshal_v method
- *os << "CORBA::Boolean " << node->name()
+ *os << "CORBA::Boolean " << node->name ()
<< "::_tao_unmarshal_v (TAO_InputCDR & strm)"
<< be_nl
<< "{" << be_idt_nl
<< "return ";
if (node->opt_accessor ())
{
- *os << node->name ()
+ be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ *os << "ACE_NESTED_CLASS ("
+ << scope->name () << ","
+ << node->local_name () << ")"
<<"::_tao_unmarshal_state (strm);" << be_uidt_nl;
}
else
@@ -142,8 +176,9 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
*os << "this->_tao_unmarshal__" << node->flat_name ()
<< " (strm);" << be_uidt_nl;
}
+
*os << "}\n" << be_nl;
- } // !node->is_abstract_valuetype ()
+ }
// The static T::_tao_unmarshal method ----------------------------
@@ -189,30 +224,45 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
// The static T::_tao_unmarshal method ------------------------ end
- // generate the ifdefined macro for the _init type
- os->gen_ifdef_macro (node->flat_name (), "_init");
- if (this->gen_init_impl (node) == -1)
+ // generate code for the elements of the valuetype
+ if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_cs::"
"visit_valuetype - "
- "codegen for _init failed\n"), -1);
+ "codegen for scope failed\n"), -1);
}
- os->gen_endif ();
- // generate code for the elements of the valuetype
- if (this->visit_scope (node) == -1)
+ // Generate the _init -related code.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CS);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_cs::"
+ "(%N:%l) be_visitor_valuetype_ch::"
"visit_valuetype - "
- "codegen for scope failed\n"), -1);
+ "NULL visitor.\n"
+ ), -1);
}
+
+ if (visitor->visit_valuetype(node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "failed to generate _init construct.\n"
+ ), -1);
+ }
+
+ delete visitor;
+
// by using a visitor to declare and define the TypeCode, we have the
// added advantage to conditionally not generate any code. This will be
// based on the command line options. This is still TO-DO
- // (see interface code how to do this. not yet impl.)
+ // (see interface code how to do this. not yet impl.)
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp
new file mode 100644
index 00000000000..0a2db0f822b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp
@@ -0,0 +1,110 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init.cpp
+//
+// = DESCRIPTION
+// Coomon visitor for valuetypes factory construct
+// (see IDL to C++ mapping). Based on ptc/00-01-02.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_valuetype.h"
+
+ACE_RCSID(be_visitor_valuetype, valuetype_init, "$Id$")
+
+be_visitor_valuetype_init::be_visitor_valuetype_init (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype (ctx)
+{
+}
+
+be_visitor_valuetype_init::~be_visitor_valuetype_init (void)
+{
+}
+
+int
+be_visitor_valuetype_init::visit_attribute (be_attribute *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_constant (be_constant *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_enum (be_enum *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_operation (be_operation *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_exception (be_exception *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_structure (be_structure *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_union (be_union *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_typedef (be_typedef *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_field (be_field *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init::visit_factory (be_factory *)
+{
+ return 0;
+}
+
+void
+be_visitor_valuetype_init::begin_public (void)
+{
+}
+
+void
+be_visitor_valuetype_init::begin_private (void)
+{
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
new file mode 100644
index 00000000000..4013f3552ea
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp
@@ -0,0 +1,124 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_arglist_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the parameter list of the OBV factory
+// signature.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_valuetype.h"
+
+ACE_RCSID(be_visitor_valuetype_init, arglist_ch, "$Id$")
+
+
+be_visitor_valuetype_init_arglist_ch::
+be_visitor_valuetype_init_arglist_ch (be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_valuetype_init_arglist_ch::
+~be_visitor_valuetype_init_arglist_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_init_arglist_ch::visit_factory (be_factory *node)
+{
+ TAO_OutStream& os = *(this->ctx_->stream ());
+ os << " (" << be_idt // idt = 1
+ << be_idt_nl; // idt = 2
+
+ // all we do is hand over code generation to our scope
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_arglist_ch::"
+ "visit_factory - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ os << be_uidt_nl // idt = 1
+ << ")" << be_uidt; // idt = 0
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_init_arglist_ch::visit_argument (be_argument *node)
+{
+ // get the visitor that will dump the argument's mapping in the operation
+ // signature.
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH:
+ ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH);
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_arglist_ch::"
+ "visit_argument - "
+ "Bad context\n"),
+ -1);
+ }
+ }
+
+ // grab a visitor
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_arglist_ch::"
+ "visit_argument - "
+ "Bad visitor\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_arglist_ch::"
+ "visit_argument - "
+ "codegen for arglist failed\n"),
+ -1);
+ }
+
+ delete visitor;
+ return 0;
+}
+
+int
+be_visitor_valuetype_init_arglist_ch::post_process (be_decl *bd)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // if we are not the last node in the list of arguments, generate a comma.
+ if (!this->last_node (bd))
+ {
+ *os << "," << be_nl;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
new file mode 100644
index 00000000000..2344ff7ed80
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
@@ -0,0 +1,196 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes factory in the client header
+// (see IDL to C++ mapping). Based on ptc/00-01-02.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_valuetype.h"
+
+ACE_RCSID(be_visitor_valuetype, valuetype_init_ch, "$Id$")
+
+be_visitor_valuetype_init_ch::be_visitor_valuetype_init_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype_init (ctx)
+{
+}
+
+be_visitor_valuetype_init_ch::~be_visitor_valuetype_init_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
+{
+
+ if (node->is_abstract_valuetype ())
+ {
+ return 0;
+ }
+
+ // There are three possible situations.
+ // (1) If there is no initializers but at least one operation.
+ // In this case we don't need to bother about factory.
+ //
+ // (2) There are no (operations or initializers) (i.e. only state
+ // members) then we need a concrete type-specific factory
+ // class whose create_for_unmarshal creates OBV_ class.
+ //
+ // (3) There is at least one operation and at least one initializer.
+ // In this case we need to generate abstract factory class.
+
+ FactoryStyle factory_style = determine_factory_style (node);
+
+ if(factory_style == FS_NO_FACTORY) // nothing to do
+ {
+ return 0; // bail out
+ }
+
+ TAO_OutStream& os = *(this->ctx_->stream ());
+
+ // Generate the ifdef macro for the _init class.
+ os.gen_ifdef_macro (node->flat_name (), "_init");
+
+
+ //@@ If I'm generating concrete class I need a RefCounter
+ os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name ()
+ << "_init : public virtual CORBA_ValueFactoryBase" << be_nl;
+
+ // generate the body
+ os << "{" << be_nl
+ << "public:" << be_idt_nl;
+
+ if(factory_style == FS_CONCRETE_FACTORY)
+ {
+ // public ctor
+ os << node->local_name () << "_init ();" << be_nl;
+ }
+
+ // virtual public dtor
+ os << "virtual ~" << node->local_name () << "_init ();" << be_nl;
+
+
+ // custom methods
+ os << be_nl;
+
+ if (this->visit_valuetype_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_ch::"
+ "visit_valuetype - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ os << be_nl;
+
+ // generate _downcast method
+ os << "static " << node->local_name () << "_init* "
+ << "_downcast (CORBA_ValueFactoryBase* );" << be_nl;
+
+ if(factory_style == FS_CONCRETE_FACTORY)
+ {
+ //@@ Boris: create_for_unmarshal is still public...
+ // generate create_for_unmarshal
+ os << be_nl
+ << "virtual CORBA_ValueBase* "
+ << "create_for_unmarshal" << " "
+ << "(void);" << be_nl;
+ }
+
+ os << be_nl;
+
+ // propriate extensions
+ os << "// TAO-specific extensions"
+ << be_uidt_nl
+ << "public:" << be_idt_nl;
+
+ os << "virtual const char* tao_repository_id (void);\n";
+
+ if(factory_style == FS_ABSTRACT_FACTORY)
+ {
+ // protected ctor
+ os << be_uidt_nl
+ << "protected:" << be_idt_nl;
+
+ os << node->local_name () << "_init ();";
+
+ }
+
+ os << be_uidt_nl << "};" << be_nl;
+
+ // Generate the endif macro.
+ os.gen_endif ();
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_init_ch::visit_factory (be_factory *node)
+{
+
+ TAO_OutStream& os = *(this->ctx_->stream ());
+
+ be_valuetype *vt =
+ be_valuetype::narrow_from_decl (this->ctx_->scope ());
+
+
+ // STEP I: Generate preambule.
+ os << "virtual " << vt->local_name () << "* ";
+
+ // STEP 2: Generate the operation name.
+ os << node->local_name ();
+
+ // STEP 3: Generate the argument list with the appropriate mapping. For these
+ // we grab a visitor that generates the parameter listing.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH);
+ be_visitor* visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_valuetype_init_ch::"
+ "visit_factory - "
+ "Bad visitor to argument list\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_init_arglist__ch::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ delete visitor;
+
+ // make pure virtual
+ os << " = 0;" << be_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp
new file mode 100644
index 00000000000..2255defdcd0
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes factory in the client header
+// (see IDL to C++ mapping)
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_valuetype.h"
+
+ACE_RCSID(be_visitor_valuetype, valuetype_init_ci, "$Id$")
+
+be_visitor_valuetype_init_ci::be_visitor_valuetype_init_ci (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype_init (ctx)
+{
+}
+
+be_visitor_valuetype_init_ci::~be_visitor_valuetype_init_ci (void)
+{
+}
+
+int
+be_visitor_valuetype_init_ci::visit_valuetype (be_valuetype *)
+{
+ return 0;
+}
+
+int
+be_visitor_valuetype_init_ci::visit_factory (be_factory *)
+{
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp
new file mode 100644
index 00000000000..73fbcde518f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp
@@ -0,0 +1,127 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_init_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Valuetypes factory in the client header
+// (see IDL to C++ mapping)
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+//
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_valuetype.h"
+
+ACE_RCSID(be_visitor_valuetype, valuetype_init_cs, "$Id$")
+
+
+be_visitor_valuetype_init_cs::be_visitor_valuetype_init_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_valuetype_init (ctx)
+{
+}
+
+be_visitor_valuetype_init_cs::~be_visitor_valuetype_init_cs (void)
+{
+}
+
+int
+be_visitor_valuetype_init_cs::visit_valuetype (be_valuetype *node)
+{
+ if (node->is_abstract_valuetype ())
+ {
+ return 0;
+ }
+
+ // There are three possible situations.
+ // (1) If there is no initializers but at least one operation.
+ // In this case we don't need to bother about factory.
+ //
+ // (2) There are no (operations or initializers) (i.e. only state
+ // members) then we need a concrete type-specific factory
+ // class whose create_for_unmarshal creates OBV_ class.
+ //
+ // (3) There is at least one operation and at least one initializer.
+ // In this case we need to generate abstract factory class.
+
+ FactoryStyle factory_style = determine_factory_style (node);
+
+ if(factory_style == FS_NO_FACTORY) // nothing to do
+ {
+ return 0; // bail out
+ }
+
+
+ TAO_OutStream *os; // output stream
+
+ os = this->ctx_->stream ();
+
+ os->indent (); // start with whatever indentation level we are at
+
+ 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_init", node->full_name ());
+
+ ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
+ ACE_OS::sprintf (lname, "%s_init", node->local_name ());
+
+ // ctor
+ *os << fname << "::" << lname << " ()" << be_nl
+ << "{" << be_nl << "}\n";
+
+ // dtor
+ *os << be_nl
+ << fname << "::~" << lname << " ()" << be_nl
+ << "{" << be_nl << "}\n";
+
+ //tao_repository_id
+ *os << be_nl
+ << "const char* " << be_nl
+ << fname << "::tao_repository_id (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return " << node->full_name ()
+ << "::_tao_obv_static_repository_id ();"
+ << be_uidt_nl << "}\n";
+
+
+ if(factory_style == FS_CONCRETE_FACTORY)
+ {
+ // generate create_for_unmarshal()
+ *os << be_nl
+ << "CORBA_ValueBase* " << be_nl
+ << fname << "::create_for_unmarshal" << " "
+ << "(void)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA_ValueBase* ret_val = 0;" << be_nl
+ << "ACE_NEW_RETURN(ret_val, " << be_nl
+ << " OBV_" << node->full_name () << ", " << be_nl
+ << " 0);" << be_nl
+ << "return ret_val;"
+ << be_uidt_nl << "}\n";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_valuetype_init_cs::visit_factory (be_factory *)
+{
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp
index 649fe94cd4f..353d08649e7 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp
@@ -84,7 +84,58 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node)
*os << node->local_name () << be_idt_nl
<< ": public virtual "
- << node->full_name () << be_uidt_nl;
+ << node->full_name ();
+
+ // STEP 1a (about which previous implementer forgot ):
+ // Generate inheritance from corresponding OBV_ classes.
+
+//------>>>
+
+ // Here we need to be careful. There are few cases to consider:
+ //
+ // (1) We have VT with concrete factory and no inhereted VT with
+ // concrete factory then we need to mix-in RefCounter
+ //
+ // (2) We have VT with concerete factory and inheretence from
+ // another (not abstract or empty abstract <would like to
+ // know how to go there>) then its OBV_ already has mix-in
+ // (3) The rest. Don't need to bother about anything, just inherit
+ // whatever there is.
+ //
+
+ int i = 0;
+ idl_bool inherited_from_value = 0;
+ for (; i < node->n_inherits (); ++i)
+ {
+ AST_Interface *inherited =
+ AST_Interface::narrow_from_decl(node->inherits ()[i]);
+
+ // we need only concrete valuetypes
+ if (!inherited->is_valuetype ()
+ || inherited->is_abstract ())
+ {
+ continue;
+ }
+
+ *os << "," << be_nl;
+
+ // dump the scoped name.
+ *os << " public virtual OBV_";
+ *os << inherited->full_name();
+ inherited_from_value = 1;
+ } // end of for loop
+
+ if (obv_need_ref_counter (node))
+ {
+ *os << "," << be_nl;
+
+ // dump the scoped name.
+ *os << " public virtual CORBA_DefaultValueRefCountBase";
+ }
+
+ *os << be_uidt_nl;
+
+//------>>>
// STEP 2: Generate the body ==
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp
index 1d3c8a5fba7..fc13b3c768c 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp
@@ -23,18 +23,15 @@
#include "idl_extern.h"
#include "be.h"
-#ifdef IDL_HAS_VALUETYPE
-
#include "be_visitor_valuetype_fwd.h"
// include all the individual files
-#if 0
+
// Not implemented yet.
#include "be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp"
#include "be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp"
+#include "be_visitor_valuetype_fwd/cdr_op_ch.cpp"
#include "be_visitor_valuetype_fwd/cdr_op_ci.cpp"
-#endif /* 0 */
ACE_RCSID(be, be_visitor_valuetype_fwd, "$Id$")
-#endif /* IDL_HAS_VALUETYPE */
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp
new file mode 100644
index 00000000000..6f2387900f4
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp
@@ -0,0 +1,93 @@
+//
+// $Id$
+//
+
+// ================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// valuetype_fwd_cdr_op_ci.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for CDR operators for forward
+// declarations of valuetypes. This uses compiled marshaling.
+//
+// = AUTHOR
+// Boris Kolpackov <bosk@ipmce.ru>
+// base on code from Torsten Kuepper
+// based on code from Aniruddha Gokhale & Carlos O'Ryan (cdr_op_ci.cpp)
+//
+// ================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_valuetype_fwd.h"
+
+ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_cdr_op_ch, "$Id$")
+
+
+be_visitor_valuetype_fwd_cdr_op_ch::be_visitor_valuetype_fwd_cdr_op_ch (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_valuetype_fwd_cdr_op_ch::~be_visitor_valuetype_fwd_cdr_op_ch (void)
+{
+}
+
+int
+be_visitor_valuetype_fwd_cdr_op_ch::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
+{
+ AST_Interface *fd = node->full_definition ();
+ be_valuetype *bfd = be_valuetype::narrow_from_decl (fd);
+
+ // If this forward declared vt is defined later in the file,
+ // the CDR operator declaration (along with the corresponding
+ // declarations for members of the interface's scope) will be
+ // generated then.
+ if (fd->is_defined ())
+ {
+ return 0;
+ }
+
+ // Check if it's imported vt or CDR ops already generated.
+ if (node->cli_hdr_cdr_op_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ // Generate helper functions declaration.
+ if (bfd->gen_helper_header () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cdr_op_ch::"
+ "visit_valuetype - "
+ "codegen for helper functions failed\n"), -1);
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // generate the CDR << and >> operator declarations (prototypes)
+
+ //@@ Boris: Can I move this to be_valuetype? (as with _var, _out, etc?)
+
+ *os << be_global->stub_export_macro ()
+ << "CORBA::Boolean operator<< (TAO_OutputCDR &, const "
+ << node->full_name () << " *);" << be_nl;
+
+ *os << be_global->stub_export_macro ()
+ << "CORBA::Boolean operator>> (TAO_InputCDR &, "
+ << node->full_name () << " *&);" << be_nl;
+
+ node->cli_hdr_cdr_op_gen (I_TRUE);
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp
index a290ee99010..917d0ce7a11 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp
@@ -37,9 +37,6 @@ be_visitor_valuetype_fwd_cdr_op_ci::
be_visitor_valuetype_fwd_cdr_op_ci (be_visitor_context *ctx)
: be_visitor_decl (ctx)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_fwd_cdr_op_ci::"
- "must be implemented\n"), -1);
}
be_visitor_valuetype_fwd_cdr_op_ci::
@@ -48,27 +45,52 @@ be_visitor_valuetype_fwd_cdr_op_ci::
}
int
-be_visitor_valuetype_fwd_cdr_op_ci::
-visit_valuetype_fwd (be_valuetype_fwd *node)
+be_visitor_valuetype_fwd_cdr_op_ci::visit_valuetype_fwd (
+ be_valuetype_fwd *node
+ )
{
+ AST_Interface *fd = node->full_definition ();
+ be_valuetype *bfd = be_valuetype::narrow_from_decl (fd);
+
+ // Check if it's imported vt or CDR ops already generated.
if (node->cli_inline_cdr_op_gen () || node->imported ())
- return 0;
+ {
+ return 0;
+ }
+ // Is we are defined leater then let the real VT to generate
+ // all this stuff.
+ if (bfd->is_defined ())
+ {
+ return 0;
+ }
+
+ // Generate helper functions declaration.
+ if (bfd->gen_helper_inline () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cdr_op_ch::"
+ "visit_valuetype - "
+ "codegen for helper functions failed\n"), -1);
+ }
+
TAO_OutStream *os = this->ctx_->stream ();
- // generate the CDR << and >> operator declarations
- os->indent ();
- *os << "ACE_INLINE CORBA::Boolean" << be_nl
- << "operator<< (" << be_idt << be_idt_nl
- << "TAO_OutputCDR &," << be_nl
- << "const " << node->name () << "_ptr" << be_uidt_nl
- << ");" << be_uidt_nl;
- *os << "ACE_INLINE CORBA::Boolean" << be_nl
- << "operator>> (" << be_idt << be_idt_nl
- << "TAO_InputCDR &," << be_nl
- << node->name () << "_ptr &" << be_uidt_nl
- << ");" << be_uidt << "\n";
-
- node->cli_inline_cdr_op_gen (1);
+ // generate the CDR << and >> operator declarations (prototypes)
+
+ //@@ Boris: Can I move this to be_valuetype? (as with _var, _out, etc?)
+
+ //This is just declaration so no ACE_INLINE
+ *os << be_global->stub_export_macro ()
+ << "CORBA::Boolean operator<< (TAO_OutputCDR &, const "
+ << node->full_name () << " *);" << be_nl;
+
+ *os << be_global->stub_export_macro ()
+ << "CORBA::Boolean operator>> (TAO_InputCDR &, "
+ << node->full_name () << " *&);" << be_nl;
+
+ // Done with this.
+ node->cli_inline_cdr_op_gen (I_TRUE);
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp
index 4edf19ad739..704ab42516b 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp
@@ -14,7 +14,8 @@
// Visitor generating code for Interface_Fwd node in the client header.
//
// = AUTHOR
-// Torsten Kuepper
+// Boris Kolpackov <bosk@ipmce.ru>
+// based on code from Torsten Kuepper
// based on code from Aniruddha Gokhale (interface_fwd_ch.cpp)
//
// ============================================================================
@@ -28,17 +29,9 @@
ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_ch, "$Id$")
-// ********************************************************************
-// Visitor implementation for the Interface_Fwd type
-// This one for the client header file
-// ********************************************************************
-
be_visitor_valuetype_fwd_ch::be_visitor_valuetype_fwd_ch (be_visitor_context *ctx)
: be_visitor_decl (ctx)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_fwd_ch::"
- "must be implemented\n"), -1);
}
be_visitor_valuetype_fwd_ch::~be_visitor_valuetype_fwd_ch (void)
@@ -49,55 +42,69 @@ be_visitor_valuetype_fwd_ch::~be_visitor_valuetype_fwd_ch (void)
int
be_visitor_valuetype_fwd_ch::visit_valuetype_fwd (be_valuetype_fwd *node)
{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ AST_Interface *fd = node->full_definition ();
+ be_valuetype *bfd = be_valuetype::narrow_from_decl (fd);
+
+ if (!fd->is_defined ())
+ {
+ // To generate extern declarations after all modules are closed.
+ be_global->non_defined_interfaces.enqueue_tail (node);
+ }
+
TAO_OutStream *os = this->ctx_->stream ();
- if (!node->cli_hdr_gen () && !node->imported ())
+ *os << "// Valuetype class" << be_nl;
+
+ // == STEP 1: Generate the class name and class names we inherit ==
+
+ // Forward declaration.
+ *os << "class " << node->local_name () << ";" << be_nl;
+
+ // Generate _ptr declaration
+ os->gen_ifdef_macro (node->flat_name (), "_ptr");
+
+ *os << "typedef " << node->local_name ()
+ << " *" << node->local_name () << "_ptr;" << be_nl;
+
+ os->gen_endif ();
+
+ // Generate the ifdefined macro for the _var type.
+ os->gen_ifdef_macro (node->flat_name (), "_var");
+
+ // Generate the _var declaration.
+ if (bfd->gen_var_defn () == -1)
{
- // All we do in this is generate a forward declaration of the class.
- *os << "class " << node->local_name () << ";" << be_nl;
-
- // Generate the ifdefined macro for the _ptr type.
- os->gen_ifdef_macro (node->flat_name (), "_ptr");
-
- // Generate the _ptr declaration.
- *os << "typedef " << node->local_name () << " *" << node->local_name ()
- << "_ptr;" << be_nl;
-
- os->gen_endif ();
-
- // Enclose under an ifdef macro.
- os->gen_ifdef_macro (node->flat_name (), "_var");
-
- // generate the _var declaration.
- if (node->gen_var_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_fwd_ch::"
- "visit_valuetype_fwd - "
- "codegen for _var failed\n"),
- s-1);
- }
-
- // Generate an endif.
- os->gen_endif ();
-
- // enclose under an ifdef macro.
- os->gen_ifdef_macro (node->flat_name (), "_out");
-
- // Generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec.
- if (node->gen_out_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_fwd_ch::"
- "visit_valuetype_fwd - "
- "codegen for _out failed\n"),
- -1);
- }
-
- // generate the endif macro.
- os->gen_endif ();
- node->cli_hdr_gen (I_TRUE);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "codegen for _var failed\n"),
+ -1);
}
+ os->gen_endif ();
+
+ // Generate the ifdef macro for the _out class.
+ os->gen_ifdef_macro (node->flat_name (), "_out");
+
+ // Generate the _out declaration
+ if (bfd->gen_out_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_ch::"
+ "visit_valuetype - "
+ "codegen for _out failed\n"), -1);
+ }
+
+ // generate the endif macro.
+ os->gen_endif ();
+
+ node->cli_hdr_gen (I_TRUE);
+ bfd->cli_hdr_gen (I_TRUE);
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp
index e14028a0034..ba6aa3972f0 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp
@@ -27,59 +27,19 @@
ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_ci, "$Id$")
-
-// ********************************************************************
-// Visitor implementation for the Interface_Fwd type
-// This one for the client inline file
-// ********************************************************************
-
-be_visitor_valuetype_fwd_ci::be_visitor_valuetype_fwd_ci (be_visitor_context *ctx)
+be_visitor_valuetype_fwd_ci::be_visitor_valuetype_fwd_ci (
+ be_visitor_context *ctx
+ )
: be_visitor_decl (ctx)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_fwd_ci::"
- "must be implemented\n"), -1);
}
be_visitor_valuetype_fwd_ci::~be_visitor_valuetype_fwd_ci (void)
{
}
-// visit the Interface_Fwd_ci node and its scope
int
-be_visitor_valuetype_fwd_ci::visit_valuetype_fwd (be_valuetype_fwd *node)
+be_visitor_valuetype_fwd_ci::visit_valuetype_fwd (be_valuetype_fwd *)
{
- TAO_OutStream *os = this->ctx_->stream ();
-
- if (!node->cli_inline_gen () && !node->imported ())
- {
-
- // generate the ifdefined macro for the _var type
- os->gen_ifdef_macro (node->flat_name (), "_var");
-
- if (node->gen_var_impl () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_fwd_ci::"
- "visit_valuetype_fwd - "
- "codegen for _var failed\n"), -1);
- }
-
- os->gen_endif ();
-
- // generate the ifdefined macro for the _out type
- os->gen_ifdef_macro (node->flat_name (), "_out");
-
- if (node->gen_out_impl () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_valuetype_fwd_ci::"
- "visit_valuetype_fwd - "
- "codegen for _out failed\n"), -1);
- }
- os->gen_endif ();
-
- node->cli_stub_gen (I_TRUE);
- }
return 0;
}