summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1998-05-26 14:54:59 +0000
committergokhale <asgokhale@users.noreply.github.com>1998-05-26 14:54:59 +0000
commitfd411e566e9bad60707580fae7fa0accc2c7632b (patch)
treee84210f1600b95fa3995f2f2393a1ea9ae772456
parent8858c23faa42ac21d29fea095ee78fb0077cb881 (diff)
downloadATCD-fd411e566e9bad60707580fae7fa0accc2c7632b.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c137
-rw-r--r--TAO/TAO_IDL/Makefile10
-rw-r--r--TAO/TAO_IDL/be/be_argument.cpp109
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp29
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp683
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp170
-rw-r--r--TAO/TAO_IDL/be/be_constant.cpp89
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp54
-rw-r--r--TAO/TAO_IDL/be/be_enum.cpp144
-rw-r--r--TAO/TAO_IDL/be/be_enum_val.cpp68
-rw-r--r--TAO/TAO_IDL/be/be_exception.cpp331
-rw-r--r--TAO/TAO_IDL/be/be_field.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp800
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp122
-rw-r--r--TAO/TAO_IDL/be/be_interpretive.cpp36
-rw-r--r--TAO/TAO_IDL/be/be_module.cpp167
-rw-r--r--TAO/TAO_IDL/be/be_native.cpp36
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp806
-rw-r--r--TAO/TAO_IDL/be/be_predefined_type.cpp78
-rw-r--r--TAO/TAO_IDL/be/be_produce.cpp65
-rw-r--r--TAO/TAO_IDL/be/be_root.cpp221
-rw-r--r--TAO/TAO_IDL/be/be_scope.cpp350
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp2320
-rw-r--r--TAO/TAO_IDL/be/be_string.cpp51
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp182
-rw-r--r--TAO/TAO_IDL/be/be_typedef.cpp152
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp393
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp95
-rw-r--r--TAO/TAO_IDL/be/be_visitor_context.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum.cpp126
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception.cpp256
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface.cpp331
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module.cpp67
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root.cpp171
-rw-r--r--TAO/TAO_IDL/be/be_visitor_scope.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence.cpp185
-rw-r--r--TAO/TAO_IDL/be/be_visitor_structure.cpp256
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef.cpp590
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union.cpp255
-rw-r--r--TAO/TAO_IDL/be_include/be.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_argument.h24
-rw-r--r--TAO/TAO_IDL/be_include/be_array.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_attribute.h24
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h91
-rw-r--r--TAO/TAO_IDL/be_include/be_constant.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h24
-rw-r--r--TAO/TAO_IDL/be_include/be_enum.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_enum_val.h24
-rw-r--r--TAO/TAO_IDL/be_include/be_exception.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_field.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_interface.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_interface_fwd.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_module.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_native.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_operation.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_predefined_type.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_root.h21
-rw-r--r--TAO/TAO_IDL/be_include/be_scope.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_sequence.h39
-rw-r--r--TAO/TAO_IDL/be_include/be_string.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_structure.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_type.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_typedef.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_union.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_union_branch.h18
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_context.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_enum.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_exception.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_module.h21
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root.h22
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_sequence.h44
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_structure.h50
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typedef.h85
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_union.h50
75 files changed, 2487 insertions, 8562 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index b731dc01d2a..df305c487bb 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,12 +1,125 @@
+Tue May 26 09:51:20 1998 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu>
+
+ This ChangeLog entry describes massive cleaning efforts to
+ remove all unwanted code as well as some more additions and
+ modifications to the TAO IDL compiler.
+
+ * TAO_IDL/Makefile: Removed compilation of all the be_state*
+ files.
+
+ * TAO_IDL/be_include/be_decl.h
+ TAO_IDL/be/be_decl.cpp:
+ Removed the gen_client_header, gen_client_inline,
+ gen_client_stubs, gen_server_header, gen_server_inline,
+ gen_server_skeleton methods.
+
+ * TAO_IDL/be_include/
+
+ be_argument.h
+ be_array.h
+ be_attribute.h
+ be_constant.h
+ be_enum.h
+ be_enum_val.h
+ be_exception.h
+ be_field.h
+ be_interface.h
+ be_interface_fwd.h
+ be_module.h
+ be_native.h
+ be_operation.h
+ be_predefined_type.h
+ be_root.h
+ be_scope.h
+ be_sequence.h
+ be_string.h
+ be_structure.h
+ be_typedef.h
+ be_union.h
+ be_union_branch.h
+
+ AND
+
+ TAO_IDL/be/
+
+ be_argument.cpp
+ be_array.cpp
+ be_attribute.cpp
+ be_constant.cpp
+ be_enum.cpp
+ be_enum_val.cpp
+ be_exception.cpp
+ be_field.cpp
+ be_interface.cpp
+ be_interface_fwd.cpp
+ be_module.cpp
+ be_native.cpp
+ be_operation.cpp
+ be_predefined_type.cpp
+ be_root.cpp
+ be_scope.cpp
+ be_sequence.cpp
+ be_string.cpp
+ be_structure.cpp
+ be_typedef.cpp
+ be_union.cpp
+ be_union_branch.cpp
+
+ Removed the gen_client_header, gen_client_inline,
+ gen_client_stubs, gen_server_header, gen_server_inline,
+ gen_server_skeleton methods.
+
+ * TAO_IDL/be_include/be_codegen.h
+ TAO_IDL/be/be_codegen.cpp:
+
+ Added a bunch of enumerations for code generation of the Any <<=
+ and >>= operators for all the IDL types
+
+ Removed a bunch of methods and data members that were used for
+ the state based approach.
+
+ * TAO_IDL/be_interpretive.cpp: Added cases for the newly
+ introduced enumerations for the <<= and >>= operators.
+
+ * TAO_IDL/be_produce.cpp: added more documentation.
+
+ * TAO_IDL/be_include/
+ AND
+ TAO_IDL/be
+
+ {be_visitor_enum, be_visitor_exception, be_visitor_interface,
+ be_visitor_module, be_visitor_root, be_visitor_sequence,
+ be_visitor_structure, be_visitor_typedef, be_visitor_union}.{h,
+ cpp}:
+
+ Added visitors to each class called be_visitor_*_any_op_{ch,cs} to
+ each file. These generate the <<= and >>= operators for all the
+ types.
+
+ * TAO_IDL/be_visitor_scope.cpp: Added a check to see if a node in
+ the scope is NUL or not.
+
+ * TAO_IDL/be_include/be_state.h
+
+ AND
+
+ TAO_IDL/be/
+ {be_state, be_state_argument, be_state_array, be_state_attribute,
+ be_state_exception, be_state_exception, be_state_operation,
+ be_state_sequence, be_state_structure, be_state_typedef,
+ be_state_union}.cpp:
+
+ All these files are no longer needed.
+
Tue May 26 09:40:42 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
- * tests/Makefile:
+ * tests/Makefile:
NestedUpcall was not on the list.
- * tests/NestedUpcall/Makefile:
+ * tests/NestedUpcall/Makefile:
Added a .PRECIOUS directive.
- * tests/NestedUpcall/Reactor.idl:
+ * tests/NestedUpcall/Reactor.idl:
The file was full of ^M (i.e. it was using DOS end-of-line)
characters; that was confusing the IDL compiler.
@@ -24,11 +137,11 @@ Mon May 25 18:42:25 1998 Nagarajan Surendran <naga@tango.cs.wustl.edu>
Mon May 25 15:54:01 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
- * tao/Timeprobe.h:
+ * tao/Timeprobe.h:
Protected the file against multiple inclusion.
- * tao/Makefile:
- * tao/orbsvcs/orbsvcs/Makefile:
+ * tao/Makefile:
+ * tao/orbsvcs/orbsvcs/Makefile:
Updated dependencies.
Sat Apr 18 01:27:52 1998 Irfan Pyarali <irfan@cs.wustl.edu>
@@ -40,19 +153,19 @@ Sat Apr 18 01:27:52 1998 Irfan Pyarali <irfan@cs.wustl.edu>
Mon May 25 11:58:35 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
- * tests/Quoter/client.cpp:
- * tests/Quoter/Factory_Finder.cpp:
- * tests/Quoter/Generic_Factory.cpp:
- * tests/Quoter/Life_Cycle_Service.cpp:
+ * tests/Quoter/client.cpp:
+ * tests/Quoter/Factory_Finder.cpp:
+ * tests/Quoter/Generic_Factory.cpp:
+ * tests/Quoter/Life_Cycle_Service.cpp:
Added several .in() calls to disambiguate things, otherwise g++
gets really confused.
Mon May 25 10:04:52 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
- * tao/GIOP.cpp:
+ * tao/GIOP.cpp:
Removed some superflous memory allocations and copys.
- * tao/CDR.cpp:
+ * tao/CDR.cpp:
write_octet_array_mb() was returning -1, but it should return a
CORBA_Boolean, thanks to David Levine (levine@cs.wust.edu) for
detecting this one.
diff --git a/TAO/TAO_IDL/Makefile b/TAO/TAO_IDL/Makefile
index bc000ab41c4..512b6194aee 100644
--- a/TAO/TAO_IDL/Makefile
+++ b/TAO/TAO_IDL/Makefile
@@ -108,16 +108,6 @@ FILES = tao_idl \
be/be_sunsoft \
be/be_decl \
be/be_scope \
- be/be_state \
- be/be_state_array \
- be/be_state_argument \
- be/be_state_attribute \
- be/be_state_exception \
- be/be_state_operation \
- be/be_state_sequence \
- be/be_state_structure \
- be/be_state_typedef \
- be/be_state_union \
be/be_visitor \
be/be_visitor_args \
be/be_visitor_attribute \
diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp
index b5ecf2486a1..44387bb8a7a 100644
--- a/TAO/TAO_IDL/be/be_argument.cpp
+++ b/TAO/TAO_IDL/be/be_argument.cpp
@@ -40,115 +40,6 @@ be_argument::be_argument (AST_Argument::Direction d, AST_Type *ft,
}
-// All the methods here are very similar. The state is set by the be_operation
-// method which then invokes its scope which inturn calls one of these methods
-// with the state that was set.
-
-
-int
-be_argument::gen_client_header (void)
-{
- be_type *bt; // the field type
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- bt = be_type::narrow_from_decl (this->field_type ());
- s = cg->make_state ();
-
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_argument::gen_client_header - "
- "error generating type\n"),
- -1);
- }
- return 0;
-}
-
-int
-be_argument::gen_client_stubs (void)
-{
- be_type *bt; // the field type
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- bt = be_type::narrow_from_decl (this->field_type ());
- s = cg->make_state ();
-
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_argument::gen_client_stubs - "
- "error generating type\n"),
- -1);
- }
- return 0;
-}
-
-int
-be_argument::gen_server_header (void)
-{
- be_type *bt; // the field type
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- bt = be_type::narrow_from_decl (this->field_type ());
- s = cg->make_state ();
-
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_argument::gen_server_header - "
- "error generating type\n"),
- -1);
- }
- return 0;
-}
-
-int
-be_argument::gen_server_skeletons (void)
-{
- be_type *bt; // the field type
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- bt = be_type::narrow_from_decl (this->field_type ());
- s = cg->make_state ();
-
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_argument::gen_server_skeletons - "
- "error generating type\n"),
- -1);
- }
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_argument::gen_client_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_argument::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
int
be_argument::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
index 347e3282b48..b3211329eb0 100644
--- a/TAO/TAO_IDL/be/be_array.cpp
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -36,26 +36,6 @@ be_array::be_array (UTL_ScopedName *n, unsigned long ndims, UTL_ExprList *dims)
AST_Decl (AST_Decl::NT_array, n, NULL),
tao_name_ (0)
{
-#if 0
- // if we are inside of a union, we change our local name to have an
- // underscore before us
- AST_Decl *d = ScopeAsDecl (this->defined_in ());
- if (d && (d->node_type () == AST_Decl::NT_union))
- {
- static char namebuf [200];
- UTL_ScopedName *myname;
-
- ACE_OS::memset (namebuf, '\0', 200);
-
- // make a copy of our parent's name
- myname = (UTL_ScopedName *)d->name ()->copy ();
- ACE_OS::sprintf (namebuf, "_%s", this->local_name ()->get_string ());
- myname->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup
- (namebuf), 1, 0,
- I_FALSE), NULL));
- this->set_name (myname);
- }
-#endif
}
be_array::~be_array (void)
@@ -236,6 +216,8 @@ be_array::gen_dimensions (TAO_OutStream *os, unsigned short slice)
return 0;
}
+#if 0 // to be eventually removed after we add support
+
int
be_array::gen_client_header (void)
{
@@ -252,7 +234,6 @@ be_array::gen_client_header (void)
ch = cg->client_header (); // retrieve client hdr stream
-#if 0
if (this->create_name () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -261,7 +242,6 @@ be_array::gen_client_header (void)
"name creation failed\n"),
0);
}
-#endif
s = cg->make_state (); // get the state-based code generation object
if (!s)
{
@@ -432,6 +412,7 @@ be_array::gen_client_header (void)
this->cli_hdr_gen_ = I_TRUE;
cg->pop ();
}
+
return 0;
}
@@ -543,6 +524,7 @@ be_array::gen_client_stubs (void)
cs->decr_indent ();
*cs << "}\n\n";
}
+
return 0;
}
@@ -550,6 +532,7 @@ be_array::gen_client_stubs (void)
int
be_array::gen_client_inline (void)
{
+
if (!this->cli_inline_gen_)
{
TAO_OutStream *ci; // output stream
@@ -674,6 +657,8 @@ be_array::gen_server_inline (void)
// nothing to be done
return 0;
}
+#endif
+
// generate the var defn
int
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index 531ee792b9c..a39e1d027fa 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -38,689 +38,6 @@ be_attribute::be_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n,
{
}
-// Handling attributes is very similar to operations. Attributes are mapped to
-// two methods - one to set the value and one to get the value. For a readonly
-// attribute we only have the method that retrieves the value. For the "set"
-// method we pass an in parameter which is of the type of the attribute. So the
-// handling here is exactly like the "in" parameters for arguments. The
-// handling of the "get" method is exactly like the return values of
-// operations.
-
-int
-be_attribute::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
- be_type *bt; // type node
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- ch = cg->client_header ();
-
- ch->indent (); // start with the current indentation level
-
- bt = be_type::narrow_from_decl (this->field_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_header - "
- "bad type\n"),
- -1);
- }
-
-
- // first the "get" method
-
- // the retrieve method is defined virtual
- *ch << "virtual ";
-
- // first generate the return type
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH); // we are now generating
- // an attribute "get"
- // definition with the
- // return type first
-
- s = cg->make_state (); // retrieve state based object
-
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_header - "
- "return type generation failure\n"),
- -1);
- }
- cg->pop (); // restore previous state
-
- // generate the operation name
- // additional argument in the form of CORBA::Environment since TAO does not
- // yet support C++ style Exceptions. However, we can have an option to the
- // "tao" IDL compiler to ask it to generate code for exceptions. This will be
- // handled in a later release.
- *ch << " " << this->local_name () << " (CORBA::Environment &env);\n";
-
- // now the set method. However, this is not defined if we are readonly
- if (!this->readonly ())
- {
- ch->indent ();
- *ch << "virtual void " << this->local_name () << "(";
-
- // we pass the type as an "in" parameter
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH);
-
- s = cg->make_state (); // retrieve state based object
-
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_header - "
- "in param type generation failure\n"),
- -1);
- }
- cg->pop (); // restore previous state
- *ch << ", CORBA::Environment &env);\n";
- }
-
- return 0;
-}
-
-int
-be_attribute::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
- be_type *bt; // type node
- be_state *s; // state based code gen object
-
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- cs = cg->client_stubs ();
-
- // retrieve the type
- bt = be_type::narrow_from_decl (this->field_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_stubs - "
- "bad type\n"),
- -1);
- }
-
- // first the retrieve method
- cs->indent (); // start with current indentation level
-
- // generate the TAO_Param_Data table for the "get" method
- *cs << "static const TAO_Param_Data _get_" << this->flatname () <<
- "_paramdata [] = " << nl;
- *cs << "{\n";
- cs->incr_indent ();
-
- // entry for the return type
- *cs << "{" << bt->tc_name () << ", PARAM_RETURN, ";
- // Are we returning a pointer to value? i.e., is the type variable? If it is,
- // we must tell the stub what is the size of the top level structure
- be_type *prim;
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- be_typedef *tdef = be_typedef::narrow_from_decl (bt);
- prim = tdef->primitive_base_type ();
- }
- else
- prim = bt;
- if (prim->size_type () == be_decl::VARIABLE)
- {
- switch (prim->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- case AST_Decl::NT_string:
- case AST_Decl::NT_sequence:
- case AST_Decl::NT_struct:
- case AST_Decl::NT_union:
- // no need of size here
- *cs << "0}";
- break;
- case AST_Decl::NT_pre_defined:
- {
- be_predefined_type *bpd = be_predefined_type::narrow_from_decl
- (bt);
- if (bpd->pt () == AST_PredefinedType::PT_pseudo)
- // no need of size here
- *cs << "0}";
- else
- *cs << "sizeof (" << bt->name () << ")}";
- }
- break;
- default:
- *cs << "sizeof (" << bt->name () << ")}";
- }
- }
- else
- *cs << "0}";
- cs->decr_indent ();
- *cs << "};\n\n";
-
- // now generate the calldata table
-
- cs->indent ();
- *cs << "static const TAO_Call_Data _get_" << this->flatname () << "_calldata = "
- << nl;
- *cs << "{";
- // prepend a "_get_"
- *cs << "\"_get_" << this->local_name () << "\", ";
- *cs << "1, "; // always a twoway call
- *cs << "1, "; // size is 1
- // insert the address of the paramdata table
- *cs << "_get_" << this->flatname () << "_paramdata, ";
- // XXXASG - Exception list goes here (if it exists) - TODO
- *cs << "0, 0};\n\n";
-
- // now generate the actual stub
-
- // first generate the return type
- cs->indent ();
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS); // declare a return
- // type of the stub
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_stubs - "
- "return type generation failure\n"),
- -1);
- }
- cg->pop ();
-
- // generate the operation name
- *cs << " " << this->name () << "(CORBA::Environment &env)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
-
- // declare a return type
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_stubs - "
- "retval declaration failure\n"),
- -1);
- }
- cg->pop ();
-
- // generate code that calls QueryInterface
- *cs << "STUB_Object *istub;\n\n";
- cs->indent ();
- *cs << "if (this->QueryInterface (IID_STUB_Object, " <<
- "(void **)&istub) != TAO_NOERROR)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" <<
- nl;
-
- // return the appropriate error value on exception
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_stubs - "
- "failure returning from exception\n"),
- -1);
- }
- cg->pop ();
-
- cs->decr_indent ();
- *cs << "}" << nl;
- *cs << "this->Release (); // QueryInterface has bumped up our refcount" << nl;
-
- // call do_static_call with appropriate number of arguments
- *cs << "istub->do_static_call (env, &_get_" << this->flatname () <<
- "_calldata";
-
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- be_typedef *tdef = be_typedef::narrow_from_decl (bt);
- prim = tdef->primitive_base_type ();
- }
- else
- prim = bt;
-
- if (prim->size_type () == be_decl::VARIABLE)
- {
- switch (prim->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- case AST_Decl::NT_string:
- *cs << ", &retval";
- break;
- case AST_Decl::NT_sequence:
- case AST_Decl::NT_struct:
- case AST_Decl::NT_union:
- *cs << ", retval";
- break;
- default:
- *cs << ", &retval";
- }
- }
- else
- *cs << ", &retval";
-
- *cs << ");" << nl;
-
- // return the retval
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs\n"
- "return val return generation failure\n"),
- -1);
- return -1;
- }
- cg->pop ();
-
- cs->decr_indent (0);
- *cs << "\n}\n\n";
-
- if (this->readonly ())
- return 0; // we were readonly, nothing else to do.
-
- // Now generate the stub for the "set" method
- cs->indent (); // start with current indentation level
-
- // generate the TAO_Param_Data table for the "set" method
- *cs << "static const TAO_Param_Data _set_" << this->flatname () <<
- "_paramdata [] = " << nl;
- *cs << "{\n";
- cs->incr_indent ();
-
- // entry for the return type
- *cs << "{CORBA::_tc_void, PARAM_RETURN, 0}," << nl;
- *cs << "{" << bt->tc_name () << ", PARAM_IN, 0}\n";
- cs->decr_indent ();
- *cs << "};\n\n";
-
- // now generate the calldata table
-
- cs->indent ();
- *cs << "static const TAO_Call_Data _set_" << this->flatname () << "_calldata = "
- << nl;
- *cs << "{";
- // prepend a "_set_"
- *cs << "\"_set_" << this->local_name () << "\", ";
- *cs << "1, "; // always a twoway call
- *cs << "2, "; // size is 2
- // insert the address of the paramdata table
- *cs << "_set_" << this->flatname () << "_paramdata, ";
- // XXXASG - Exception list goes here (if it exists) - TODO
- *cs << "0, 0};\n\n";
-
- // now generate the actual stub
-
- cs->indent ();
- *cs << "void " << this->name () << "(";
- // generate the in parameter
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "failure in argument generation in signature\n"),
- -1);
- }
- cg->pop ();
-
- // last argument - is always CORBA::Environment
- *cs << ", CORBA::Environment &env)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
-
- // generate code that calls QueryInterface
- *cs << "STUB_Object *istub;\n\n";
- cs->indent ();
- *cs << "if (this->QueryInterface (IID_STUB_Object, " <<
- "(void **)&istub) != TAO_NOERROR)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" <<
- nl;
- *cs << "return;\n";
- cs->decr_indent ();
- *cs << "}" << nl;
- *cs << "this->Release (); // QueryInterface has bumped up our refcount" << nl;
-
- // do any pre do_static_call stuff with the lone IN parameter
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS);
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_atribute::gen_client_stubs - "
- "failure generating pre docall stuff\n"),
- -1);
- }
- cg->pop ();
-
- // call do_static_call with appropriate number of arguments
- *cs << "istub->do_static_call (env, &_set_" << this->flatname () <<
- "_calldata, 0"; // no return value
-
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_stubs - "
- "in param in docall generation failure\n"),
- -1);
- return -1;
- }
- cg->pop ();
- *cs << ");" << nl;
-
- // do any post do_static_call processing
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS);
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_client_stubs\n"
- "post docall generation failure\n"),
- -1);
- return -1;
- }
- cg->pop ();
-
- cs->decr_indent (0);
- *cs << "\n}\n\n";
-
- return 0;
-}
-
-int
-be_attribute::gen_server_header (void)
-{
- TAO_OutStream *sh; // output stream
- be_type *bt; // type node
- be_state *s; // state based code generator object
- TAO_NL nl; // newline generator
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- sh = cg->server_header ();
-
- // first retrieve the type
- bt = be_type::narrow_from_decl (this->field_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_header - "
- "bad type\n"),
- -1);
- }
-
- // first the "get" method
-
- sh->indent (); // start with the current indentation level
-
- // the retrieve method is defined pure virtual
- *sh << "virtual ";
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH); // we are now generating
- // an operation
- // definition with the
- // return type first
-
- s = cg->make_state (); // retrieve state based object
-
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_header - "
- "return type generation failure\n"),
- -1);
- }
- cg->pop (); // restore previous state
-
- *sh << " " << this->local_name () << " (CORBA::Environment &env) = 0;" << nl;
-
- // generate the static method corresponding to the method
- *sh << "static void _get_" << this->local_name () <<
- "_skel (CORBA::ServerRequest &req, void *obj, " <<
- "void *context, CORBA::Environment &env);\n\n";
-
-
- // now the set method. However, this is not defined if we are readonly
- if (this->readonly ())
- return 0;
-
- sh->indent ();
- *sh << "virtual void " << this->local_name () << "(";
-
- // we pass the type as an "in" parameter
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH);
-
- s = cg->make_state (); // retrieve state based object
-
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_header - "
- "in param type generation failure\n"),
- -1);
- }
- cg->pop (); // restore previous state
- *sh << ", CORBA::Environment &env) = 0;" << nl;
-
- // generate the static method corresponding to the method
- *sh << "static void _set_" << this->local_name () <<
- "_skel (CORBA::ServerRequest &req, void *obj, " <<
- "void *context, CORBA::Environment &env);\n\n";
-
-
- return 0;
-}
-
-int
-be_attribute::gen_server_skeletons (void)
-{
- TAO_OutStream *ss; // output stream
- TAO_NL nl; // end line
- be_type *bt; // type node
- be_state *s; // state based code gen object
- be_interface *intf; // enclosing interface node
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- ss = cg->server_skeletons ();
-
- ss->indent (); // start with the current indentation level
-
- // retrieve our type
- bt = be_type::narrow_from_decl (this->field_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "bad type\n"),
- -1);
- }
-
- // retrieve our enclosing interface decl
- intf = be_interface::narrow_from_decl (ScopeAsDecl (this->defined_in ()));
- if (!intf)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "bad enclosing interface\n"),
- -1);
- }
-
-
- // code generation - first the "get" method
- *ss << "void " << intf->full_skel_name () << "::_get_"
- << this->local_name () << "_skel ("
- << "CORBA::ServerRequest &_tao_server_request, "
- << "void *_tao_object_reference, void * /*context*/, "
- << "CORBA::Environment &_tao_environment)" << nl;
- *ss << "{\n";
- ss->incr_indent ();
- // define a variable that will eventually point to our implementation object
- *ss << intf->full_skel_name () << "_ptr impl = (" << intf->full_skel_name ()
- << "_ptr) _tao_object_reference;" << nl;
- // store the result in this Any
- *ss << "CORBA::Any *result;" << nl;
- // emit the return type
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS); // emit type for return
- // value
- // get a state based code gen object
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "codegen for return val decl failed\n"),
- -1);
- }
- cg->pop ();
-
- ss->indent ();
- *ss << "// this method has no incoming parameters. Nothing to parse" << nl;
-
- // make the upcall
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS);
- s = cg->make_state ();
- // emit code to assign to retval
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "codegen for return val assign failed\n"),
- -1);
- }
- *ss << " = impl->" << this->local_name () << "(_tao_environment);" << nl;
- cg->pop ();
-
- // insert our return val into the result
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "codegen for returning result failed\n"),
- -1);
- }
- cg->pop ();
- // insert the result into the server request
- *ss << "_tao_server_request.result (result, _tao_environment);\n";
- ss->decr_indent ();
- *ss << "}\n\n";
-
- if (this->readonly ())
- return 0; // nothing else to do as we are readonly
-
- // generate skeleton for the "set" method
-
- ss->indent ();
- *ss << "void " << intf->full_skel_name () << "::_set_"
- << this->local_name () << "_skel ("
- << "CORBA::ServerRequest &_tao_server_request, "
- << "void *_tao_object_reference, void * /*context*/, "
- << "CORBA::Environment &_tao_environment)" << nl;
- *ss << "{\n";
- ss->incr_indent ();
- // define an NVList to hold the in argument
- *ss << "CORBA::NVList_ptr nvlist;" << nl;
- // define a variable that will eventually point to our implementation object
- *ss << intf->full_skel_name () << "_ptr impl = (" << intf->full_skel_name
- () << "_ptr)_tao_object_reference;" << nl;
-
- // declare an NVList and create one
- ss->indent ();
- *ss << "// create an NV list and populate it with typecodes" << nl;
- *ss << "_tao_server_request.orb ()->create_list (1, nvlist); // initialize a list" << nl;
-
- // if we have any arguments, get each one of them and allocate an Any and
- // NamedValue for each. In addition, define a variable of that type
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "codegen for returning result failed\n"),
- -1);
- }
- cg->pop ();
-
- *ss << "// parse the arguments" << nl;
- *ss << "_tao_server_request.params (nvlist, _tao_environment);" << nl;
- *ss << "if (_tao_environment.exception ()) return;" << nl;
-
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "preupcall code failed\n"),
- -1);
- }
- cg->pop ();
-
- // make the upcall
- *ss << "impl->" << this->local_name () << "(";
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "upcall code failed\n"),
- -1);
- }
- cg->pop ();
- *ss << "_tao_environment);" << nl;
-
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS);
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_attribute::gen_server_skeletons - "
- "post upcall code failed\n"),
- -1);
- }
- cg->pop ();
-
- *ss << "\n";
- ss->decr_indent ();
- *ss << "}\n\n";
-
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_attribute::gen_client_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_attribute::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
int
be_attribute::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 7cad882fd3e..5980a0989cb 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -23,8 +23,6 @@
TAO_CodeGen *tao_cg = TAO_CODEGEN::instance ();
-static const int CHUNK = 100;
-
/* BE global Data */
TAO_CodeGen::TAO_CodeGen (void)
: client_header_ (0),
@@ -34,13 +32,8 @@ TAO_CodeGen::TAO_CodeGen (void)
server_skeletons_ (0),
server_inline_ (0),
curr_os_ (0),
- state_ (new TAO_CodeGen::CG_STATE [CHUNK]),
- top_ (0),
- size_ (CHUNK),
visitor_factory_ (0)
{
- // set the current code generation state
- this->state_ [this->top_++] = TAO_CodeGen::TAO_INITIAL;
}
// destructor
@@ -53,7 +46,6 @@ TAO_CodeGen::~TAO_CodeGen (void)
delete this->client_inline_;
delete this->server_inline_;
this->curr_os_ = 0;
- delete [] this->state_;
delete this->visitor_factory_;
}
@@ -65,101 +57,6 @@ TAO_CodeGen::make_visitor (be_visitor_context *ctx)
return this->visitor_factory_->make_visitor (ctx);
}
-// factory method
-be_state *
-TAO_CodeGen::make_state (void)
-{
- switch (this->state ())
- {
- case TAO_STRUCT_CH:
- case TAO_STRUCT_CS:
- case TAO_STRUCT_CI:
- return TAO_BE_STATE_STRUCT::instance ();
- case TAO_UNION_DISCTYPEDEFN_CH:
- return TAO_BE_STATE_UNION_DISCTYPEDEFN_CH::instance ();
- case TAO_UNION_DISCTYPEDEFN_CI:
- return TAO_BE_STATE_UNION_DISCTYPEDEFN_CI::instance ();
- case TAO_UNION_PUBLIC_CH:
- return TAO_BE_STATE_UNION_PUBLIC_CH::instance ();
- case TAO_UNION_PUBLIC_CI:
- return TAO_BE_STATE_UNION_PUBLIC_CI::instance ();
- case TAO_UNION_PUBLIC_CS:
- case TAO_UNION_PUBLIC_ASSIGN_CS:
- return TAO_BE_STATE_UNION_PUBLIC_CS::instance ();
- case TAO_UNION_PRIVATE_CH:
- return TAO_BE_STATE_UNION_PRIVATE_CH::instance ();
- case TAO_OPERATION_CH:
- case TAO_OPERATION_RETURN_TYPE_CS:
- case TAO_OPERATION_RETVAL_DECL_CS:
- case TAO_OPERATION_RETVAL_EXCEPTION_CS:
- case TAO_OPERATION_RETVAL_RETURN_CS:
- case TAO_OPERATION_SH:
- case TAO_OPERATION_RETVAL_DECL_SS:
- case TAO_OPERATION_RETVAL_ASSIGN_SS:
- case TAO_OPERATION_RESULT_SS:
- return TAO_BE_STATE_OPERATION::instance ();
- case TAO_ARGUMENT_CH:
- case TAO_ARGUMENT_CS:
- case TAO_ARGUMENT_PRE_DOCALL_CS:
- case TAO_ARGUMENT_DOCALL_CS:
- case TAO_ARGUMENT_POST_DOCALL_CS:
- case TAO_ARGUMENT_SH:
- case TAO_ARGUMENT_SS:
- case TAO_ARGUMENT_VARDECL_SS:
- case TAO_ARGUMENT_PRE_UPCALL_SS:
- case TAO_ARGUMENT_UPCALL_SS:
- case TAO_ARGUMENT_POST_UPCALL_SS:
- return TAO_BE_STATE_ARGUMENT::instance ();
- case TAO_TYPEDEF_CH:
- case TAO_TYPEDEF_CS:
- case TAO_TYPEDEF_CI:
- return TAO_BE_STATE_TYPEDEF::instance ();
- case TAO_ARRAY_DEFN_CH:
- case TAO_ARRAY_OTHER_CH:
- case TAO_ARRAY_DEFN_CI:
- return TAO_BE_STATE_ARRAY::instance ();
- case TAO_SEQUENCE_BASE_CH:
- case TAO_SEQUENCE_BASE_CS:
- case TAO_SEQUENCE_BASE_CI:
- case TAO_SEQUENCE_BODY_CH:
- case TAO_SEQUENCE_BODY_CS:
- case TAO_SEQUENCE_BODY_CI:
- case TAO_SEQELEM_RETTYPE_CH:
- case TAO_SEQELEM_RETTYPE_CI:
- case TAO_SEQELEM_RETTYPE_CS:
- return TAO_BE_STATE_SEQUENCE::instance ();
- case TAO_ATTRIBUTE_RETURN_TYPE_CH:
- case TAO_ATTRIBUTE_INPARAM_TYPE_CH:
- case TAO_ATTRIBUTE_RETURN_TYPE_CS:
- case TAO_ATTRIBUTE_RETVAL_DECL_CS:
- case TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
- case TAO_ATTRIBUTE_RETVAL_RETURN_CS:
- case TAO_ATTRIBUTE_INPARAM_TYPE_CS:
- case TAO_ATTRIBUTE_PRE_DOCALL_CS:
- case TAO_ATTRIBUTE_DOCALL_CS:
- case TAO_ATTRIBUTE_POST_DOCALL_CS:
- case TAO_ATTRIBUTE_RETURN_TYPE_SH:
- case TAO_ATTRIBUTE_INPARAM_TYPE_SH:
- case TAO_ATTRIBUTE_RETVAL_DECL_SS:
- case TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
- case TAO_ATTRIBUTE_RESULT_SS:
- case TAO_ATTRIBUTE_INPARAM_TYPE_SS:
- case TAO_ATTRIBUTE_PRE_UPCALL_SS:
- case TAO_ATTRIBUTE_UPCALL_SS:
- case TAO_ATTRIBUTE_POST_UPCALL_SS:
- return TAO_BE_STATE_ATTRIBUTE::instance ();
- case TAO_EXCEPTION_CH:
- case TAO_EXCEPTION_CTOR_CH:
- case TAO_EXCEPTION_CS:
- case TAO_EXCEPTION_CTOR_CS:
- case TAO_EXCEPTION_CTOR_ASSIGN_CS:
- case TAO_EXCEPTION_CI:
- return TAO_BE_STATE_EXCEPTION::instance ();
- default:
- return 0;
- }
-}
-
// change the string to all upcase
const char *
TAO_CodeGen::upcase (const char *str)
@@ -185,7 +82,7 @@ TAO_CodeGen::upcase (const char *str)
// set the client header stream
int
-TAO_CodeGen::client_header (const char *fname)
+TAO_CodeGen::start_client_header (const char *fname)
{
// retrieve the singleton instance to the outstream factory
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
@@ -224,9 +121,16 @@ TAO_CodeGen::client_header (const char *fname)
ACE_OS::strcat (macro_name, "_H_");
+ // generate the #ifndef ... #define statements
this->client_header_->print ("#if !defined (%s)\n", macro_name);
this->client_header_->print ("#define %s\n\n", macro_name);
+ // generate the TAO_EXPORT_MACRO macro
+ *this->client_header_ << "#if !defined (TAO_EXPORT_MACRO)\n";
+ *this->client_header_ << "#define TAO_EXPORT_MACRO "
+ << idl_global->export_macro () << be_nl;
+ *this->client_header_ << "#endif\n";
+
*this->client_header_ << "#include \"tao/corba.h\"\n";
if (idl_global->export_include () != 0)
@@ -280,7 +184,7 @@ TAO_CodeGen::client_header (void)
// set the client stub stream
int
-TAO_CodeGen::client_stubs (const char *fname)
+TAO_CodeGen::start_client_stubs (const char *fname)
{
// retrieve the singleton instance to the outstream factory
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
@@ -321,7 +225,7 @@ TAO_CodeGen::client_stubs (void)
// set the client inline stream
int
-TAO_CodeGen::client_inline (const char *fname)
+TAO_CodeGen::start_client_inline (const char *fname)
{
// retrieve the singleton instance to the outstream factory
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
@@ -345,7 +249,7 @@ TAO_CodeGen::client_inline (void)
// set the server header stream
int
-TAO_CodeGen::server_header (const char *fname)
+TAO_CodeGen::start_server_header (const char *fname)
{
// retrieve the singleton instance to the outstream factory
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
@@ -375,8 +279,10 @@ TAO_CodeGen::server_header (const char *fname)
for (int i=0; i < (suffix - fname); i++)
if (isalpha (fname [i]))
macro_name[i+9] = toupper (fname [i]);
- else
+ else if (isdigit (fname [i]))
macro_name[i+9] = fname[i];
+ else
+ macro_name[i+9] = '_';
ACE_OS::strcat (macro_name, "_H_");
@@ -420,7 +326,7 @@ TAO_CodeGen::server_header (void)
// set the server skeletons stream
int
-TAO_CodeGen::server_skeletons (const char *fname)
+TAO_CodeGen::start_server_skeletons (const char *fname)
{
// retrieve the singleton instance to the outstream factory
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
@@ -459,7 +365,7 @@ TAO_CodeGen::server_skeletons (void)
// set the server inline stream
int
-TAO_CodeGen::server_inline (const char *fname)
+TAO_CodeGen::start_server_inline (const char *fname)
{
// retrieve the singleton instance to the outstream factory
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
@@ -485,6 +391,8 @@ TAO_CodeGen::server_inline (void)
int
TAO_CodeGen::end_client_header (void)
{
+ // generate the <<= and >>= operators here
+
// insert the code to include the inline file
*this->client_header_ << "\n#if defined (__ACE_INLINE__)\n";
*this->client_header_ << "#include \"" <<
@@ -536,39 +444,6 @@ TAO_CodeGen::outstream (void)
}
void
-TAO_CodeGen::push (TAO_CodeGen::CG_STATE s)
-{
- if (this->top_ == this->size_)
- {
- TAO_CodeGen::CG_STATE *temp = this->state_;
- this->size_ += CHUNK;
- this->state_ = new TAO_CodeGen::CG_STATE [this->size_];
- for (int i=0; i < this->top_; i++)
- this->state_ [i] = temp [i];
- delete []temp;
- }
- this->state_[this->top_++] = s;
-}
-
-void
-TAO_CodeGen::pop (void)
-{
- this->top_--;
-}
-
-TAO_CodeGen::CG_STATE
-TAO_CodeGen::state (void)
-{
- return this->state_[this->top_ - 1]; // top points to the next free slot
-}
-
-void
-TAO_CodeGen::reset (void)
-{
- this->top_ = 1; // the 0th posn is always the INITIAL state
-}
-
-void
TAO_CodeGen::node (be_decl *n)
{
this->node_ = n;
@@ -585,3 +460,12 @@ TAO_CodeGen::visitor_factory (TAO_Visitor_Factory *f)
{
this->visitor_factory_ = f;
}
+
+
+#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 fcdf73ce264..f64d348e179 100644
--- a/TAO/TAO_IDL/be/be_constant.cpp
+++ b/TAO/TAO_IDL/be/be_constant.cpp
@@ -41,95 +41,6 @@ be_constant::be_constant (AST_Expression::ExprType et,
this->size_type (be_decl::FIXED);
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// Generates the client-side header information for the constant
-int
-be_constant::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_CONSTANT_CH);
-
- ch = cg->client_header ();
-
- // if we are defined in the outermost scope, then the value is assigned
- // to us here itself, else it will be in the *.cpp file
-
- ch->indent (); // start from whatever indentation level we were at
- *ch << "static const " << this->exprtype_to_string () << " " << local_name ();
- if (!this->is_nested ())
- {
- // We were defined at the outermost scope. So we put the value in the
- // header itself
- *ch << " = " << this->constant_value ();
- }
- *ch << ";\n\n";
- cg->pop ();
- return 0;
-}
-
-// Generates the client-side stubs for the constant
-int
-be_constant::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_CONSTANT_CS);
-
- cs = cg->client_stubs ();
-
- if (this->is_nested ())
- {
- // for those constants not defined in the outer most scope, they get
- // assigned to their values in the
- cs->indent (); // start from whatever indentation level we were at
- *cs << "const " << this->exprtype_to_string () << " " << this->name ();
- *cs << " = " << this->constant_value ();
- *cs << ";\n\n";
- }
- cg->pop ();
- return 0;
-}
-
-// Generates the server-side header information for the constant
-int
-be_constant::gen_server_header (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side skeletons for the constant
-int
-be_constant::gen_server_skeletons (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_constant::gen_client_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_constant::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
char *
be_constant::exprtype_to_string (void)
{
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index ceb856fac9f..6ee86d85266 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -31,6 +31,8 @@ be_decl::be_decl (void)
srv_hdr_gen_ (I_FALSE),
srv_skel_gen_ (I_FALSE),
srv_inline_gen_ (I_FALSE),
+ cli_hdr_any_op_gen_ (I_FALSE),
+ cli_stub_any_op_gen_ (I_FALSE),
fullname_ (0),
flatname_ (0),
repoID_ (0),
@@ -49,6 +51,8 @@ be_decl::be_decl (AST_Decl::NodeType type, UTL_ScopedName *n, UTL_StrList
srv_hdr_gen_ (I_FALSE),
srv_skel_gen_ (I_FALSE),
srv_inline_gen_ (I_FALSE),
+ cli_hdr_any_op_gen_ (I_FALSE),
+ cli_stub_any_op_gen_ (I_FALSE),
fullname_ (0),
size_type_ (be_decl::SIZE_UNKNOWN),
encap_len_ (-1)
@@ -98,32 +102,6 @@ be_decl::size_type (be_decl::SIZE_TYPE st)
// get overwritten to VARIABLE, it is fine. Such a situation occurs only
// when setting the sizes of structures and unions
this->size_type_ = st;
-
-
-#if 0
- // if we are just a typedef, nothing else to do
- if (this->node_type () == AST_Decl::NT_typedef)
- return;
-
- // update our parent if it is of a specific type
- if (this->is_nested ())
- {
- // get the scope we are defined in
- be_decl *d = be_decl::narrow_from_decl (ScopeAsDecl (this->defined_in
- ()));
- switch (d->node_type ())
- {
- // only these define valid scopes whose size needs to be set the same
- // as ours.
- case AST_Decl::NT_struct:
- case AST_Decl::NT_union:
- d->size_type (st); // call recursively to set the size type of our
- // ancestors
- default:
- return; // we are done
- }
- } // end else
-#endif
}
// compute stringified fully scoped name
@@ -481,6 +459,18 @@ be_decl::cli_stub_gen (void)
}
idl_bool
+be_decl::cli_hdr_any_op_gen (void)
+{
+ return this->cli_hdr_any_op_gen_;
+}
+
+idl_bool
+be_decl::cli_stub_any_op_gen (void)
+{
+ return this->cli_stub_any_op_gen_;
+}
+
+idl_bool
be_decl::cli_inline_gen (void)
{
return this->cli_inline_gen_;
@@ -518,6 +508,18 @@ be_decl::cli_stub_gen (idl_bool val)
}
void
+be_decl::cli_hdr_any_op_gen (idl_bool val)
+{
+ this->cli_hdr_any_op_gen_ = val;
+}
+
+void
+be_decl::cli_stub_any_op_gen (idl_bool val)
+{
+ this->cli_stub_any_op_gen_ = val;
+}
+
+void
be_decl::cli_inline_gen (idl_bool val)
{
this->cli_inline_gen_ = val;
diff --git a/TAO/TAO_IDL/be/be_enum.cpp b/TAO/TAO_IDL/be/be_enum.cpp
index 98be9f8e16c..afdf34116f4 100644
--- a/TAO/TAO_IDL/be/be_enum.cpp
+++ b/TAO/TAO_IDL/be/be_enum.cpp
@@ -81,150 +81,6 @@ be_enum::member_count (void)
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// Generates the client-side header information for the interface
-int
-be_enum::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
-
- if (!this->cli_hdr_gen_)
- {
- UTL_ScopeActiveIterator *i = new UTL_ScopeActiveIterator(this, IK_decls);
- // scope iterator
- AST_Decl *d; // AST node
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ENUM_CH);
-
- ch = cg->client_header ();
-
- ch->indent (); // start from whatever indentation level we were at
- *ch << "enum " << this->local_name () << nl;
- *ch << "{\n";
- ch->incr_indent ();
- while (!(i->is_done ()))
- {
- d = i->item ();
- *ch << d->local_name ();
- i->next ();
- if (!(i->is_done()))
- *ch << ", " << nl;
- }
- delete i;
- *ch << "\n";
- ch->decr_indent ();
- *ch << "};" << nl;
- // As per the ORBOS spec, we need the following typedef
- *ch << "typedef " << this->local_name () << " &" << this->local_name () <<
- "_out;\n";
- cg->pop ();
-
- // Generate the typecode decl
- // All names in the root scope have length 2 (for the root and
- // ourself). The children have length greater than 2. Thus, if our name
- // length is 2 or less, we are outermost and our typecode decl must be
- // extern, else we are defined static inside the enclosing scope.
- if (this->name ()->length () > 2)
- {
- // we have a scoped name
- ch->indent ();
- *ch << "static CORBA::TypeCode_ptr " << this->tc_name
- ()->last_component () << ";\n\n";
- }
- else
- {
- // we are in the ROOT scope
- ch->indent ();
- *ch << "extern "
- << idl_global->export_macro ()
- << "CORBA::TypeCode_ptr "
- << this->tc_name ()->last_component () << ";\n\n";
- }
- this->cli_hdr_gen_ = I_TRUE;
- }
- return 0;
-}
-
-// Generates the client-side stubs for the interface
-int
-be_enum::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
-
- if (!this->cli_stub_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ENUM_CS); // set current code gen state
-
- cs = cg->client_stubs ();
-
- // generate the typecode information here
- cs->indent (); // start from current indentation level
- *cs << nl;
- *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
- nl;
- *cs << "{\n";
- cs->incr_indent (0);
- if (this->gen_encapsulation () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_enum:Error generating encapsulation\n\n"));
- return -1;
- }
- cs->decr_indent ();
- *cs << "};" << nl;
-
- *cs << "static CORBA::TypeCode _tc__tc_" << this->flatname () <<
- " (CORBA::tk_enum, sizeof (_oc_" << this->flatname () <<
- "), (char *) &_oc_" << this->flatname () <<
- ", CORBA::B_FALSE);" << nl;
- *cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" <<
- this->flatname () << ";\n\n";
- this->cli_stub_gen_ = I_TRUE;
- cg->pop ();
- }
- return 0;
-}
-
-// Generates the server-side header information for the interface
-int
-be_enum::gen_server_header (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side skeletons for the interface
-int
-be_enum::gen_server_skeletons (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_enum::gen_client_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_enum::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
// generate typecode.
// Typecode for enum comprises the enumerated value followed by the
// encapsulation of the parameters
diff --git a/TAO/TAO_IDL/be/be_enum_val.cpp b/TAO/TAO_IDL/be/be_enum_val.cpp
index 492a20baa8c..435d4c494b4 100644
--- a/TAO/TAO_IDL/be/be_enum_val.cpp
+++ b/TAO/TAO_IDL/be/be_enum_val.cpp
@@ -35,74 +35,6 @@ be_enum_val::be_enum_val (unsigned long v, UTL_ScopedName *n, UTL_StrList *p)
p),
AST_Decl (AST_Decl::NT_enum_val, n, p)
{
-#if 0
- // computes the repoID
- compute_repoID ();
-
- // computes the fully scoped name
- compute_fullname ();
-
- // compute the flattened fully scoped name
- compute_flatname ();
-#endif
-}
-
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// NOTE: The IDL front end does a strange thing of putting the enum_vals in the
-// Enum decl scope as well as the scope that encloses the ENUM decl. Since we
-// took care of generating the client header declarations for all the
-// enum_vals, we do not do anything in any of the methods below. However, we
-// have to provide them so that whenever be_scope finds an enum_val in a scope
-// that is not an ENUM, it just ignores it.
-
-// Generates the client-side header information for the enum val
-int
-be_enum_val::gen_client_header (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the client-side stubs for the enum val
-int
-be_enum_val::gen_client_stubs (void)
-{
- return 0;
-}
-
-// Generates the server-side header information for the enum val
-int
-be_enum_val::gen_server_header (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side skeletons for the enum val
-int
-be_enum_val::gen_server_skeletons (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_enum_val::gen_client_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_enum_val::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
}
int
diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp
index e47b3401b6f..9250c2dba38 100644
--- a/TAO/TAO_IDL/be/be_exception.cpp
+++ b/TAO/TAO_IDL/be/be_exception.cpp
@@ -77,337 +77,6 @@ be_exception::member_count (void)
return this->member_count_;
}
-// CODE GENERATION
-
-int
-be_exception::gen_client_header (void)
-{
- if (!this->cli_hdr_gen_) // not already generated
- {
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- TAO_OutStream *ch = cg->client_header (); // output stream
- TAO_NL nl; // end line
- be_scope *s = be_scope::narrow_from_scope (DeclAsScope (this)); // the
- // scope
- // defined by us
-
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::"
- "gen_client_header - "
- "bad scope\n"), -1);
- }
-
- cg->push (TAO_CodeGen::TAO_EXCEPTION_CH);
- ch->indent (); // start from whatever indentation level we were at
- ch->gen_ifdef_macro (this->flatname (), "_ptr");
-
- ch->indent ();
- *ch << "class " << this->local_name () << ";" << nl;
- // generate the _ptr declaration
- *ch << "typedef " << this->local_name () << " *"
- << this->local_name () << "_ptr;" << nl;
- ch->gen_endif ();
-
- ch->gen_ifdef_macro (this->flatname ());
-
- ch->indent ();
- *ch << "class " << idl_global->export_macro ()
- << " " << this->local_name ()
- << " : public CORBA::UserException" << nl;
- *ch << "{" << nl
- << "public:\n";
- ch->incr_indent ();
- // constructors and destructor
- *ch << this->local_name () << " (void); // default ctor" << nl;
- *ch << this->local_name () << " (const " << this->local_name () <<
- " &); // copy ctor" << nl;
- *ch << "~" << this->local_name () << "(void); // dtor" << nl;
-
- // generate constructor that takes each member as a parameter. We need a
- // new state. Such a constructor exists if we have members
- if (this->member_count () > 0)
- {
- cg->push (TAO_CodeGen::TAO_EXCEPTION_CTOR_CH);
- s->comma (1); // tell the scope to generate a comma after every
- // member is generated
- *ch << this->local_name () << "(";
- if (be_scope::gen_client_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::"
- "gen_client_header - "
- "codegen for scope failed\n"), -1);
- }
- *ch << ");" << nl;
- s->comma (0); // revert comma generation state
- cg->pop (); // revert to previous state
- }
-
- // assignment operator
- *ch << this->local_name () << " &operator= (const " << this->local_name
- () << " &);" << nl;
- // the static _narrow method
- *ch << "static " << this->local_name () <<
- " *_narrow (CORBA::Exception *);\n";
-
- // generate the members
- if (be_scope::gen_client_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::"
- "gen_client_header - "
- "codegen for scope failed\n"), -1);
- }
-
- ch->decr_indent ();
- *ch << "};" << nl;
-
- // generate the typecode decl
- if (this->is_nested ())
- {
- // we have a scoped name
- ch->indent ();
- *ch << "static CORBA::TypeCode_ptr " << this->tc_name
- ()->last_component () << ";\n\n";
- }
- else
- {
- // we are in the ROOT scope
- ch->indent ();
- *ch << "extern "
- << idl_global->export_macro ()
- << " CORBA::TypeCode_ptr "
- << this->tc_name ()->last_component () << ";\n\n";
- }
- ch->gen_endif ();
-
- this->cli_hdr_gen_ = I_TRUE;
- cg->pop ();
- }
-
- return 0;
-}
-
-int
-be_exception::gen_client_inline (void)
-{
- if (!this->cli_inline_gen_)
- {
- TAO_NL nl; // end line
-
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- TAO_OutStream *ci = cg->client_inline ();
-
- ci->indent ();
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for exception " << this->name () << nl;
- *ci << "// *************************************************************\n\n";
-
- // default constructor
- ci->indent ();
- *ci << "// default constructor" << nl;
- *ci << "ACE_INLINE" << nl;
- *ci << this->name () << "::" << this->local_name () << " (void)" << nl;
- *ci << " : CORBA_UserException (CORBA::TypeCode::_duplicate (" <<
- this->tc_name () << "))\n";
- *ci << "{" << nl;
- *ci << "}\n\n";
-
- // destructor
- ci->indent ();
- *ci << "// destructor - all members are of self managing types" << nl;
- *ci << "ACE_INLINE" << nl;
- *ci << this->name () << "::~" << this->local_name () << " (void)" << nl;
- *ci << "{" << nl;
- *ci << "}\n\n";
-
- cg->push (TAO_CodeGen::TAO_EXCEPTION_CI);
- // generate inline code required of any anonymous types of members
- if (be_scope::gen_client_inline () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::gen_client_inline -"
- "codegen for scope failed\n"), -1);
- }
-
- cg->pop ();
- this->cli_inline_gen_ = I_TRUE;
- }
- return 0;
-}
-
-int
-be_exception::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
- be_scope *s = be_scope::narrow_from_scope (DeclAsScope (this)); // the scope
- // defined by
- // us
-
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::"
- "gen_client_stubs - "
- "bad scope\n"), -1);
- }
-
- if (!this->cli_stub_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_EXCEPTION_CS); // set current code gen state
-
- cs = cg->client_stubs ();
-
- // copy constructor
- cs->indent ();
- *cs << "// copy constructor" << nl;
- *cs << this->name () << "::" << this->local_name () << "(const " <<
- this->name () << " &_tao_excp)" << nl;
- *cs << " :CORBA_UserException (" <<
- "CORBA::TypeCode::_duplicate (_tao_excp.type ()))" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- // assign each individual member
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::gen_client_stubs -"
- "codegen for scope failed\n"), -1);
- }
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // assignment operator
- cs->indent ();
- *cs << "// assignment operator" << nl;
- *cs << this->name () << "&" << nl;
- *cs << this->name () << "::operator= (const " <<
- this->name () << " &_tao_excp)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "this->type_ = " <<
- "CORBA::TypeCode::_duplicate (_tao_excp.type ());\n";
- // assign each individual member
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::gen_client_stubs -"
- "codegen for scope failed\n"), -1);
- }
- cs->indent ();
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // constructor taking all members. We need a new state here. Also, such a
- // constructor exists if we have any members
- if (this->member_count () > 0)
- {
- cg->push (TAO_CodeGen::TAO_EXCEPTION_CTOR_CS);
- s->comma (1); // scope should produce comma after every parameter is
- // defined
- cs->indent ();
- *cs << "// special constructor" << nl;
- *cs << this->name () << "::" << this->local_name () << "(";
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::gen_client_stubs -"
- "codegen for scope failed\n"), -1);
- }
- s->comma (0);
- cg->pop ();
- *cs << ")" << nl;
-
- *cs << " : CORBA_UserException " <<
- "(CORBA::TypeCode::_duplicate (" << this->tc_name () <<
- "))" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- // assign each individual member. We need yet another state
- cg->push (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::gen_client_stubs -"
- "codegen for scope failed\n"), -1);
- }
- cg->pop (); // revert to previous state
- cs->decr_indent ();
- *cs << "}\n\n";
- }
-
- // narrow method
- cs->indent ();
- *cs << "// narrow" << nl;
- *cs << this->name () << "_ptr " << nl;
- *cs << this->name () << "::_narrow(CORBA::Exception *exc)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (!ACE_OS::strcmp (\"" << this->repoID () <<
- "\", exc->id ())) // same type" << nl;
- *cs << " return ACE_dynamic_cast (" << this->name () << "_ptr, exc);" <<
- nl;
- *cs << "else" << nl;
- *cs << " return 0;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // generate the typecode information here
- cs->indent (); // start from current indentation level
- *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
- nl;
- *cs << "{\n";
- cs->incr_indent (0);
- // note that we just need the parameters here and hence we generate the
- // encapsulation for the parameters
- if (this->gen_encapsulation () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_structure::gen_client_stubs -"
- "codegen for scope failed\n"), -1);
- }
- cs->decr_indent ();
- *cs << "};" << nl;
-
- *cs << "static CORBA::TypeCode _tc__tc_" << this->flatname () <<
- " (CORBA::tk_except, sizeof (_oc_" << this->flatname () <<
- "), (char *) &_oc_" << this->flatname () <<
- ", CORBA::B_FALSE);" << nl;
- *cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" <<
- this->flatname () << ";\n\n";
- this->cli_stub_gen_ = I_TRUE;
- cg->pop ();
- }
-
- return 0;
-}
-
-int
-be_exception::gen_server_header (void)
-{
- return 0;
-}
-
-
-int
-be_exception::gen_server_inline (void)
-{
- return 0;
-}
-
-int
-be_exception::gen_server_skeletons (void)
-{
- return 0;
-}
-
// generate typecode.
// Typecode for exceptions comprises the enumerated value followed by the
// encapsulation of the parameters
diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp
index bda1f3725e8..0f708d888e0 100644
--- a/TAO/TAO_IDL/be/be_field.cpp
+++ b/TAO/TAO_IDL/be/be_field.cpp
@@ -35,109 +35,6 @@ be_field::be_field (AST_Type *ft, UTL_ScopedName *n, UTL_StrList *p)
{
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// Generates the client-side header information for the field
-int
-be_field::gen_client_header (void)
-{
- be_type *bt; // the field type
- be_state *s; // code generation state
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- // retrieve field type
- bt = be_type::narrow_from_decl (this->field_type ());
-
- // make the state based object. The state has been set by the enclosing
- // parent structure
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_field::gen_client_header -"
- "codegen failed\n"), -1);
- }
- return 0;
-}
-
-// Generates the client-side stubs for the field
-int
-be_field::gen_client_stubs (void)
-{
- be_type *bt; // the field type
- be_state *s; // code generation state
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- // retrieve field type
- bt = be_type::narrow_from_decl (this->field_type ());
-
- // make the state based object. The state has been set by the enclosing
- // parent structure
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_field::gen_client_stubs -"
- "codegen failed\n"), -1);
- }
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_field::gen_client_inline (void)
-{
- be_type *bt; // the field type
- be_state *s; // code generation state
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- // retrieve field type
- bt = be_type::narrow_from_decl (this->field_type ());
-
- // make the state based object. The state has been set by the enclosing
- // parent structure
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_field::gen_client_inline -"
- "codegen failed\n"), -1);
- }
- return 0;
-}
-
-// Generates the server-side header information for the field
-int
-be_field::gen_server_header (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side skeletons for the field
-int
-be_field::gen_server_skeletons (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_field::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
int
be_field::gen_encapsulation (void)
{
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 478aa6010ab..4ed92d1ca4c 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -240,806 +240,6 @@ be_interface::full_skel_name (void)
return this->full_skel_name_;
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// generate the client header
-int
-be_interface::gen_client_header (void)
-{
- if (!this->cli_hdr_gen_) // not already generated
- {
- long i; // loop index
- TAO_NL nl; // end line
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- cg->push (TAO_CodeGen::TAO_INTERFACE_CH); // set the current code
- // generation state
-
- TAO_OutStream *ch = cg->client_header ();
-
- // == STEP 1: generate the class name and class names we inherit ==
- ch->indent (); // start with whatever indentation level we are at
-
- // generate the ifdefined macro for the _ptr type
- ch->gen_ifdef_macro (this->flatname (), "_ptr");
-
- // the following two are required to be under the ifdef macro to avoid
- // multiple declarations
-
- // forward declaration
- *ch << "class " << this->local_name () << ";" << nl;
- // generate the _ptr declaration
- *ch << "typedef " << this->local_name () << " *" << this->local_name ()
- << "_ptr;" << nl;
-
- ch->gen_endif ();
-
- // generate the ifdefined macro for the var type
- ch->gen_ifdef_macro (this->flatname (), "_var");
-
- // generate the _var declaration
- if (this->gen_var_defn () == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "be_interface - error generating _var definition\n"));
- return -1;
- }
- ch->gen_endif ();
-
- // generate the ifdef macro for the _out class
- ch->gen_ifdef_macro (this->flatname (), "_out");
-
- // generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec
- if (this->gen_out_defn () == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "be_interface - error generating _var definition\n"));
- return -1;
- }
- // generate the endif macro
- ch->gen_endif ();
-
- ch->gen_ifdef_macro (this->flatname ());
-
- // now generate the class definition
- ch->indent ();
- *ch << "class " << idl_global->export_macro ()
- << " " << this->local_name ();
-
- if (n_inherits () > 0) // this interface inherits from other interfaces
- {
- *ch << ": ";
- for (i = 0; i < n_inherits (); i++)
- {
- be_interface *inherited = be_interface::narrow_from_decl
- (this->inherits ()[i]);
- be_decl *scope = 0;
- if (inherited->is_nested ())
- {
- // inherited node is used in the scope of "this" node
- scope = be_scope::narrow_from_scope (this->defined_in
- ())->decl ();
- }
-
- *ch << "public virtual ";
- *ch << inherited->nested_type_name (scope); // dump the scoped name
- if (i < n_inherits () - 1) // this is the case of multiple
- // inheritance
- {
- *ch << ", ";
- }
- } // end of for loop
- *ch << nl;
- }
- else
- {
- // we do not inherit from anybody, hence we do so from the base
- // CORBA::Object class
- *ch << " : public virtual CORBA::Object" << nl;
- }
-
- // generate the body
-
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
- // generate the static _duplicate, _narrow, and _nil operations
- *ch << "// the static operations" << nl;
- *ch << "static " << this->local_name () << "_ptr " << "_duplicate ("
- << this->local_name () << "_ptr obj);" << nl;
- *ch << "static " << this->local_name () << "_ptr " << "_narrow ("
- << "CORBA::Object_ptr obj, CORBA::Environment &env);" << nl;
- *ch << "static " << this->local_name () << "_ptr "
- << "_nil (void);" << nl;
-
- // generate a TAO-specific _bind method similar to what Orbix and VisiBroker
- // have
- *ch << "static " << this->local_name () << "_ptr _bind (const char *host, "
- << "CORBA::UShort port, const char *key, CORBA::Environment &env);\n\n";
-
- // the _is_a method
- ch->indent ();
- *ch << "virtual CORBA::Boolean _is_a (const CORBA::Char *type_id, "
- << "CORBA::Environment &env);\n" << be_nl
- << "// = user methods\n";
-
- // generate code for the interface definition by traversing thru the
- // elements of its scope. We depend on the front-end to have made sure
- // that only legal syntactic elements appear in our scope.
- if (this->be_scope::gen_client_header () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface::gen_client_header\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- // generate the "protected" constructor so that users cannot instantiate
- // us
- *ch << be_uidt_nl
- << "protected:" << be_idt_nl
- << this->local_name () << " (" << be_idt << be_idt_nl
- << "STUB_Object *objref = 0," << be_nl
- << "TAO_ServantBase *servant = 0," << be_nl
- << "CORBA::Boolean collocated = CORBA::B_FALSE" << be_uidt_nl
- << ");\n" << be_uidt;
- ch->decr_indent ();
-
- // dtor is public...
- *ch << "public:" << be_idt_nl
- << "virtual ~" << this->local_name () << " (void);" << be_uidt_nl;
-
- // private copy constructor and assignment operator. These are not
- // allowed, hence they are private.
- *ch << "private:\n";
- ch->incr_indent ();
- *ch << this->local_name () << " (const " << this->local_name () << "&);" << nl;
- *ch << "void operator= (const " << this->local_name () << "&);\n";
- ch->decr_indent ();
- *ch << "};\n\n";
- ch->gen_endif ();
-
-
- // generate the typecode decl. If we are in the outermost scope, our typecode
- // decl is extern
- if (this->is_nested ())
- {
- // we have a scoped name
- ch->indent ();
- *ch << "static CORBA::TypeCode_ptr " << this->tc_name
- ()->last_component () << ";\n\n";
- }
- else
- {
- // we are in the ROOT scope
- ch->indent ();
- *ch << "extern "
- << idl_global->export_macro ()
- << " CORBA::TypeCode_ptr "
- << this->tc_name ()->last_component () << ";\n\n";
- }
-
- cg->pop ();
- this->cli_hdr_gen_ = I_TRUE;
- }
- return 0;
-}
-
-// Generates the client-side inline functions
-int
-be_interface::gen_client_inline (void)
-{
- TAO_NL nl; // end line
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- TAO_OutStream *ci = cg->client_inline ();
- ci->indent (); // start from the current indentation level
-
- *ci << "ACE_INLINE" << nl;
- *ci << this->name () << "::"
- << this->local_name () << "(" << be_idt << be_idt_nl
- << "STUB_Object *objref," << be_nl
- << "TAO_ServantBase *servant," << be_nl
- << "CORBA::Boolean collocated" << be_uidt_nl
- << ")" << be_uidt_nl
- << " : ACE_CORBA_1 (Object) (objref, servant, collocated)" << be_nl
- << "{}" << be_nl << be_nl;
-
- *ci << "ACE_INLINE" << nl;
- *ci << this->name () << "::~" << this->local_name () <<
- " (void) // destructor" << nl;
- *ci << "{}\n\n";
-
- // _nil method
- *ci << "ACE_INLINE " << this->name () << "_ptr" << be_nl
- << this->name () << "::_nil (void)" << be_nl
- << "{" << be_idt_nl
- << "return (" << this->name () << "_ptr)0;" << be_uidt_nl
- << "}\n" << be_nl;
-
- // generate the ifdefined macro for the _var type
- ci->gen_ifdef_macro (this->flatname (), "_var");
-
- if (this->gen_var_impl () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface: _var impl code gen failed\n"));
- return -1;
- }
- ci->gen_endif ();
-
- // generate the ifdefined macro for the _out type
- ci->gen_ifdef_macro (this->flatname (), "_out");
-
- if (this->gen_out_impl () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface: _out impl code gen failed\n"));
- return -1;
- }
- ci->gen_endif ();
-
- if (this->be_scope::gen_client_inline () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface: code gen failed for scope\n"));
- return -1;
- }
-
- return 0;
-}
-
-
-// Generate the client-side stubs
-int
-be_interface::gen_client_stubs (void)
-{
- TAO_NL nl; // end line
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_INTERFACE_CS); // set the current code generation
- // state
-
- TAO_OutStream *cs = cg->client_stubs ();
-
- cs->indent (); // start with whatever indentation level we are at
-
- // first generate the code for the static methods
- // The _duplicate method
- *cs << this->name () << "_ptr " << this->name () << "::_duplicate ("
- << this->name () << "_ptr obj)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (!CORBA::is_nil (obj))\n";
- cs->incr_indent ();
- *cs << "obj->AddRef ();\n";
- cs->decr_indent ();
- *cs << nl;
- *cs << "return obj;\n";
- cs->decr_indent ();
- *cs << "} // end of _duplicate" << nl << nl;
-
- // The _narrow method
- *cs << this->name () << "_ptr " << this->name ()
- << "::_narrow (" << be_idt << be_idt_nl
- << "CORBA::Object_ptr obj," << be_nl
- << "CORBA::Environment &env" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (CORBA::is_nil (obj))" << be_idt_nl
- << "return " << this->name () << "::_nil ();" << be_uidt_nl
- << "if (!obj->_is_a (\"" << this->repoID () << "\", env))"
- << be_idt_nl
- << "return " << this->name () << "::_nil ();" << be_uidt_nl;
-
- *cs << "if (!obj->_is_collocated () || !obj->_servant())" << be_nl
- << "{" << be_idt_nl;
- *cs << this->name () << "_ptr new_obj = new " << this->name () << "(obj->_get_parent ());" << be_nl
- << "return new_obj;" << be_uidt_nl
- << "} // end of if" << be_nl;
-
- *cs << "STUB_Object *stub = obj->_servant ()->_create_stub (env);" << be_nl
- << "if (env.exception () != 0)" << be_idt_nl
- << "return " << this->name () << "::_nil ();" << be_uidt_nl
- << "void* servant = obj->_servant ()->_downcast (\""
- << this->repoID () << "\");" << be_nl
- << "return new ";
-
- // This may be necessary to work around a GCC compiler bug!
- const char *coll_name = this->full_coll_name ();
- const char *skel_name = this->full_skel_name ();
-
- *cs << coll_name << "(" << be_idt << be_idt_nl
- << "ACE_reinterpret_cast(" << skel_name
- << "_ptr, servant)," << be_nl
- << "stub" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl
- << "}" << be_nl << be_nl;
-
- // the _bind method
- *cs << this->name () << "_ptr " << this->name () << "::_bind (" <<
- "const char *host, CORBA::UShort port, const char *key, " <<
- "CORBA::Environment &env)" << nl;
- *cs << "{" << be_idt_nl
- << "IIOP_Object *data = new IIOP_Object (host, port, key);" << be_nl
- << "if (!data) return " << this->name () << "::_nil ();" << be_nl
- << "// create the CORBA level proxy" << be_nl
- << "CORBA::Object_ptr objref = new CORBA_Object (data);" << be_nl
- << "if (objref == 0)" << be_idt_nl << "{" << be_idt_nl
- << "data->Release ();" << be_nl
- << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" << be_nl
- << "return " << this->name () << "::_nil ();" << be_uidt_nl << "}" << be_uidt_nl
- << "return " << this->name () << "::_narrow (objref, env);" << be_uidt_nl
- << "}" << be_nl << be_nl;
-
- // generate code for the elements of the interface
- if (this->be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface::gen_client_stubs\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- // generate the is_a method
- cs->indent ();
- *cs << "CORBA::Boolean " << this->name () << "::_is_a (" <<
- "const CORBA::Char *value, CORBA::Environment &_tao_environment)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (\n";
- cs->incr_indent (0);
- if (this->traverse_inheritance_graph (be_interface::is_a_helper, cs) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_interface::gen_client_stubs - "
- "inheritance graph failed\n"), -1);
- }
- cs->indent ();
- *cs << "(!ACE_OS::strcmp ((char *)value, CORBA::_tc_Object->id (_tao_environment))))\n";
- *cs << " return 1; // success using local knowledge\n";
- cs->decr_indent ();
- *cs << "else" << nl;
- *cs << " return this->CORBA_Object::_is_a (value, _tao_environment); // remote call\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // generate the typecode information here
- cs->indent (); // start from current indentation level
- *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
- nl;
- *cs << "{\n";
- cs->incr_indent (0);
- if (this->gen_encapsulation () == -1)
- {
- ACE_ERROR ((LM_ERROR, "Error generating typecode\n\n"));
- return -1;
- }
- cs->decr_indent ();
- *cs << "};" << nl;
-
- *cs << "static CORBA::TypeCode _tc__tc_" << this->flatname () <<
- " (CORBA::tk_objref, sizeof (_oc_" << this->flatname () <<
- "), (char *) &_oc_" << this->flatname () <<
- ", CORBA::B_FALSE);" << nl;
- *cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" <<
- this->flatname () << ";\n\n";
-
- cg->pop ();
- return 0;
-}
-
-// generate server header
-int be_interface::gen_server_header (void)
-{
- TAO_OutStream *sh; // output stream
- long i; // loop index
- TAO_NL nl; // end line
- static char namebuf [NAMEBUFSIZE]; // holds the class name
- AST_Decl *d; // enclosing scope
-
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_INTERFACE_SH); // set the current code generation
- // state
-
- sh = cg->server_header ();
-
- // generate the skeleton class name
-
- sh->indent (); // start with whatever indentation level we are at
-
- // we shall have a POA_ prefix only if we are at the topmost level
- // generate the forward declaration
- d = ScopeAsDecl (this->defined_in ());
- if (d->node_type () == AST_Decl::NT_root)
- {
- // we are outermost
- ACE_OS::sprintf (namebuf, "POA_%s", this->local_name ()->get_string ());
- }
- else
- {
- ACE_OS::sprintf (namebuf, "%s", this->local_name ()->get_string ());
- }
-
- *sh << "class " << namebuf << ";" << nl;
-
- // generate the _ptr declaration
- *sh << "typedef " << namebuf << " *" << namebuf
- << "_ptr;" << nl;
-
- // now generate the class definition
- *sh << "class " << idl_global->export_macro ()
- << " " << namebuf << " : ";
- if (n_inherits () > 0) // this interface inherits from other interfaces
- {
- be_interface *intf;
-
- *sh << "public virtual ";
- intf = be_interface::narrow_from_decl (inherits ()[0]);
- *sh << intf->relative_skel_name (this->full_skel_name ());
- for (i = 1; i < n_inherits (); i++)
- {
- *sh << ", public virtual ";
- intf = be_interface::narrow_from_decl (inherits ()[i]);
- *sh << intf->relative_skel_name (this->full_skel_name ());
- } // end of for loop
- }
- else
- {
- // We don't inherit from another user defined object, hence our
- // base class is the ServantBase class.
- *sh << " public virtual PortableServer::ServantBase";
- }
- *sh << nl;
- *sh << "{" << nl;
- *sh << "protected:\n";
- sh->incr_indent ();
- *sh << namebuf << " (void);" << nl;
- sh->decr_indent ();
- *sh << "public:\n";
- sh->incr_indent ();
- *sh << "virtual ~" << namebuf << " (void);\n";
-
- sh->indent ();
- *sh << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl
- << "const char* logical_type_id," << be_nl
- << "CORBA::Environment &_tao_environment" << be_uidt
- << ");\n" << be_uidt;
-
- sh->indent ();
- *sh << "virtual void* _downcast (" << be_idt << be_idt_nl
- << "const char* logical_type_id" << be_uidt_nl
- << ");\n" << be_uidt;
-
- // generate code for elements in the scope (e.g., operations)
- if (be_scope::gen_server_header () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface::gen_server_header\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- // add our _is_a method
- sh->indent ();
- *sh << "static void _is_a_skel (CORBA::ServerRequest &req, " <<
- "void *obj, void *context, CORBA::Environment &_tao_enviroment);\n\n";
-
- // generate skeletons for operations of our base classes. These skeletons
- // just cast the pointer to the appropriate type before invoking the call
- if (this->traverse_inheritance_graph (be_interface::gen_skel_helper, sh) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_interface::gen_server_header - "
- "inheritance graph traversal failed\n"), -1);
- }
-
- // add the dispatch method
- sh->indent ();
- *sh << "virtual void _dispatch (CORBA::ServerRequest &req, " <<
- "void *context, CORBA::Environment &env);\n\n";
-
- // Print out the _this() method.
- sh->indent ();
- *sh << this->name () << " *_this (CORBA::Environment &_tao_environment);\n";
-
- sh->indent ();
- *sh << "virtual const char* _interface_repository_id"
- << " (void) const;\n";
-
- sh->decr_indent ();
-
- *sh << "};\n\n";
-
-#if 0
- be_visitor_collocated_sh visitor;
- this->accept (&visitor);
- *sh << "\n";
-#endif
- cg->pop ();
- return 0;
-}
-
-int be_interface::gen_server_skeletons (void)
-{
- TAO_OutStream *ss; // output stream
- TAO_NL nl; // end line
- AST_Decl *d; // temporary
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_INTERFACE_SS); // set the current code generation
- // state
-
- ss = cg->server_skeletons ();
-
- // generate the skeleton class name
-
- ss->indent (); // start with whatever indentation level we are at
-
- if (this->gen_operation_table () == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "be_interface::gen_operation_table failure\n"));
- return -1;
- }
-
- *ss << "// skeleton constructor" << nl;
- // find if we are at the top scope or inside some module
- d = ScopeAsDecl (this->defined_in ());
-
- // if (d && d->node_type () == AST_Decl::NT_root)
- if (!this->is_nested ())
- {
- // we are outermost. So the POA_ prefix is prepended to our name
- *ss << this->full_skel_name () << "::POA_" << this->local_name () <<
- " (void)" << nl;
- }
- else
- {
- // the POA_ prefix is prepended to our outermost module name
- *ss << this->full_skel_name () << "::" << this->local_name () <<
- " (void)" << nl;
- }
-
- *ss << "{" << be_idt_nl
- << "this->optable_ = &tao_" << this->flatname ()
- << "_optable;" << be_uidt_nl
- << "}\n\n";
-
- // generate code for elements in the scope (e.g., operations)
- if (be_scope::gen_server_skeletons () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface::gen_server_skeletons\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- // generate code for the _is_a skeleton
- ss->indent ();
- *ss << "void " << this->full_skel_name ()
- << "::_is_a_skel (" << be_idt << be_idt_nl
- << "CORBA::ServerRequest &req, " << be_nl
- << "void * _tao_object_reference," << be_nl
- << "void * /*context*/," << be_nl
- << "CORBA::Environment &_tao_environment" << be_uidt_nl
- << ")" << be_uidt_nl;
-
- *ss << "{\n";
- ss->incr_indent ();
- *ss << "CORBA::NVList_ptr nvlist;" << nl;
- *ss << "CORBA::NamedValue_ptr nv;" << nl;
- *ss << "CORBA::Any temp_value (CORBA::_tc_string);" << nl;
- *ss << "CORBA::Any *any;" << nl;
- *ss << "CORBA::Boolean *retval = new CORBA::Boolean;" << nl;
- *ss << "CORBA::String value;" << nl;
- *ss << nl;
- *ss << "req.orb()->create_list (0, nvlist);" << nl;
- *ss << "nv = nvlist->add_value (0, temp_value, "
- << "CORBA::ARG_IN, _tao_environment);" << nl;
- *ss << "req.params (nvlist, _tao_environment); // parse the args" << nl;
- *ss << "if (_tao_environment.exception () != 0) return;" << nl;
- *ss << "value = *(CORBA::String *)nv->value ()->value ();" << nl;
-
- *ss << this->full_skel_name () << "_ptr impl = ("
- << this->full_skel_name () << "_ptr) _tao_object_reference;"
- << nl;
-
- *ss << "*retval = impl->_is_a (value, _tao_environment);" << be_nl
- << "if (_tao_environment.exception () != 0) return;" << be_nl;
- *ss << "any = new CORBA::Any (CORBA::_tc_boolean, "
- << "retval, CORBA::B_TRUE);" << nl;
- *ss << "req.result (any, _tao_environment);\n";
- ss->decr_indent ();
- *ss << "}\n\n";
-
- ss->indent ();
- *ss << "CORBA::Boolean " << this->full_skel_name ()
- << "::_is_a (" << be_idt << be_idt_nl
- << "const char* value," << be_nl
- << "CORBA::Environment &_tao_environment" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (\n" << be_idt;
- if (this->traverse_inheritance_graph (be_interface::is_a_helper, ss) == -1)
- {
- return -1;
- }
-
- ss->indent ();
- *ss << "(!ACE_OS::strcmp ((char *)value, "
- << "CORBA::_tc_Object->id (_tao_environment))))"
- << be_idt_nl << "return CORBA::B_TRUE;" << be_uidt_nl
- << "else" << be_idt_nl
- << "return CORBA::B_FALSE;" << be_uidt << be_uidt << be_uidt_nl
- << "}\n\n";
-
- ss->indent ();
- *ss << "void* " << this->full_skel_name ()
- << "::_downcast (" << be_idt << be_idt_nl
- << "const char* logical_type_id" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (this->traverse_inheritance_graph (be_interface::downcast_helper, ss) == -1)
- {
- return -1;
- }
-
- *ss << "if (ACE_OS::strcmp (logical_type_id, "
- << "\"IDL:omg.org/CORBA/Object:1.0\") == 0)" << be_idt_nl
- << "return ACE_static_cast(PortableServer::Servant, this);"
- << be_uidt_nl;
-
- *ss << "return 0;" << be_uidt_nl
- << "}\n\n";
-
-
- // now the dispatch method
- ss->indent ();
- *ss << "void " << this->full_skel_name () <<
- "::_dispatch (CORBA::ServerRequest &req, " <<
- "void *context, CORBA::Environment &env)" << nl;
- *ss << "{\n";
- ss->incr_indent ();
- *ss << "TAO_Skeleton skel; // pointer to skeleton for operation" << nl;
- *ss << "CORBA::String opname = req.operation (); // retrieve operation name" <<
- nl;
- *ss << "// find the skeleton corresponding to this opname" << nl;
- *ss << "if (this->_find (opname, skel) == -1)" << nl;
- *ss << "{\n";
- ss->incr_indent ();
- *ss << "env.exception (new CORBA_BAD_OPERATION (CORBA::COMPLETED_NO));" <<
- nl;
- *ss << "ACE_ERROR ((LM_ERROR, \"Bad operation <%s>\\n\", opname));\n";
- ss->decr_indent ();
- *ss << "}\n";
- *ss << "else" << nl;
- *ss << " skel (req, this, context, env);\n";
- ss->decr_indent ();
- *ss << "}\n\n";
-
- ss->indent ();
- *ss << "const char* " << this->full_skel_name ()
- << "::_interface_repository_id (void) const"
- << nl;
- *ss << "{\n";
- ss->incr_indent ();
- *ss << "return \"" << this->repoID () << "\";\n";
- ss->decr_indent ();
- *ss << "}\n\n";
-
- cg->pop ();
-
-#if 0
- be_visitor_collocated_ss visitor;
- this->accept (&visitor);
- *ss << "\n";
-#endif
- *ss << this->name () << "*" << be_nl
- << this->full_skel_name ()
- << "::_this (CORBA_Environment &_env)" << be_nl
- << "{" << be_idt_nl
- << "STUB_Object *stub = this->_create_stub (_env);" << be_nl
- << "if (_env.exception () != 0)" << be_idt_nl
- << "return 0;" << be_uidt_nl
-
-#if 0
- << "TAO_ORB_Core *orb_core = TAO_ORB_Core_instance ();" << be_nl
- << "if (orb_core->get_current ()->in_servant_upcall ())" << be_nl
- << "{" << be_idt << be_nl
- << "stub = new IIOP_Object (" << be_idt << be_idt << be_nl
- << "CORBA::string_copy (this->_interface_repository_id ())," << be_nl
- << "IIOP::Profile (" << be_idt << be_idt << be_nl
- << "TAO_ORB_Core_instance ()->orb_params ()->addr ()," << be_nl
- << "orb_core->get_current ()->object_key ()" << be_uidt << be_nl
- << ")" << be_uidt << be_uidt << be_nl
- << ");" << be_uidt << be_uidt << be_nl
- << "}" << be_nl
- << "else" << be_nl
- << "{" << be_idt_nl
- << "POA* poa = this->default_poa (_env);" << be_nl
- << "if (_env.exception () != 0)" << be_idt << be_nl
- << "return 0;" << be_uidt << be_nl
- << "const TAO::ObjectKey& object_key = " << be_idt << be_nl
- << "poa->servant_to_id (this, _env);" << be_uidt << be_nl
- << "if (_env.exception () != 0)" << be_idt << be_nl
- << "return 0;" << be_uidt << be_nl
- << "stub = new IIOP_Object (" << be_idt << be_idt << be_nl
- << "CORBA::string_copy (this->_interface_repository_id ())," << be_nl
- << "IIOP::Profile (" << be_idt << be_idt << be_nl
- << "TAO_ORB_Core_instance ()->orb_params ()->addr ()," << be_nl
- << "object_key" << be_uidt << be_nl
- << ")" << be_uidt << be_uidt << be_nl
- << ");" << be_uidt << be_uidt << be_nl
- << "}\n" << be_nl
-#endif /* 0 */
-
- << "return new " << this->full_coll_name ()
- << " (this, stub);" << be_uidt << be_nl;
-
- *ss << "}\n\n";
-
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_interface::gen_server_inline (void)
-{
- // nothing to be done
- TAO_OutStream *si; // output stream
- long i; // loop index
- TAO_NL nl; // end line
-
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (i);
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- si = cg->server_inline ();
-
- // generate the skeleton class name
-
- si->indent (); // start with whatever indentation level we are at
-
- *si << "// skeleton destructor" << nl;
-
- *si << "ACE_INLINE" << nl;
- if (!this->is_nested ())
- {
- // we are outermost. So the POA_ prefix is prepended to our name
- *si << this->full_skel_name () << "::~POA_" << this->local_name () <<
- " (void)" << nl;
- }
- else
- {
- // the POA_ prefix is prepended to our outermost module name
- *si << this->full_skel_name () << "::~" << this->local_name () <<
- " (void)" << nl;
- }
-
- *si << "{\n";
- *si << "}\n";
-
-
- // generate skeletons for operations of our base classes. These skeletons
- // just cast the pointer to the appropriate type before invoking the call
- if (this->traverse_inheritance_graph (be_interface::gen_skel_helper, si) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_interface::gen_server_inline - "
- "inheritance graph traversal failed\n"), -1);
- }
-
- return 0;
-}
-
// generate the var definition
int
be_interface::gen_var_defn (void)
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
index 4a740a00bc0..60bf5bf37f3 100644
--- a/TAO/TAO_IDL/be/be_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -40,128 +40,6 @@ be_interface_fwd::be_interface_fwd (UTL_ScopedName *n, UTL_StrList *p)
this->size_type (be_decl::VARIABLE); // always the case
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// generate the client header
-int be_interface_fwd::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
-
- if (!this->cli_hdr_gen_) // not already generated
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- // get the client header
- ch = cg->client_header ();
-
- ch->indent (); // start from the current
-
- // all we do in this is generate a forward declaration of the class
- *ch << "class " << this->local_name () << ";" << nl;
-
- // generate the ifdefined macro for the _ptr type
- ch->gen_ifdef_macro (this->flatname (), "_ptr");
-
- // generate the _ptr declaration
- *ch << "typedef " << this->local_name () << " *" << this->local_name () <<
- "_ptr; \n";
-
- ch->gen_endif ();
-
- // enclose under an ifdef macro
- ch->gen_ifdef_macro (this->flatname (), "_var");
-
- // generate the _var declaration
- if (this->gen_var_defn () == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "be_interface_fwd - error generating _var definition\n"));
- return -1;
- }
- // gen an endif
- ch->gen_endif ();
-
- // enclose under an ifdef macro
- ch->gen_ifdef_macro (this->flatname (), "_out");
-
- // generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec
- if (this->gen_out_defn () == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "be_interface_fwd - error generating _var definition\n"));
- return -1;
- }
-
- // generate the endif macro
- ch->gen_endif ();
-
- this->cli_hdr_gen_ = I_TRUE;
- }
- return 0;
-}
-
-int
-be_interface_fwd::gen_client_stubs (void)
-{
- return 0;
-}
-
-int
-be_interface_fwd::gen_client_inline (void)
-{
- TAO_OutStream *ci; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
-
- // generate the ifdefined macro for the _var type
- ci->gen_ifdef_macro (this->flatname (), "_var");
-
- if (this->gen_var_impl () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface_fwd: _var impl code gen failed\n"));
- return -1;
- }
-
- ci->gen_endif ();
-
- // generate the ifdefined macro for the _out type
- ci->gen_ifdef_macro (this->flatname (), "_out");
-
- if (this->gen_out_impl () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_interface_fwd: _out impl code gen failed\n"));
- return -1;
- }
- ci->gen_endif ();
-
- return 0;
-}
-
-int
-be_interface_fwd::gen_server_header (void)
-{
- return 0;
-}
-
-int
-be_interface_fwd::gen_server_skeletons (void)
-{
- return 0;
-}
-
-int
-be_interface_fwd::gen_server_inline (void)
-{
- return 0;
-}
-
// generate the var definition
int
be_interface_fwd::gen_var_defn (void)
diff --git a/TAO/TAO_IDL/be/be_interpretive.cpp b/TAO/TAO_IDL/be/be_interpretive.cpp
index 8c40a549d5d..d7318b26324 100644
--- a/TAO/TAO_IDL/be/be_interpretive.cpp
+++ b/TAO/TAO_IDL/be/be_interpretive.cpp
@@ -74,6 +74,9 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
return new be_visitor_root_si (new_ctx);
case TAO_CodeGen::TAO_ROOT_SS:
return new be_visitor_root_ss (new_ctx);
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ return new be_visitor_root_any_op (new_ctx);
case TAO_CodeGen::TAO_MODULE_CH:
return new be_visitor_module_ch (new_ctx);
@@ -84,6 +87,10 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_MODULE_SI:
case TAO_CodeGen::TAO_MODULE_SS:
return new be_visitor_module (new_ctx);
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
+ return new be_visitor_module_any_op (new_ctx);
+
case TAO_CodeGen::TAO_INTERFACE_CH:
return new be_visitor_interface_ch (new_ctx);
@@ -101,6 +108,10 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
return new be_visitor_interface_collocated_sh (new_ctx);
case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS:
return new be_visitor_interface_collocated_ss (new_ctx);
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ return new be_visitor_interface_any_op_ch (new_ctx);
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
+ return new be_visitor_interface_any_op_cs (new_ctx);
case TAO_CodeGen::TAO_INTERFACE_FWD_CH:
return new be_visitor_interface_fwd_ch (new_ctx);
@@ -113,6 +124,10 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
return new be_visitor_structure_cs (new_ctx);
case TAO_CodeGen::TAO_STRUCT_CI:
return new be_visitor_structure_ci (new_ctx);
+ case TAO_CodeGen::TAO_STRUCT_ANY_OP_CH:
+ return new be_visitor_structure_any_op_ch (new_ctx);
+ case TAO_CodeGen::TAO_STRUCT_ANY_OP_CS:
+ return new be_visitor_structure_any_op_cs (new_ctx);
case TAO_CodeGen::TAO_CONSTANT_CH:
return new be_visitor_constant_ch (new_ctx);
@@ -123,6 +138,10 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
return new be_visitor_enum_ch (new_ctx);
case TAO_CodeGen::TAO_ENUM_CS:
return new be_visitor_enum_cs (new_ctx);
+ case TAO_CodeGen::TAO_ENUM_ANY_OP_CH:
+ return new be_visitor_enum_any_op_ch (new_ctx);
+ case TAO_CodeGen::TAO_ENUM_ANY_OP_CS:
+ return new be_visitor_enum_any_op_cs (new_ctx);
case TAO_CodeGen::TAO_FIELD_CH:
return new be_visitor_field_ch (new_ctx);
@@ -148,12 +167,15 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_UNION_PRIVATE_CH:
return new be_visitor_union_branch_private_ch (new_ctx);
case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH:
-
return new be_visitor_union_discriminant_ch (new_ctx);
case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CI:
return new be_visitor_union_discriminant_ci (new_ctx);
case TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CS:
return new be_visitor_union_discriminant_cs (new_ctx);
+ case TAO_CodeGen::TAO_UNION_ANY_OP_CH:
+ return new be_visitor_union_any_op_ch (new_ctx);
+ case TAO_CodeGen::TAO_UNION_ANY_OP_CS:
+ return new be_visitor_union_any_op_cs (new_ctx);
case TAO_CodeGen::TAO_SEQUENCE_CH:
return new be_visitor_sequence_ch (new_ctx);
@@ -172,6 +194,10 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CI:
case TAO_CodeGen::TAO_SEQUENCE_BUFFER_TYPE_CS:
return new be_visitor_sequence_buffer_type (new_ctx);
+ case TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CH:
+ return new be_visitor_sequence_any_op_ch (new_ctx);
+ case TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CS:
+ return new be_visitor_sequence_any_op_cs (new_ctx);
case TAO_CodeGen::TAO_TYPEDEF_CH:
return new be_visitor_typedef_ch (new_ctx);
@@ -179,6 +205,10 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
return new be_visitor_typedef_cs (new_ctx);
case TAO_CodeGen::TAO_TYPEDEF_CI:
return new be_visitor_typedef_ci (new_ctx);
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
+ return new be_visitor_typedef_any_op_ch (new_ctx);
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
+ return new be_visitor_typedef_any_op_cs (new_ctx);
case TAO_CodeGen::TAO_OPERATION_CH:
return new be_visitor_operation_ch (new_ctx);
@@ -275,6 +305,10 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx)
return new be_visitor_exception_ctor (new_ctx);
case TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS:
return new be_visitor_exception_ctor_assign (new_ctx);
+ case TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH:
+ return new be_visitor_exception_any_op_ch (new_ctx);
+ case TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS:
+ return new be_visitor_exception_any_op_cs (new_ctx);
case TAO_CodeGen::TAO_OPERATION_RESULT_SS:
case TAO_CodeGen::TAO_ARGUMENT_CH:
diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp
index f51a834806b..5de398f507e 100644
--- a/TAO/TAO_IDL/be/be_module.cpp
+++ b/TAO/TAO_IDL/be/be_module.cpp
@@ -35,173 +35,6 @@ be_module::be_module (UTL_ScopedName *n, UTL_StrList *p)
{
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// generate the client header
-int be_module::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
-
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_MODULE_CH); // set the current code generation state
- ch = cg->client_header (); // get the stream
-
- // XXXASG - Modules really map to namespace. We need to see if our target
- // compiler supports namespaces or not. For this release we opt to generate a
- // class definition for a module
-
- ch->indent (); // start with whatever indentation level we are at
-
- // now generate the class definition
- *ch << "class " << idl_global->export_macro ()
- << " " << local_name ();
-
- // generate the body
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent (0);
-
- // generate code for the module definition by traversing thru the
- // elements of its scope. We depend on the front-end to have made sure
- // that only legal syntactic elements appear in our scope.
- if (be_scope::gen_client_header () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_module::gen_client_header\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- ch->decr_indent ();
- *ch << "};\n\n";
- cg->pop ();
- return 0;
-}
-
-int be_module::gen_client_stubs (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_MODULE_CS); // set the current code generation state
-
- // gen code for elements in the scope
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_module::gen_client_stubs\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- cg->pop ();
- return 0;
-}
-
-int be_module::gen_server_header (void)
-{
- TAO_OutStream *sh; // output stream
- TAO_NL nl; // end line
- AST_Decl *d;
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_MODULE_SH); // set the current code generation state
-
- sh = cg->server_header ();
-
- // generate the skeleton class name
-
- sh->indent (); // start with whatever indentation level we are at
-
- // now generate the class definition. The prefix POA_ is prepended to our
- // name only if we are the outermost module
- d = ScopeAsDecl (this->defined_in ());
-
- *sh << "class " << idl_global->export_macro ()
- << " ";
- if (d->node_type () == AST_Decl::NT_root)
- // we are outermost module
- *sh << "POA_" << local_name () << nl;
- else
- // we are inside another module
- *sh << local_name () << nl;
-
- *sh << "{" << nl;
- *sh << "public:\n";
- sh->incr_indent (0);
-
- if (be_scope::gen_server_header () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_module::gen_server_header\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- sh->decr_indent ();
- *sh << "};\n\n";
- cg->pop ();
- return 0;
-}
-
-int be_module::gen_server_skeletons (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_MODULE_SS); // set the current code generation state
-
- if (be_scope::gen_server_skeletons () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_module::gen_server_skeletons\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
- cg->pop ();
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_module::gen_client_inline (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_MODULE_CI); // set the current code generation state
-
- // gen code for elements in the scope
- if (be_scope::gen_client_inline () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_module::gen_client_inline\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- cg->pop ();
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_module::gen_server_inline (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_MODULE_SI); // set the current code generation state
-
- // gen code for elements in the scope
- if (be_scope::gen_server_inline () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_module::gen_server_inline\n"));
- ACE_ERROR ((LM_ERROR, "Scope code generation failure\n"));
- return -1;
- }
-
- cg->pop ();
- return 0;
-}
-
// compute the size type of the node in question
int
be_module::compute_size_type (void)
diff --git a/TAO/TAO_IDL/be/be_native.cpp b/TAO/TAO_IDL/be/be_native.cpp
index 156f989eeda..bf2af0a6eb8 100644
--- a/TAO/TAO_IDL/be/be_native.cpp
+++ b/TAO/TAO_IDL/be/be_native.cpp
@@ -38,42 +38,6 @@ be_native::be_native (UTL_ScopedName *n,
}
int
-be_native::gen_client_header (void)
-{
- return 0;
-}
-
-int
-be_native::gen_client_stubs (void)
-{
- return 0;
-}
-
-int
-be_native::gen_server_header (void)
-{
- return 0;
-}
-
-int
-be_native::gen_server_skeletons (void)
-{
- return 0;
-}
-
-int
-be_native::gen_client_inline (void)
-{
- return 0;
-}
-
-int
-be_native::gen_server_inline (void)
-{
- return 0;
-}
-
-int
be_native::gen_typecode (void)
{
return 0;
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
index cfb9568bda6..5b1189f7cf4 100644
--- a/TAO/TAO_IDL/be/be_operation.cpp
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -112,812 +112,6 @@ be_operation::add_argument_to_scope (be_argument *arg)
return arg;
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-int
-be_operation::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
- be_type *bt; // type node
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- ch = cg->client_header ();
-
- ch->indent (); // start with the current indentation level
-
- // every operation is declared virtual in the client code
- *ch << "virtual ";
-
- // first generate the return type
- bt = be_type::narrow_from_decl (this->return_type ());
- cg->push (TAO_CodeGen::TAO_OPERATION_CH); // we are now generating an
- // operation definition with the
- // return type first
-
- s = cg->make_state (); // retrieve state based object
-
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_header - "
- "return type generation failure\n"),
- -1);
- }
- cg->pop (); // restore previous state
-
- // generate the operation name
- *ch << " " << this->local_name () << " (";
-
- // generate the arguments with the appropriate mapping
- cg->push (TAO_CodeGen::TAO_ARGUMENT_CH); // generating code for arguments in
- // the signature
- if (be_scope::gen_client_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_header - "
- "failed in argument generation in signature\n"),
- -1);
- }
- cg->pop ();
-
- // XXXASG
- // additional argument in the form of CORBA::Environment since TAO does not
- // yet support C++ style Exceptions. However, we can have an option to the
- // "tao" IDL compiler to ask it to generate code for exceptions. This will be
- // handled in a later release.
- *ch << "CORBA::Environment &env);\n";
-
- return 0;
-}
-
-int
-be_operation::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
- be_type *bt; // type node
- UTL_ScopeActiveIterator *si; // scope iterator
- AST_Decl *d; // temp node
- be_argument *bd; // argument node
- be_predefined_type *bpd=0; // predefined type used for return VOID type
- be_state *s; // state based code gen object
- long paramtblsize = 0; // size of the paradata table
-
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- cs = cg->client_stubs ();
-
- // for each operation, generate the paramdata and calldata tables followed by
- // the actual stub
-
- cs->indent (); // start with current indentation level
-
- // retrieve the return type
- bt = be_type::narrow_from_decl (this->return_type ());
-
- // bt holds the return type. Declare a variable that will hold the return
- // type. However, we must be careful if the return type is a void
- if (bt->node_type () == AST_Decl::NT_pre_defined)
- {
- bpd = be_predefined_type::narrow_from_decl (bt);
- }
-
- if (!this->has_native ())
- {
- // generate the TAO_Param_Data table
- *cs << "static const TAO_Param_Data " << this->flatname () <<
- "_paramdata [] = " << nl;
- *cs << "{\n";
- cs->incr_indent ();
-
- // entry for the return type
- *cs << "{" << bt->tc_name () << ", PARAM_RETURN, ";
-
- // Are we returning a pointer to value? i.e., is the type
- // variable? If it is, we must tell the stub what is the size of
- // the top level structure
- be_type *prim;
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- be_typedef *tdef = be_typedef::narrow_from_decl (bt);
- prim = tdef->primitive_base_type ();
- }
- else
- prim = bt;
- if (prim->size_type () == be_decl::VARIABLE)
- {
- switch (prim->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- case AST_Decl::NT_string:
- case AST_Decl::NT_sequence:
- case AST_Decl::NT_struct:
- case AST_Decl::NT_union:
- // no need of size here
- *cs << "0}";
- break;
- case AST_Decl::NT_pre_defined:
- {
- be_predefined_type *bpd = be_predefined_type::narrow_from_decl
- (bt);
- if (bpd->pt () == AST_PredefinedType::PT_pseudo)
- // no need of size here
- *cs << "0}";
- else
- *cs << "sizeof (" << bt->name () << ")}";
- }
- break;
- default:
- *cs << "sizeof (" << bt->name () << ")}";
- }
- }
- else
- *cs << "0}";
- paramtblsize++;
-
- // if we have any arguments, get each one of them
- if (this->nmembers () > 0)
- {
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
- // only if this is an argument node
- if (d->node_type () == AST_Decl::NT_argument)
- {
- bd = be_argument::narrow_from_decl (d);
- bt = be_type::narrow_from_decl (bd->field_type ());
- *cs << "," << nl; // put a comma and newline before the
- // previous entry
- *cs << "{" << bt->tc_name ();
- // based on the direction, output the appropriate constant.
- switch (bd->direction ())
- {
- case AST_Argument::dir_IN:
- *cs << ", PARAM_IN, 0}";
- break;
- case AST_Argument::dir_INOUT:
- *cs << ", PARAM_INOUT, 0}";
- break;
- case AST_Argument::dir_OUT:
- {
- *cs << ", PARAM_OUT, 0}";
-#if 0
- // Are we returning a pointer to value? i.e.,
- // is the type variable? If it is, we must
- // tell the stub what is the size of the top
- // level structure
- if (bt->size_type () == be_decl::VARIABLE)
- {
- switch (bt->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- // no need of size here
- *cs << "0}";
- break;
- case AST_Decl::NT_pre_defined:
- {
- be_predefined_type *bpd =
- be_predefined_type::narrow_from_decl (bt);
- if (bpd->pt () == AST_PredefinedType::PT_pseudo)
- // no need of size here
- *cs << "0}";
- else
- *cs << "sizeof (" << bt->name () << ")}";
- }
- break;
- default:
- *cs << "sizeof (" << bt->name () << ")}";
- }
- }
- else
- *cs << "0}";
-#endif
- }
- break;
- } // end switch
- paramtblsize++;
- } // end if argument node
- si->next ();
- } // end of while
- delete si; // free the iterator object
- } // end of arg list
- *cs << "\n";
- cs->decr_indent ();
- *cs << "};\n\n";
-
- // now generate the calldata table
-
- cs->indent ();
- *cs << "static const TAO_Call_Data " << this->flatname ()
- << "_calldata = " << nl
- << "{"
- << "\"" << this->local_name () << "\", ";
-
- // are we oneway or two operation?
- if (this->flags () == AST_Operation::OP_oneway)
- {
- *cs << "0, "; // for false
- }
- else
- {
- *cs << "1, "; // for true
- }
- // insert the size of the paramdata table
- *cs << paramtblsize << ", ";
-
- // insert the address of the paramdata table
- *cs << this->flatname () << "_paramdata, ";
-
- // XXXASG - Exception list goes here (if it exists) - TODO
- *cs << "0, 0};\n\n";
- }
-
- // now generate the actual stub
-
- // retrieve the return type again because we have used bt to also retrieve
- // the argument types
- bt = be_type::narrow_from_decl (this->return_type ());
-
- // bt holds the return type. Declare a variable that will hold the return
- // type. However, we must be careful if the return type is a void
- if (bt->node_type () == AST_Decl::NT_pre_defined)
- {
- bpd = be_predefined_type::narrow_from_decl (bt);
- }
-
- // first generate the return type
- cs->indent ();
- cg->push (TAO_CodeGen::TAO_OPERATION_RETURN_TYPE_CS); // declare a return
- // type of the stub
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "return type generation failure\n"),
- -1);
- }
- cg->pop ();
-
- // generate the operation name
- *cs << " " << this->name () << " (";
-
- // generate the arguments with the appropriate mapping
- cg->push (TAO_CodeGen::TAO_ARGUMENT_CS); // generating code for arguments in
- // the signature
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "failure in argument generation in signature\n"),
- -1);
- }
- cg->pop ();
-
- // last argument - is always CORBA::Environment
- *cs << "CORBA::Environment &env)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
-
- if (this->has_native ())
- {
- *cs << "env.exception (new CORBA::MARSHAL "
- << "(CORBA::COMPLETED_NO));" << nl;
- // return the appropriate error value on exception
- cg->push (TAO_CodeGen::TAO_OPERATION_RETVAL_EXCEPTION_CS);
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "failure returning from exception\n"),
- -1);
- }
- }
- else
- {
- // declare a return type
- cg->push (TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_CS);
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "retval declaration failure\n"),
- -1);
- }
- cg->pop ();
-
- // generate code that calls QueryInterface
- *cs << "STUB_Object *istub;\n\n";
- cs->indent ();
- *cs << "if (this->QueryInterface (IID_STUB_Object, " <<
- "(void **)&istub) != TAO_NOERROR)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "env.exception (new CORBA::DATA_CONVERSION "
- << "(CORBA::COMPLETED_NO));" << nl;
-
- // return the appropriate error value on exception
- cg->push (TAO_CodeGen::TAO_OPERATION_RETVAL_EXCEPTION_CS);
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "failure returning from exception\n"),
- -1);
- }
- cg->pop ();
-
- cs->decr_indent ();
- *cs << "}" << nl;
- *cs << "this->Release (); "
- << "// QueryInterface has bumped up our refcount" << nl;
-
- // do any pre do_static_call stuff with arguments
- cg->push (TAO_CodeGen::TAO_ARGUMENT_PRE_DOCALL_CS);
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "failure generating pre docall stuff\n"),
- -1);
- }
- cg->pop ();
-
- // call do_static_call with appropriate number of arguments
- *cs << "istub->do_static_call (env, &" << this->flatname ()
- << "_calldata";
-
- // if our return type is not void, then pass the address of retval
- if (!bpd || (bpd->pt () != AST_PredefinedType::PT_void))
- {
- be_type *prim;
- if (bt->node_type () == AST_Decl::NT_typedef)
- {
- be_typedef *tdef = be_typedef::narrow_from_decl (bt);
- prim = tdef->primitive_base_type ();
- }
- else
- prim = bt;
- if (prim->size_type () == be_decl::VARIABLE)
- {
- switch (prim->node_type ())
- {
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- case AST_Decl::NT_string:
- *cs << ", &retval";
- break;
- case AST_Decl::NT_sequence:
- case AST_Decl::NT_struct:
- case AST_Decl::NT_union:
- *cs << ", retval";
- break;
- default:
- *cs << ", &retval";
- }
- }
- else
- *cs << ", &retval";
- }
- else
- {
- // pass a 0
- *cs << ", 0";
- }
-
- cg->push (TAO_CodeGen::TAO_ARGUMENT_DOCALL_CS);
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "failed to emit code for arguments in docall\n"),
- -1);
- }
- cg->pop ();
- *cs << ");" << nl;
-
- // do any post do_static_call stuff with arguments
- cg->push (TAO_CodeGen::TAO_ARGUMENT_POST_DOCALL_CS);
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs - "
- "failed to emit code for post "
- "docall processing\n"),
- -1);
- }
- cg->pop ();
-
- // return the retval
- cg->push (TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS);
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::gen_client_stubs\n"
- "return val return generation failure\n"),
- -1);
- }
- cg->pop ();
- }
-
- cs->decr_indent (0);
- *cs << "\n}\n\n";
- return 0;
-}
-
-int
-be_operation::gen_server_header (void)
-{
- TAO_OutStream *sh; // output stream
- be_type *bt; // type node
- be_state *s; // state based code generator object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_OPERATION_SH); // we are now generating an
- // operation definition
-
- sh = cg->server_header ();
- sh->indent (); // start with the current indentation level
-
- // every operation is declared virtual
- *sh << "virtual ";
-
-
- // first generate the return type
- bt = be_type::narrow_from_decl (this->return_type ());
- s = cg->make_state (); // retrieve code gen object for this state
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR ((LM_ERROR, "be_operation::gen_server_header\n"));
- ACE_ERROR ((LM_ERROR, "return type generation failure\n"));
- return -1;
- }
- // generate the operation name
- *sh << " " << this->local_name () << " (";
-
- // generate the arguments with the appropriate mapping
- cg->push (TAO_CodeGen::TAO_ARGUMENT_SH); // generating code for arguments in
- // the signature
- if (be_scope::gen_server_header () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_operation::gen_server_header\n"));
- ACE_ERROR ((LM_ERROR, "Argument generation failure\n"));
- return -1;
- }
- cg->pop ();
-
- // XXXASG
- // additional argument in the form of CORBA::Environment since TAO does not
- // yet support Exceptions. However, we can have an option to the "tao" IDL
- // compiler to ask it to generate code for exceptions. This will be handled
- // in a later release.
- *sh << " CORBA::Environment &env) = 0; // pure virtual\n";
-
- sh->indent ();
-
- // generate the static method corresponding to this method
- *sh << "static void " << this->local_name () <<
- "_skel (CORBA::ServerRequest &req, void *obj,"
- << " void *context, CORBA::Environment &env);\n\n";
- cg->pop (); // restore previous state
- return 0;
-}
-
-// Generate code for the operation skeleton that makes the upcall.
-// Special Note: We deviate a bit from our policy of handing over code
-// generation for elements in our scope to the be_scope class. For this method,
-// it is best to simulate that behavior here as it involves a lot of
-// complexity.
-int
-be_operation::gen_server_skeletons (void)
-{
- TAO_OutStream *ss; // output stream
- TAO_NL nl; // end line
- be_type *bt; // type node
- be_type *rt; // type node for the return type
- UTL_ScopeActiveIterator *si; // scope iterator
- AST_Decl *d; // temp node
- be_argument *bd = 0; // argument node
- be_state *s; // state based code gen object
- be_predefined_type *bpd=0; // predefined return type
- be_interface *intf; // enclosing interface node
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- ss = cg->server_skeletons ();
-
- ss->indent (); // start with the current indentation level
-
- // retrieve our enclosing interface decl
- intf = be_interface::narrow_from_decl (ScopeAsDecl (this->defined_in ()));
-
- *ss << "void " << intf->full_skel_name () << "::"
- << this->local_name () << "_skel ("
- << "CORBA::ServerRequest &_tao_server_request, "
- //@@XXASG << "CORBA::Object_ptr _tao_object_reference, "
- << "void *_tao_object_reference, "
- << "void *context, "
- << "CORBA::Environment &_tao_environment)" << nl;
- *ss << "{\n";
- ss->incr_indent ();
- *ss << "ACE_UNUSED_ARG (context);" << nl;
-
- if (this->has_native ())
- {
- // Native types cannot be exported...
- *ss << "_tao_environment.exception (new CORBA::MARSHAL"
- << " (CORBA::COMPLETED_NO));\n";
- }
- else
- {
- // define an NVList to hold arguments
- *ss << "CORBA::NVList_ptr nvlist;" << nl;
- // define a variable that will eventually point to our
- // implementation object
- *ss << intf->full_skel_name () << "_ptr impl = ("
- << intf->full_skel_name () << "_ptr) _tao_object_reference;"
- << nl;
-
- // verify if we need to define a variable intended to hold the
- // operation return type. We do not need one if the return type
- // is void
-
- rt = be_type::narrow_from_decl (this->return_type ());
- if (!rt)
- {
- ACE_ERROR ((LM_ERROR,
- "be_operation::gen_server_skeletons - bad "
- "return type\n"));
- return -1;
- }
- if (rt->node_type () == AST_Decl::NT_pre_defined)
- {
- bpd = be_predefined_type::narrow_from_decl (rt);
- }
- if (!bpd || (bpd->pt () != AST_PredefinedType::PT_void))
- {
- // not a void type
- *ss << "CORBA::Any *result;" << nl;
-
- // emit the return type
-
- // emit type for return value
- cg->push (TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_SS);
-
- // get a state based code gen object
- s = cg->make_state ();
-
- if (s->gen_code (rt, this) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "be_operation::gen_server_skeletons - "
- "codegen failed for return type\n"));
- return -1;
- }
- cg->pop ();
- }
-
-#if 0
- // if we have any arguments, get each one of them and allocate
- // an Any and NamedValue for each. In addition, define a
- // variable of that type
- cg->push (TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS);
- if (be_scope::gen_server_skeletons () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_operation::gen_server_skeletons - "
- "argument gen code failed\n"),
- -1);
- }
- *ss << "\n";
- cg->pop ();
-#endif
-
- // declare an NVList and create one
- ss->indent ();
- *ss << "// create an NV list and populate it with typecodes" << nl;
- *ss << "_tao_server_request.orb ()->create_list ("
- << this->argument_count ()
- << ", nvlist); // initialize a list" << nl;
-
- // add each argument according to the in, out, inout semantics
- if (this->nmembers () > 0)
- {
- *ss << "// add each argument according to the "
- << "in, out, inout semantics" << nl;
- // if we have any arguments, insert its typecode and a
- // pointer to storage for the variable
- cg->push (TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS);
- s = cg->make_state ();
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::"
- "gen_server_skeletons - "
- "Bad state\n"),
- -1);
- }
-
- // if there are elements in this scope
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
- if (!d->imported ())
- {
- // only if this is an argument node
- if (d->node_type () == AST_Decl::NT_argument)
- {
- bd = be_argument::narrow_from_decl (d);
- if (!bd)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::"
- "gen_server_skeletons - "
- "Bad argument\n"),
- -1);
- }
- bt = be_type::narrow_from_decl (bd->field_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::"
- "gen_server_skeletons - "
- "Bad type\n"),
- -1);
- }
- // emit code that adds this argument to the
- // NVList
-#if 0
- *ss << "nv_" << bd->local_name ()
- << " = nvlist->add_value (\""
- << bd->local_name () << "\", "
- << "any_" << bd->local_name () << ", ";
- switch (bd->direction ())
- {
- case AST_Argument::dir_IN:
- *ss << "CORBA::ARG_IN, _tao_environment);" << nl;
- break;
- case AST_Argument::dir_INOUT:
- *ss << "CORBA::ARG_INOUT, _tao_environment);" << nl;
- break;
- case AST_Argument::dir_OUT:
- *ss << "CORBA::ARG_OUT, _tao_environment);" << nl;
- break;
- }
-#endif
- if (s->gen_code (bt, bd) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_operation::"
- "gen_server_skeletons - "
- "state based code gen failed\n"),
- -1);
- }
- } // end if argument node
- } // end if ! imported
- si->next ();
- } // end of while
- delete si; // free the iterator object
- cg->pop ();
- } // end of arg list
-
- // parse the arguments
- *ss << "// parse the arguments" << nl;
- *ss << "_tao_server_request.params (nvlist, _tao_environment);" << nl;
- *ss << "if (_tao_environment.exception ()) return;" << nl;
-
- cg->push (TAO_CodeGen::TAO_ARGUMENT_PRE_UPCALL_SS);
- if (be_scope::gen_server_skeletons () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_operation::gen_server_skeletons - "
- "argument gen code failed\n"),
- -1);
- }
- cg->pop ();
-
- // make the upcall
- // *ss << "impl = (" << intf->full_skel_name ()
- // << "_ptr) _tao_object_reference->get_subclass ();"
- // << nl;
- if (!bpd || (bpd->pt () != AST_PredefinedType::PT_void))
- {
- cg->push (TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS);
- s = cg->make_state ();
- // emit code to assign to retval
- if (!s || (s->gen_code (rt, this) == -1))
- {
- return -1;
- }
- *ss << " = impl->" << this->local_name () << "(";
- cg->pop ();
- }
- else
- {
- // void return type
- *ss << "impl->" << this->local_name () << "(";
- }
-
- cg->push (TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS);
- if (be_scope::gen_server_skeletons () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_operation::gen_server_skeletons - "
- "argument in upcall\n"),
- -1);
- }
- cg->pop ();
- *ss << "_tao_environment);" << nl;
-
- cg->push (TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS);
- if (be_scope::gen_server_skeletons () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_operation::gen_server_skeletons - "
- "argument gen code failed\n"),
- -1);
- }
- cg->pop ();
-
- // if there is any return type, send it via the ServerRequest
- if (!bpd || (bpd->pt () != AST_PredefinedType::PT_void))
- {
- cg->push (TAO_CodeGen::TAO_OPERATION_RESULT_SS);
- s = cg->make_state ();
- if (!s || (s->gen_code (rt, this) == -1))
- return -1;
- cg->pop ();
- *ss << "_tao_server_request.result (result, "
- << "_tao_environment);" << nl;
- }
- *ss << "\n";
- }
-
- ss->decr_indent ();
- *ss << "}\n\n";
-
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_operation::gen_client_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_operation::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
// compute the size type of the node in question
int
be_operation::compute_size_type (void)
diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp
index 2dff03c0b72..ab11824d0b6 100644
--- a/TAO/TAO_IDL/be/be_predefined_type.cpp
+++ b/TAO/TAO_IDL/be/be_predefined_type.cpp
@@ -274,84 +274,6 @@ be_predefined_type::compute_tc_name (void)
}
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// Generates the client-side header information for the predefined type
-int
-be_predefined_type::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
-
- ch->indent ();
- *ch << this->name ();
- return 0;
-}
-
-// Generates the client-side stubs for the predefined type
-int
-be_predefined_type::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- cs = cg->client_stubs ();
-
- return 0;
-}
-
-// Generates the server-side header information for the predefined type
-int
-be_predefined_type::gen_server_header (void)
-{
- TAO_OutStream *sh; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- sh = cg->server_header ();
-
- return 0;
-}
-
-// Generates the server-side skeletons for the predefined type
-int
-be_predefined_type::gen_server_skeletons (void)
-{
- TAO_OutStream *ss; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ss = cg->server_skeletons ();
-
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_predefined_type::gen_client_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_predefined_type::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
int
be_predefined_type::gen_typecode (void)
{
diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp
index 9f7f584fe85..1e7a2844c43 100644
--- a/TAO/TAO_IDL/be/be_produce.cpp
+++ b/TAO/TAO_IDL/be/be_produce.cpp
@@ -81,7 +81,7 @@ void
BE_produce()
{
be_root *root; // root of the AST made up of BE nodes
- be_visitor *root_visitor; // visitor for root
+ be_visitor *visitor; // visitor for root
be_visitor_context ctx; // context information for the visitor root
// XXXASG - Here is where we will have a choice of what to initialize i.e.,
@@ -91,10 +91,10 @@ BE_produce()
// right now we just force it to be the interpretive one.
tao_cg->visitor_factory (new TAO_Interpretive_Visitor_Factory);
- AST_Decl *d = idl_global->root (); // get the root
-
- root = be_root::narrow_from_decl (d); // narrow it to the "be_root"
- if (!root) // no root
+ // get the root node and narro wit down to be the back-end root node
+ AST_Decl *d = idl_global->root ();
+ root = be_root::narrow_from_decl (d);
+ if (!root)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
@@ -109,84 +109,99 @@ BE_produce()
// instantiate a visitor context
ctx.state (TAO_CodeGen::TAO_ROOT_CH); // set the codegen state
// get a root visitor
- root_visitor = tao_cg->make_visitor (&ctx);
- if (root->accept (root_visitor) == -1)
+ visitor = tao_cg->make_visitor (&ctx);
+ // generate code for the client header
+ if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"client header for Root failed\n"));
BE_abort();
}
- (void) tao_cg->end_client_header (); // generate the last #endif
- delete root_visitor; // it is our responsibility to free up the visitor
+ // it is our responsibility to free up the visitor
+ delete visitor;
// (2) generate client inline
// set the context information
+ ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_CI);
// create a visitor
- root_visitor = tao_cg->make_visitor (&ctx);
- if (root->accept (root_visitor) == -1)
+ visitor = tao_cg->make_visitor (&ctx);
+ // generate code for the client inline file
+ if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"client inline for Root failed\n"));
BE_abort();
}
- delete root_visitor; // it is our responsibility to free up the visitor
+ // it is our responsibility to free up the visitor
+ delete visitor;
// (3) generate client stubs
+ ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_CS);
// create a visitor
- root_visitor = tao_cg->make_visitor (&ctx);
- if (root->accept (root_visitor) == -1)
+ visitor = tao_cg->make_visitor (&ctx);
+ // generate code for the client stubs
+ if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"client stubs for Root failed\n"));
BE_abort();
}
- delete root_visitor; // it is our responsibility to free up the visitor
+ // it is our responsibility to free up the visitor
+ delete visitor;
// (4) generate server header
+ ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SH);
// create a visitor
- root_visitor = tao_cg->make_visitor (&ctx);
- if (root->accept (root_visitor) == -1)
+ visitor = tao_cg->make_visitor (&ctx);
+ // generate code for the server header file
+ if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"server header for Root failed\n"));
BE_abort();
}
- (void) tao_cg->end_server_header (); // generate the last #endif
- delete root_visitor; // it is our responsibility to free up the visitor
+ // it is our responsibility to free up the visitor
+ delete visitor;
// (5) generate server inline
+ ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SI);
// create a visitor
- root_visitor = tao_cg->make_visitor (&ctx);
- if (root->accept (root_visitor) == -1)
+ visitor = tao_cg->make_visitor (&ctx);
+ // generate code for the server inline file
+ if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"server inline for Root failed\n"));
BE_abort();
}
- delete root_visitor; // it is our responsibility to free up the visitor
+ // it is our responsibility to free up the visitor
+ delete visitor;
// (6) generate server skeletons
+ ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SS);
// create a visitor
- root_visitor = tao_cg->make_visitor (&ctx);
- if (root->accept (root_visitor) == -1)
+ visitor = tao_cg->make_visitor (&ctx);
+ // generate code for the server skeletons
+ if (root->accept (visitor) == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_produce - "
"server skeletons for Root failed\n"));
BE_abort();
}
- delete root_visitor; // it is our responsibility to free up the visitor
+ // it is our responsibility to free up the visitor
+ delete visitor;
}
/*
diff --git a/TAO/TAO_IDL/be/be_root.cpp b/TAO/TAO_IDL/be/be_root.cpp
index 96dcb1065d6..0028f985067 100644
--- a/TAO/TAO_IDL/be/be_root.cpp
+++ b/TAO/TAO_IDL/be/be_root.cpp
@@ -36,227 +36,6 @@ be_root::be_root (UTL_ScopedName *n, UTL_StrList *p)
{
}
-// =====================================================
-// CODE GENERATION METHODS
-// =====================================================
-
-// Starting point for the code generation. Called inside BE_produce ()
-int be_root::gen_idl2cplusplus_mapping (void)
-{
- // this is the main starting point from which the files are generated. We
- // delegate the task of code generation to a special Code Generation
- // object. This allows a number of different front ends to access the services
- // of a single code generator
-
- // C++ mapping involves producing 6 files. These include the client and
- // server side headers, the client and server side inlines, as well as client
- // stubs and server skeletons.
- if (this->gen_client_header () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error generating client header file: %s\n",
- idl_global->be_get_client_hdr_fname ()));
- return -1;
- }
- if (this->gen_client_inline () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error generating client inline file: %s\n",
- idl_global->be_get_client_inline_fname ()));
- return -1;
- }
- if (this->gen_client_stubs () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error generating client stubs file: %s\n",
- idl_global->be_get_client_stub_fname ()));
- return -1;
- }
- if (this->gen_server_header () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error generating server header file: %s\n",
- idl_global->be_get_server_hdr_fname ()));
- return -1;
- }
- if (this->gen_server_inline () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error generating server inline file: %s\n",
- idl_global->be_get_server_inline_fname ()));
- return -1;
- }
- if (this->gen_server_skeletons () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error generating server skeleton file: %s\n",
- idl_global->be_get_server_skeleton_fname ()));
- return -1;
- }
-
- return 0;
-}
-
-// generate client header
-int be_root::gen_client_header (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ROOT_CH); // set the code generation state
-
- // open the client-side header file
- if (cg->client_header (idl_global->be_get_client_hdr_fname ()) == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error opening client header\n"));
- return -1;
- }
- // delegate the task of code generation to the scope
- if (be_scope::gen_client_header () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n"));
- return -1;
- }
- cg->pop ();
-
- // at this point, we must be in the initial state
- ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL);
-
- (void) cg->end_client_header (); // generate the last #endif
- return 0;
-}
-
-// Generates the client-side stubs for the root
-int be_root::gen_client_stubs (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ROOT_CS); // set the code generation state
-
- // open the client-side stub file
- if (cg->client_stubs (idl_global->be_get_client_stub_fname ()) == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error opening client stubs file\n"));
- return -1;
- }
- // delegate the task of code generation to the scope
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n"));
- return -1;
- }
- cg->pop ();
-
- // at this point, we must be in the initial state
- // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL);
-
- return 0;
-}
-
-// Generates the client-side inlines for the root
-int be_root::gen_client_inline (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ROOT_CI); // set the code generation state
-
- // open the client-side inline file
- if (cg->client_inline (idl_global->be_get_client_inline_fname ()) == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error opening client inline file\n"));
- return -1;
- }
- // delegate the task of code generation to the scope
- if (be_scope::gen_client_inline () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n"));
- return -1;
- }
- cg->pop ();
-
- // at this point, we must be in the initial state
- // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL);
-
- return 0;
-}
-
-// Generates the server-side header information for the root
-int be_root::gen_server_header (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ROOT_SH); // set the code generation state
-
- // open the server-side header file
- if (cg->server_header (idl_global->be_get_server_hdr_fname ()) == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error opening server header\n"));
- return -1;
- }
- // delegate the task of code generation to the scope
- if (be_scope::gen_server_header () == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "be_root: server code generation for scope failed\n"));
- return -1;
- }
-
- cg->pop ();
-
- // at this point, we must be in the initial state
- // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL);
-
- (void) cg->end_server_header (); // generate the last #endif statement
- return 0;
-}
-
-// Generates the server-side skeletons for the root
-int be_root::gen_server_skeletons (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ROOT_SS); // set the code generation state
-
- // open the server-side skeleton file
- if (cg->server_skeletons (idl_global->be_get_server_skeleton_fname ()) == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error opening server skeletons file\n"));
- return -1;
- }
- // delegate the task of code generation to the scope
- if (be_scope::gen_server_skeletons () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n"));
- return -1;
- }
- cg->pop ();
-
- // at this point, we must be in the initial state
- // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL);
-
- return 0;
-}
-
-// Generates the server-side inlines for the root
-int be_root::gen_server_inline (void)
-{
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ROOT_SI); // set the code generation state
-
- // open the server-side inline file
- if (cg->server_inline (idl_global->be_get_server_inline_fname ()) == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: Error opening server inline file\n"));
- return -1;
- }
- // delegate the task of code generation to the scope
- if (be_scope::gen_server_inline () == -1)
- {
- ACE_ERROR ((LM_ERROR, "be_root: code generation for scope failed\n"));
- return -1;
- }
- cg->pop ();
-
- // at this point, we must be in the initial state
- // ACE_ASSERT (cg->state () == TAO_CodeGen::TAO_INITIAL);
-
- return 0;
-}
-
// We had to provide these since the AST_Root::fe_* method was setting the
// names of these three to "local type"
diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp
index 1842d29143a..403431f1609 100644
--- a/TAO/TAO_IDL/be/be_scope.cpp
+++ b/TAO/TAO_IDL/be/be_scope.cpp
@@ -36,356 +36,6 @@ be_scope::comma (void) const
}
int
-be_scope::gen_client_header (void)
-{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- be_decl *bd;
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- TAO_OutStream *os = cg->client_header (); // output stream
-
- if (this->nmembers () > 0)
- {
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
- if (!d->imported ())
- {
- // we are not imported.
-
- // NOTE: Our assumption here is that whatever scope we are in, the
- // node type that shows up here *MUST* be valid according to the
- // IDL grammar. We do not check for this since the front end must
- // have taken care of weeding out such errors
-
- // The FE does some strange things in which items get added to
- // the enclosing scope as well as the scope that encloses the
- // enclosing scope. We do not want to generate code for items
- // that do not belong to the appropriate scope
-
- bd = be_decl::narrow_from_decl (d);
- // @@ Despite the comment above the following code will
- // crash without the if() around it.
- if (bd != 0)
- {
- if (bd->gen_client_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_scope::gen_client_header failed\n"),
- -1);
- }
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l) be_scope::gen_client_header - "
- "narrow_from_decl returned 0\n"));
- }
- } // no imported
- si->next ();
- if (!si->is_done () && this->comma_)
- {
- *os << ", "; // generate a comma
- }
- } // end of while
- delete si; // free the iterator object
- }
- return 0;
-}
-
-int
-be_scope::gen_client_stubs (void)
-{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- be_decl *bd;
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- TAO_OutStream *os = cg->client_stubs (); // output stream
-
- if (this->nmembers () > 0)
- {
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
- if (!d->imported ())
- {
- // we are not imported.
- // NOTE: Our assumptin here is that whatever scope we are in, the
- // node type that shows up here *MUST* be valid according to the
- // IDL grammar. We do not check for this since the front end must
- // have taken care of weeding out such errors
-
- bd = be_decl::narrow_from_decl (d);
- // @@ Despite the comment above the following code will
- // crash without the if() around it.
- if (bd != 0)
- {
- if (bd->gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_scope::gen_client_stubs failed\n"),
- -1);
- }
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l) be_scope::gen_client_stubs - "
- "narrow_from_decl returned 0\n"));
- }
- } // not imported
- si->next ();
- if (!si->is_done () && this->comma_)
- {
- *os << ", "; // generate a comma
- }
- } // end of while
- delete si; // free the iterator object
- }
- return 0;
-}
-
-int
-be_scope::gen_client_inline (void)
-{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- be_decl *bd;
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- TAO_OutStream *os = cg->client_inline (); // output stream
-
- if (this->nmembers () > 0)
- {
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
- if (!d->imported ())
- {
- // we are not imported.
- // NOTE: Our assumptin here is that whatever scope we are in, the
- // node type that shows up here *MUST* be valid according to the
- // IDL grammar. We do not check for this since the front end must
- // have taken care of weeding out such errors
-
- bd = be_decl::narrow_from_decl (d);
- if (bd != 0)
- {
- if (bd->gen_client_inline () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_scope::gen_client_inline failed\n"),
- -1);
- }
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l) be_scope::gen_client_inline - "
- "narrow_from_decl returned 0\n"));
- }
- } // not imported
- si->next ();
- if (!si->is_done () && this->comma_)
- {
- *os << ", "; // generate a comma
- }
- } // end of while
- delete si; // free the iterator object
- }
- return 0;
-}
-
-int
-be_scope::gen_server_header (void)
-{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- be_decl *bd;
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- TAO_OutStream *os = cg->server_header (); // output stream
-
- if (this->nmembers () > 0)
- {
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
- if (!d->imported ())
- {
- // we are not imported.
- // we are not imported.
-
- // NOTE: Our assumptin here is that whatever scope we are in, the
- // node type that shows up here *MUST* be valid according to the
- // IDL grammar. We do not check for this since the front end must
- // have taken care of weeding out such errors
-
- bd = be_decl::narrow_from_decl (d);
- if (bd != 0)
- {
- if (bd->gen_server_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_scope::gen_server_header failed\n"),
- -1);
- }
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l) be_scope::gen_server_header - "
- "narrow_from_decl returned 0\n"));
- }
- } // not imported
- si->next ();
- if (!si->is_done () && this->comma_)
- {
- *os << ", "; // generate a comma
- }
- } // end of while
- delete si; // free the iterator object
- }
- return 0;
-}
-
-int
-be_scope::gen_server_skeletons (void)
-{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- be_decl *bd;
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- TAO_OutStream *os = cg->server_skeletons (); // output stream
-
- if (this->nmembers () > 0)
- {
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
- if (!d->imported ())
- {
- // we are not imported.
-
- // NOTE: Our assumptin here is that whatever scope we are in, the
- // node type that shows up here *MUST* be valid according to the
- // IDL grammar. We do not check for this since the front end must
- // have taken care of weeding out such errors
-
- bd = be_decl::narrow_from_decl (d);
- if (bd != 0)
- {
- if (bd->gen_server_skeletons () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_scope::gen_server_skeletons failed\n"),
- -1);
- }
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l): be_scope::gen-server_skeletons - "
- "narrow_from_decl returned 0\n"));
- }
- } // not imported
- si->next ();
- if (!si->is_done () && this->comma_)
- {
- *os << ", "; // generate a comma
- }
- } // end of while
- delete si; // free the iterator object
- }
- return 0;
-}
-
-int
-be_scope::gen_server_inline (void)
-{
- UTL_ScopeActiveIterator *si;
- AST_Decl *d;
- be_decl *bd;
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- TAO_OutStream *os = cg->server_inline (); // output stream
-
- if (this->nmembers () > 0)
- {
- // if there are elements in this scope
-
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
-
- if (!d->imported ())
- {
- // we are not imported.
- // NOTE: Our assumptin here is that whatever scope we are in, the
- // node type that shows up here *MUST* be valid according to the
- // IDL grammar. We do not check for this since the front end must
- // have taken care of weeding out such errors
-
- bd = be_decl::narrow_from_decl (d);
- if (bd != 0)
- {
- if (bd->gen_server_inline () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_scope::gen_server_inline failed\n"),
- -1);
- }
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "WARNING (%N:%l): be_scope::gen_server_inline - "
- "narrow_from_decl returned 0\n"));
- }
- }
- si->next ();
- if (!si->is_done () && this->comma_)
- {
- *os << ", "; // generate a comma
- }
- } // end of while
- delete si; // free the iterator object
- }
- return 0;
-}
-
-int
be_scope::gen_encapsulation (void)
{
UTL_ScopeActiveIterator *si;
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index 6ffdfbe8997..318cc8f4968 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -204,2326 +204,6 @@ be_sequence::managed_type (void)
return this->mt_;
}
-int
-be_sequence::gen_client_header (void)
-{
-#if 0 /* visitor code */
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- be_type *bt; // type node
- be_state *s; // state based code gen object
-#endif /* visitor code */
-
- if (!this->cli_hdr_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- // first create a name for ourselves. We defer name creation for
- // ourselves to this point since named sequences should get the name
- // of the typedef node, else some other technique of name generation
- // should be used.
- if (this->create_name () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_sequence::gen_client_header - name creation failed\n"),
- -1);
- }
-
- be_visitor *visitor_seq_ch = cg->make_visitor (0);
- // (TAO_CodeGen::TAO_SEQUENCE_BODY_CH);
-
- if (this->accept (visitor_seq_ch) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence - "
- "gen_client_header"
- "\n"),
- -1);
- }
-
-#if 0 /* visitor code */
- ch = cg->client_header ();
-
- // generate the ifdefined macro for the sequence type
- ch->gen_ifdef_macro (this->flatname ());
-
- ch->indent (); // start with the current indentation level
-
- *ch << "// *************************************************************"
- << nl;
- *ch << "// class " << this->local_name () << nl;
- *ch << "// *************************************************************"
- << nl << nl;
-
- *ch << "class " << idl_global->export_macro ()
- << " " << this->local_name () << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent (0);
-
- // retrieve the base type since we may need to do some code
- // generation for the base type.
- bt = be_type::narrow_from_decl (this->base_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence.cpp - "
- "Bad base type\n"),
- -1);
- }
-
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BASE_CH); // set current code gen
- // state
- s = cg->make_state ();
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence.cpp - "
- "base type codegen failed\n"),
- -1);
- }
- cg->pop ();
-
- // now generate the sequence body
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CH);
- s = cg->make_state ();
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "bad state\n"),
- -1);
- }
-
- // generate constructors
- ch->indent ();
- *ch << this->local_name () << " (void); // default constructor" << nl;
- // check whether we are bounded or not. Depending on that the mapping is
- // slightly different as shown below
- if (this->unbounded_)
- {
- *ch << local_name () << " (CORBA::ULong max);" << nl;
- *ch << local_name () << " (CORBA::ULong max, CORBA::ULong length, " << nl;
- }
- else
- {
- // bounded seq does not take the "max" argument
- *ch << local_name () << " (CORBA::ULong length, " << nl;
- }
-
- *ch << " ";
- // generate the type info for the element type
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "state based codegen failed\n"),
- -1);
- }
-
- *ch << " *value, CORBA::Boolean release=CORBA::B_FALSE);" << nl;
- *ch << local_name () << "(const " << local_name () <<
- " &); // copy constructor" << nl;
- *ch << "~" << this->local_name () << " (void);" << nl;
- *ch << this->local_name () << " &operator= (const " <<
- this->local_name () << " &);" << nl;
- *ch << "CORBA::ULong maximum (void) const;" << nl;
- *ch << "void length (CORBA::ULong);" << nl;
- *ch << "CORBA::ULong length (void) const;" << nl;
-
- // we need a new state here because the [] operator for strings and obj
- // references returns a managed type as opposed to the normal type
- cg->push (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH);
- s = cg->make_state ();
- if (!s || s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "state based codegen failed\n"),
- -1);
- }
- *ch << "operator[] (CORBA::ULong index);" << nl;
- *ch << "const ";
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "state based codegen failed\n"),
- -1);
- }
- *ch << "operator[] (CORBA::ULong index) const;" << nl;
- cg->pop (); // back to the previous state
-
- s = cg->make_state ();
- // generate the static allocbuf and freebuf methods
- *ch << "static ";
- if (!s || s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "state based codegen failed\n"),
- -1);
- }
- *ch << " *allocbuf (CORBA::ULong nelems);" << nl;
- *ch << "static void freebuf (";
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "state based codegen failed\n"),
- -1);
- }
- *ch << " *);\n" ;
-
- // the spec says that for managed sequence types, the freebuf method
- // should individually free up the elements before deleting the
- // buffer. However, freebuf does not have a parameter that indicates the
- // total number of elements that are in the buffer. Hence we provide a
- // helper method to freebuf
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- case be_sequence::MNG_STRING:
- ch->indent ();
- *ch << "static void freebuf (" << nl;
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "state based codegen failed\n"),
- -1);
- }
- *ch << " *, CORBA::ULong);\n" ;
- break;
- default:
- break;
- }
- ch->decr_indent ();
- *ch << "private:\n";
- ch->incr_indent ();
- *ch << "CORBA::ULong maximum_;" << nl;
- *ch << "CORBA::ULong length_;" << nl;
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "state based codegen failed\n"),
- -1);
- }
-
- *ch << " *buffer_;" << nl;
- *ch << "CORBA::Boolean release_;\n";
- ch->decr_indent ();
- *ch << "};\n";
- ch->indent ();
- *ch << "typedef " << this->local_name () << "* "
- << this->local_name () << "_ptr;\n";
- // Generate the typecode decl
- if (this->is_nested ())
- {
- // we have a scoped name
- ch->indent ();
- *ch << "static CORBA::TypeCode_ptr " << this->tc_name
- ()->last_component () << ";\n\n";
- }
- else
- {
- // we are in the ROOT scope
- ch->indent ();
- *ch << "extern "
- << idl_global->export_macro ()
- << " CORBA::TypeCode_ptr "
- << this->tc_name ()->last_component () << ";\n\n";
- }
-
- ch->gen_endif (); // endif macro
-
- // generate the ifdefined macro for the var type
- ch->gen_ifdef_macro (this->flatname (), "_var");
-
- // generate the var and out types
- if (this->gen_var_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "codegen for _var failed\n"),
- -1);
- }
-
- ch->gen_endif ();
-
- // generate the ifdefined macro for the var type
- ch->gen_ifdef_macro (this->flatname (), "_out");
-
- if (this->gen_out_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_header - "
- "codegen for _out failed\n"),
- -1);
- }
- ch->gen_endif ();
-
- cg->pop ();
-#endif /* visitor code */
-
- this->cli_hdr_gen_ = I_TRUE;
- } // if (cli_hdr_gen_)
- return 0;
-}
-
-int
-be_sequence::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
-#if 0 /* visitor code */
- be_type *bt; // base type
- be_state *s; //state object
-#endif /* visitor code */
-
- if (!this->cli_stub_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- cs = cg->client_stubs (); // retrieve the client stubs stream
- // generate the ifdefined macro for the sequence type
- cs->gen_ifdef_macro (this->flatname ());
-
-#if 0 /* visitor code */
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_stubs - "
- "bad type\n"),
- -1);
- }
-
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BASE_CS);
- s = cg->make_state ();
-
- // generate stubs for our base type if it itself is a sequence or we
- // need to generate code for our managed types
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_stubs - "
- "state based codegen failed\n"),
- -1);
- }
-
- cg->pop ();
-
- // generate the methods of the sequence C++ mapping
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CS);
- s = cg->make_state ();
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_stubs - "
- "bad state\n"),
- -1);
- }
-
-
- *cs << "// *************************************************************"
- << nl;
- *cs << "// class " << this->name () << nl;
- *cs << "// *************************************************************\n\n";
-
- // copy constructor
- cs->indent ();
- *cs << "// copy constructor" << nl;
- *cs << this->name () << "::" << this->local_name () <<
- " (const " << this->name () << " &seq)" << nl;
- *cs << " : maximum_ (seq.maximum_)," << nl;
- *cs << " length_ (seq.length_)," << nl;
- *cs << " buffer_ (" << this->name () << "::allocbuf (seq.maximum_)),"
- << nl;
- *cs << " release_ (1) // we always own it" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- // copy each element
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- *cs << "for (CORBA::ULong i=0; i < seq.length_; i++)" << nl;
- *cs << "{" << nl;
- *cs << " this->buffer_[i] = " << bt->name () << "::_duplicate ("
- << "seq.buffer_[i]);" << nl;
- *cs << "}\n";
- }
- break;
- case be_sequence::MNG_STRING:
- {
- *cs << "for (CORBA::ULong i=0; i < seq.length_; i++)" << nl;
- *cs << "{" << nl;
- *cs << " this->buffer_[i] = CORBA::string_dup (" <<
- "seq.buffer_[i]);" << nl;
- *cs << "}\n";
- }
- break;
- default: // all other types are self managed, just assign them.
- *cs << "for (CORBA::ULong i=0; i < seq.length_; i++)" << nl;
- *cs << " this->buffer_[i] = seq.buffer_[i];\n";
- }
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // constructor only for unbounded seq. This takes in "max length"
- if (this->unbounded_)
- {
- cs->indent ();
- *cs << "// constructor for unbounded seq" << nl;
- *cs << this->name () << "::" << this->local_name () <<
- "(CORBA::ULong max )" << nl;
- *cs << " : maximum_ (max)," << nl;
- *cs << " length_ (0)," << nl;
- *cs << " buffer_ (" << this->name () << "::allocbuf (max))," << nl;
- *cs << " release_ (1) // owns" << nl;
- *cs << "{\n";
- *cs << "}\n\n";
- }
-
- // constructor that takes in the data buffer
- cs->indent ();
- *cs << "// constructor from data buffer" << nl;
- *cs << this->name () << "::" << this->local_name ();
- // depending on whether we are bounded or not, the constructor has
- // different sets of parameters
- if (this->unbounded_)
- {
- *cs << " (CORBA::ULong max, CORBA::ULong length, " << nl;
- }
- else
- {
- // bounded seq does not take the "max" argument
- *cs << " (CORBA::ULong length, " << nl;
- }
- *cs << " ";
- if (s->gen_code (bt, this) == -1)
- return -1;
- *cs << " *value, CORBA::Boolean release)" << nl;
- // for unbounded we have the additional max parameter
- if (this->unbounded_)
- {
- *cs << " : maximum_ (max)," << nl;
- }
- else
- {
- *cs << " : maximum_ (" << this->max_size () << ")," << nl;
- }
- *cs << " length_ (length)," << nl;
- *cs << " buffer_ (value)," << nl;
- *cs << " release_ (release) // ownership depends on release" << nl;
- *cs << "{\n";
- *cs << "}\n\n";
-
- // destructor
- cs->indent ();
- *cs << "// destructor" << nl;
- *cs << this->name () << "::~" << this->local_name () << " (void)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (this->release_) // we own the buffer" << nl;
- *cs << "{\n";
- cs->incr_indent ();
-
- // only for obj references and strings, we need to free each individual
- // element
- // call the appropriate freebuf on the buffer
- if (this->managed_type () != be_sequence::MNG_NONE)
- {
- *cs << this->name () << "::freebuf (this->buffer_, " <<
- "this->maximum_);\n";
- }
- else
- *cs << this->name () << "::freebuf (this->buffer_);\n";
-
- cs->decr_indent ();
- *cs << "}\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // assignment operator
- cs->indent ();
- *cs << "// assignment operator" << nl;
- *cs << this->name () << "& " << nl;
- *cs << this->name () << "::operator=" <<
- " (const " << this->name () << " &seq)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- // check for equality
- *cs << "if (this == &seq) return *this;" << nl;
- // otherwise, if release flag, free the buffer
- *cs << "if (this->release_)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- // only for obj references and strings, we need to free each individual
- // element
- // call the appropriate freebuf on the buffer
- if (this->managed_type () != be_sequence::MNG_NONE)
- {
- *cs << this->name () << "::freebuf (this->buffer_, " <<
- "this->maximum_);\n";
- }
- else
- *cs << this->name () << "::freebuf (this->buffer_);\n";
-
- cs->decr_indent ();
- *cs << "}" << nl;
-
- *cs << "this->length_ = seq.length_;" << nl;
- *cs << "this->maximum_ = seq.maximum_;" << nl;
- *cs << "this->buffer_ = " << this->name () << "::allocbuf (seq.maximum_),"
- << nl;
- *cs << "this->release_ = 1; // we always own it" << nl;
- // copy each element
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- *cs << "for (CORBA::ULong i=0; i < seq.length_; i++)" << nl;
- *cs << "{" << nl;
- *cs << " this->buffer_[i] = " << bt->name () << "::_duplicate ("
- << "seq.buffer_[i]);" << nl;
- *cs << "}" << nl;
- }
- break;
- case be_sequence::MNG_STRING:
- {
- *cs << "for (CORBA::ULong i=0; i < seq.length_; i++)" << nl;
- *cs << "{" << nl;
- *cs << " this->buffer_[i] = CORBA::string_dup (" <<
- "seq.buffer_[i]);" << nl;
- *cs << "}" << nl;
- }
- break;
- default: // all other types are self managed, just assign them.
- *cs << "for (CORBA::ULong i=0; i < seq.length_; i++)" << nl;
- *cs << " this->buffer_[i] = seq.buffer_[i];" << nl;
- }
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // the length method
- cs->indent ();
- *cs << "void" << nl;
- *cs << this->name () << "::length (CORBA::ULong length)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- if (!this->unbounded_) // bounded sequence - we cannot increase length
- // more than its max => no reallocation necessary
- {
- // The sequence has a maximum length, check that the new
- // length is valid before changing anything.
- *cs << "if (length > this->maximum_)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "// @@ throw something?" << nl;
- *cs << "return;\n";
- cs->decr_indent ();
- *cs << "}" << nl;
- *cs << "this->length_ = length;\n";
- }
- else // unbounded buffer - may need reallocation
- {
- // Reallocate the buffer.
- *cs << "if (length > this->maximum_) // need realloc" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_stubs - "
- "bad state\n"),
- -1);
- }
-
- *cs << " *tmp = " << this->name ()
- << "::allocbuf (length);" << nl;
- *cs << "if (!tmp)" << nl;
- *cs << " return;" << nl;
-
- // copy each element. Allocate a new manager and initialize it.
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- *cs << "CORBA::ULong i;" << nl;
- *cs << "// copy old buffer" << nl;
- *cs << "for (i=0; i < this->length_; i++)" << nl;
- *cs << "{" << nl;
- *cs << " tmp[i] = " << bt->name () << "::_duplicate ("
- << "this->buffer_[i]);" << nl;
- *cs << "}" << nl;
- }
- break;
- case be_sequence::MNG_STRING:
- {
- *cs << "CORBA::ULong i;" << nl;
- *cs << "// copy old buffer" << nl;
- *cs << "for (i=0; i < this->length_; i++)" << nl;
- *cs << "{" << nl;
- *cs << " tmp[i] = CORBA::string_dup (" <<
- "this->buffer_[i]);" << nl;
- *cs << "}" << nl;
- }
- break;
- default: // all other types are self managed, just assign them.
- {
- *cs << "CORBA::ULong i;" << nl;
- *cs << "// copy old buffer" << nl;
- *cs << "for (i=0; i < this->length_; i++)" << nl;
- *cs << "{" << nl;
- *cs << " tmp[i] = this->buffer_[i];" << nl;
- *cs << "}" << nl;
- }
- }
- // if release is set, we must free the previous buffer
- *cs << "if (this->release_) // free old one if we own it" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- // only for obj references and strings, we need to free each individual
- // element. Others are self managed.
- // call the appropriate freebuf on the buffer
- if (this->managed_type () != be_sequence::MNG_NONE)
- {
- *cs << this->name () << "::freebuf (this->buffer_, " <<
- "this->maximum_);\n";
- }
- else
- *cs << this->name () << "::freebuf (this->buffer_);\n";
-
- cs->decr_indent ();
- *cs << "}" << nl;
-
- *cs << "//assign the newly reallocated buffer" << nl;
- *cs << "this->buffer_ = tmp;" << nl;
- *cs << "this->release_ = 1; //after reallocation, we own it" << nl;
- *cs << "this->maximum_ = length;\n";
- cs->decr_indent ();
- *cs << "}" << nl;;
- *cs << "this->length_ = length;\n";
- }
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // the allocbuf method
- cs->indent ();
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_stubs - "
- "state based codegen failed\n"),
- -1);
- }
-
- *cs << " *" << nl;
- *cs << this->name () << "::allocbuf (CORBA::ULong nelems)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_stubs - "
- "state based codegen failed\n"),
- -1);
- }
-
- *cs << " *buf = new ";
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_stubs - "
- "state based codegen failed\n"),
- -1);
- }
- *cs << "[nelems]; // allocate from heap" << nl;
- // the managed types must be initilaized
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- *cs << "for (CORBA::ULong i=0; i < nelems; i++)" << nl;
- *cs << " buf[i] = " << bt->name () << "::_nil ();" << nl;
- }
- break;
- case be_sequence::MNG_STRING:
- {
- *cs << "for (CORBA::ULong i=0; i < nelems; i++)" << nl;
- *cs << " buf[i] = (char *)0;" << nl;
- }
- break;
- }
- *cs << "return buf;\n";
-
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // extra freebuf method for managed types
- if (this->managed_type () != MNG_NONE)
- {
- cs->indent ();
- *cs << "void" << nl;
- *cs << this->name () << "::freebuf (";
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "state based codegen failed\n"),
- -1);
- }
-
- *cs << " *seq, CORBA::ULong nelems)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (!seq) return; // null sequence" << nl;
- // the managed types must be individually freed. The others will have
- // their destructors called.
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- *cs << "for (CORBA::ULong i=0; i < nelems; i++)" << nl;
- *cs << " CORBA::release (seq[i]);" << nl;
- }
- break;
- case be_sequence::MNG_STRING:
- {
- *cs << "for (CORBA::ULong i=0; i < nelems; i++)" << nl;
- *cs << " CORBA::string_free (seq[i]);" << nl;
- }
- break;
- }
- *cs << this->name () << "::freebuf (seq);\n";
- cs->decr_indent ();
- *cs << "}\n\n";
- }
-#endif /* visitor code */
- // generate the typecode information here
- cs->indent (); // start from current indentation level
- *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
- nl;
- *cs << "{\n";
- cs->incr_indent (0);
- if (this->gen_encapsulation () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_stubs - "
- "codegen for encapsulation failed\n"),
- -1);
- }
-
- cs->decr_indent ();
- *cs << "};" << nl;
-
- *cs << "static CORBA::TypeCode _tc__tc_" << this->flatname () <<
- " (CORBA::tk_sequence, sizeof (_oc_" << this->flatname () <<
- "), (char *) &_oc_" << this->flatname () <<
- ", CORBA::B_FALSE);" << nl;
- *cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" <<
- this->flatname () << ";\n\n";
-
-#if 0
- cg->pop ();
-#endif
- this->cli_stub_gen_ = I_TRUE;
-
- cs->gen_endif ();
- }
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_sequence::gen_client_inline (void)
-{
- TAO_OutStream *ci; // output stream
-#if 0 /* visitor code */
- TAO_NL nl; // end line
- be_state *s; // code gen state
- be_type *bt; // base type
-#endif /* visitor code */
-
- if (!this->cli_inline_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
-#if 0
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "bad type\n"),
- -1);
- }
-
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BASE_CI);
- s = cg->make_state ();
-
- // generate inline methods for our base type if it itself is a sequence
- if (!s || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "state based codegen failed\n"),
- -1);
- }
- cg->pop ();
-
- // generate the methods of the sequence C++ mapping
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CI);
- s = cg->make_state ();
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "bad state\n"),
- -1);
- }
-
- // generate the ifdefined macro for type
- ci->gen_ifdef_macro (this->flatname ());
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// class " << this->name () << nl;
- *ci << "// *************************************************************\n\n";
-
- // freebuf method
- ci->indent ();
- *ci << "ACE_INLINE void" << nl;
- *ci << this->name () << "::freebuf (";
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "state based codegen failed\n"),
- -1);
- }
-
- *ci << " *seq)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete []seq;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // default constructor
- ci->indent ();
- *ci << "//default constructor" << nl;
- *ci << "ACE_INLINE " << nl;
- *ci << this->name () << "::" << this->local_name () << " (void)" << nl;
- // for bounded and unbounded, initialize the data members differently
- if (this->unbounded_)
- {
- *ci << " : maximum_ (0)," << nl;
- *ci << " length_ (0)," << nl;
- *ci << " buffer_ (0)," << nl;
- *ci << " release_ (0) // does not own" << nl;
- }
- else
- {
- *ci << " : maximum_ (" << this->max_size () << ")," << nl;
- *ci << " length_ (0)," << nl;
- *ci << " buffer_ (" << this->name () << "::allocbuf (" <<
- this->max_size () << "))," << nl;
- *ci << " release_ (1) // owns" << nl;
- }
- *ci << "{}\n\n";
-
- // the maximum method
- ci->indent ();
- *ci << "ACE_INLINE CORBA::ULong" << nl;
- *ci << this->name () << "::maximum (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->maximum_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // the length method
- ci->indent ();
- *ci << "ACE_INLINE CORBA::ULong" << nl;
- *ci << this->name () << "::length (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->length_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- cg->pop ();
-
- // subscript operators (1) read-only, (2) read/write
- cg->push (TAO_CodeGen::TAO_SEQELEM_RETTYPE_CI);
- s = cg->make_state ();
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "bad state\n"),
- -1);
- }
-
- ci->indent ();
- *ci << "ACE_INLINE ";
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "state based codegen failed\n"),
- -1);
- }
-
- *ci << nl;
- *ci << this->name () << "::operator[] (CORBA::ULong index) // read/write"
- << nl;
- *ci << "{\n";
- ci->incr_indent ();
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- *ci << "return " << this->name () << "::TAO_ObjRefMngType (" <<
- "&this->buffer_[index], this->release_);\n";
- break;
- case be_sequence::MNG_STRING:
- *ci << "return " << this->name () << "::TAO_StrMngType (" <<
- "&this->buffer_[index], this->release_);\n";
- break;
- default:
- *ci << "return this->buffer_[index];\n";
- }
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE const ";
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "state based codegen failed\n"),
- -1);
- }
-
- *ci << nl;
- *ci << this->name () << "::operator[] (CORBA::ULong index) const // read"
- << nl;
- *ci << "{\n";
- ci->incr_indent ();
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- *ci << "return " << this->name () << "::TAO_ObjRefMngType (" <<
- "&this->buffer_[index], this->release_);\n";
- break;
- case be_sequence::MNG_STRING:
- *ci << "return " << this->name () << "::TAO_StrMngType (" <<
- "&this->buffer_[index], this->release_);\n";
- break;
- default:
- *ci << "return this->buffer_[index];\n";
- }
- ci->decr_indent ();
- *ci << "}\n\n";
- cg->pop ();
- ci->gen_endif (); // endif macro
-#endif
- // generate the ifdefined macro for the var type
- ci->gen_ifdef_macro (this->flatname (), "_var");
-
- // generate the implementations for the _var and _impl classes
- if (this->gen_var_impl () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "var implementation failed\n"),
- -1);
- }
- ci->gen_endif ();
-
- // generate the ifdefined macro for the var type
- ci->gen_ifdef_macro (this->flatname (), "_out");
-
- if (this->gen_out_impl () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_client_inline - "
- "out impl failed\n"),
- -1);
- }
- ci->gen_endif (); // endif macro
-
- this->cli_inline_gen_ = I_TRUE;
- }
- return 0;
-}
-
-int
-be_sequence::gen_server_header (void)
-{
- // nothing to be done
- return 0;
-}
-
-int
-be_sequence::gen_server_skeletons (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_sequence::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// generate the _var definition for ourself
-int
-be_sequence::gen_var_defn (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // names
- be_state *s; // code gen state
- be_type *bt; // base type
- be_decl *scope; // our enclosing scope
-
-
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (namebuf, "%s_var", this->local_name ()->get_string ());
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
-
- *ch << "// *************************************************************"
- << nl;
- *ch << "// class " << this->name () << "_var" << nl;
- *ch << "// *************************************************************\n\n";
-
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CH);
- s = cg->make_state ();
-
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_var_defn - "
- "state based codegen failed\n"),
- -1);
- }
-
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
-
- if (this->defined_in ())
- scope = be_scope::narrow_from_scope (this->defined_in ())->decl ();
- else
- scope = 0;
-
- // generate the var definition (always in the client header).
- // Depending upon the data type, there are some differences which we account
- // for over here.
-
- ch->indent (); // start with whatever was our current indent level
- *ch << "class " << idl_global->export_macro ()
- << " " << namebuf << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
- // default constr
- *ch << namebuf << " (void); // default constructor" << nl;
- // constr
- *ch << namebuf << " (" << this->local_name () << " *);" << nl;
- // copy constructor
- *ch << namebuf << " (const " << namebuf <<
- " &); // copy constructor" << nl;
- // destructor
- *ch << "~" << namebuf << " (void); // destructor" << nl;
- *ch << nl;
- // assignment operator from a pointer
- *ch << namebuf << " &operator= (" << this->local_name () << " *);" << nl;
- // assignment from _var
- *ch << namebuf << " &operator= (const " << namebuf <<
- " &);" << nl;
-
- // arrow operator
- *ch << this->local_name () << " *operator-> (void);" << nl;
- *ch << "const " << this->local_name () << " *operator-> (void) const;" << nl;
- *ch << nl;
-
- // other extra types (cast operators, [] operator, and others)
-
- // cast operator
- *ch << "operator const " << this->local_name () << " &() const;" << nl;
- *ch << "operator " << this->local_name () << " &();" << nl;
- *ch << "operator " << this->local_name () << " &() const;" << nl;
-
- // overloaded [] operator. The const version is not required for sequences
-
-#if 0
- switch (this->managed_type ())
- {
- case be_sequence::MNG_STRING:
- if (scope)
- {
- *ch << "ACE_NESTED_CLASS (" << scope->name () << "," <<
- this->local_name () << "::TAO_StrMngType) ";
- }
- else
- {
- *ch << this->local_name () << "::TAO_StrMngType ";
- }
- break;
- case be_sequence::MNG_OBJREF:
- if (scope)
- {
- *ch << "ACE_NESTED_CLASS (" << scope->name () << "," <<
- this->local_name () << "::TAO_ObjRefMngType) ";
- }
- else
- {
- *ch << this->local_name () << "::TAO_ObjRefMngType ";
- }
- break;
- default:
- // gen code for base return type
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_var_defn - "
- "state based codegen failed\n"),
- -1);
- }
- *ch << " &";
- }
-
- be_visitor_sequence_elemtype elemtype (ch, this, bt);
- if (bt->accept (&elemtype) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_var_defn - "
- "[] ret type gen failed\n"),
- -1);
- }
-#endif
-
- *ch << "operator[] (CORBA::ULong index);" << nl;
-
- *ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
- *ch << "const " << this->local_name () << " &in (void) const;" << nl;
- *ch << this->local_name () << " &inout (void);" << nl;
- *ch << this->local_name () << " *&out (void);" << nl;
- *ch << this->local_name () << " *_retn (void);" << nl;
-
- // generate an additional member function that returns the underlying pointer
- *ch << this->local_name () << " *ptr (void) const;\n";
-
- *ch << "\n";
- ch->decr_indent ();
-
- // generate the private section
- *ch << "private:\n";
- ch->incr_indent ();
- *ch << this->local_name () << " *ptr_;\n";
-
- ch->decr_indent ();
- *ch << "};\n\n";
- cg->pop ();
-
- return 0;
-}
-
-// implementation of the _var class. All of these get generated in the inline
-// file
-int
-be_sequence::gen_var_impl (void)
-{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _var names
- be_state *s; // code gen state
- be_type *bt; // base type
-
-
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_var", this->fullname ());
-
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", this->local_name ()->get_string ());
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
-
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CI);
- s = cg->make_state ();
-
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_sequence::gen_var_impl - invalid state obj\n"), -1);
- }
-
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
-
- // generate the var implementation in the inline file
- ci->indent (); // start with whatever was our current indent level
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for class " << fname << nl;
- *ci << "// *************************************************************\n\n";
-
- // default constr
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname <<
- " (void) // default constructor" << nl;
- *ci << " " << ": ptr_ (0)" << nl;
- *ci << "{}\n\n";
-
- // constr from a _ptr
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << " *p)" << nl;
- *ci << " : ptr_ (p)" << nl;
- *ci << "{}\n\n";
-
- // copy constructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (const " << fname <<
- " &p) // copy constructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (p.ptr_)" << nl;
- *ci << " this->ptr_ = new " << this->name () << "(*p.ptr_);" << nl;
- *ci << "else" << nl;
- *ci << " this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // destructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::~" << lname << " (void) // destructor" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from a pointer
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << name () <<
- " *p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment operator from _var
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (const " << fname <<
- " &p) // deep copy" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "if (this != &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = new " << this->name () << " (*p.ptr_);\n";
- ci->decr_indent ();
- *ci << "}" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // two arrow operators
- ci->indent ();
- *ci << "ACE_INLINE const " << this->name () << " *" << nl;
- *ci << fname << "::operator-> (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << " *" << nl;
- *ci << fname << "::operator-> (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - 3 cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
- " &() const // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() // cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << " &() const// cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator []
- ci->indent ();
- *ci << "ACE_INLINE ";
-
-#if 0
- switch (this->managed_type ())
- {
- case be_sequence::MNG_STRING:
- *ci << this->name () << "::TAO_StrMngType ";
- break;
- case be_sequence::MNG_OBJREF:
- *ci << this->name () << "::TAO_ObjRefMngType ";
- break;
- default:
- // gen code for base return type
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_var_impl - "
- "state based codegen failed\n"),
- -1);
- }
- *ci << " &";
- }
-
- be_visitor_sequence_elemtype elemtype (ci, 0, bt);
- if (bt->accept (&elemtype) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_var_defn - "
- "[] ret type gen failed\n"),
- -1);
- }
-#endif
-
-
- *ci << nl;
- *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_->operator[] (index);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // in, inout, out, and _retn
- ci->indent ();
- *ci << "ACE_INLINE const " << name () << " &" << nl;
- *ci << fname << "::in (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " &" << nl;
- *ci << fname << "::inout (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "// mapping for variable size " << nl;
- *ci << "ACE_INLINE " << name () << " *&" << nl;
- *ci << fname << "::out (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = 0;" << nl;
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
- *ci << fname << "::_retn (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << this->name () << " *tmp = this->ptr_;" << nl;
- *ci << "this->ptr_ = 0;" << nl;
- *ci << "return tmp;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // the additional ptr () member function
- ci->indent ();
- *ci << "ACE_INLINE " << name () << " *" << nl;
- *ci << fname << "::ptr (void) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- cg->pop ();
-
- return 0;
-}
-
-// generate the _out definition
-int
-be_sequence::gen_out_defn (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // to hold the _out name
- be_state *s; // code gen state
- be_type *bt; // base type
- be_decl *scope; // our enclosing scope
-
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (namebuf, "%s_out", this->local_name ()->get_string ());
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CH);
- s = cg->make_state ();
-
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_sequence::gen_out_defn - invalid state obj\n"), -1);
- }
-
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
-
- if (this->defined_in ())
- scope = be_scope::narrow_from_scope (this->defined_in ())->decl ();
- else
- scope = 0;
-
- // generate the out definition (always in the client header)
- ch->indent (); // start with whatever was our current indent level
-
- *ch << "class " << idl_global->export_macro ()
- << " " << namebuf << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
-
- // No default constructor
-
- // constructor from a pointer
- *ch << namebuf << " (" << this->local_name () << " *&);" << nl;
- // constructor from a _var &
- *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
- // constructor from a _out &
- *ch << namebuf << " (" << namebuf << " &);" << nl;
- // assignment operator from a _out &
- *ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
- // assignment
- *ch << namebuf << " &operator= (" << this->local_name () << " *);" << nl;
- // operator ()
- *ch << "operator " << this->local_name () << " *&();" << nl;
- // ptr fn
- *ch << this->local_name () << " *&ptr (void);" << nl;
- // operator ->
- *ch << this->local_name () << " *operator-> (void);" << nl;
-
- // overloaded [] operator only for sequence. The const version is not
- // required
-
-#if 0
- switch (this->managed_type ())
- {
- case be_sequence::MNG_STRING:
- if (scope)
- {
- *ch << "ACE_NESTED_CLASS (" << scope->name () << "," <<
- this->local_name () << "::TAO_StrMngType) ";
- }
- else
- {
- *ch << this->local_name () << "::TAO_StrMngType ";
- }
- break;
- case be_sequence::MNG_OBJREF:
- if (scope)
- {
- *ch << "ACE_NESTED_CLASS (" << scope->name () << "," <<
- this->local_name () << "::TAO_ObjRefMngType) ";
- }
- else
- {
- *ch << this->local_name () << "::TAO_ObjRefMngType ";
- }
- break;
- default:
- // gen code for base return type
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_out_defn - "
- "state based codegen failed\n"),
- -1);
- }
- *ch << " &";
- }
-
- be_visitor_sequence_elemtype elemtype(ch, this, bt);
- if (bt->accept (&elemtype) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_var_defn - "
- "[] ret type gen failed\n"),
- -1);
- }
-#endif
-
- *ch << "operator[] (CORBA::ULong index);" << nl;
- *ch << "\n";
- ch->decr_indent ();
- *ch << "private:\n";
- ch->incr_indent ();
-
- *ch << this->local_name () << " *&ptr_;" << nl;
- *ch << "// assignment from T_var not allowed" << nl;
- *ch << "void operator= (const " << this->local_name () << "_var &);\n";
-
- ch->decr_indent ();
- *ch << "};\n\n";
-
- cg->pop ();
- return 0;
-}
-
-int
-be_sequence::gen_out_impl (void)
-{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- char fname [NAMEBUFSIZE]; // to hold the full and
- char lname [NAMEBUFSIZE]; // local _out names
- be_state *s; // code gen state
- be_type *bt; // base type
-
-
- ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (fname, "%s_out", this->fullname ());
-
- ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_out", this->local_name ()->get_string ());
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ci = cg->client_inline ();
-
- cg->push (TAO_CodeGen::TAO_SEQUENCE_BODY_CI);
- s = cg->make_state ();
-
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_sequence::gen_out_impl - invalid state obj\n"), -1);
- }
-
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
-
- // generate the out implementation in the inline file
-
- ci->indent (); // start with whatever was our current indent level
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for class " << fname << nl;
- *ci << "// *************************************************************\n\n";
-
- // constr from a pointer
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << " *&p)" << nl;
- *ci << " : ptr_ (p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // constructor from _var &
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << this->name () <<
- "_var &p) // constructor from _var" << nl;
- *ci << " : ptr_ (p.out ())" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "delete this->ptr_;" << nl;
- *ci << "this->ptr_ = 0;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // copy constructor
- ci->indent ();
- *ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << fname <<
- " &p) // copy constructor" << nl;
- *ci << " : ptr_ (p.ptr_)" << nl;
- *ci << "{}\n\n";
-
- // assignment operator from _out &
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << fname <<
- " &p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p.ptr_;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // assignment from _var is not allowed by a private declaration
-
- // assignment operator from pointer
- ci->indent ();
- *ci << "ACE_INLINE " << fname << " &" << nl;
- *ci << fname << "::operator= (" << this->name () <<
- " *p)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "this->ptr_ = p;" << nl;
- *ci << "return *this;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // other extra methods - cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << this->name () <<
- " *&() // cast" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // ptr function
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << " *&" << nl;
- *ci << fname << "::ptr (void) // ptr" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator ->
- ci->indent ();
- *ci << "ACE_INLINE " << this->name () << " *" << nl;
- *ci << fname << "::operator-> (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // sequence has an additional method
- ci->indent ();
- *ci << "ACE_INLINE ";
-#if 0
- switch (this->managed_type ())
- {
- case be_sequence::MNG_STRING:
- *ci << this->name () << "::TAO_StrMngType ";
- break;
- case be_sequence::MNG_OBJREF:
- *ci << this->name () << "::TAO_ObjRefMngType ";
- break;
- default:
- // gen code for base return type
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_out_impl - "
- "state based codegen failed\n"),
- -1);
- }
- *ci << " &";
- }
-
- be_visitor_sequence_elemtype elemtype (ci, 0, bt);
- if (bt->accept (&elemtype) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_var_defn - "
- "[] ret type gen failed\n"),
- -1);
- }
-#endif
-
-
- *ci << nl;
- *ci << fname << "::operator[] (CORBA::ULong index)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return this->ptr_->operator[] (index);\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- cg->pop ();
- return 0;
-}
-
-// generate the managed type
-int
-be_sequence::gen_managed_type_ch (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // names
- char typebuf [NAMEBUFSIZE]; // generated type
- be_type *bt; // base type
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
-
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_gen_managed_type_ch - "
- "state based codegen failed\n"),
- -1);
- }
-
- // set the name of the generated class
- // the name depends on whether we are interface type or a string type
- ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::memset (typebuf, '\0', NAMEBUFSIZE);
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- ACE_OS::sprintf (namebuf, "%s", "TAO_ObjRefMngType");
- ACE_OS::sprintf (typebuf, "%s", bt->nested_type_name (this, "_ptr"));
- }
- break;
- case be_sequence::MNG_STRING:
- {
- ACE_OS::sprintf (namebuf, "%s", "TAO_StrMngType");
- ACE_OS::sprintf (typebuf, "%s", "char *");
- }
- break;
- default:
- // cannot be here
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_gen_managed_type_ch - "
- "bad managed type\n"),
- -1);
- }
- }
-
- ch->indent (); // start with whatever was our current indent level
- *ch << "class " << idl_global->export_macro ()
- << " " << namebuf << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
- // generate the friend instruction
- *ch << "friend " << this->local_name () << ";" << nl;
- // default constr is protected as this managed type is not available
- // outside. Only this sequence can play with it.
- //*ch << namebuf << " (void); // default constructor" << nl;
- // copy constructor
- *ch << namebuf << "(const " << namebuf << " &); // copy ctor " << nl;
- // the constructor that will be used
- if (this->managed_type () == be_sequence::MNG_STRING)
- {
- *ch << namebuf << "(char **buffer, CORBA::Boolean release);" << nl;
- }
- else
- {
- *ch << namebuf << "(" << bt->nested_type_name (this, "_ptr*") <<
- ", CORBA::Boolean release);" << nl;
- }
- // destructor
- *ch << "~" << namebuf << " (void); // destructor" << nl;
- *ch << nl;
- // assignment operator from another managed type
- *ch << namebuf << " &operator= (const " << namebuf << "&);" << nl;
- // assignment operator from a pointer
- *ch << namebuf << " &operator= (" << typebuf << ");" << nl;
-
- // others
- if (this->managed_type () == be_sequence::MNG_STRING)
- {
- // assignment operator from a pointer to const
- *ch << namebuf << " &operator= (const " << typebuf << ");" << nl;
- // cast op
- *ch << "operator const char*() const;" << nl;
- *ch << "operator char *();" << nl;
- // overloaded [] operator - only for strings
- *ch << "char &operator[] (CORBA::ULong index);" << nl;
- *ch << "const char &operator[] (CORBA::ULong index) const;" << nl;
- *ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
- *ch << "const char *in (void) const;" << nl;
- *ch << "char *&inout (void);" << nl;
- *ch << "char *&out (void);" << nl;
- *ch << "char *_retn (void);" << nl;
- }
- else
- {
- *ch << "operator const " << bt->nested_type_name (this, "_ptr") <<
- " &() const;" << nl;
- *ch << "operator " << bt->nested_type_name (this, "_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 << "const " << bt->nested_type_name (this, "_ptr") <<
- " in (void) const;" << nl;
- *ch << bt->nested_type_name (this, "_ptr") << " &inout (void);" << nl;
- *ch << bt->nested_type_name (this, "_ptr") << " &out (void);" << nl;
- *ch << bt->nested_type_name (this, "_ptr") << " _retn (void);" << nl;
- }
-
- *ch << "\n";
- ch->decr_indent ();
-
- // generate the private section
- *ch << "private:\n";
- ch->incr_indent ();
- // *ch << namebuf << "(const " << namebuf << " &); // copy ctor " << nl;
- *ch << typebuf << " *ptr_;" << nl;
- *ch << "CORBA::Boolean release_;\n";
- ch->decr_indent ();
- *ch << "};\n\n";
-
- return 0;
-}
-
-// implementation of the managed type class. All of these get generated in the
-// inline file
-int
-be_sequence::gen_managed_type_ci (void)
-{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- be_type *bt; // base type
- char fnamebuf [NAMEBUFSIZE]; // full name
- char lnamebuf [NAMEBUFSIZE]; // local name
- char typebuf [NAMEBUFSIZE]; // type name
- char macro [NAMEBUFSIZE]; // for ifdef macro
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- // get the inline stream
- ci = cg->client_inline ();
-
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence.cpp::"
- "gen_managed_types_ci - "
- "Bad base type\n"),
- -1);
- }
-
- // set the names (this is for easier code generation)
- ACE_OS::memset (fnamebuf, '\0', NAMEBUFSIZE);
- ACE_OS::memset (lnamebuf, '\0', NAMEBUFSIZE);
- ACE_OS::memset (typebuf, '\0', NAMEBUFSIZE);
- ACE_OS::memset (macro, '\0', NAMEBUFSIZE);
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- ACE_OS::sprintf (fnamebuf, "%s::%s", this->fullname (), "TAO_ObjRefMngType");
- ACE_OS::sprintf (lnamebuf, "%s", "TAO_ObjRefMngType");
- ACE_OS::sprintf (typebuf, "%s_ptr", bt->fullname ());
- ACE_OS::sprintf (macro, "%s_%s", this->flatname (), "TAO_ObjRefMngType");
- }
- break;
- case be_sequence::MNG_STRING:
- {
- ACE_OS::sprintf (fnamebuf, "%s::%s", this->fullname (), "TAO_StrMngType");
- ACE_OS::sprintf (lnamebuf, "%s", "TAO_StrMngType");
- ACE_OS::sprintf (typebuf, "%s", "char *");
- ACE_OS::sprintf (macro, "%s_%s", this->flatname (), "TAO_StrMngType");
- }
- break;
- default:
- // cannot be here
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_managed_types_ci - "
- "Bad managed type\n"),
- -1);
- }
- }
-
- // generate the ifdefined macro for the managed
- ci->gen_ifdef_macro (macro);
-
- // generate the managed type implementation in the inline file
- ci->indent (); // start with whatever was our current indent level
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for class " << fnamebuf << nl;
- *ci << "// *************************************************************\n\n";
-
- // destructor
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fnamebuf << "::~" << lnamebuf << " (void) // destructor" << nl;
- *ci << "{}\n\n";
-
- // copy constructor not allowed
-
- // operators
- if (this->managed_type () == be_sequence::MNG_STRING)
- {
- // constructor that will be used
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fnamebuf << "::" << lnamebuf <<
- "(char **buffer, CORBA::Boolean release)" << nl;
- *ci << " : ptr_ (buffer)," << nl;
- *ci << " release_ (release)" << nl;
- *ci << "{}\n\n";
-
- // other extra methods - cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fnamebuf << "::operator const " << typebuf <<
- " () 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 << fnamebuf << "::operator " << typebuf << " () // cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator []
- ci->indent ();
- *ci << "ACE_INLINE char&" << nl;
- *ci << fnamebuf << "::operator[] (CORBA::ULong index)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_[index];\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // operator []
- ci->indent ();
- *ci << "ACE_INLINE const char&" << nl;
- *ci << fnamebuf << "::operator[] (CORBA::ULong index) const" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_[index];\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- }
- else if (this->managed_type () == be_sequence::MNG_OBJREF)
- {
- // constructor that will be used
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fnamebuf << "::" << lnamebuf << "(" << bt->name () <<
- "_ptr* buffer, CORBA::Boolean release)" << nl;
- *ci << " : ptr_ (buffer)," << nl;
- *ci << " release_ (release)" << nl;
- *ci << "{}\n\n";
-
- // other extra methods - cast operator ()
- ci->indent ();
- *ci << "ACE_INLINE " << nl;
- *ci << fnamebuf << "::operator const " << typebuf <<
- " &() 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 << fnamebuf << "::operator " << typebuf << " &() // cast " << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- }
- else
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence::"
- "gen_managed_types_ci - "
- "Bad managed type\n"),
- -1);
- }
-
- // in, inout
- ci->indent ();
- *ci << "ACE_INLINE const " << typebuf << nl;
- *ci << fnamebuf << "::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 " << typebuf << "&" << nl;
- *ci << fnamebuf << "::inout (void)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << "return *this->ptr_;\n";
- ci->decr_indent ();
- *ci << "}\n\n";
-
- ci->gen_endif ();
- return 0;
-}
-
-// implementation of the managed types
-int
-be_sequence::gen_managed_type_cs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
- be_type *bt; // base type
- char fnamebuf [NAMEBUFSIZE]; // full name
- char lnamebuf [NAMEBUFSIZE]; // local name
- char typebuf [NAMEBUFSIZE]; // type name
- char macro [NAMEBUFSIZE]; // for ifdef macro
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- // get the stubs stream
- cs = cg->client_stubs ();
-
- // retrieve base type
- bt = be_type::narrow_from_decl (this->base_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence.cpp::"
- "gen_managed_types_cs - "
- "Bad base type\n"),
- -1);
- }
-
- // set the names (this is for easier code generation)
- ACE_OS::memset (fnamebuf, '\0', NAMEBUFSIZE);
- ACE_OS::memset (lnamebuf, '\0', NAMEBUFSIZE);
- ACE_OS::memset (typebuf, '\0', NAMEBUFSIZE);
- ACE_OS::memset (macro, '\0', NAMEBUFSIZE);
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- ACE_OS::sprintf (fnamebuf, "%s::%s", this->fullname (), "TAO_ObjRefMngType");
- ACE_OS::sprintf (lnamebuf, "%s", "TAO_ObjRefMngType");
- ACE_OS::sprintf (typebuf, "%s_ptr", bt->fullname ());
- ACE_OS::sprintf (macro, "%s_%s", this->flatname (), "TAO_ObjRefMngType");
- }
- break;
- case be_sequence::MNG_STRING:
- {
- ACE_OS::sprintf (fnamebuf, "%s::%s", this->fullname (), "TAO_StrMngType");
- ACE_OS::sprintf (lnamebuf, "%s", "TAO_StrMngType");
- ACE_OS::sprintf (typebuf, "%s", "char *");
- ACE_OS::sprintf (macro, "%s_%s", this->flatname (), "TAO_StrMngType");
- }
- break;
- default:
- // cannot be here
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_sequence.cpp::"
- "gen_managed_types_cs - "
- "Bad managed type\n"),
- -1);
- }
- }
-
- // generate the ifdefined macro for the sequence type
- cs->gen_ifdef_macro (macro);
-
- switch (this->managed_type ())
- {
- case be_sequence::MNG_OBJREF:
- {
- // copy ctro
- cs->indent ();
- *cs << fnamebuf << "::" << lnamebuf << "(const " << fnamebuf <<
- " &_tao_mng_type)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "*this->ptr_ = " << bt->name () <<
- "::_duplicate (*_tao_mng_type.ptr_);" << nl;
- *cs << "this->release_ = _tao_mng_type.release_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // assignment operator
- cs->indent ();
- *cs << fnamebuf << "&" << nl;
- *cs << fnamebuf << "::operator= (const " << fnamebuf <<
- " &_tao_mng_type)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (this == &_tao_mng_type) return *this;" << nl;
- *cs << "if (this->release_) // need to free old one" << nl;
- *cs << " CORBA::release (*this->ptr_);" << nl;
- *cs << "*this->ptr_ = " << bt->name () <<
- "::_duplicate (*_tao_mng_type.ptr_);" << nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // assignment operator from a pointer
- cs->indent ();
- *cs << fnamebuf << " &" << nl;
- *cs << fnamebuf << "::operator= (" << typebuf << " p)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (this->release_) // need to free old one" << nl;
- *cs << " CORBA::release (*this->ptr_);" << nl;
- *cs << "*this->ptr_ = p; // no copy" << nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // out method and _retn
- cs->indent ();
- *cs << "// mapping for variable size " << nl;
- *cs << bt->name () << "_ptr &" << nl;
- *cs << fnamebuf << "::out (void)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (this->release_)" << nl;
- *cs << " CORBA::release (*this->ptr_);" << nl;
- *cs << "*this->ptr_ = " << bt->name () << "::_nil ();" << nl;
- *cs << "return *this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- cs->indent ();
- *cs << bt->name () << "_ptr" << nl;
- *cs << fnamebuf << "::_retn (void)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << bt->name () << "_ptr tmp = *this->ptr_;" << nl;
- *cs << "*this->ptr_ = " << bt->name () << "::_nil ();" << nl;
- *cs << "return tmp;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
- }
- break;
- case be_sequence::MNG_STRING:
- {
- // copy constructor
- cs->indent ();
- *cs << fnamebuf << "::" << lnamebuf << "(const " << fnamebuf <<
- " &_tao_mng_type)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "*this->ptr_ = CORBA::string_dup (*_tao_mng_type.ptr_);" << nl;
- *cs << "this->release_ = _tao_mng_type.release_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // assignment operator (does not change the release flag)
- cs->indent ();
- *cs << fnamebuf << "&" << nl;
- *cs << fnamebuf << "::operator= (const " << fnamebuf <<
- " &_tao_mng_type)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (this == &_tao_mng_type) return *this;" << nl;
- *cs << "if (this->release_) // need to free old one" << nl;
- *cs << " CORBA::string_free (*this->ptr_);" << nl;
- *cs << "*this->ptr_ = CORBA::string_dup (*_tao_mng_type.ptr_);" << nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // assignment operator from a pointer
- cs->indent ();
- *cs << fnamebuf << " &" << nl;
- *cs << fnamebuf << "::operator= (" << typebuf << " p)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (this->release_) // need to free old one" << nl;
- *cs << " CORBA::string_free (*this->ptr_);" << nl;
- *cs << "*this->ptr_ = p; // no copy" << nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // assignment operator from a pointer to const
- cs->indent ();
- *cs << fnamebuf << " &" << nl;
- *cs << fnamebuf << "::operator= (const " << typebuf << " p)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (this->release_) // need to free old one" << nl;
- *cs << "{" << nl;
- *cs << " CORBA::string_free (*this->ptr_);" << nl;
- *cs << " *this->ptr_ = CORBA::string_dup (p);// make copy" << nl;
- *cs << "}" << nl;
- *cs << "else // make no copy as we don't own it" << nl;
- *cs << " *this->ptr_ = (char *)p; // no copy" << nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // out method and _retn
- cs->indent ();
- *cs << "// mapping for variable size " << nl;
- *cs << "char *&" << nl;
- *cs << fnamebuf << "::out (void)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "if (this->release_)" << nl;
- *cs << " CORBA::string_free (*this->ptr_);" << nl;
- *cs << "*this->ptr_ = 0;" << nl;
- *cs << "return *this->ptr_;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- cs->indent ();
- *cs << "char *" << nl;
- *cs << fnamebuf << "::_retn (void)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- *cs << "char *tmp = *this->ptr_;" << nl;
- *cs << "*this->ptr_ = 0;" << nl;
- *cs << "return tmp;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
- }
- break;
- }
-
- cs->gen_endif ();
- return 0;
-}
-
// generate typecode.
// Typecode for sequences comprises the enumerated value followed by the
// encapsulation of the parameters
diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp
index d53a5c6c364..ffc90137311 100644
--- a/TAO/TAO_IDL/be/be_string.cpp
+++ b/TAO/TAO_IDL/be/be_string.cpp
@@ -69,57 +69,6 @@ be_string::compute_tc_name (void)
I_FALSE), NULL));
}
-// Code generation
-
-int
-be_string::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
- ch->indent ();
- *ch << "char *";
-
- return 0;
-}
-
-int
-be_string::gen_client_stubs (void)
-{
- return 0;
-}
-
-int
-be_string::gen_server_header (void)
-{
- return 0;
-}
-
-int
-be_string::gen_server_skeletons (void)
-{
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_string::gen_client_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_string::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
int
be_string::gen_typecode (void)
{
diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp
index 07d9c3398fa..39c7af6a9ce 100644
--- a/TAO/TAO_IDL/be/be_structure.cpp
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -74,188 +74,6 @@ be_structure::member_count (void)
return this->member_count_;
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// Generates the client-side header information for the structure
-int
-be_structure::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
-
-
- if (!this->cli_hdr_gen_) // not already generated
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_STRUCT_CH); // set current code gen state
-
- ch = cg->client_header ();
-
- ch->indent (); // start from whatever indentation level we were at
- *ch << "struct " << local_name () << nl;
- *ch << "{\n";
- ch->incr_indent (0);
-
- // generate code for field members
- if (be_scope::gen_client_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_structure::gen_client_header -"
- "codegen for scope failed\n"), -1);
- }
-
- ch->decr_indent ();
- *ch << "};\n\n";
-
- // generate var defn
- this->gen_var_defn ();
-
- // a class is generated for an out defn only for a variable length struct
- if (this->size_type () == be_decl::VARIABLE)
- {
- this->gen_out_defn ();
- }
- else
- {
- ch->indent ();
- *ch << "typedef " << this->local_name () << " &" << this->local_name
- () << "_out;\n\n";
- }
-
- // generate the typecode decl
- if (this->is_nested ())
- {
- // we have a scoped name
- ch->indent ();
-
- *ch << "static CORBA::TypeCode_ptr " << this->tc_name
- ()->last_component () << ";\n\n";
- }
- else
- {
- // we are in the ROOT scope
- ch->indent ();
- *ch << "extern "
- << idl_global->export_macro ()
- << " CORBA::TypeCode_ptr "
- << this->tc_name ()->last_component () << ";\n\n";
- }
- this->cli_hdr_gen_ = I_TRUE;
- cg->pop (); // pop up the current state
- }
- return 0;
-}
-
-// Generates the client-side stubs for the structure
-int
-be_structure::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
-
-
- if (!this->cli_stub_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_STRUCT_CS); // set current code gen state
-
- cs = cg->client_stubs ();
- // pass info
- cg->node (this);
-
- // generate the typecode information here
- cs->indent (); // start from current indentation level
- *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
- nl;
- *cs << "{\n";
- cs->incr_indent (0);
- // note that we just need the parameters here and hence we generate the
- // encapsulation for the parameters
- if (this->gen_encapsulation () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_structure::gen_client_stubs -"
- "codegen for scope failed\n"), -1);
- }
- cs->decr_indent ();
- *cs << "};" << nl;
-
- *cs << "static CORBA::TypeCode _tc__tc_" << this->flatname () <<
- " (CORBA::tk_struct, sizeof (_oc_" << this->flatname () <<
- "), (char *) &_oc_" << this->flatname () <<
- ", CORBA::B_FALSE);" << nl;
- *cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" <<
- this->flatname () << ";\n\n";
- this->cli_stub_gen_ = I_TRUE;
- cg->pop ();
- }
-
- return 0;
-
-}
-
-// Generates the client-side inline information
-int
-be_structure::gen_client_inline (void)
-{
- if (!this->cli_inline_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_STRUCT_CI); // set current code gen state
-
- if (this->gen_var_impl () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_structure::gen_client_inline -"
- "_var codegen failed\n"), -1);
- }
- if (this->size_type () == be_decl::VARIABLE && this->gen_out_impl () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_structure::gen_client_inline -"
- "_out codegen failed\n"), -1);
- }
- if (be_scope::gen_client_inline () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_structure::gen_client_inline -"
- "codegen for scope failed\n"), -1);
- }
- this->cli_inline_gen_ = I_TRUE;
- cg->pop ();
- }
- return 0;
-}
-
-// Generates the server-side header information for the structure
-int
-be_structure::gen_server_header (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side skeletons for the structure
-int
-be_structure::gen_server_skeletons (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_structure::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
// generate the _var definition for ourself
int
be_structure::gen_var_defn (void)
diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp
index 11453cc9033..f9fab1fa24d 100644
--- a/TAO/TAO_IDL/be/be_typedef.cpp
+++ b/TAO/TAO_IDL/be/be_typedef.cpp
@@ -52,158 +52,6 @@ be_typedef::primitive_base_type (void)
}
int
-be_typedef::gen_client_header (void)
-{
- be_type *bt; // type node
- be_state *s; // state based code gen object
- TAO_OutStream *ch; // client header
-
- if (!this->cli_hdr_gen_) // not already generated
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- ch = cg->client_header ();
- cg->push (TAO_CodeGen::TAO_TYPEDEF_CH);
- s = cg->make_state ();
-
- bt = be_type::narrow_from_decl (this->base_type ());
- // first generate the mapping for our type. As a side effect, also
- // generate the mapping for the typedef
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR ((LM_ERROR, "be_typedef: error generating code for base type\n"));
- return -1;
- }
-
- // generate the typecode decl for this typedef node
- if (this->is_nested ())
- {
- // we have a scoped name
- ch->indent ();
- *ch << "static CORBA::TypeCode_ptr " << this->tc_name
- ()->last_component () << ";\n\n";
- }
- else
- {
- // we are in the ROOT scope
- ch->indent ();
- *ch << "extern "
- << idl_global->export_macro ()
- << " CORBA::TypeCode_ptr "
- << this->tc_name ()->last_component () << ";\n\n";
- }
-
- cg->pop ();
- this->cli_hdr_gen_ = I_TRUE;
- }
- return 0;
-}
-
-int
-be_typedef::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
- be_type *bt;
- be_state *s; // state based code gen object
-
- if (!this->cli_stub_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_TYPEDEF_CS); // set current code gen state
-
- cs = cg->client_stubs ();
-
- s = cg->make_state ();
-
- bt = be_type::narrow_from_decl (this->base_type ());
- // first generate the mapping for our type. As a side effect, also
- // generate the mapping for the typedef
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR ((LM_ERROR, "be_typedef: error generating code for base type\n"));
- return -1;
- }
-
- // generate the typecode information here
- cs->indent (); // start from current indentation level
- *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
- nl;
- *cs << "{\n";
- cs->incr_indent (0);
- if (this->gen_encapsulation () == -1)
- {
- ACE_ERROR ((LM_ERROR, "Error generating typecode\n\n"));
- return -1;
- }
- cs->decr_indent ();
- *cs << "};" << nl;
-
- *cs << "static CORBA::TypeCode _tc__tc_" << this->flatname () <<
- " (CORBA::tk_alias, sizeof (_oc_" << this->flatname () <<
- "), (char *) &_oc_" << this->flatname () <<
- ", CORBA::B_FALSE);" << nl;
- *cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" <<
- this->flatname () << ";\n\n";
-
-
- this->cli_stub_gen_ = I_TRUE;
- cg->pop ();
- }
-
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_typedef::gen_client_inline (void)
-{
- be_type *bt; // type node
- be_state *s; // state based code gen object
-
- if (!this->cli_inline_gen_) // not already generated
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_TYPEDEF_CI);
- s = cg->make_state ();
-
- bt = be_type::narrow_from_decl (this->base_type ());
- // first generate the mapping for our type
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR ((LM_ERROR, "be_typedef: error generating code for base type\n"));
- return -1;
- }
-
- cg->pop ();
- this->cli_inline_gen_ = I_TRUE;
- }
- return 0;
-}
-
-int
-be_typedef::gen_server_header (void)
-{
- return 0;
-}
-
-int
-be_typedef::gen_server_skeletons (void)
-{
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_typedef::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
-int
be_typedef::gen_typecode (void)
{
TAO_OutStream *cs; // output stream
diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp
index 70f9f5d41c8..1e9d1c7dd0b 100644
--- a/TAO/TAO_IDL/be/be_union.cpp
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -124,399 +124,6 @@ be_union::default_index (void)
return this->default_index_;
}
-
-// ****************************
-// code generation
-// ****************************
-
-int
-be_union::gen_client_header (void)
-{
- TAO_OutStream *ch; // output stream
- TAO_NL nl; // end line
- be_type *bt; // type node
- be_state *s; // code generation state
-
- if (!this->cli_hdr_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- ch = cg->client_header ();
-
- // generate the ifdefined macro for the array type
- ch->gen_ifdef_macro (this->flatname ());
- ch->indent (); // start with the current indentation level
- *ch << "class " << idl_global->export_macro ()
- << " " << local_name () << nl;
- *ch << "{" << nl;
- *ch << "public:\n";
- ch->incr_indent ();
-
- // generate default and copy constructors
- *ch << local_name () << " (void); // default constructor" << nl;
- *ch << local_name () << " (const " << local_name () <<
- " &); // copy constructor" << nl;
- // generate destructor
- *ch << "~" << local_name () << " (void); // destructor" << nl;
- // generate assignment operator
- *ch << local_name () << " &operator= (const " << local_name () <<
- " &); // copy constructor\n\n";
-
- // the discriminant type may have to be defined here if it was an enum
- // declaration inside of the union statement.
-
- cg->push (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH); // set current code gen state
- bt = be_type::narrow_from_decl (this->disc_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_header - "
- "bad disciminant type\n"), -1);
- }
-
- s = cg->make_state (); // get the code gen object for the current state
- if (!s)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_header - "
- "bad state\n"), -1);
- }
-
- if (s->gen_code (bt, this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_header - "
- "codegen for discriminant failed\n"), -1);
- }
- cg->pop (); // revert to previous state
-
- // now generate the public defn for the union branch members
- cg->push (TAO_CodeGen::TAO_UNION_PUBLIC_CH); // set current code gen state
- if (be_scope::gen_client_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_header - "
- "codegen for public defn of union members\n"),
- -1);
- }
-
- cg->pop ();
-
- // now generate the private data members of the union
- cg->push (TAO_CodeGen::TAO_UNION_PRIVATE_CH); // set current code gen state
- ch->decr_indent ();
- *ch << "private:\n";
- ch->incr_indent ();
- *ch << bt->nested_type_name (this) << " disc_;" << nl; // emit the
- // ACE_NESTED_CLASS macro
-
- // the members are inside of a union
- *ch << "union" << nl;
- *ch << "{\n";
- ch->incr_indent (0);
- if (be_scope::gen_client_header () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_header - "
- "codegen for private members of union\n"), -1);
- }
-
- ch->decr_indent ();
- *ch << "}; // end of union\n";
-
- ch->decr_indent ();
- *ch << "};\n\n";
-
- // Generate the typecode decl
- if (this->is_nested ())
- {
- // we have a scoped name
- ch->indent ();
- *ch << "static CORBA::TypeCode_ptr " << this->tc_name
- ()->last_component () << ";\n\n";
- }
- else
- {
- // we are in the ROOT scope
- ch->indent ();
- *ch << "extern "
- << idl_global->export_macro ()
- << " CORBA::TypeCode_ptr "
- << this->tc_name ()->last_component () << ";\n\n";
- }
- ch->gen_endif ();
-
- // generate the ifdefined macro for the array type
- ch->gen_ifdef_macro (this->flatname (), "_var");
- // generate var defn
- if (this->gen_var_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_header - "
- "codegen for _var\n"), -1);
- }
- ch->gen_endif ();
-
- // generate the ifdefined macro for the array type
- ch->gen_ifdef_macro (this->flatname (), "_out");
- // a class is generated for an out defn only for a variable length struct
- if (this->size_type () == be_decl::VARIABLE)
- {
- if (this->gen_out_defn () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_header - "
- "codegen for _out\n"), -1);
- }
- }
- else
- {
- ch->indent ();
- *ch << "typedef " << this->local_name () << " &" << this->local_name
- () << "_out;\n\n";
- }
- ch->gen_endif ();
-
- cg->pop ();
- this->cli_hdr_gen_ = I_TRUE;
- }
- return 0;
-}
-
-int
-be_union::gen_client_stubs (void)
-{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
-
- if (!this->cli_stub_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cs = cg->client_stubs ();
-
- // first generate code for any of the members (if required, e.g.,
- // anonymous sequences, structs, unions, arrays)
- cg->push (TAO_CodeGen::TAO_UNION_PUBLIC_CS); // set current code gen state
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_stubs - "
- "codegen for scope failed\n"), -1);
- }
- cg->pop ();
-
- // now generate the operations on the union such as the copy constructor
- // and the assignment operator
-
- *cs << "// *************************************************************"
- << nl;
- *cs << "// Operations for union " << this->name () << nl;
- *cs << "// *************************************************************\n\n";
-
- cg->push (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
-
- // generate the copy constructor and the assignment operator here
- cs->indent ();
- *cs << "// copy constructor" << nl;
- *cs << this->name () << "::" << this->local_name () << " (const " <<
- this->name () << " &u)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- // first set the discriminant
- *cs << "this->disc_ = u.disc_;" << nl;
- // now switch based on the disc value
- *cs << "switch (this->disc_)" << nl;
- *cs << "{\n";
- cs->incr_indent (0);
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_stubs - "
- "codegen for scope failed\n"), -1);
- }
-
- cs->decr_indent ();
- *cs << "}\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // assignment operator
- cs->indent ();
- *cs << "// assignment operator" << nl;
- *cs << this->name () << " &" << nl; // return type
- *cs << this->name () << "::operator= (const " <<
- this->name () << " &u)" << nl;
- *cs << "{\n";
- cs->incr_indent ();
- // first set the discriminant
- *cs << "this->disc_ = u.disc_;" << nl;
- // now switch based on the disc value
- *cs << "switch (this->disc_)" << nl;
- *cs << "{\n";
- cs->incr_indent (0);
- if (be_scope::gen_client_stubs () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_stubs - "
- "codegen for scope failed\n"), -1);
- }
-
- cs->decr_indent ();
- *cs << "}" << nl;
- *cs << "return *this;\n";
- cs->decr_indent ();
- *cs << "}\n\n";
-
- // generate the typecode information here
- cs->indent (); // start from current indentation level
- *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" <<
- nl;
- *cs << "{\n";
- cs->incr_indent (0);
- if (this->gen_encapsulation () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_stubs - "
- "codegen for encapsulation failed\n"), -1);
- }
-
- cs->decr_indent ();
- *cs << "};" << nl;
-
- *cs << "static CORBA::TypeCode _tc__tc_" << this->flatname () <<
- " (CORBA::tk_union, sizeof (_oc_" << this->flatname () <<
- "), (char *) &_oc_" << this->flatname () <<
- ", CORBA::B_FALSE);" << nl;
- *cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" <<
- this->flatname () << ";\n\n";
- this->cli_stub_gen_ = I_TRUE;
- cg->pop ();
- }
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_union::gen_client_inline (void)
-{
- TAO_OutStream *ci; // output stream
- TAO_NL nl; // end line
- be_type *bt; // type node
- be_state *s; // code generation state
-
-
- if (!this->cli_inline_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- ci = cg->client_inline ();
-
- *ci << "// *************************************************************"
- << nl;
- *ci << "// Inline operations for union " << this->name () << nl;
- *ci << "// *************************************************************\n\n";
-
- // generate the default constructor and the destructor here
- ci->indent ();
- *ci << "// default constructor" << nl;
- *ci << "ACE_INLINE" << nl;
- *ci << this->name () << "::" << this->local_name () << " (void)" << nl;
- *ci << "{" << nl;
- *ci << "}" << nl << nl;
-
- *ci << "// destructor" << nl;
- *ci << "ACE_INLINE" << nl;
- *ci << this->name () << "::~" << this->local_name () << " (void)" << nl;
- *ci << "{" << nl;
- *ci << "}\n\n";
-
- // the discriminant type may have to be defined here if it was an enum
- // declaration inside of the union statement.
-
- cg->push (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CI); // set current code gen state
- bt = be_type::narrow_from_decl (this->disc_type ());
-
- s = cg->make_state (); // get the code gen object for the current state
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR ((LM_ERROR, "be_union::gen_client_header\n"));
- ACE_ERROR ((LM_ERROR, "Discriminant type generation failure\n"));
- return -1;
- }
- cg->pop ();
-
- // now generate the implementation of the access methods
- cg->push (TAO_CodeGen::TAO_UNION_PUBLIC_CI); // set current code gen state
- if (be_scope::gen_client_inline () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_inline - "
- "codegen for scope failed\n"), -1);
- }
-
- cg->pop ();
-
- // generate the ifdefined macro for the array type
- ci->gen_ifdef_macro (this->flatname (), "_var");
- if (this->gen_var_impl () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_inline - "
- "codegen for _var failed\n"), -1);
- }
- ci->gen_endif ();
-
- // generate the ifdefined macro for the array type
- ci->gen_ifdef_macro (this->flatname (), "_out");
- if (this->size_type () == be_decl::VARIABLE && this->gen_out_impl () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union::"
- "gen_client_inline - "
- "codegen for _out failed\n"), -1);
- }
- ci->gen_endif ();
-
- this->cli_inline_gen_ = I_TRUE;
- }
- return 0;
-}
-
-int
-be_union::gen_server_header (void)
-{
- return 0;
-}
-
-int
-be_union::gen_server_skeletons (void)
-{
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_union::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
// generate typecode.
// Typecode for union comprises the enumerated value followed by the
// encapsulation of the parameters
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
index b8b6e1c7d21..d2a5bc12dab 100644
--- a/TAO/TAO_IDL/be/be_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -38,101 +38,6 @@ be_union_branch::be_union_branch (AST_UnionLabel *lab, AST_Type *ft,
{
}
-// ----------------------------------------
-// CODE GENERATION METHODS
-// ----------------------------------------
-
-// Generates the client-side header information for the union_branch
-int
-be_union_branch::gen_client_header (void)
-{
- be_type *bt; // the union_branch type
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- bt = be_type::narrow_from_decl (this->field_type ());
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union_branch::"
- "gen_client_header - "
- "state based code gen failed\n"), -1);
- }
- return 0;
-}
-
-// Generates the client-side stubs for the union_branch
-int
-be_union_branch::gen_client_stubs (void)
-{
- be_type *bt; // the union_branch type
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- bt = be_type::narrow_from_decl (this->field_type ());
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union_branch::"
- "gen_client_stubs - "
- "state based code gen failed\n"), -1);
- }
-
- return 0;
-}
-
-// Generates the client-side inline information
-int
-be_union_branch::gen_client_inline (void)
-{
- be_type *bt; // the union_branch type
- be_state *s; // state based code gen object
-
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
- bt = be_type::narrow_from_decl (this->field_type ());
- s = cg->make_state ();
- if (!s || !bt || (s->gen_code (bt, this) == -1))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_union_branch::"
- "gen_client_inline - "
- "state based code gen failed\n"), -1);
- }
- return 0;
-}
-
-// Generates the server-side header information for the union_branch
-int
-be_union_branch::gen_server_header (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side skeletons for the union_branch
-int
-be_union_branch::gen_server_skeletons (void)
-{
- // nothing to be done
- return 0;
-}
-
-// Generates the server-side inline
-int
-be_union_branch::gen_server_inline (void)
-{
- // nothing to be done
- return 0;
-}
-
int
be_union_branch::gen_encapsulation (void)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_context.cpp b/TAO/TAO_IDL/be/be_visitor_context.cpp
index 11ecf88da38..a430e5cb54e 100644
--- a/TAO/TAO_IDL/be/be_visitor_context.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_context.cpp
@@ -73,6 +73,21 @@ be_visitor_context::~be_visitor_context (void)
//= helpers
void
+be_visitor_context::reset (void)
+{
+ this->state_ = TAO_CodeGen::TAO_INITIAL;
+ this->os_ = 0;
+ this->scope_ = 0;
+ this->node_ = 0;
+ this->alias_ = 0;
+ this->tdef_ = 0;
+ this->attr_ = 0;
+ this->exception_ = 0;
+ this->comma_ = 0;
+
+}
+
+void
be_visitor_context::stream (TAO_OutStream *os)
{
this->os_ = os;
diff --git a/TAO/TAO_IDL/be/be_visitor_enum.cpp b/TAO/TAO_IDL/be/be_visitor_enum.cpp
index 809e8dee3de..95e6c5b4a0e 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum.cpp
@@ -59,24 +59,13 @@ be_visitor_enum_ch::visit_enum (be_enum *node)
"scope generation failed\n"
), -1);
}
- *os << "\n";
+
os->decr_indent ();
*os << "};" << be_nl;
// As per the ORBOS spec, we need the following typedef
*os << "typedef " << node->local_name () << " &" << node->local_name ()
<< "_out;\n";
- // generate the Any <<= and >>= operators
- os->indent ();
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, " << node->local_name ()
- << ");" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
- << node->local_name () << " &);\n";
-
// Generate the typecode decl
if (node->is_nested ())
{
@@ -157,32 +146,6 @@ be_visitor_enum_cs::visit_enum (be_enum *node)
os->decr_indent ();
*os << "};\n";
- // Any <<= and >>= operators
- os->indent ();
- *os << "void operator<<= (CORBA::Any &_tao_any, "
- << node->name () << " _tao_elem)" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", &"
- << "_tao_elem, 1, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
- << node->name () << " &_tao_elem)" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "if (!_tao_any.type ()->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
- << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
- << be_nl
- << "if (stream.decode (" << node->tc_name ()
- << ", &_tao_elem, 0, _tao_env)" << be_nl
- << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
- << " return 1;" << be_nl
- << "else" << be_nl
- << " return 0;" << be_uidt_nl
- << "}\n\n";
-
os->indent ();
*os << "static CORBA::TypeCode _tc__tc_" << node->flatname ()
<< " (CORBA::tk_enum, sizeof (_oc_" << node->flatname ()
@@ -194,3 +157,90 @@ be_visitor_enum_cs::visit_enum (be_enum *node)
}
return 0;
}
+
+// ***************************************************************************
+// Enum visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_enum_any_op_ch::be_visitor_enum_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_enum_any_op_ch::~be_visitor_enum_any_op_ch (void)
+{
+}
+
+int
+be_visitor_enum_any_op_ch::visit_enum (be_enum *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ // generate the Any <<= and >>= operators
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &, " << node->name ()
+ << ");" << be_nl;
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
+ << node->name () << " &);\n";
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+// ***************************************************************************
+// Enum visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_enum_any_op_cs::be_visitor_enum_any_op_cs
+(be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_enum_any_op_cs::~be_visitor_enum_any_op_cs (void)
+{
+}
+
+int
+be_visitor_enum_any_op_cs::visit_enum (be_enum *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_stubs ();
+
+ // generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &_tao_any, "
+ << node->name () << " _tao_elem)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", &"
+ << "_tao_elem, 1, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
+ << node->name () << " &_tao_elem)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "if (!_tao_any.type ()->equal (" << node->tc_name ()
+ << ", _tao_env)) return 0; // not equal" << be_nl
+ << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
+ << be_nl
+ << "if (stream.decode (" << node->tc_name ()
+ << ", &_tao_elem, 0, _tao_env)" << be_nl
+ << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
+ << " return 1;" << be_nl
+ << "else" << be_nl
+ << " return 0;" << be_uidt_nl
+ << "}\n\n";
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception.cpp
index 068632562c2..340334ce6cf 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp
@@ -187,21 +187,6 @@ int be_visitor_exception_ch::visit_exception (be_exception *node)
*os << "static CORBA::Exception *_alloc (void);" << be_uidt_nl;
*os << "}; // exception " << node->name () << be_nl;
- // generate the Any <<= and >>= operators
- os->indent ();
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, const " << node->local_name ()
- << " &); // copying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, " << node->local_name ()
- << "*); // noncopying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
- << node->local_name () << " *&);\n";
-
// generate the typecode decl
if (node->is_nested ())
{
@@ -423,59 +408,6 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
*os << "return new " << node->name () << ";" << be_uidt_nl;
*os << "}\n\n";
- // Any <<= and >>= operators
- os->indent ();
- *os << "void operator<<= (CORBA::Any &_tao_any, const "
- << node->name () << " &_tao_elem) // copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", &"
- << "_tao_elem, 1, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "void operator<<= (CORBA::Any &_tao_any, "
- << node->name () << " *_tao_elem) // non copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 0, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
- << node->name () << " *&_tao_elem)" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "if (!_tao_any.type ()->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
- << "if (_tao_any.any_owns_data ())" << be_nl
- << "{" << be_idt_nl
- << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
- << be_nl
- << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
- << be_nl
- << "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem, 0, _tao_env)" << be_nl
- << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
- << "{" << be_idt_nl
- << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
- << "_tao_elem, 1, _tao_env);"
- << be_nl
- << " return 1;" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // decode failed
- << "{" << be_idt_nl
- << "delete _tao_elem;" << be_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // else any does not own the data
- << "{" << be_idt_nl
- << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
- << be_nl
- << "return 1;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}\n\n";
-
os->indent ();
// generate the typecode information here
os->indent (); // start from current indentation level
@@ -1061,3 +993,191 @@ int be_visitor_exception_ctor_assign::visit_typedef (be_typedef *node)
this->ctx_->alias (0);
return 0;
}
+
+// ***************************************************************************
+// Exception visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_exception_any_op_ch::be_visitor_exception_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_exception_any_op_ch::~be_visitor_exception_any_op_ch (void)
+{
+}
+
+int
+be_visitor_exception_any_op_ch::visit_exception (be_exception *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ // generate the Any <<= and >>= operator declarations
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &, const " << node->name ()
+ << " &); // copying version" << be_nl;
+ *os << "void operator<<= (CORBA::Any &, " << node->name ()
+ << "*); // noncopying version" << be_nl;
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
+ << node->name () << " *&);\n";
+
+
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::visit_exception - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_ch::visit_field (be_field *node)
+{
+ be_type *bt; // field's type
+
+ // first generate the type information
+ bt = be_type::narrow_from_decl (node->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_ch::"
+ "visit_field - "
+ "Bad field type\n"
+ ), -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"
+ ), -1);
+ }
+ return 0;
+}
+
+// ***************************************************************************
+// Exception visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_exception_any_op_cs::be_visitor_exception_any_op_cs
+(be_visitor_context *ctx)
+ : be_visitor_scope (ctx)
+{
+}
+
+be_visitor_exception_any_op_cs::~be_visitor_exception_any_op_cs (void)
+{
+}
+
+int
+be_visitor_exception_any_op_cs::visit_exception (be_exception *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_stubs ();
+
+ // generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &_tao_any, const "
+ << node->name () << " &_tao_elem) // copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", &"
+ << "_tao_elem, 1, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "void operator<<= (CORBA::Any &_tao_any, "
+ << node->name () << " *_tao_elem) // non copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", "
+ << "_tao_elem, 0, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
+ << node->name () << " *&_tao_elem)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "if (!_tao_any.type ()->equal (" << node->tc_name ()
+ << ", _tao_env)) return 0; // not equal" << be_nl
+ << "if (_tao_any.any_owns_data ())" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
+ << be_nl
+ << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
+ << be_nl
+ << "if (stream.decode (" << node->tc_name ()
+ << ", _tao_elem, 0, _tao_env)" << be_nl
+ << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
+ << "{" << be_idt_nl
+ << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
+ << "_tao_elem, 1, _tao_env);"
+ << be_nl
+ << " return 1;" << be_uidt_nl
+ << "}" << be_nl
+ << "else" << be_nl // decode failed
+ << "{" << be_idt_nl
+ << "delete _tao_elem;" << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl
+ << "else" << be_nl // else any does not own the data
+ << "{" << be_idt_nl
+ << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
+ << be_nl
+ << "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}\n\n";
+
+
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception::visit_exception - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_exception_any_op_cs::visit_field (be_field *node)
+{
+ be_type *bt; // field's type
+
+ // first generate the type information
+ bt = be_type::narrow_from_decl (node->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_cs::"
+ "visit_field - "
+ "Bad field type\n"
+ ), -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_exception_any_op_cs::"
+ "visit_field - "
+ "codegen for field type failed\n"
+ ), -1);
+ }
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp
index 9d93f187661..cad2be10de9 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp
@@ -77,6 +77,8 @@ be_visitor_interface::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_COLLOCATED_SS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_CI:
case TAO_CodeGen::TAO_INTERFACE_SI:
return 0; // nothing to be done
@@ -135,6 +137,8 @@ be_visitor_interface::visit_constant (be_constant *node)
case TAO_CodeGen::TAO_INTERFACE_CS:
ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SH:
case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS:
case TAO_CodeGen::TAO_INTERFACE_CI:
@@ -197,6 +201,12 @@ be_visitor_interface::visit_enum (be_enum *node)
case TAO_CodeGen::TAO_INTERFACE_CS:
ctx.state (TAO_CodeGen::TAO_ENUM_CS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_INTERFACE_CI:
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_SI:
@@ -262,6 +272,12 @@ be_visitor_interface::visit_exception (be_exception *node)
case TAO_CodeGen::TAO_INTERFACE_CS:
ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_SI:
case TAO_CodeGen::TAO_INTERFACE_SS:
@@ -339,6 +355,8 @@ be_visitor_interface::visit_operation (be_operation *node)
case TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS:
ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_SS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
case TAO_CodeGen::TAO_INTERFACE_CI:
case TAO_CodeGen::TAO_INTERFACE_SI:
return 0; // nothing to be done
@@ -401,6 +419,12 @@ be_visitor_interface::visit_structure (be_structure *node)
case TAO_CodeGen::TAO_INTERFACE_CS:
ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_SI:
case TAO_CodeGen::TAO_INTERFACE_SS:
@@ -465,6 +489,12 @@ be_visitor_interface::visit_union (be_union *node)
case TAO_CodeGen::TAO_INTERFACE_CS:
ctx.state (TAO_CodeGen::TAO_UNION_CS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_SI:
case TAO_CodeGen::TAO_INTERFACE_SS:
@@ -529,6 +559,12 @@ be_visitor_interface::visit_typedef (be_typedef *node)
case TAO_CodeGen::TAO_INTERFACE_CS:
ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_INTERFACE_SH:
case TAO_CodeGen::TAO_INTERFACE_SI:
case TAO_CodeGen::TAO_INTERFACE_SS:
@@ -730,26 +766,12 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
*os << node->local_name () << " (const " << node->local_name () << " &);"
<< be_nl
<< "void operator= (const " << node->local_name () << " &);\n";
+
os->decr_indent ();
*os << "};\n\n";
os->gen_endif ();
- // generate the Any <<= and >>= operators
- os->indent ();
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, " << node->local_name ()
- << "_ptr); // copying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, " << node->local_name ()
- << "_ptr *); // noncopying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
- << node->local_name () << "_ptr &);\n";
-
// generate the typecode decl. If we are in the outermost scope, our typecode
// decl is extern
if (node->is_nested ())
@@ -983,57 +1005,6 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "return \"" << node->repoID () << "\";" << be_uidt_nl
<< "}\n\n";
- // Any <<= and >>= operators
- os->indent ();
- *os << "void operator<<= (CORBA::Any &_tao_any, "
- << node->name () << "_ptr _tao_elem) // copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl
- << "ACE_NEW (_tao_obj_ptr, CORBA::Object_ptr);" << be_nl
- << "*_tao_obj_ptr = " << node->name ()
- << "::_duplicate (_tao_elem);" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_obj_ptr, 1, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "void operator<<= (CORBA::Any &_tao_any, "
- << node->name () << "_ptr *_tao_elem) // non copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 0, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
- << node->name () << "_ptr &_tao_elem)" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_elem = " << node->name () << "::_nil ();" << be_nl
- << "if (!_tao_any.type ()->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
- << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
- << be_nl
- << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl
- << "ACE_NEW_RETURN (_tao_obj_ptr, CORBA::Object_ptr, 0);" << be_nl
- << "if (stream.decode (" << node->tc_name ()
- << ", _tao_obj_ptr, 0, _tao_env)" << be_nl
- << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
- << "{" << be_idt_nl
- << "_tao_elem = " << node->name ()
- << "::_narrow (*_tao_obj_ptr, _tao_env);" << be_nl
- << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl
- << "CORBA::release (*_tao_obj_ptr);" << be_nl
- << "*_tao_obj_ptr = _tao_elem;" << be_nl
- << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
- << "_tao_obj_ptr, 1, _tao_env);"
- << be_nl
- << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl
- << "return 1;" << be_uidt_nl
- << "}" << be_nl
- << "return 0; // failure" << be_uidt_nl
- << "}\n\n";
-
os->indent ();
// generate the typecode information here
os->indent (); // start from current indentation level
@@ -1856,155 +1827,137 @@ int be_visitor_interface_collocated_ss::visit_interface (be_interface *node)
-1);
}
-#if 0
- // XXXASG - DO NOT DELETE until the visit_scope has been tested
- if (node->nmembers () > 0)
- {
- UTL_ScopeActiveIterator *si;
- ACE_NEW_RETURN (si,
- UTL_ScopeActiveIterator (node,
- UTL_Scope::IK_decls),
- -1);
- while (!si->is_done ())
- {
- AST_Decl *d = si->item ();
- si->next ();
- be_decl *bd = be_decl::narrow_from_decl (d);
- // Only printout the operations, nested interfaces and
- // structures only go in the main declaration.
- if (d->imported () || bd == 0)
- {
- continue;
- }
- if (bd->accept (this) == -1)
- {
- delete si;
- return -1;
- }
- }
- delete si;
- }
-#endif
-
return 0;
}
-#if 0
-int be_visitor_interface_collocated_ss::visit_operation (be_operation *node)
+// ***************************************************************************
+// Interface visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_interface_any_op_ch::be_visitor_interface_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
{
- TAO_OutStream *os = tao_cg->server_skeletons ();
- be_interface *intf = this->ctx_->be_scope_as_interface ();
+}
- // retrieve the return type again because we have used bt to also retrieve
- // the argument types
- be_type *bt = be_type::narrow_from_decl (node->return_type ());
+be_visitor_interface_any_op_ch::~be_visitor_interface_any_op_ch (void)
+{
+}
- if (bt->write_as_return (os, bt) == -1)
- {
- return -1;
- }
+int
+be_visitor_interface_any_op_ch::visit_interface (be_interface *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ return 0;
- *os << " " << intf->full_coll_name () << "::"
- << node->local_name () << " ";
+ TAO_OutStream *os = tao_cg->client_header ();
- be_visitor_args_decl visitor (os);
- if (node->accept (&visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) args decl failed\n"), -1);
- }
- *os << "\n";
+ // generate the Any <<= and >>= operator declarations
os->indent ();
- *os << "{\n";
- os->incr_indent ();
-
- if (bt->node_type () != AST_Decl::NT_pre_defined
- || be_predefined_type::narrow_from_decl (bt)->pt () != AST_PredefinedType::PT_void)
- {
- *os << "return ";
- }
-
- *os << "this->servant_->" << node->local_name () << " (\n";
- os->incr_indent (0);
- os->incr_indent (0);
-
+ *os << "// Any operators for interface " << node->name () << be_nl;
+ *os << "void operator<<= (CORBA::Any &, const " << node->name ()
+ << " &); // copying version" << be_nl;
+ *os << "void operator<<= (CORBA::Any &, " << node->name ()
+ << "*); // noncopying version" << be_nl;
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
+ << node->name () << " *&);\n";
+
+ // all we have to do is to visit the scope and generate code
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_collocated_ss::"
- "visit_operation - "
- "codegen for scope failed\n"),
- -1);
+ "(%N:%l) be_visitor_interface::visit_interface - "
+ "codegen for scope failed\n"), -1);
}
- os->indent ();
- *os << " _tao_environment\n";
- os->decr_indent ();
- *os << ");\n";
- os->decr_indent (0);
- os->decr_indent (0);
- *os << "}\n\n";
-
+ node->cli_hdr_any_op_gen (1);
return 0;
}
-int be_visitor_interface_collocated_ss::visit_attribute (be_attribute *node)
+// ***************************************************************************
+// Interface visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_interface_any_op_cs::be_visitor_interface_any_op_cs
+(be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
{
- TAO_OutStream *os = this->ctx_->stream ();
- be_interface *intf = this->ctx_->be_scope_as_interface ();
+}
- os->indent (); // start with the current indentation level
+be_visitor_interface_any_op_cs::~be_visitor_interface_any_op_cs (void)
+{
+}
- be_type* bt = be_type::narrow_from_decl (node->field_type ());
+int
+be_visitor_interface_any_op_cs::visit_interface (be_interface *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ return 0;
- if (bt->write_as_return (os, bt) == -1)
- {
- return -1;
- }
+ TAO_OutStream *os = tao_cg->client_stubs ();
- *os << be_nl << intf->full_coll_name ()
- << "::" << node->local_name () << " (" << be_idt << be_idt_nl
- << "CORBA::Environment &_tao_environment" << be_uidt_nl
- << ")" << be_uidt_nl
+ // generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &_tao_any, "
+ << node->name () << "_ptr _tao_elem) // copying" << be_nl
<< "{" << be_idt_nl
- << "return this->servant_->"
- << node->local_name () << "(_tao_environment);" << be_uidt_nl
- << "}\n";
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl
+ << "ACE_NEW (_tao_obj_ptr, CORBA::Object_ptr);" << be_nl
+ << "*_tao_obj_ptr = " << node->name ()
+ << "::_duplicate (_tao_elem);" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", "
+ << "_tao_obj_ptr, 1, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
- if (!node->readonly ())
- {
- *os << be_nl
- << "void "
- << intf->full_coll_name ()
- << "::" << node->local_name ()
- << " (" << be_idt << be_idt_nl;
- // XXXASG - TODO
- be_visitor_args_decl vdecl (os);
- vdecl.current_type_name (bt->name ());
- vdecl.argument_direction (AST_Argument::dir_IN);
- if (bt->accept (&vdecl) == -1)
- return -1;
+ *os << "void operator<<= (CORBA::Any &_tao_any, "
+ << node->name () << "_ptr *_tao_elem) // non copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", "
+ << "_tao_elem, 0, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
- *os << " _tao_value," << be_nl
- << "CORBA::Environment &_tao_environment" << be_uidt_nl
- << ")" << be_uidt_nl
- << "{" << be_idt_nl
- << "this->servant_->" << node->local_name ()
- << " (" << be_idt << be_idt_nl
- << "_tao_value," << be_nl
- << "_tao_environment" << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl
- << "}\n\n";
- }
- return 0;
-}
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
+ << node->name () << "_ptr &_tao_elem)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_elem = " << node->name () << "::_nil ();" << be_nl
+ << "if (!_tao_any.type ()->equal (" << node->tc_name ()
+ << ", _tao_env)) return 0; // not equal" << be_nl
+ << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
+ << be_nl
+ << "CORBA::Object_ptr *_tao_obj_ptr;" << be_nl
+ << "ACE_NEW_RETURN (_tao_obj_ptr, CORBA::Object_ptr, 0);" << be_nl
+ << "if (stream.decode (" << node->tc_name ()
+ << ", _tao_obj_ptr, 0, _tao_env)" << be_nl
+ << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
+ << "{" << be_idt_nl
+ << "_tao_elem = " << node->name ()
+ << "::_narrow (*_tao_obj_ptr, _tao_env);" << be_nl
+ << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl
+ << "CORBA::release (*_tao_obj_ptr);" << be_nl
+ << "*_tao_obj_ptr = _tao_elem;" << be_nl
+ << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
+ << "_tao_obj_ptr, 1, _tao_env);"
+ << be_nl
+ << "if (_tao_env.exception ()) return 0; // narrow failed" << be_nl
+ << "return 1;" << be_uidt_nl
+ << "}" << be_nl
+ << "return 0; // failure" << be_uidt_nl
+ << "}\n\n";
-int be_visitor_interface_collocated_ss::visit_argument (be_argument *node)
-{
- TAO_OutStream *os = this->ctx_->stream ();
- os->indent ();
- *os << node->local_name () << ",\n";
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface::visit_interface - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_stub_any_op_gen (1);
return 0;
}
-#endif
diff --git a/TAO/TAO_IDL/be/be_visitor_module.cpp b/TAO/TAO_IDL/be/be_visitor_module.cpp
index 697e7ceaf8a..6f90597040e 100644
--- a/TAO/TAO_IDL/be/be_visitor_module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module.cpp
@@ -74,6 +74,8 @@ be_visitor_module::visit_constant (be_constant *node)
case TAO_CodeGen::TAO_MODULE_CS:
ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
case TAO_CodeGen::TAO_MODULE_CI:
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
@@ -134,6 +136,12 @@ be_visitor_module::visit_enum (be_enum *node)
case TAO_CodeGen::TAO_MODULE_CS:
ctx.state (TAO_CodeGen::TAO_ENUM_CS);
break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_MODULE_CI:
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
@@ -197,6 +205,12 @@ be_visitor_module::visit_exception (be_exception *node)
case TAO_CodeGen::TAO_MODULE_CS:
ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
case TAO_CodeGen::TAO_MODULE_SS:
@@ -268,6 +282,12 @@ be_visitor_module::visit_interface (be_interface *node)
case TAO_CodeGen::TAO_MODULE_SS:
ctx.state (TAO_CodeGen::TAO_INTERFACE_SS);
break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS);
+ break;
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -323,6 +343,8 @@ be_visitor_module::visit_interface_fwd (be_interface_fwd *node)
case TAO_CodeGen::TAO_MODULE_CI:
ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CI);
break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
case TAO_CodeGen::TAO_MODULE_CS:
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
@@ -386,6 +408,12 @@ be_visitor_module::visit_structure (be_structure *node)
case TAO_CodeGen::TAO_MODULE_CS:
ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
case TAO_CodeGen::TAO_MODULE_SS:
@@ -448,6 +476,12 @@ be_visitor_module::visit_union (be_union *node)
case TAO_CodeGen::TAO_MODULE_CS:
ctx.state (TAO_CodeGen::TAO_UNION_CS);
break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
case TAO_CodeGen::TAO_MODULE_SS:
@@ -510,6 +544,12 @@ be_visitor_module::visit_typedef (be_typedef *node)
case TAO_CodeGen::TAO_MODULE_CS:
ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_MODULE_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_MODULE_SH:
case TAO_CodeGen::TAO_MODULE_SI:
case TAO_CodeGen::TAO_MODULE_SS:
@@ -655,3 +695,30 @@ be_visitor_module_sh::visit_module (be_module *node)
return 0;
}
+
+// ***************************************************************************
+// Module visitor for generating Any operator declarations in the client header
+// and stub
+// ***************************************************************************
+
+be_visitor_module_any_op::be_visitor_module_any_op (be_visitor_context *ctx)
+ : be_visitor_module (ctx)
+{
+}
+
+be_visitor_module_any_op::~be_visitor_module_any_op (void)
+{
+}
+
+int
+be_visitor_module_any_op::visit_module (be_module *node)
+{
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module::visit_module - "
+ "codegen for scope failed\n"), -1);
+ }
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp
index cd291424a39..48898241cf4 100644
--- a/TAO/TAO_IDL/be/be_visitor_root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root.cpp
@@ -50,13 +50,80 @@ int be_visitor_root::visit_root (be_root *node)
"failed to initialize context\n"), -1);
}
- // all we have to do is to visit the scope
+ // all we have to do is to visit the scope and generate code
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root::visit_root - "
"codegen for scope failed\n"), -1);
}
+
+ // The last 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
+ // user-defined types.
+ //
+ // XXXASG - this part of the code may be conditionally generated because at
+ // times it is not necessary to have these operators at all. TO-DO.
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_CS:
+ ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS);
+ break;
+ case TAO_CodeGen::TAO_ROOT_SH:
+ (void) tao_cg->end_server_header ();
+ return 0;
+ break;
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_constant - "
+ "Bad context state\n"
+ ), -1);
+ }
+ break;
+ }
+
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "NUL visitor\n"
+ ), -1);
+ }
+
+ // generate the <<= and >>= operators for all the user-defined data types in
+ // the outermost scope
+ if (node->accept (visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_root - "
+ "failed to generate Any operators\n"
+ ), -1);
+ }
+ delete visitor;
+
+ // generate any final code such as #endifs
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ (void) tao_cg->end_client_header ();
+ break;
+ default:
+ break;
+ }
return 0;
}
@@ -83,6 +150,8 @@ be_visitor_root::visit_constant (be_constant *node)
case TAO_CodeGen::TAO_ROOT_CS:
ctx.state (TAO_CodeGen::TAO_CONSTANT_CS);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
case TAO_CodeGen::TAO_ROOT_CI:
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
@@ -143,6 +212,12 @@ be_visitor_root::visit_enum (be_enum *node)
case TAO_CodeGen::TAO_ROOT_CS:
ctx.state (TAO_CodeGen::TAO_ENUM_CS);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_ROOT_CI:
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
@@ -206,6 +281,12 @@ be_visitor_root::visit_exception (be_exception *node)
case TAO_CodeGen::TAO_ROOT_CS:
ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_EXCEPTION_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
case TAO_CodeGen::TAO_ROOT_SS:
@@ -277,6 +358,12 @@ be_visitor_root::visit_interface (be_interface *node)
case TAO_CodeGen::TAO_ROOT_SS:
ctx.state (TAO_CodeGen::TAO_INTERFACE_SS);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS);
+ break;
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -332,6 +419,8 @@ be_visitor_root::visit_interface_fwd (be_interface_fwd *node)
case TAO_CodeGen::TAO_ROOT_CI:
ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_CI);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
case TAO_CodeGen::TAO_ROOT_CS:
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
@@ -404,6 +493,12 @@ be_visitor_root::visit_module (be_module *node)
case TAO_CodeGen::TAO_ROOT_SS:
ctx.state (TAO_CodeGen::TAO_MODULE_SS);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_MODULE_ANY_OP_CS);
+ break;
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -462,6 +557,12 @@ be_visitor_root::visit_structure (be_structure *node)
case TAO_CodeGen::TAO_ROOT_CS:
ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
case TAO_CodeGen::TAO_ROOT_SS:
@@ -524,6 +625,12 @@ be_visitor_root::visit_union (be_union *node)
case TAO_CodeGen::TAO_ROOT_CS:
ctx.state (TAO_CodeGen::TAO_UNION_CS);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
case TAO_CodeGen::TAO_ROOT_SS:
@@ -586,6 +693,12 @@ be_visitor_root::visit_typedef (be_typedef *node)
case TAO_CodeGen::TAO_ROOT_CS:
ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS);
break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_ROOT_SH:
case TAO_CodeGen::TAO_ROOT_SI:
case TAO_CodeGen::TAO_ROOT_SS:
@@ -641,7 +754,8 @@ int
be_visitor_root_ch::init (void)
{
// first open the client-side header file for writing
- if (tao_cg->client_header (idl_global->be_get_client_hdr_fname ()) == -1)
+ if (tao_cg->start_client_header (idl_global->be_get_client_hdr_fname ())
+ == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_visitor_root_ch::init - "
@@ -649,6 +763,7 @@ be_visitor_root_ch::init (void)
return -1;
}
+ // init the stream
this->ctx_->stream (tao_cg->client_header ());
return 0;
}
@@ -670,7 +785,8 @@ int
be_visitor_root_ci::init (void)
{
// first open the client-side inline file for writing
- if (tao_cg->client_inline (idl_global->be_get_client_inline_fname ()) == -1)
+ if (tao_cg->start_client_inline (idl_global->be_get_client_inline_fname ())
+ == -1)
{
ACE_ERROR ((LM_ERROR,
"(%N:%l) be_visitor_root_ci - "
@@ -699,14 +815,16 @@ int
be_visitor_root_cs::init (void)
{
// first open the file
- if (tao_cg->client_stubs (idl_global->be_get_client_stub_fname ()) == -1)
+ if (tao_cg->start_client_stubs (idl_global->be_get_client_stub_fname ())
+ == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_cs - "
"Error opening client stub file\n"), -1);
}
- this->ctx_->stream (tao_cg->client_stubs ()); // init stream
+ // init stream
+ this->ctx_->stream (tao_cg->client_stubs ());
return 0;
}
@@ -727,7 +845,8 @@ int
be_visitor_root_sh::init (void)
{
// open the file
- if (tao_cg->server_header (idl_global->be_get_server_hdr_fname ()) == -1)
+ if (tao_cg->start_server_header (idl_global->be_get_server_hdr_fname ())
+ == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_sh::init - "
@@ -756,14 +875,16 @@ int
be_visitor_root_si::init (void)
{
// first open the file for writing
- if (tao_cg->server_inline (idl_global->be_get_server_inline_fname ()) == -1)
+ if (tao_cg->start_server_inline (idl_global->be_get_server_inline_fname ())
+ == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_si::init - "
"server inline open failed\n"), -1);
}
- this->ctx_->stream (tao_cg->server_inline ()); // init stream
+ // init stream
+ this->ctx_->stream (tao_cg->server_inline ());
return 0;
}
@@ -784,13 +905,43 @@ int
be_visitor_root_ss::init (void)
{
// first open the file for writing
- if (tao_cg->server_skeletons (idl_global->be_get_server_skeleton_fname ()) == -1)
+ if (tao_cg->start_server_skeletons (idl_global
+ ->be_get_server_skeleton_fname ())
+ == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_root_ss::init - "
"Error opening server skeletons file\n"), -1);
}
- this->ctx_->stream (tao_cg->server_skeletons ()); // set stream
+ // set stream
+ this->ctx_->stream (tao_cg->server_skeletons ());
+ return 0;
+}
+
+// ***************************************************************************
+// Root visitor for generating Any operator declarations in the client header
+// and stub
+// ***************************************************************************
+
+be_visitor_root_any_op::be_visitor_root_any_op (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_any_op::~be_visitor_root_any_op (void)
+{
+}
+
+int
+be_visitor_root_any_op::visit_root (be_root *node)
+{
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::visit_root - "
+ "codegen for scope failed\n"), -1);
+ }
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_scope.cpp b/TAO/TAO_IDL/be/be_visitor_scope.cpp
index 126e18ca3e2..0d28959f0f3 100644
--- a/TAO/TAO_IDL/be/be_visitor_scope.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_scope.cpp
@@ -57,8 +57,17 @@ be_visitor_scope::visit_scope (be_scope *node)
while (!si->is_done ())
{
AST_Decl *d = si->item ();
+ if (!d)
+ {
+ delete si;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_scope::visit_scope - "
+ "bad node in this scope\n"), -1);
+
+ }
be_decl *bd = be_decl::narrow_from_decl (d);
- // set the scope node in which the code is being generated
+ // set the scope node as "node" in which the code is being generated
+ // so that elements in the node's scope can use it for code generation
this->ctx_->scope (node->decl ());
// set the node to be visited
this->ctx_->node (bd);
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence.cpp b/TAO/TAO_IDL/be/be_visitor_sequence.cpp
index 6c9aa16389f..7a54a5c3a1a 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence.cpp
@@ -202,6 +202,7 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
*os << node->local_name () << " (const " << node->local_name ()
<< " &); // copy ctor" << be_nl;
*os << "~" << node->local_name () << " (void); // dtor\n";
+
os->decr_indent ();
*os << "};" << be_nl;
@@ -209,21 +210,6 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
*os << "typedef " << node->local_name () << " *"
<< node->local_name () << "_ptr;\n";
- // generate the Any <<= and >>= operators
- os->indent ();
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, const " << node->local_name ()
- << " &); // copying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, " << node->local_name ()
- << "*); // noncopying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
- << node->local_name () << " *&);\n";
-
// Generate the typecode decl
if (node->is_nested ())
{
@@ -1140,59 +1126,6 @@ int be_visitor_sequence_cs::visit_sequence (be_sequence *node)
<< " (void) // dtor" << be_nl
<< "{}\n\n";
- // Any <<= and >>= operators
- os->indent ();
- *os << "void operator<<= (CORBA::Any &_tao_any, const "
- << node->name () << " &_tao_elem) // copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", &"
- << "_tao_elem, 1, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "void operator<<= (CORBA::Any &_tao_any, "
- << node->name () << " *_tao_elem) // non copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 0, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
- << node->name () << " *&_tao_elem)" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "if (!_tao_any.type ()->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
- << "if (_tao_any.any_owns_data ())" << be_nl
- << "{" << be_idt_nl
- << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
- << be_nl
- << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
- << be_nl
- << "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem, 0, _tao_env)" << be_nl
- << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
- << "{" << be_idt_nl
- << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
- << "_tao_elem, 1, _tao_env);"
- << be_nl
- << " return 1;" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // decode failed
- << "{" << be_idt_nl
- << "delete _tao_elem;" << be_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // else any does not own the data
- << "{" << be_idt_nl
- << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
- << be_nl
- << "return 1;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}\n\n";
-
// generate the typecode information here
os->indent (); // start from current indentation level
*os << "static const CORBA::Long _oc_" << node->flatname () << "_seq[] ="
@@ -1624,3 +1557,119 @@ be_visitor_sequence_elemtype::visit_typedef (be_typedef *node)
this->ctx_->alias (0);
return 0;
}
+
+// ***************************************************************************
+// Sequence visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_sequence_any_op_ch::be_visitor_sequence_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_any_op_ch::~be_visitor_sequence_any_op_ch (void)
+{
+}
+
+int
+be_visitor_sequence_any_op_ch::visit_sequence (be_sequence *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ // generate the Any <<= and >>= operators
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &, const " << node->name ()
+ << " &); // copying version" << be_nl;
+ *os << "void operator<<= (CORBA::Any &, " << node->name ()
+ << "*); // noncopying version" << be_nl;
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
+ << node->name () << " *&);\n";
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+// ***************************************************************************
+// Sequence visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_sequence_any_op_cs::be_visitor_sequence_any_op_cs
+(be_visitor_context *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_sequence_any_op_cs::~be_visitor_sequence_any_op_cs (void)
+{
+}
+
+int
+be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_stubs ();
+
+ // Any <<= and >>= operators
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &_tao_any, const "
+ << node->name () << " &_tao_elem) // copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", &"
+ << "_tao_elem, 1, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "void operator<<= (CORBA::Any &_tao_any, "
+ << node->name () << " *_tao_elem) // non copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", "
+ << "_tao_elem, 0, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
+ << node->name () << " *&_tao_elem)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "if (!_tao_any.type ()->equal (" << node->tc_name ()
+ << ", _tao_env)) return 0; // not equal" << be_nl
+ << "if (_tao_any.any_owns_data ())" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
+ << be_nl
+ << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
+ << be_nl
+ << "if (stream.decode (" << node->tc_name ()
+ << ", _tao_elem, 0, _tao_env)" << be_nl
+ << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
+ << "{" << be_idt_nl
+ << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
+ << "_tao_elem, 1, _tao_env);"
+ << be_nl
+ << " return 1;" << be_uidt_nl
+ << "}" << be_nl
+ << "else" << be_nl // decode failed
+ << "{" << be_idt_nl
+ << "delete _tao_elem;" << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl
+ << "else" << be_nl // else any does not own the data
+ << "{" << be_idt_nl
+ << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
+ << be_nl
+ << "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}\n\n";
+
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_structure.cpp b/TAO/TAO_IDL/be/be_visitor_structure.cpp
index 9c5b813d883..c99091aea6c 100644
--- a/TAO/TAO_IDL/be/be_visitor_structure.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_structure.cpp
@@ -164,21 +164,6 @@ int be_visitor_structure_ch::visit_structure (be_structure *node)
() << "_out;\n\n";
}
- // generate the Any <<= and >>= operators
- os->indent ();
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, const " << node->local_name ()
- << " &); // copying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, " << node->local_name ()
- << "*); // noncopying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
- << node->local_name () << " *&);\n";
-
// generate the typecode decl
if (node->is_nested ())
{
@@ -293,59 +278,6 @@ int be_visitor_structure_cs::visit_structure (be_structure *node)
*os << "CORBA::TypeCode_ptr " << node->tc_name () << " = &_tc__tc_" <<
node->flatname () << ";\n\n";
- // Any <<= and >>= operators
- os->indent ();
- *os << "void operator<<= (CORBA::Any &_tao_any, const "
- << node->name () << " &_tao_elem) // copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", &"
- << "_tao_elem, 1, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "void operator<<= (CORBA::Any &_tao_any, "
- << node->name () << " *_tao_elem) // non copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 0, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
- << node->name () << " *&_tao_elem)" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "if (!_tao_any.type ()->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
- << "if (_tao_any.any_owns_data ())" << be_nl
- << "{" << be_idt_nl
- << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
- << be_nl
- << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
- << be_nl
- << "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem, 0, _tao_env)" << be_nl
- << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
- << "{" << be_idt_nl
- << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
- << "_tao_elem, 1, _tao_env);"
- << be_nl
- << " return 1;" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // decode failed
- << "{" << be_idt_nl
- << "delete _tao_elem;" << be_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // else any does not own the data
- << "{" << be_idt_nl
- << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
- << be_nl
- << "return 1;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}\n\n";
-
// do any code generation required for the scope members
// all we have to do is to visit the scope
if (this->visit_scope (node) == -1)
@@ -360,3 +292,191 @@ int be_visitor_structure_cs::visit_structure (be_structure *node)
return 0;
}
+
+// ***************************************************************************
+// Structure visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_structure_any_op_ch::be_visitor_structure_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_any_op_ch::~be_visitor_structure_any_op_ch (void)
+{
+}
+
+int
+be_visitor_structure_any_op_ch::visit_structure (be_structure *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ // generate the Any <<= and >>= operator declarations
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &, const " << node->name ()
+ << " &); // copying version" << be_nl;
+ *os << "void operator<<= (CORBA::Any &, " << node->name ()
+ << "*); // noncopying version" << be_nl;
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
+ << node->name () << " *&);\n";
+
+
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure::visit_structure - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_structure_any_op_ch::visit_field (be_field *node)
+{
+ be_type *bt; // field's type
+
+ // first generate the type information
+ bt = be_type::narrow_from_decl (node->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_ch::"
+ "visit_field - "
+ "Bad field type\n"
+ ), -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"
+ ), -1);
+ }
+ return 0;
+}
+
+// ***************************************************************************
+// Structure visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_structure_any_op_cs::be_visitor_structure_any_op_cs
+(be_visitor_context *ctx)
+ : be_visitor_structure (ctx)
+{
+}
+
+be_visitor_structure_any_op_cs::~be_visitor_structure_any_op_cs (void)
+{
+}
+
+int
+be_visitor_structure_any_op_cs::visit_structure (be_structure *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_stubs ();
+
+ // generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &_tao_any, const "
+ << node->name () << " &_tao_elem) // copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", &"
+ << "_tao_elem, 1, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "void operator<<= (CORBA::Any &_tao_any, "
+ << node->name () << " *_tao_elem) // non copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", "
+ << "_tao_elem, 0, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
+ << node->name () << " *&_tao_elem)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "if (!_tao_any.type ()->equal (" << node->tc_name ()
+ << ", _tao_env)) return 0; // not equal" << be_nl
+ << "if (_tao_any.any_owns_data ())" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
+ << be_nl
+ << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
+ << be_nl
+ << "if (stream.decode (" << node->tc_name ()
+ << ", _tao_elem, 0, _tao_env)" << be_nl
+ << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
+ << "{" << be_idt_nl
+ << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
+ << "_tao_elem, 1, _tao_env);"
+ << be_nl
+ << " return 1;" << be_uidt_nl
+ << "}" << be_nl
+ << "else" << be_nl // decode failed
+ << "{" << be_idt_nl
+ << "delete _tao_elem;" << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl
+ << "else" << be_nl // else any does not own the data
+ << "{" << be_idt_nl
+ << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
+ << be_nl
+ << "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}\n\n";
+
+
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure::visit_structure - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_structure_any_op_cs::visit_field (be_field *node)
+{
+ be_type *bt; // field's type
+
+ // first generate the type information
+ bt = be_type::narrow_from_decl (node->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_cs::"
+ "visit_field - "
+ "Bad field type\n"
+ ), -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_structure_any_op_cs::"
+ "visit_field - "
+ "codegen for field type failed\n"
+ ), -1);
+ }
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef.cpp
index fcf0477b7da..dfa65f83996 100644
--- a/TAO/TAO_IDL/be/be_visitor_typedef.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typedef.cpp
@@ -70,6 +70,12 @@ be_visitor_typedef::visit_array (be_array *node)
case TAO_CodeGen::TAO_TYPEDEF_CI:
ctx.state (TAO_CodeGen::TAO_ARRAY_CI);
break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_TYPEDEF_SH:
case TAO_CodeGen::TAO_TYPEDEF_SI:
case TAO_CodeGen::TAO_TYPEDEF_SS:
@@ -129,6 +135,12 @@ be_visitor_typedef::visit_enum (be_enum *node)
case TAO_CodeGen::TAO_TYPEDEF_CS:
ctx.state (TAO_CodeGen::TAO_ENUM_CS);
break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_TYPEDEF_CI:
case TAO_CodeGen::TAO_TYPEDEF_SH:
case TAO_CodeGen::TAO_TYPEDEF_SI:
@@ -199,6 +211,8 @@ be_visitor_typedef::visit_sequence (be_sequence *node)
case TAO_CodeGen::TAO_TYPEDEF_CS:
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CS);
break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
case TAO_CodeGen::TAO_TYPEDEF_SH:
case TAO_CodeGen::TAO_TYPEDEF_SI:
case TAO_CodeGen::TAO_TYPEDEF_SS:
@@ -261,6 +275,8 @@ be_visitor_typedef::visit_string (be_string *node)
case TAO_CodeGen::TAO_TYPEDEF_CS:
ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
case TAO_CodeGen::TAO_TYPEDEF_SH:
case TAO_CodeGen::TAO_TYPEDEF_SI:
case TAO_CodeGen::TAO_TYPEDEF_SS:
@@ -323,6 +339,12 @@ be_visitor_typedef::visit_structure (be_structure *node)
case TAO_CodeGen::TAO_TYPEDEF_CS:
ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_TYPEDEF_SH:
case TAO_CodeGen::TAO_TYPEDEF_SI:
case TAO_CodeGen::TAO_TYPEDEF_SS:
@@ -385,6 +407,12 @@ be_visitor_typedef::visit_union (be_union *node)
case TAO_CodeGen::TAO_TYPEDEF_CS:
ctx.state (TAO_CodeGen::TAO_UNION_CS);
break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
+ ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
+ break;
case TAO_CodeGen::TAO_TYPEDEF_SH:
case TAO_CodeGen::TAO_TYPEDEF_SI:
case TAO_CodeGen::TAO_TYPEDEF_SS:
@@ -639,6 +667,37 @@ be_visitor_typedef_ch::visit_enum (be_enum *node)
}
int
+be_visitor_typedef_ch::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ // now generate the typedefs
+ os->indent ();
+
+ // typedef the _ptr
+ *os << "typedef " << bt->nested_type_name (scope, "_ptr")
+ << " " << tdef->nested_type_name (scope, "_ptr") << ";" << be_nl;
+
+ // typedef the _var
+ *os << "typedef " << bt->nested_type_name (scope, "_var")
+ << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl;
+
+ // typedef the _out
+ *os << "typedef " << bt->nested_type_name (scope, "_out")
+ << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl;
+
+ return 0;
+}
+
+int
be_visitor_typedef_ch::visit_predefined_type (be_predefined_type *node)
{
TAO_OutStream *os = this->ctx_->stream (); // output stream
@@ -1159,3 +1218,534 @@ be_visitor_typedef_cs::visit_typedef (be_typedef *node)
return 0;
}
+
+// ***************************************************************************
+// Typedef visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_typedef_any_op_ch::be_visitor_typedef_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_typedef (ctx)
+{
+}
+
+be_visitor_typedef_any_op_ch::~be_visitor_typedef_any_op_ch (void)
+{
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_typedef (be_typedef *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ // generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators
+ os->indent ();
+
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forany type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // the fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node
+
+ this->ctx_->alias (node); // save this alias
+
+ // grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method
+ bt = node->primitive_base_type ();
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_typedef - "
+ "bad primitive base type\n"
+ ), -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"
+ ), -1);
+ }
+ this->ctx_->alias (0); // reset
+ }
+ else
+ {
+ // the context has not stored any "tdef" node. So we must be in here for
+ // the first time
+ this->ctx_->tdef (node); // save the typedef node
+
+ // grab the immediate base type node
+ bt = be_type::narrow_from_decl (node->base_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_typedef - "
+ "bad base type\n"
+ ), -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_typedef - "
+ "failed to accept visitor\n"
+ ), -1);
+ }
+
+ this->ctx_->tdef (0); // reset
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (!bt->imported () &&
+ bt->node_type () == AST_Decl::NT_array) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_array - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_enum (be_enum *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_enum) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_enum (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_enum - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_sequence (be_sequence *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_sequence) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_sequence - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_structure (be_structure *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_structure - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_ch::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_ch::"
+ "visit_union - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+// ***************************************************************************
+// Typedef visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_typedef_any_op_cs::be_visitor_typedef_any_op_cs
+(be_visitor_context *ctx)
+ : be_visitor_typedef (ctx)
+{
+}
+
+be_visitor_typedef_any_op_cs::~be_visitor_typedef_any_op_cs (void)
+{
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_typedef (be_typedef *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_stubs ();
+
+ // generate the Any <<= and >>= operator declarations
+ // Any <<= and >>= operators
+ os->indent ();
+
+ // In general, we may have a chain of typedefs. i.e.,
+ // typedef sequence<long> X;
+ // typedef X Y;
+ // typedef Y Z; and so on
+ // The first time we will be in will be for node Z for which the code
+ // generation has to take place. However, it is not enough to just generate
+ // code that looks like -
+ // typedef Y Z;
+ // For different types (in this case we have a sequence), we will need
+ // typedefs for the _var and _out types for Z. If it had been an array, we
+ // will additionally have the _forany type as well as inlined *_alloc, _dup,
+ // and _free methods.
+ //
+ // Finally, we need to differentiate between the case where we were
+ // generating code for
+ // typedef sequence<long> X; and
+ // typedef Y Z; where Y was somehow aliased to the sequence. In the former
+ // case, we will need to generate all the code for sequence<long> or whatever
+ // the type maybe. In the latter, we just need typedefs for the type and all
+ // associated _var, _out, and other types.
+
+ be_type *bt; // base type
+
+ if (this->ctx_->tdef ())
+ {
+ // the fact that we are here indicates that we were generating code for a
+ // typedef node whose base type also happens to be another typedef-ed
+ // (i.e. an alias) node for another (possibly alias) node
+
+ this->ctx_->alias (node); // save this alias
+
+ // grab the most primitive base type in the chain to avoid recusrsively
+ // going thru this visit method
+ bt = node->primitive_base_type ();
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_typedef - "
+ "bad primitive base type\n"
+ ), -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_typedef - "
+ "failed to accept visitor\n"
+ ), -1);
+ }
+ this->ctx_->alias (0); // reset
+ }
+ else
+ {
+ // the context has not stored any "tdef" node. So we must be in here for
+ // the first time
+ this->ctx_->tdef (node); // save the typedef node
+
+ // grab the immediate base type node
+ bt = be_type::narrow_from_decl (node->base_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_typedef - "
+ "bad base type\n"
+ ), -1);
+ }
+
+ // accept on this base type, but generate code for the typedef node
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_typedef - "
+ "failed to accept visitor\n"
+ ), -1);
+ }
+
+ this->ctx_->tdef (0); // reset
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_array (be_array *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (!bt->imported () &&
+ bt->node_type () == AST_Decl::NT_array) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_array (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_array - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_enum (be_enum *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_enum) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_enum (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_enum - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_sequence (be_sequence *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_sequence) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_sequence (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_sequence - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_structure (be_structure *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_struct) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_structure (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_structure - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_typedef_any_op_cs::visit_union (be_union *node)
+{
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
+ be_typedef *tdef = this->ctx_->tdef (); // typedef node
+ be_decl *scope = this->ctx_->scope (); // scope in which it is used
+ be_type *bt;
+
+ if (this->ctx_->alias ()) // typedef of a typedef
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ if (bt->node_type () == AST_Decl::NT_union) // direct typedef of a base node
+ // type
+ {
+ // let the base class visitor handle this case
+ if (this->be_visitor_typedef::visit_union (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typedef_any_op_cs::"
+ "visit_union - "
+ "base class visitor failed \n"
+ ), -1);
+ }
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_union.cpp b/TAO/TAO_IDL/be/be_visitor_union.cpp
index 7e2cec05d43..a6d882e3b8b 100644
--- a/TAO/TAO_IDL/be/be_visitor_union.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union.cpp
@@ -224,21 +224,6 @@ int be_visitor_union_ch::visit_union (be_union *node)
os->decr_indent ();
*os << "}; // " << node->name () << "\n\n";
- // generate the Any <<= and >>= operators
- os->indent ();
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, const " << node->local_name ()
- << " &); // copying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "void operator<<= (CORBA::Any &, " << node->local_name ()
- << "*); // noncopying version" << be_nl;
- if (node->is_nested ())
- *os << "friend ";
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
- << node->local_name () << " *&);\n";
-
// Generate the typecode decl
if (node->is_nested ())
{
@@ -546,59 +531,6 @@ int be_visitor_union_cs::visit_union (be_union *node)
os->decr_indent ();
*os << "}\n\n";
- // Any <<= and >>= operators
- os->indent ();
- *os << "void operator<<= (CORBA::Any &_tao_any, const "
- << node->name () << " &_tao_elem) // copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", &"
- << "_tao_elem, 1, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "void operator<<= (CORBA::Any &_tao_any, "
- << node->name () << " *_tao_elem) // non copying" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 0, _tao_env);" << be_uidt_nl
- << "}" << be_nl;
-
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
- << node->name () << " *&_tao_elem)" << be_nl
- << "{" << be_idt_nl
- << "CORBA::Environment _tao_env;" << be_nl
- << "if (!_tao_any.type ()->equal (" << node->tc_name ()
- << ", _tao_env)) return 0; // not equal" << be_nl
- << "if (_tao_any.any_owns_data ())" << be_nl
- << "{" << be_idt_nl
- << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
- << be_nl
- << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
- << be_nl
- << "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem, 0, _tao_env)" << be_nl
- << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
- << "{" << be_idt_nl
- << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
- << "_tao_elem, 1, _tao_env);"
- << be_nl
- << " return 1;" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // decode failed
- << "{" << be_idt_nl
- << "delete _tao_elem;" << be_nl
- << "return 0;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // else any does not own the data
- << "{" << be_idt_nl
- << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
- << be_nl
- << "return 1;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}\n\n";
-
os->indent ();
// generate the typecode information here
os->indent (); // start from current indentation level
@@ -919,3 +851,190 @@ be_visitor_union_discriminant_cs::visit_enum (be_enum *node)
}
return 0;
}
+
+// ***************************************************************************
+// Union visitor for generating Any operator declarations in the client header
+// ***************************************************************************
+
+be_visitor_union_any_op_ch::be_visitor_union_any_op_ch
+(be_visitor_context *ctx)
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_any_op_ch::~be_visitor_union_any_op_ch (void)
+{
+}
+
+int
+be_visitor_union_any_op_ch::visit_union (be_union *node)
+{
+ if (node->cli_hdr_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_header ();
+
+ // generate the Any <<= and >>= operator declarations
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &, const " << node->name ()
+ << " &); // copying version" << be_nl;
+ *os << "void operator<<= (CORBA::Any &, " << node->name ()
+ << "*); // noncopying version" << be_nl;
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &, "
+ << node->name () << " *&);\n";
+
+
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union::visit_union - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_hdr_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_union_any_op_ch::visit_union_branch (be_union_branch *node)
+{
+ be_type *bt; // field's type
+
+ // first generate the type information
+ bt = be_type::narrow_from_decl (node->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_ch::"
+ "visit_union_branch - "
+ "Bad field type\n"
+ ), -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_ch::"
+ "visit_field - "
+ "codegen for field type failed\n"
+ ), -1);
+ }
+ return 0;
+}
+
+// ***************************************************************************
+// Union visitor for generating Any operator declarations in the client
+// stubs file
+// ***************************************************************************
+
+be_visitor_union_any_op_cs::be_visitor_union_any_op_cs
+(be_visitor_context *ctx)
+ : be_visitor_union (ctx)
+{
+}
+
+be_visitor_union_any_op_cs::~be_visitor_union_any_op_cs (void)
+{
+}
+
+int
+be_visitor_union_any_op_cs::visit_union (be_union *node)
+{
+ if (node->cli_stub_any_op_gen () || node->imported ())
+ return 0;
+
+ TAO_OutStream *os = tao_cg->client_stubs ();
+
+ // generate the Any <<= and >>= operator declarations
+ os->indent ();
+ *os << "void operator<<= (CORBA::Any &_tao_any, const "
+ << node->name () << " &_tao_elem) // copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", &"
+ << "_tao_elem, 1, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "void operator<<= (CORBA::Any &_tao_any, "
+ << node->name () << " *_tao_elem) // non copying" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "_tao_any.replace (" << node->tc_name () << ", "
+ << "_tao_elem, 0, _tao_env);" << be_uidt_nl
+ << "}" << be_nl;
+
+ *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
+ << node->name () << " *&_tao_elem)" << be_nl
+ << "{" << be_idt_nl
+ << "CORBA::Environment _tao_env;" << be_nl
+ << "if (!_tao_any.type ()->equal (" << node->tc_name ()
+ << ", _tao_env)) return 0; // not equal" << be_nl
+ << "if (_tao_any.any_owns_data ())" << be_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
+ << be_nl
+ << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());"
+ << be_nl
+ << "if (stream.decode (" << node->tc_name ()
+ << ", _tao_elem, 0, _tao_env)" << be_nl
+ << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
+ << "{" << be_idt_nl
+ << "((CORBA::Any *)&_tao_any)->replace (_tao_any.type (), "
+ << "_tao_elem, 1, _tao_env);"
+ << be_nl
+ << " return 1;" << be_uidt_nl
+ << "}" << be_nl
+ << "else" << be_nl // decode failed
+ << "{" << be_idt_nl
+ << "delete _tao_elem;" << be_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}" << be_nl
+ << "else" << be_nl // else any does not own the data
+ << "{" << be_idt_nl
+ << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
+ << be_nl
+ << "return 1;" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "}\n\n";
+
+
+ // all we have to do is to visit the scope and generate code
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union::visit_union - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_stub_any_op_gen (1);
+ return 0;
+}
+
+int
+be_visitor_union_any_op_cs::visit_union_branch (be_union_branch *node)
+{
+ be_type *bt; // field's type
+
+ // first generate the type information
+ bt = be_type::narrow_from_decl (node->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_cs::"
+ "visit_union_branch - "
+ "Bad field type\n"
+ ), -1);
+ }
+
+ if (bt->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_union_any_op_cs::"
+ "visit_union_branch - "
+ "codegen for field type failed\n"
+ ), -1);
+ }
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be_include/be.h b/TAO/TAO_IDL/be_include/be.h
index 1487c62e31c..5505a36ad8b 100644
--- a/TAO/TAO_IDL/be_include/be.h
+++ b/TAO/TAO_IDL/be_include/be.h
@@ -116,7 +116,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "be_native.h" // class BE_Native
#include "be_helper.h" // helper functions
-#include "be_state.h" // code generation states
#include "be_codegen.h" // code generator
#include "be_factory.h" // factory
diff --git a/TAO/TAO_IDL/be_include/be_argument.h b/TAO/TAO_IDL/be_include/be_argument.h
index 837b6c8273b..cbf2e30f249 100644
--- a/TAO/TAO_IDL/be_include/be_argument.h
+++ b/TAO/TAO_IDL/be_include/be_argument.h
@@ -4,7 +4,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_argument.h
//
@@ -14,9 +14,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#if !defined (BE_ARGUMENT_H)
@@ -38,24 +38,6 @@ public:
UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // generate client header for the argument
-
- virtual int gen_client_stubs (void);
- // generate client side stubs for the argument
-
- virtual int gen_server_header (void);
- // generate server header for the argument
-
- virtual int gen_server_skeletons (void);
- // generate server skeletons for the argument
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the argument
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the argument
-
// Visiting
virtual int accept (be_visitor *visitor);
diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h
index e77962217e9..2d47c20f846 100644
--- a/TAO/TAO_IDL/be_include/be_array.h
+++ b/TAO/TAO_IDL/be_include/be_array.h
@@ -41,24 +41,6 @@ public:
~be_array (void);
- virtual int gen_client_header (void);
- // generate client header for array
-
- virtual int gen_client_stubs (void);
- // generate client side stubs for array
-
- virtual int gen_server_header (void);
- // generate server header for array
-
- virtual int gen_server_skeletons (void);
- // generate server skeletons for array
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the array
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the array
-
virtual int gen_var_defn (void);
// generate the _var class definition
diff --git a/TAO/TAO_IDL/be_include/be_attribute.h b/TAO/TAO_IDL/be_include/be_attribute.h
index ac3230d8d99..93f7d111279 100644
--- a/TAO/TAO_IDL/be_include/be_attribute.h
+++ b/TAO/TAO_IDL/be_include/be_attribute.h
@@ -4,7 +4,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_attribute.h
//
@@ -14,9 +14,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#if !defined (BE_ATTRIBUTE_H)
@@ -37,24 +37,6 @@ public:
be_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // generate client header for the attribute
-
- virtual int gen_client_stubs (void);
- // generate client side stubs for the attribute
-
- virtual int gen_server_header (void);
- // generate server header for the attribute
-
- virtual int gen_server_skeletons (void);
- // generate server skeletons for the attribute
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the attribute
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the attribute
-
// Visiting
virtual int accept (be_visitor *visitor);
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index c3516c62bfc..6001312b666 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -117,6 +117,8 @@ public:
TAO_ARRAY_DEFN_SH,
TAO_ARRAY_DEFN_SI,
TAO_ARRAY_DEFN_SS,
+ TAO_ARRAY_ANY_OP_CH,
+ TAO_ARRAY_ANY_OP_CS,
// emitting code for rest of the array decl
TAO_ARRAY_OTHER_CH,
@@ -138,6 +140,8 @@ public:
TAO_ENUM_SH, // XXXASG rm? all 3
TAO_ENUM_SI,
TAO_ENUM_SS,
+ TAO_ENUM_ANY_OP_CH,
+ TAO_ENUM_ANY_OP_CS,
// emitting code for exceptions
TAO_EXCEPTION_CH,
@@ -149,6 +153,8 @@ public:
TAO_EXCEPTION_SH,
TAO_EXCEPTION_SI,
TAO_EXCEPTION_SS,
+ TAO_EXCEPTION_ANY_OP_CH,
+ TAO_EXCEPTION_ANY_OP_CS,
// emitting fields i.e., struct members
TAO_FIELD_CH,
@@ -164,6 +170,8 @@ public:
TAO_INTERFACE_SS,
TAO_INTERFACE_COLLOCATED_SH,
TAO_INTERFACE_COLLOCATED_SS,
+ TAO_INTERFACE_ANY_OP_CH,
+ TAO_INTERFACE_ANY_OP_CS,
// emitting code for the interface forward declaration
TAO_INTERFACE_FWD_CH,
@@ -176,6 +184,8 @@ public:
TAO_MODULE_SH,
TAO_MODULE_SI,
TAO_MODULE_SS,
+ TAO_MODULE_ANY_OP_CH,
+ TAO_MODULE_ANY_OP_CS,
// emitting code for an operation.
TAO_OPERATION_CH, // in client header
@@ -238,11 +248,15 @@ public:
TAO_ROOT_SH,
TAO_ROOT_SI,
TAO_ROOT_SS,
+ TAO_ROOT_ANY_OP_CH,
+ TAO_ROOT_ANY_OP_CS,
// emitting sequences
TAO_SEQUENCE_CH,
TAO_SEQUENCE_CI,
TAO_SEQUENCE_CS,
+ TAO_SEQUENCE_ANY_OP_CH,
+ TAO_SEQUENCE_ANY_OP_CS,
// emitting code for sequence base type
TAO_SEQUENCE_BASE_CH,
@@ -282,6 +296,8 @@ public:
TAO_STRUCT_CH,
TAO_STRUCT_CI,
TAO_STRUCT_CS,
+ TAO_STRUCT_ANY_OP_CH,
+ TAO_STRUCT_ANY_OP_CS,
// emitting code for typedefs
TAO_TYPEDEF_CH,
@@ -290,11 +306,15 @@ public:
TAO_TYPEDEF_SH,
TAO_TYPEDEF_SI,
TAO_TYPEDEF_SS,
+ TAO_TYPEDEF_ANY_OP_CH,
+ TAO_TYPEDEF_ANY_OP_CS,
// emitting code for unions
TAO_UNION_CH,
TAO_UNION_CI,
TAO_UNION_CS,
+ TAO_UNION_ANY_OP_CH,
+ TAO_UNION_ANY_OP_CS,
// emitting code for the discriminant
TAO_UNION_DISCTYPEDEFN_CH,
@@ -336,46 +356,49 @@ public:
// Factory that makes the right visitor based on the contex. This
// delegates the task to its factory data member
- be_state *make_state (void);
- // factory method returning appropriate subclass of the be_state object
- // based on the current code generation state
-
int gen_cplusplus_mapping (void);
// generate the C++ mapping for CORBA IDL
- int client_header (const char *fname);
+ int start_client_header (const char *fname);
// set the client header stream
- TAO_OutStream *client_header (void);
- // get the client header stream
+ int start_client_inline (const char *fname);
+ // set the client inline stream
- int client_stubs (const char *fname);
+ int start_client_stubs (const char *fname);
// set the client stub stream
+ int start_server_header (const char *fname);
+ // set the server header stream
+
+ int start_server_inline (const char *fname);
+ // set the server inline stream
+
+ int start_server_skeletons (const char *fname);
+ // set the server skeletons stream
+
+ int end_client_header (void);
+ // generate code at the end such as the <<= and >>= operators alongwith the
+ // ending #endif statement
+
+ int end_server_header (void);
+ // put a last #endif in the server header
+
+ TAO_OutStream *client_header (void);
+ // get the client header stream
+
TAO_OutStream *client_stubs (void);
// get the client stubs stream
- int client_inline (const char *fname);
- // set the client inline stream
-
TAO_OutStream *client_inline (void);
// get the client inline stream
- int server_header (const char *fname);
- // set the server header stream
-
TAO_OutStream *server_header (void);
// get the server header stream
- int server_skeletons (const char *fname);
- // set the server skeletons stream
-
TAO_OutStream *server_skeletons (void);
// get the server skeletons stream
- int server_inline (const char *fname);
- // set the server inline stream
-
TAO_OutStream *server_inline (void);
// get the server inline stream
@@ -388,24 +411,6 @@ public:
void visitor_factory (TAO_Visitor_Factory *);
// set the visitor factory object
- int end_client_header (void);
- // put a last #endif in the client header
-
- int end_server_header (void);
- // put a last #endif in the server header
-
- void push (CG_STATE s);
- // set the code generation state
-
- void pop (void);
- // out of the current state
-
- void reset (void);
- // reset the stack to 1
-
- CG_STATE state (void);
- // return the current state
-
void node (be_decl *n);
// pass info
@@ -437,20 +442,12 @@ private:
TAO_OutStream *curr_os_;
// currently used out stream
- CG_STATE *state_;
- // code generation state stack
-
- int top_;
- // top of state stack
-
- int size_;
- // size of allocated stack
-
be_decl *node_;
// save current node in this
TAO_Visitor_Factory *visitor_factory_;
// visitor factory object
+
};
typedef ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX> TAO_CODEGEN;
diff --git a/TAO/TAO_IDL/be_include/be_constant.h b/TAO/TAO_IDL/be_include/be_constant.h
index a847982ec65..75a503e3e19 100644
--- a/TAO/TAO_IDL/be_include/be_constant.h
+++ b/TAO/TAO_IDL/be_include/be_constant.h
@@ -40,24 +40,6 @@ public:
UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the constant
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the constant
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the constant
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the constant
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the constant
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the constant
-
// = helper
char *exprtype_to_string (void);
// returns the appropriate type
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
index b3b7ff2cc97..0d0f3f1daa4 100644
--- a/TAO/TAO_IDL/be_include/be_decl.h
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -57,24 +57,6 @@ public:
~be_decl (void);
// destructor
- virtual int gen_client_header (void) = 0;
- // Generates the client-side header information for the decl
-
- virtual int gen_client_stubs (void) = 0;
- // Generates the client-side stubs for the decl
-
- virtual int gen_server_header (void) = 0;
- // Generates the server-side header information for the decl
-
- virtual int gen_server_skeletons (void) = 0;
- // Generates the server-side skeletons for the decl
-
- virtual int gen_client_inline (void) = 0;
- // Generates the client-side inline for the decl
-
- virtual int gen_server_inline (void) = 0;
- // Generates the server-side inlines for the decl
-
virtual void size_type (SIZE_TYPE);
// set the size type
@@ -112,6 +94,8 @@ public:
idl_bool srv_hdr_gen (void);
idl_bool srv_skel_gen (void);
idl_bool srv_inline_gen (void);
+ idl_bool cli_hdr_any_op_gen (void);
+ idl_bool cli_stub_any_op_gen (void);
// set the flag indicating that code generation is done
void cli_hdr_gen (idl_bool);
@@ -120,6 +104,8 @@ public:
void srv_hdr_gen (idl_bool);
void srv_skel_gen (idl_bool);
void srv_inline_gen (idl_bool);
+ void cli_hdr_any_op_gen (idl_bool);
+ void cli_stub_any_op_gen (idl_bool);
idl_bool is_child (be_decl *node);
// am I a direct child of node?
@@ -160,6 +146,8 @@ protected:
idl_bool srv_hdr_gen_;
idl_bool srv_skel_gen_;
idl_bool srv_inline_gen_;
+ idl_bool cli_hdr_any_op_gen_;
+ idl_bool cli_stub_any_op_gen_;
char *fullname_;
// our full scoped name
diff --git a/TAO/TAO_IDL/be_include/be_enum.h b/TAO/TAO_IDL/be_include/be_enum.h
index 07c525571f3..6196d5053aa 100644
--- a/TAO/TAO_IDL/be_include/be_enum.h
+++ b/TAO/TAO_IDL/be_include/be_enum.h
@@ -39,24 +39,6 @@ public:
be_enum (UTL_ScopedName *n, UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the enum
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the enum
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the enum
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the enum
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the enum
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the enum
-
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_enum_val.h b/TAO/TAO_IDL/be_include/be_enum_val.h
index d1cf4f3e817..45815eef998 100644
--- a/TAO/TAO_IDL/be_include/be_enum_val.h
+++ b/TAO/TAO_IDL/be_include/be_enum_val.h
@@ -5,7 +5,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_enum_val.h
//
@@ -15,9 +15,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#if !defined (BE_ENUM_VAL_H)
@@ -38,24 +38,6 @@ public:
be_enum_val (unsigned long v, UTL_ScopedName *n, UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the EnumVal
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the EnumVal
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the EnumVal
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the EnumVal
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the EnumVal
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the EnumVal
-
virtual int gen_encapsulation (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_exception.h b/TAO/TAO_IDL/be_include/be_exception.h
index 2fac73151e8..1f9348e993a 100644
--- a/TAO/TAO_IDL/be_include/be_exception.h
+++ b/TAO/TAO_IDL/be_include/be_exception.h
@@ -21,24 +21,6 @@ public:
// =code generation
- virtual int gen_client_header (void);
- // generate client header
-
- virtual int gen_client_inline (void);
- // generate client inline
-
- virtual int gen_client_stubs (void);
- // generate client stubs
-
- virtual int gen_server_header (void);
- // generate server header
-
- virtual int gen_server_inline (void);
- // generate server inline
-
- virtual int gen_server_skeletons (void);
- // generate server skeletons
-
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_field.h b/TAO/TAO_IDL/be_include/be_field.h
index 31b1c78df2a..b5802574bad 100644
--- a/TAO/TAO_IDL/be_include/be_field.h
+++ b/TAO/TAO_IDL/be_include/be_field.h
@@ -37,24 +37,6 @@ public:
be_field (AST_Type *ft, UTL_ScopedName *n, UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the field
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the field
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the field
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the field
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the field
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the field
-
virtual int gen_encapsulation (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h
index c27c72e393e..d1381d40448 100644
--- a/TAO/TAO_IDL/be_include/be_interface.h
+++ b/TAO/TAO_IDL/be_include/be_interface.h
@@ -54,24 +54,6 @@ public:
~be_interface (void);
// dtor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the interface
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the interface
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the interface
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the interface
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the interface
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the interface
-
virtual int gen_var_defn (void);
// generate the _var class definition
diff --git a/TAO/TAO_IDL/be_include/be_interface_fwd.h b/TAO/TAO_IDL/be_include/be_interface_fwd.h
index cc8939f6180..e14b051837a 100644
--- a/TAO/TAO_IDL/be_include/be_interface_fwd.h
+++ b/TAO/TAO_IDL/be_include/be_interface_fwd.h
@@ -42,24 +42,6 @@ public:
be_interface_fwd (UTL_ScopedName *n, UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the interface
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the interface
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the interface
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the interface
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the interface
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the interface
-
virtual int gen_var_defn (void);
// generate the _var class definition
diff --git a/TAO/TAO_IDL/be_include/be_module.h b/TAO/TAO_IDL/be_include/be_module.h
index 0afb8772af1..68190f9406b 100644
--- a/TAO/TAO_IDL/be_include/be_module.h
+++ b/TAO/TAO_IDL/be_include/be_module.h
@@ -40,24 +40,6 @@ public:
be_module (UTL_ScopedName *n, UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the module
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the module
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the module
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the module
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the module
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the module
-
// Visiting
virtual int accept (be_visitor *visitor);
diff --git a/TAO/TAO_IDL/be_include/be_native.h b/TAO/TAO_IDL/be_include/be_native.h
index 578f3c86222..869e17a0fca 100644
--- a/TAO/TAO_IDL/be_include/be_native.h
+++ b/TAO/TAO_IDL/be_include/be_native.h
@@ -38,24 +38,6 @@ public:
virtual ~be_native (void) {}
// destructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the type
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the type
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the type
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the type
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the type
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the type
-
virtual int gen_typecode (void);
// generate the typecode description
diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h
index d07304a6b23..21859abdd96 100644
--- a/TAO/TAO_IDL/be_include/be_operation.h
+++ b/TAO/TAO_IDL/be_include/be_operation.h
@@ -41,24 +41,6 @@ public:
UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // generate client header
-
- virtual int gen_client_stubs (void);
- // generate client side stubs
-
- virtual int gen_server_header (void);
- // generate server header
-
- virtual int gen_server_skeletons (void);
- // generate server skeletons
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the operation
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the operation
-
virtual int argument_count (void);
// return the count of members
diff --git a/TAO/TAO_IDL/be_include/be_predefined_type.h b/TAO/TAO_IDL/be_include/be_predefined_type.h
index 7edefc2e661..8d0aa7a44fd 100644
--- a/TAO/TAO_IDL/be_include/be_predefined_type.h
+++ b/TAO/TAO_IDL/be_include/be_predefined_type.h
@@ -43,24 +43,6 @@ public:
UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the predefined type
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the predefined type
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the predefined type
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the predefined type
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the predefined type
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the predefined type
-
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_root.h b/TAO/TAO_IDL/be_include/be_root.h
index 54b44c4476e..d0d1221b7f2 100644
--- a/TAO/TAO_IDL/be_include/be_root.h
+++ b/TAO/TAO_IDL/be_include/be_root.h
@@ -39,27 +39,6 @@ public:
be_root (UTL_ScopedName *n, UTL_StrList *p);
// Constructor that sets its scoped name <n>, and any pragmas <p>
- int gen_idl2cplusplus_mapping (void);
- // generates the IDL to C++ mapping
-
- virtual int gen_client_header (void);
- // Generates the client-side header information for the root
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the root
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the root
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the root
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the root
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the root
-
// =Scope management functions that override the AST scope management methods
// since the AST methods set the names of the sequences, strings, and arrays
// to a fixed value which interferes with our back-end code generation
diff --git a/TAO/TAO_IDL/be_include/be_scope.h b/TAO/TAO_IDL/be_include/be_scope.h
index cacc8980171..0378a5dec80 100644
--- a/TAO/TAO_IDL/be_include/be_scope.h
+++ b/TAO/TAO_IDL/be_include/be_scope.h
@@ -46,24 +46,6 @@ public:
virtual ~be_scope (void);
// destructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the scope
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the scope
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the scope
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the scope
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the scope
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the scope
-
virtual int gen_encapsulation (void);
// encapsulation for parameters
diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h
index 3e4f1cf3eba..cd9e446cf54 100644
--- a/TAO/TAO_IDL/be_include/be_sequence.h
+++ b/TAO/TAO_IDL/be_include/be_sequence.h
@@ -58,45 +58,6 @@ public:
// create a name for ourselves. If we are typedefed, then we get the name of
// the typedef node, else we generate a name for ourselves
- virtual int gen_client_header (void);
- // Generates the client-side header information for the sequence
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the sequence
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the sequence
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the sequence
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the sequence
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the sequence
-
- virtual int gen_var_defn (void);
- // generate the _var class definition
-
- virtual int gen_var_impl (void);
- // generate the implementation for the _var class
-
- virtual int gen_out_defn (void);
- // generate the _out class definition
-
- virtual int gen_out_impl (void);
- // generate the _out implementation
-
- virtual int gen_managed_type_ch (void);
- // generate code for managed types in header
-
- virtual int gen_managed_type_ci (void);
- // generate code for managed types in inlined file
-
- virtual int gen_managed_type_cs (void);
- // generate code for managed types in impl file
-
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_string.h b/TAO/TAO_IDL/be_include/be_string.h
index ef005f99ee1..983653f4824 100644
--- a/TAO/TAO_IDL/be_include/be_string.h
+++ b/TAO/TAO_IDL/be_include/be_string.h
@@ -40,24 +40,6 @@ public:
be_string (AST_Expression *v, long wide);
// constructor
- virtual int gen_client_header (void);
- // generate client header for string
-
- virtual int gen_client_stubs (void);
- // generate client side stubs for string
-
- virtual int gen_server_header (void);
- // generate server header for string
-
- virtual int gen_server_skeletons (void);
- // generate server skeletons for string
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the string
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the string
-
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_structure.h b/TAO/TAO_IDL/be_include/be_structure.h
index 6c246b929d6..52fe361e00e 100644
--- a/TAO/TAO_IDL/be_include/be_structure.h
+++ b/TAO/TAO_IDL/be_include/be_structure.h
@@ -39,24 +39,6 @@ public:
be_structure (UTL_ScopedName *n, UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the struct
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the struct
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the struct
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the struct
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the struct
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the struct
-
virtual int gen_var_defn (void);
// generate the _var class definition
diff --git a/TAO/TAO_IDL/be_include/be_type.h b/TAO/TAO_IDL/be_include/be_type.h
index a3574b46887..56e4acfd5c4 100644
--- a/TAO/TAO_IDL/be_include/be_type.h
+++ b/TAO/TAO_IDL/be_include/be_type.h
@@ -41,24 +41,6 @@ public:
virtual ~be_type (void);
- virtual int gen_client_header (void) = 0;
- // Generates the client-side header information for the type
-
- virtual int gen_client_stubs (void) = 0;
- // Generates the client-side stubs for the type
-
- virtual int gen_server_header (void) = 0;
- // Generates the server-side header information for the type
-
- virtual int gen_server_skeletons (void) = 0;
- // Generates the server-side skeletons for the type
-
- virtual int gen_client_inline (void) = 0;
- // Generates the client-side inline for the type
-
- virtual int gen_server_inline (void) = 0;
- // Generates the server-side inlines for the type
-
virtual int gen_var_defn (void);
// generate the _var class definition
diff --git a/TAO/TAO_IDL/be_include/be_typedef.h b/TAO/TAO_IDL/be_include/be_typedef.h
index b2ddfa58cea..abc9d767b3b 100644
--- a/TAO/TAO_IDL/be_include/be_typedef.h
+++ b/TAO/TAO_IDL/be_include/be_typedef.h
@@ -41,24 +41,6 @@ public:
// return the most primitive base type by traversing the chain of typedefed
// base types
- virtual int gen_client_header (void);
- // Generates the client-side header information for the typedef
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the typedef
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the typedef
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the typedef
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the typedef
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the typedef
-
virtual int gen_typecode (void);
// generate the typecode
diff --git a/TAO/TAO_IDL/be_include/be_union.h b/TAO/TAO_IDL/be_include/be_union.h
index 643f95584e3..55757b68030 100644
--- a/TAO/TAO_IDL/be_include/be_union.h
+++ b/TAO/TAO_IDL/be_include/be_union.h
@@ -38,24 +38,6 @@ public:
be_union(AST_ConcreteType *dt, UTL_ScopedName *n, UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the union
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the union
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the union
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the union
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the union
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the union
-
virtual int gen_var_defn (void);
// generate the _var class definition
diff --git a/TAO/TAO_IDL/be_include/be_union_branch.h b/TAO/TAO_IDL/be_include/be_union_branch.h
index 3afba72a50b..349db9ff58f 100644
--- a/TAO/TAO_IDL/be_include/be_union_branch.h
+++ b/TAO/TAO_IDL/be_include/be_union_branch.h
@@ -37,24 +37,6 @@ public:
UTL_StrList *p);
// constructor
- virtual int gen_client_header (void);
- // Generates the client-side header information for the union branch
-
- virtual int gen_client_stubs (void);
- // Generates the client-side stubs for the union branch
-
- virtual int gen_server_header (void);
- // Generates the server-side header information for the union branch
-
- virtual int gen_server_skeletons (void);
- // Generates the server-side skeletons for the union branch
-
- virtual int gen_client_inline (void);
- // Generates the client-side inline for the union branch
-
- virtual int gen_server_inline (void);
- // Generates the server-side inlines for the union branch
-
virtual int gen_encapsulation (void);
// generate the encapsulation
diff --git a/TAO/TAO_IDL/be_include/be_visitor_context.h b/TAO/TAO_IDL/be_include/be_visitor_context.h
index 399f59137cf..5896f2dd892 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_context.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_context.h
@@ -43,6 +43,9 @@ public:
// =helpers
+ void reset (void);
+ // reset the context
+
void stream (TAO_OutStream *os);
// set the output stream
diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum.h b/TAO/TAO_IDL/be_include/be_visitor_enum.h
index 59a6aff8ab6..bd8779d7349 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_enum.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_enum.h
@@ -78,4 +78,48 @@ public:
};
+class be_visitor_enum_any_op_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_enum_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for enum that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_enum_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_enum_any_op_ch (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum
+};
+
+class be_visitor_enum_any_op_cs : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_enum_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for enum that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_enum_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_enum_any_op_cs (void);
+ // destructor
+
+ virtual int visit_enum (be_enum *node);
+ // visit enum
+};
+
#endif // TAO_BE_VISITOR_ENUM_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception.h b/TAO/TAO_IDL/be_include/be_visitor_exception.h
index 627fd708b5f..a569cec9eb8 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_exception.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_exception.h
@@ -228,4 +228,54 @@ public:
};
+class be_visitor_exception_any_op_ch : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_exception_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for exception that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_exception_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_exception_any_op_ch (void);
+ // destructor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception
+
+ virtual int visit_field (be_field *node);
+ // visit field
+};
+
+class be_visitor_exception_any_op_cs : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_exception_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for exception that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_exception_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_exception_any_op_cs (void);
+ // destructor
+
+ virtual int visit_exception (be_exception *node);
+ // visit exception
+
+ virtual int visit_field (be_field *node);
+ // visit field
+};
+
#endif // TAO_BE_VISITOR_EXCEPTION_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h
index c649c3a5fc2..3f3e11ea4a5 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h
@@ -254,4 +254,48 @@ public:
};
+class be_visitor_interface_any_op_ch : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_interface_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_any_op_ch (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+};
+
+class be_visitor_interface_any_op_cs : public be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_interface_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for interface that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_interface_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_interface_any_op_cs (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // visit interface
+};
+
#endif // _BE_VISITOR_INTERFACE_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_module.h b/TAO/TAO_IDL/be_include/be_visitor_module.h
index 0a1f64a4496..272af5bad45 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_module.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_module.h
@@ -120,5 +120,26 @@ public:
};
+class be_visitor_module_any_op : public be_visitor_module
+{
+ //
+ // = TITLE
+ // be_visitor_module_any_op
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for module that generates the Any operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_module_any_op (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_module_any_op (void);
+ // destructor
+
+ virtual int visit_module (be_module *node);
+ // visit module
+};
#endif // TAO_BE_VISITOR_MODULE_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root.h b/TAO/TAO_IDL/be_include/be_visitor_root.h
index 7d0f4f6a704..68d3dcf4867 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_root.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_root.h
@@ -207,4 +207,26 @@ public:
};
+class be_visitor_root_any_op : public be_visitor_root
+{
+ //
+ // = TITLE
+ // be_visitor_root_any_op
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for root that generates the Any operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_root_any_op (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_root_any_op (void);
+ // destructor
+
+ virtual int visit_root (be_root *node);
+ // visit root
+};
+
#endif // TAO_BE_VISITOR_ROOT_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence.h b/TAO/TAO_IDL/be_include/be_visitor_sequence.h
index 5be601730ac..da412d0b9e4 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_sequence.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_sequence.h
@@ -211,4 +211,48 @@ protected:
};
+class be_visitor_sequence_any_op_ch : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for sequence that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_sequence_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_any_op_ch (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+};
+
+class be_visitor_sequence_any_op_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_sequence_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for sequence that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_sequence_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_sequence_any_op_cs (void);
+ // destructor
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit sequence
+};
+
#endif /* TAO_BE_VISITOR_SEQUENCE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure.h b/TAO/TAO_IDL/be_include/be_visitor_structure.h
index 5c643d48c23..63484a80692 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_structure.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_structure.h
@@ -117,5 +117,55 @@ public:
};
+class be_visitor_structure_any_op_ch : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for structure that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_structure_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_any_op_ch (void);
+ // destructor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_field (be_field *node);
+ // visit field
+};
+
+class be_visitor_structure_any_op_cs : public be_visitor_structure
+{
+ //
+ // = TITLE
+ // be_visitor_structure_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for structure that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_structure_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_structure_any_op_cs (void);
+ // destructor
+
+ virtual int visit_structure (be_structure *node);
+ // visit structure
+
+ virtual int visit_field (be_field *node);
+ // visit field
+};
+
#endif // TAO_BE_VISITOR_STRUCTURE_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef.h b/TAO/TAO_IDL/be_include/be_visitor_typedef.h
index 270f2aae6a0..7e5370057db 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typedef.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typedef.h
@@ -102,6 +102,9 @@ public:
virtual int visit_enum (be_enum *node);
// visit an enum
+ virtual int visit_interface (be_interface *node);
+ // visit an interface;
+
virtual int visit_predefined_type (be_predefined_type *node);
// visit predefined type node
@@ -178,5 +181,87 @@ public:
};
+class be_visitor_typedef_any_op_ch : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that generates the Any operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_typedef_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_any_op_ch (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+
+};
+
+class be_visitor_typedef_any_op_cs : public be_visitor_typedef
+{
+ //
+ // = TITLE
+ // be_visitor_typedef_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for typedef that generates the Any operator
+ // declarations and implementations
+ //
+
+public:
+ be_visitor_typedef_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_typedef_any_op_cs (void);
+ // destructor
+
+ virtual int visit_typedef (be_typedef *node);
+ // visit typedef
+
+ // =visit methods on all elements syntactically valid as types that can be
+ // typedefed.
+
+ virtual int visit_array (be_array *node);
+ // visit a array
+
+ virtual int visit_enum (be_enum *node);
+ // visit an enum
+
+ virtual int visit_sequence (be_sequence *node);
+ // visit a sequence
+
+ virtual int visit_structure (be_structure *node);
+ // visit a structure
+
+ virtual int visit_union (be_union *node);
+ // visit a union
+
+};
+
#endif // TAO_BE_VISITOR_TYPEDEF_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_union.h b/TAO/TAO_IDL/be_include/be_visitor_union.h
index 5ed4437fa2c..c812317d841 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_union.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_union.h
@@ -197,4 +197,54 @@ public:
};
+class be_visitor_union_any_op_ch : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_any_op_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for union that generates the Any operator
+ // declarations
+ //
+
+public:
+ be_visitor_union_any_op_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_any_op_ch (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit union_branch
+};
+
+class be_visitor_union_any_op_cs : public be_visitor_union
+{
+ //
+ // = TITLE
+ // be_visitor_union_any_op_cs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor for union that generates the Any operator
+ // implementations
+ //
+
+public:
+ be_visitor_union_any_op_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_union_any_op_cs (void);
+ // destructor
+
+ virtual int visit_union (be_union *node);
+ // visit union
+
+ virtual int visit_union_branch (be_union_branch *node);
+ // visit union_branch
+};
+
#endif // TAO_BE_VISITOR_UNION_H