diff options
author | mk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-10-01 12:28:46 +0000 |
---|---|---|
committer | mk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-10-01 12:28:46 +0000 |
commit | 533c5a8c2b8039125e79d197b83d983553ac4d76 (patch) | |
tree | d714cb5adaf5c5c7ef198a51f9ae361072f6416b | |
parent | 05703e5ce7e4f20a552a671022b7ae54605fcd69 (diff) | |
download | ATCD-533c5a8c2b8039125e79d197b83d983553ac4d76.tar.gz |
ChangeLogEntry: Fri Oct 01 07:20:00 1999 Michael Kircher <Michael.Kircher@mchp.siemens.de>
61 files changed, 204 insertions, 8801 deletions
diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp index ee15eb00612..f1e8cebfc57 100644 --- a/TAO/TAO_IDL/ast/ast_module.cpp +++ b/TAO/TAO_IDL/ast/ast_module.cpp @@ -685,7 +685,7 @@ AST_Module::be_add_interface (AST_Interface *i, AST_Interface *ix) /* * Add it to set of locally referenced symbols */ - add_to_referenced(i, I_FALSE, ix->local_name (), ix); + add_to_referenced(i, I_FALSE, i->local_name (), ix); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp index f83a0099bc1..814f63c7039 100644 --- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp @@ -12,7 +12,10 @@ // be_visitor_ami_pre_proc.cpp // // = DESCRIPTION -// A visitor to generate the AMI implied IDL code. +// This visitor creates for AMI implied IDL constructs +// the appropriate AST (Abstract Syntax Tree) node, +// sets the corresponding interface or operation strategy +// on it and enteres the nodes into the AST. // // = AUTHOR // Michael Kircher <Michael.Kircher@mchp.siemens.de> @@ -41,85 +44,89 @@ be_visitor_ami_pre_proc::~be_visitor_ami_pre_proc (void) int be_visitor_ami_pre_proc::visit_module (be_module *node) { - ACE_UNUSED_ARG (node); - ACE_DEBUG ((LM_DEBUG, "be_visitor_ami_pre_proc::visit_module\n")); - if (this->visit_scope (node) == -1) + if (!node->imported ()) { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_pre_proc::" - "visit_module - " - "visit scope failed\n"), - -1); + ACE_DEBUG ((LM_DEBUG, "be_visitor_ami_pre_proc::visit_module\n")); + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_ami_pre_proc::" + "visit_module - " + "visit scope failed\n"), + -1); + } } - return 0; } int be_visitor_ami_pre_proc::visit_interface (be_interface *node) { - ACE_DEBUG ((LM_DEBUG, "be_visitor_ami_pre_proc::visit_interface\n")); + if (!node->imported ()) + { + ACE_DEBUG ((LM_DEBUG, "be_visitor_ami_pre_proc::visit_interface\n")); - AST_Module *module = AST_Module::narrow_from_scope (node->defined_in ()); - if (!module) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_pre_proc::" - "visit_interface - " - "module is null\n"), - -1); - } + AST_Module *module = AST_Module::narrow_from_scope (node->defined_in ()); + if (!module) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_ami_pre_proc::" + "visit_interface - " + "module is null\n"), + -1); + } - be_valuetype *excep_holder = this->create_exception_holder (node); - - if (excep_holder) - { - excep_holder->set_defined_in (node->defined_in ()); - module->be_add_interface (excep_holder, node); - module->set_has_nested_valuetype (); - // Remember from whom we were cloned - excep_holder->original_interface (node); - // Set the strategy - be_interface_strategy *old_strategy = - excep_holder->set_strategy (new be_interface_ami_exception_holder_strategy (excep_holder)); - if (old_strategy) - delete old_strategy; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_pre_proc::" - "visit_interface - " - "creating the exception holder failed\n"), - -1); - } + be_valuetype *excep_holder = this->create_exception_holder (node); + if (excep_holder) + { + excep_holder->set_defined_in (node->defined_in ()); + module->be_add_interface (excep_holder, node); + module->set_has_nested_valuetype (); + // Remember from whom we were cloned + excep_holder->original_interface (node); + // Set the strategy + be_interface_strategy *old_strategy = + excep_holder->set_strategy (new be_interface_ami_exception_holder_strategy (excep_holder)); + if (old_strategy) + delete old_strategy; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_ami_pre_proc::" + "visit_interface - " + "creating the exception holder failed\n"), + -1); + } - be_interface *reply_handler = this->create_reply_handler (node, - excep_holder); - if (reply_handler) - { - reply_handler->set_defined_in (node->defined_in ()); - module->be_add_interface (reply_handler, node); - // Remember from whom we were cloned - reply_handler->original_interface (node); - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_pre_proc::" - "visit_interface - " - "creating the reply handler failed\n"), - -1); - } - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_pre_proc::" - "visit_interface - " - "visit scope failed\n"), - -1); + be_interface *reply_handler = this->create_reply_handler (node, + excep_holder); + if (reply_handler) + { + reply_handler->set_defined_in (node->defined_in ()); + module->be_add_interface (reply_handler, node); + // Remember from whom we were cloned + reply_handler->original_interface (node); + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_ami_pre_proc::" + "visit_interface - " + "creating the reply handler failed\n"), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_ami_pre_proc::" + "visit_interface - " + "visit scope failed\n"), + -1); + } } return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument.cpp index b3fb7357aab..5cc908e0e6e 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument.cpp @@ -39,14 +39,7 @@ #include "be_visitor_argument/compiled_marshal_ss.cpp" #include "be_visitor_argument/pre_invoke_cs.cpp" -#if 0 -#include "be_visitor_argument/ami_arglist.cpp" -#include "be_visitor_argument/ami_handler_arglist.cpp" -#include "be_visitor_argument/ami_handler_result_arg.cpp" -#include "be_visitor_argument/ami_handler_compiled_marshal_cs.cpp" -#include "be_visitor_argument/ami_handler_upcall_cs.cpp" -#include "be_visitor_argument/ami_handler_vardecl_cs.cpp" -#endif /* 0 */ + ACE_RCSID(be, be_visitor_argument, "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_arglist.cpp deleted file mode 100644 index b95db4b46be..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_arglist.cpp +++ /dev/null @@ -1,372 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// arglist.cpp -// -// = DESCRIPTION -// Visitor that generates the parameters in an Operation signature -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, ami_arglist, "$Id$") - - -// ************************************************************ -// be_visitor_args_arglist for parameter list in method declarations and -// definitions for AMI stubs. -// ************************************************************ - -be_visitor_args_ami_arglist::be_visitor_args_ami_arglist (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_ami_arglist::~be_visitor_args_ami_arglist (void) -{ -} - -int -be_visitor_args_ami_arglist::visit_argument (be_argument *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node - - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_arglist::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - os->indent (); // start with current indentation level - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - int result = bt->accept (this); - if (result == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_arglist::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - // Print the variable name only if the type was printed already. - if (result) - *os << " " << node->local_name () << ",\n"; - - return 0; -} - -int -be_visitor_args_ami_arglist::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "const " << this->type_name (node); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << this->type_name (node); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: // inout - *os << this->type_name (node, "_ptr"); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: // inout - *os << this->type_name (node, "_ptr"); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_native (be_native *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << this->type_name (node); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "const " << this->type_name (node) << " &"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - } - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << this->type_name (node, "_ptr"); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } // end switch direction - } // end else if - else // simple predefined types - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << this->type_name (node); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } // end switch direction - } // end of else - - return 0; -} - -int -be_visitor_args_ami_arglist::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "const " << this->type_name (node) << " &"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - if (node->width () == sizeof (char)) - { - *os << "const char *"; - } - else - { - *os << "const CORBA::WChar *"; - } - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "const " << this->type_name (node) << " &"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "const " << this->type_name (node) << " &"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - - int result = node->primitive_base_type ()->accept (this); - if (result == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_arglist::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - - this->ctx_->alias (0); - - return result; -} - - -#ifdef IDL_HAS_VALUETYPE - -int -be_visitor_args_ami_arglist::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " *"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_arglist::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "const " << this->type_name (node) << " *"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_arglist.cpp deleted file mode 100644 index 6e5c3fb242d..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_arglist.cpp +++ /dev/null @@ -1,388 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_arglist.cpp -// -// = DESCRIPTION -// Visitor that generates the parameters in an operation of the AMI -// Reply Handler. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, ami_handler_arglist, "$Id$") - - -// ************************************************************ -// Visitor for parameter list in AMI Handler call back declarations -// and definitions. -// ************************************************************ - -be_visitor_args_ami_handler_arglist::be_visitor_args_ami_handler_arglist (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_ami_handler_arglist::~be_visitor_args_ami_handler_arglist (void) -{ -} - -int -be_visitor_args_ami_handler_arglist::visit_argument (be_argument *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node - - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_arglist::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - int result = bt->accept (this); - if (result == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_arglist::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - // Print the variable name only if the type was printed already. - if (result) - *os << " " << node->local_name () << ",\n"; - - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "const " << this->type_name (node); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << this->type_name (node); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << this->type_name (node, "_ptr"); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << this->type_name (node, "_ptr"); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_native (be_native *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << this->type_name (node); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) - { - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "const " << this->type_name (node) << " &"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << this->type_name (node, "_ptr"); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } // end switch direction - } // end else if - else // simple predefined types - { - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << this->type_name (node); - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } // end switch direction - } // end of else - - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "const " << this->type_name (node) << " &"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - if (node->width () == sizeof (char)) - { - os->indent (); - *os << "const char *"; - } - else - { - os->indent (); - *os << "const CORBA::WChar *"; - } - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "const " << this->type_name (node) << " &"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "const " << this->type_name (node) << " &"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - - // result-type necessary to create the function attributes for AMI - int result = node->primitive_base_type ()->accept (this); - if (result == -1) - - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_arglist::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - - return result; -} - - -#ifdef IDL_HAS_VALUETYPE - -int -be_visitor_args_ami_handler_arglist::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << this->type_name (node) << " *"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -int -be_visitor_args_ami_handler_arglist::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "const " << this->type_name (node) << " *"; - return 1; - /* NOT REACHED */ - default: - // Do nothing - break; - } - return 0; -} - -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_compiled_marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_compiled_marshal_cs.cpp deleted file mode 100644 index 361d9a95fd7..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_compiled_marshal_cs.cpp +++ /dev/null @@ -1,706 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_compiled_marshal_cs.cpp -// -// = DESCRIPTION -// Visitor generating the code that passes arguments to the CDR operators -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, ami_handler_compiled_marshal_cs, "$Id$") - - -// **************************************************************************** -// visitor for arguments passing to the CDR operators. -// **************************************************************************** - -be_visitor_args_ami_handler_compiled_marshal_cs:: -be_visitor_args_ami_handler_compiled_marshal_cs (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_ami_handler_compiled_marshal_cs:: -~be_visitor_args_ami_handler_compiled_marshal_cs (void) -{ -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_argument (be_argument *node) -{ - this->ctx_->node (node); // save the argument node - - // retrieve the type of the argument - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - //TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGS_DEMARSHAL_CS) - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "(_tao_in >> "; - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "(_tao_out << "; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_argument - " - "Bad substate\n"), - -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << ")"; - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << ")"; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_argument - " - "Bad substate\n"), - -1); - } - - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << "_tao_forany_" << arg->local_name (); - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << node->name () << "_forany (" - << "(" << node->name () << "_slice *)" - << arg->local_name () << ")"; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_array - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_enum (be_enum *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_enum - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_interface (be_interface *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".out ()"; - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_interface_fwd (be_interface_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << "out ()"; - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -#ifdef IDL_HAS_VALUETYPE - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_valuetype (be_valuetype *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".out ()"; - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_valuetype - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_valuetype_fwd (be_valuetype_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << "out ()"; - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_valuetype_fwd - " - "Bad substate\n"), - -1); - } - return 0; -} - -#endif /* IDL_HAS_VALUETYPE */ - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get argument node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - *os << arg->local_name () << ".out ()"; - break; - case AST_PredefinedType::PT_any: - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_ushort: - case AST_PredefinedType::PT_float: - case AST_PredefinedType::PT_double: - case AST_PredefinedType::PT_longdouble: - *os << arg->local_name (); - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::to_char (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::to_wchar (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::to_boolean (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_octet: - *os << "CORBA::Any::to_octet (" << arg->local_name () << ")"; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_predefined_type - " - "Bad predefined type\n"), - -1); - } - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - case AST_PredefinedType::PT_any: - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_ushort: - case AST_PredefinedType::PT_float: - case AST_PredefinedType::PT_double: - case AST_PredefinedType::PT_longdouble: - *os << arg->local_name (); - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::from_char (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::from_wchar (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::from_boolean (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_octet: - *os << "CORBA::Any::from_octet (" << arg->local_name () << ")"; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_cs::" - "visit_predefined_type - " - "Bad predefined type\n"), - -1); - } - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_array - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_sequence (be_sequence *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - // we need to make a distinction between bounded and unbounded strings - if (node->max_size ()->ev ()->u.ulval == 0) - { - *os << arg->local_name () << ".out ()"; - } - else - { - if (node->width () == sizeof (char)) - { - *os << "CORBA::Any::to_string ("; - } - else - { - *os << "CORBA::Any::to_wstring ("; - } - - *os << arg->local_name () << ".out (), " - << node->max_size ()->ev ()->u.ulval - 1 - << ")"; - } - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_structure (be_structure *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_union (be_union *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_interface - " - "Bad substate\n"), - -1); - } - - return 0; -} - -int be_visitor_args_ami_handler_compiled_marshal_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_compiled_marshal_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_result_arg.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_result_arg.cpp deleted file mode 100644 index 3e24790173b..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_result_arg.cpp +++ /dev/null @@ -1,188 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_result_arg.cpp -// -// = DESCRIPTION -// Visitor that generates the result argument in a call back method -// of a Reply Handler. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_args, ami_handler_result_arg, "$Id$") - - -// ************************************************************ -// Visitor for parameter list in AMI Handler call back declarations -// and definitions. -// ************************************************************ - -be_visitor_args_ami_handler_result_arg::be_visitor_args_ami_handler_result_arg (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_ami_handler_result_arg::~be_visitor_args_ami_handler_result_arg (void) -{ -} - -int -be_visitor_args_ami_handler_result_arg::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << "const " << this->type_name (node) << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << this->type_name (node) << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << this->type_name (node, "_ptr") << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << this->type_name (node, "_ptr") << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_native (be_native *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << this->type_name (node) << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_predefined_type (be_predefined_type *node) -{ - - // Nothing to do if the return type is void. - if (node->pt () == AST_PredefinedType::PT_void) - return 0; - - // Get output stream. - TAO_OutStream *os = this->ctx_->stream (); - - // Check if the type is an any. - if (node->pt () == AST_PredefinedType::PT_any) - { - *os << "const " << this->type_name (node) << " &" << " _tao_retval"; - } - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - *os << this->type_name (node, "_ptr") << " _tao_retval"; - } - else - { - *os << this->type_name (node) << " _tao_retval"; - } - - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const " << this->type_name (node) << " &" << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - if (node->width () == sizeof (char)) - { - *os << "const char *" << " _tao_retval"; - } - else - { - *os << "const CORBA::WChar *" << " _tao_retval"; - } - - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const " << this->type_name (node) << " &" << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const " << this->type_name (node) << " &" << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_result_arg::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 1; -} - - -#ifdef IDL_HAS_VALUETYPE - -int -be_visitor_args_ami_handler_result_arg::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << this->type_name (node) << " *" << " _tao_retval"; - return 1; -} - -int -be_visitor_args_ami_handler_result_arg::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const " << this->type_name (node) << " *" << " _tao_retval"; - return 1; -} - -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_upcall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_upcall_cs.cpp deleted file mode 100644 index e331cb2ca4c..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_upcall_cs.cpp +++ /dev/null @@ -1,369 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_upcall_cs.cpp -// -// = DESCRIPTION -// Visitor that generates code that passes argument variables to the -// upcall. -// -// = AUTHOR -// Aniruddha Gokhale -// Michael Kircher -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, upcall_cs, "$Id$") - - -// ************************************************************************ -// visitor for passing arguments to the upcall -// ************************************************************************ - -be_visitor_args_ami_handler_upcall_cs::be_visitor_args_ami_handler_upcall_cs (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_ami_handler_upcall_cs::~be_visitor_args_ami_handler_upcall_cs (void) -{ -} - -int be_visitor_args_ami_handler_upcall_cs::visit_argument (be_argument *node) -{ - this->ctx_->node (node); // save the argument node - - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_upcall_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_upcall_cs::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_array (be_array *node) -{ - ACE_UNUSED_ARG (node); - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_enum (be_enum *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_interface (be_interface *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - if (this->ctx_->state () - == TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_interface_fwd (be_interface_fwd *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - if (this->ctx_->state () - == TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - } - return 0; -} - -#ifdef IDL_HAS_VALUETYPE - -int be_visitor_args_ami_handler_upcall_cs::visit_valuetype (be_valuetype *node) -{ - ACE_UNUSED_ARG (node); - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - if (this->ctx_->state () - == TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - if (this->ctx_->state () - == TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - } - return 0; -} - -#endif /* IDL_HAS_VALUETYPE */ - - -int be_visitor_args_ami_handler_upcall_cs::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << arg->local_name () << ".in ()"; - break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - if (this->ctx_->state () - == TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - } // end switch direction - } // end else if - else // simple predefined types - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << arg->local_name (); - break; - } // end switch direction - } // end of else - - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_sequence (be_sequence *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get the stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << arg->local_name () << ".in ()"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_string (be_string *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get the stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // If we use it in conjunction with AMI Reply Handlers we do - // not want to generate declarations for IN arguments - if (this->direction () == AST_Argument::dir_IN - && this->ctx_->state() == TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_UPCALL_CS) - return 0; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - if (this->ctx_->state () - == TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".in ()"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_structure (be_structure *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get the stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_union (be_union *node) -{ - ACE_UNUSED_ARG (node); - - TAO_OutStream *os = this->ctx_->stream (); // get the stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_ami_handler_upcall_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_upcall_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_vardecl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_vardecl_cs.cpp deleted file mode 100644 index 6062d53d13a..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_vardecl_cs.cpp +++ /dev/null @@ -1,512 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_vardecl_cs.cpp -// -// = DESCRIPTION -// Visitor that generates the variable declaration in the skeleton -// corresponding to the Argument node -// -// = AUTHOR -// Aniruddha Gokhale -// Michael Kircher -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, ami_handler_vardecl_cs, "$Id$") - - -// ************************************************************************ -// Visitor to generate code for argument variable declaration -// ************************************************************************ - -be_visitor_args_ami_handler_vardecl_cs::be_visitor_args_ami_handler_vardecl_cs (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_ami_handler_vardecl_cs::~be_visitor_args_ami_handler_vardecl_cs (void) -{ -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_argument (be_argument *node) -{ - this->ctx_->node (node); // save the argument node - - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_vardecl_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_vardecl_cs::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << " " << arg->local_name () << ";" << be_nl - << bt->name () << "_forany _tao_forany_" - << arg->local_name () << " (" << be_idt << be_idt_nl - << arg->local_name () << be_uidt_nl - << ");\n" << be_uidt; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << " " << arg->local_name () << ";\n"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";" << be_nl; - *os << "CORBA::Object_ptr &_tao_base_ptr_" << arg->local_name () - << " = _tao_base_var_" << arg->local_name () << ".out ();\n"; -#endif - *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";\n"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";" << be_nl; - *os << "CORBA::Object_ptr &_tao_base_ptr_" << arg->local_name () - << " = _tao_base_var_" << arg->local_name () << ".out ();\n"; -#endif - *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";\n"; - break; - } - return 0; -} - - -#ifdef IDL_HAS_VALUETYPE - -int be_visitor_args_ami_handler_vardecl_cs::visit_valuetype (be_valuetype *) -{ - return -1; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_valuetype_fwd (be_valuetype_fwd *) -{ - return -1; -} - -#endif /* IDL_HAS_VALUETYPE */ - -int be_visitor_args_ami_handler_vardecl_cs::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << " " << arg->local_name () << ";\n"; - break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var " << arg->local_name () - << ";" << be_nl; - *os << bt->name () << "_ptr &_tao_ptr_" << arg->local_name () - << " = " << arg->local_name () << ".out ();\n"; -#endif - *os << bt->name () << "_var " << arg->local_name () - << ";\n"; - break; - } // end switch direction - } // end else if - else // simple predefined types - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << " " << arg->local_name () << ";\n"; - break; - } // end switch direction - } // end of else - - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << " " << arg->local_name () << ";\n"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - - if (node->width () == sizeof (char)) - { - *os << "CORBA::String_var "; - } - else - { - *os << "CORBA::WString_var "; - } - - *os << arg->local_name () << ";\n"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << " " << arg->local_name () << ";\n"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << " " << arg->local_name () << ";\n"; - break; - } - return 0; -} - -int be_visitor_args_ami_handler_vardecl_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_ami_handler_vardecl_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - - -// ************************************************************************ -// Visitor to generate code for argument variable declaration for compiled -// marshaling. This provides only the overriden methods. The rest is handled by -// the base class that works for interpretiveskeletons. -// ************************************************************************ - -be_compiled_visitor_args_ami_handler_vardecl_cs:: -be_compiled_visitor_args_ami_handler_vardecl_cs (be_visitor_context *ctx) - : be_visitor_args_ami_handler_vardecl_cs (ctx) -{ -} - -be_compiled_visitor_args_ami_handler_vardecl_cs::~be_compiled_visitor_args_ami_handler_vardecl_cs (void) -{ -} - -int be_compiled_visitor_args_ami_handler_vardecl_cs::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << "_var " << arg->local_name () << ";\n"; - break; - } - return 0; -} - -int be_compiled_visitor_args_ami_handler_vardecl_cs::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << "_var " << arg->local_name () << ";\n"; - break; - } - return 0; -} - - -#ifdef IDL_HAS_VALUETYPE - -int be_compiled_visitor_args_ami_handler_vardecl_cs::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << "_var " << arg->local_name () << ";\n"; - break; - } - return 0; -} - -int -be_compiled_visitor_args_ami_handler_vardecl_cs::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << bt->name () << "_var " << arg->local_name () << ";\n"; - break; - } - return 0; -} - -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index 6e0cf692117..fba87e40c30 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -44,11 +44,5 @@ #include "be_visitor_interface/cdr_op_ci.cpp" #include "be_visitor_interface/cdr_op_cs.cpp" -#if 0 -#include "be_visitor_interface/ami_handler_fwd_ch.cpp" -#include "be_visitor_interface/ami_handler_fwd_ci.cpp" -#include "be_visitor_interface/ami_handler_stub_ch.cpp" -#include "be_visitor_interface/ami_handler_stub_cs.cpp" -#include "be_visitor_interface/ami_exception_holder_ci.cpp" -#endif /* 0 */ + ACE_RCSID(be, be_visitor_interface, "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ch.cpp deleted file mode 100644 index 30ae6b541b2..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ch.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_fwd_ch.cpp -// -// = DESCRIPTION -// Visitor generating fwd declaration code for the AMI Handler -// interface. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_interface_fwd.h" - -ACE_RCSID(be_visitor_interface_ami_handler_fwd, ami_handler_fwd_ch, "$Id$") - - -// ******************************************************************** -// Visitor implementation generating fwd declaration code for the AMI -// Handler interface. -// ******************************************************************** - -be_visitor_interface_ami_handler_fwd_ch::be_visitor_interface_ami_handler_fwd_ch (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_interface_ami_handler_fwd_ch::~be_visitor_interface_ami_handler_fwd_ch (void) -{ -} - -// visit the interface node and its scope -int -be_visitor_interface_ami_handler_fwd_ch::visit_interface (be_interface *node) -{ - // Grab the out stream. - TAO_OutStream *os = this->ctx_->stream (); - - // Generate code, if the client header is not generated already. - if (!node->cli_hdr_gen () && !node->imported ()) - { - // start from the current indentation. - os->indent (); - - // Generate forward declaration class. - *os << "class " << node->local_name () << ";" - << be_nl; - - // Generate the ifdefined macro for the _ptr type. - os->gen_ifdef_macro (node->flat_name (), "_ptr"); - - // Generate the _ptr declaration - *os << "typedef " << node->local_name () - << " *" << node->local_name () << "_ptr;" - << be_nl; - - // Generate the endif. - os->gen_endif (); - - // Generate the var class. - - // Enclose under an ifdef macro - os->gen_ifdef_macro (node->local_name (), "_var"); - - // Generate the _var declaration. - if (node->gen_var_defn ((char *) node->local_name ()) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ami_handler_fwd_ch::" - "visit_interface_fwd - " - "codegen for _var failed\n"), -1); - } - - // Gen an endif. - os->gen_endif (); - - // Generate the our class. - - // Enclose under an ifdef macro. - os->gen_ifdef_macro (node->local_name (), "_out"); - - // Generate the _out declaration - ORBOS/97-05-15 pg 16-20 - // spec. - if (node->gen_out_defn ( (char *) node->local_name ()) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ami_handler_fwd_ch::" - "visit_interface_fwd - " - "codegen for _out failed\n"), -1); - } - - // Generate the endif macro. - os->gen_endif (); - } - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ci.cpp deleted file mode 100644 index 21402995ebb..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_fwd_ci.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_fwd_ci.cpp -// -// = DESCRIPTION -// Visitor generating code for Ami_<Interface>_Handler node in the -// client inline. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_interface_fwd.h" - -ACE_RCSID(be_visitor_interface_ami_handler_fwd, ami_handler_fwd_ci, "$Id$") - - -// ******************************************************************** -// Visitor implementation for the Ami_Handler_Fwd type -// This one for the client inline file -// ******************************************************************** - -be_visitor_interface_ami_handler_fwd_ci::be_visitor_interface_ami_handler_fwd_ci (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_interface_ami_handler_fwd_ci::~be_visitor_interface_ami_handler_fwd_ci (void) -{ -} - -// visit the Ami_Handler_Fwd_ci node and its scope -int -be_visitor_interface_ami_handler_fwd_ci::visit_interface (be_interface *node) -{ - if (node->cli_inline_gen () || node->imported ()) - return 0; - - // Generate code. - - // Get the out stream. - TAO_OutStream *os; - os = this->ctx_->stream (); - - // Start from the current indentation level. - os->indent (); // start from the current indentation level - - // generate the constructors and destructor - *os << "ACE_INLINE" << be_nl; - *os << node->full_name () << "::" << node->local_name () << - " (void) // default constructor" << be_nl; - *os << "{}" << be_nl << be_nl; - - *os << "ACE_INLINE" << be_nl; - *os << node->full_name () << "::" << node->local_name () << - " (TAO_Stub *objref, TAO_ServantBase *_tao_servant, " - << "CORBA::Boolean _tao_collocated) // constructor" << be_nl; - *os << " : CORBA_Object (objref, _tao_servant, _tao_collocated)" << be_nl; - *os << "{}" << be_nl << be_nl; - - *os << "ACE_INLINE" << be_nl; - *os << node->full_name () << "::~" << node->local_name () << - " (void) // destructor" << be_nl; - *os << "{}\n\n"; - - // generate the ifdefined macro for the _var type - os->gen_ifdef_macro (node->flat_name (), "_var"); - if (node->gen_var_impl () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ci::" - "visit_interface - " - "codegen for _var failed\n"), -1); - } - os->gen_endif (); - - // generate the ifdefined macro for the _out type - os->gen_ifdef_macro (node->flat_name (), "_out"); - if (node->gen_out_impl () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ci::" - "visit_interface - " - "codegen for _out failed\n"), -1); - } - os->gen_endif (); - - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_stub_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_stub_ch.cpp deleted file mode 100644 index e0891ba4317..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_stub_ch.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_stub_ch.cpp -// -// = DESCRIPTION -// Visitor generating default stub class for the AMI Handler in the -// client header. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_interface.h" - - -// ****************************************************** -// Interface visitor for client header -// ****************************************************** - -be_visitor_interface_ami_handler_stub_ch::be_visitor_interface_ami_handler_stub_ch (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -be_visitor_interface_ami_handler_stub_ch::~be_visitor_interface_ami_handler_stub_ch (void) -{ -} - -int -be_visitor_interface_ami_handler_stub_ch::visit_interface (be_interface *node) -{ - TAO_OutStream *os; // output stream - - // Not already generated and not imported. - if (!node->cli_hdr_gen () && !node->imported ()) - { - // Grab the stream. - os = this->ctx_->stream (); - - // Ifdef guard. - - os->gen_ifdef_macro (node->flat_name ()); - - // Now generate the class definition. - - os->indent (); - - *os << "class " << idl_global->stub_export_macro () << " " - << node->local_name (); - - // Node interface inherits from the Messaging::ReplyHandler - // interface. - *os << " : public virtual Messaging::ReplyHandler" << be_nl; - - // Generate the body. - - *os << "{" << be_nl - << "public:" << be_nl - - // generate the _ptr_type and _var_type typedefs - // but we must protect against certain versions of g++ - << "#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)" - << be_idt_nl - << "typedef " << node->local_name () << "_ptr _ptr_type;" << be_nl - << "typedef " << node->local_name () << "_var _var_type;" << be_uidt_nl - << "#endif /* __GNUC__ */\n" << be_idt_nl - - // generate the static _duplicate, _narrow, and _nil operations - << "// the static operations" << be_nl - << "static " << node->local_name () << "_ptr " << "_duplicate (" - << node->local_name () << "_ptr obj);" << be_nl - << "static " << node->local_name () << "_ptr " - << "_narrow (" << be_idt << be_idt_nl - << "CORBA::Object_ptr obj," << be_nl - << "CORBA::Environment &env = " << be_idt_nl - << "TAO_default_environment ()" - << be_uidt << be_uidt_nl - << ");" << be_uidt_nl - << "static " << node->local_name () << "_ptr " - << "_unchecked_narrow (" << be_idt << be_idt_nl - << "CORBA::Object_ptr obj," << be_nl - << "CORBA::Environment &env = " << be_idt_nl - << "TAO_default_environment ()" - << be_uidt << be_uidt_nl - << ");" << be_uidt_nl - << "static " << node->local_name () - << "_ptr _nil (void)" << be_nl - << "{" << be_idt_nl - << "return (" << node->local_name () << "_ptr)0;" << be_uidt_nl - << "}\n\n"; - - // Visit the scope to generate the stubs for the call back - // methods. - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ami_handler_stub_ch::" - "visit_interface - " - "codegen for scope failed\n"), - -1); - } - - - // the _is_a method - os->indent (); - *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl - << "const CORBA::Char *type_id, " << be_nl - << "CORBA::Environment &env = " << be_idt_nl - << "TAO_default_environment ()" - << be_uidt << be_uidt_nl - << ");" << be_uidt_nl - << "virtual const char* " - << "_interface_repository_id (void) const;\n" << be_uidt_nl; - - // generate the "protected" constructor so that users cannot instantiate - // us - *os << "protected:" << be_idt_nl - << node->local_name () << " (void);" << be_nl - << node->local_name () - << " (TAO_Stub *objref, " << be_idt << be_idt_nl - << "TAO_ServantBase *_tao_servant = 0, " << be_nl - << "CORBA::Boolean _tao_collocated = 0" << be_uidt_nl - << ");" << be_uidt_nl - << "virtual ~" << node->local_name () << " (void);" << be_uidt_nl; - - // private copy constructor and assignment operator. These are not - // allowed, hence they are private. - *os << "private:\n"; - os->incr_indent (); - *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 (); - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ami_handler_stub_ch::" - "visit_interface - " - "TypeCode declaration failed\n"), - -1); - } - } - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_stub_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_stub_cs.cpp deleted file mode 100644 index 0f4fb7b4523..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/ami_handler_stub_cs.cpp +++ /dev/null @@ -1,235 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_stub_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for AMI Handler class for an Interface. -// -// = AUTHOR -// Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_interface.h" - -ACE_RCSID(be_visitor_interface, ami_handler_stub_cs, "$Id$") - - -// ************************************************************ -// Interface visitor for client stubs -// ************************************************************ - -be_visitor_interface_ami_handler_stub_cs::be_visitor_interface_ami_handler_stub_cs (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -be_visitor_interface_ami_handler_stub_cs::~be_visitor_interface_ami_handler_stub_cs (void) -{ -} - -int -be_visitor_interface_ami_handler_stub_cs::visit_interface (be_interface *node) -{ - be_interface_strategy *old_strategy = - node->set_strategy (new be_interface_ami_handler_strategy (node)); - - // output stream. - TAO_OutStream *os; - - if (node->cli_stub_gen () || node->imported ()) - return 0; - - os = this->ctx_->stream (); - - // Start with whatever indentation level we are at. - os->indent (); - - // Create the full name for the AMI_<Interface name>_Handler - // interface. - char *full_name = 0; - - // Full name. - // If there exists a scope name for this, then generate - // "Scope::AMI_<Local Name>_Handler". - - size_t scope_len = 0; - - be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl (); - - if (parent != 0 && - parent->full_name () != 0 && - ACE_OS::strlen (parent->full_name ())) - scope_len = ACE_OS::strlen (parent->full_name ()) + ACE_OS::strlen ("::"); - - ACE_NEW_RETURN (full_name, - char [scope_len + - ACE_OS::strlen (node->local_name ()) + - 1], - -1); - - if (parent != 0 && - parent->full_name () != 0 && - ACE_OS::strlen (parent->full_name ())) - ACE_OS::sprintf (full_name, - "%s::%s", - parent->full_name (), - node->local_name ()); - else - ACE_OS::sprintf (full_name, - "%s", - node->local_name ()); - - // First generate the code for the static methods. - - // The _narrow method - *os << full_name << "_ptr " << full_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 " << full_name << "::_nil ();" << be_uidt_nl - << "if (!obj->_is_a (\"" - << node->repoID () << "\", env))" - << be_idt_nl - << "return " << full_name << "::_nil ();" << be_uidt_nl; - - *os << "return " << full_name - << "::_unchecked_narrow (obj, env);" << be_uidt_nl - << "}" << be_nl << be_nl; - - // This may be necessary to work around a GCC compiler bug! - // const char *skel_name = node->full_skel_name (); // unused at this time - - // the following full_name usage was node->name - // The _unchecked_narrow method - *os << full_name << "_ptr " << full_name - << "::_unchecked_narrow (" << be_idt << be_idt_nl - << "CORBA::Object_ptr obj," << be_nl - << "CORBA::Environment &" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "if (CORBA::is_nil (obj))" << be_idt_nl - << "return " << full_name << "::_nil ();" << be_uidt_nl; - - *os << "TAO_Stub* stub = obj->_stubobj ();" << be_nl - << "stub->_incr_refcnt ();" << be_nl; - - *os << "if (obj->_is_collocated () && _TAO_collocation_" << node->flat_name () - << "_Stub_Factory_function_pointer != 0)" << be_nl - << "{" << be_idt_nl - << node->local_name () << "_ptr retv = _TAO_collocation_" - << node->flat_name () - << "_Stub_Factory_function_pointer (obj);" << be_nl - << "if (retv != 0)" << be_idt_nl - << "return retv;" << be_uidt << be_uidt_nl - << "}" << be_nl; - - *os << full_name << "_ptr retval = 0;" << be_nl - << "ACE_NEW_RETURN (retval, " << full_name << " (stub), 0);" << be_nl - << "return retval;" << be_uidt_nl - << "}" << be_nl << be_nl; - - // The _duplicate method - *os << full_name << "_ptr " << be_nl - << full_name << "::_duplicate (" - << full_name << "_ptr obj)" << be_nl - << "{" << be_idt_nl - << "if (!CORBA::is_nil (obj))" << be_idt_nl - << "obj->_incr_refcnt ();" << be_uidt_nl - << "return obj;" << be_uidt_nl - << "}" << be_nl << be_nl; - - // Generate code for the elements of the interface. - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ami_handler_stub_cs::" - "visit_interface - " - "codegen for scope failed\n"), -1); - } - - // generate the is_a method - os->indent (); - *os << "CORBA::Boolean " << full_name << "::_is_a (" << - "const CORBA::Char *value, CORBA::Environment &env)" << be_nl; - *os << "{\n"; - os->incr_indent (); - *os << "if (\n"; - os->incr_indent (0); - - // We know what to generate. We dont have to call traverse graph. - - // Current interface. - *os << "(!ACE_OS::strcmp ((char *)value, " - << "\"" - << node->repoID () - << "\"" - << ")) ||" - << be_nl; - - // Reply Handler. - *os << "(!ACE_OS::strcmp ((char *)value, " - << "\"" - << "IDL:omg.org/Messaging/ReplyHandler:1.0" - << "\"" - << ")) ||" - << be_nl; - - os->indent (); - - *os << "(!ACE_OS::strcmp ((char *)value, CORBA::_tc_Object->id (env))))\n"; - *os << " return 1; // success using local knowledge\n"; - os->decr_indent (); - *os << "else" << be_nl; - *os << " return this->CORBA_Object::_is_a (value, env);\n"; - os->decr_indent (); - *os << "}\n\n"; - - os->indent (); - - *os << "const char* " << full_name - << "::_interface_repository_id (void) const" - << be_nl - << "{" << be_idt_nl - << "return \"" << node->repoID () << "\";" << be_uidt_nl - << "}\n\n"; - - // By using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO. - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_TYPECODE_DEFN); - ctx.sub_state (TAO_CodeGen::TAO_AMI_HANDLER_TC_DEFN_TYPECODE); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ami_handler_stub_cs::" - "visit_interface - " - "TypeCode definition failed\n"), - -1); - } - - delete full_name; - full_name = 0; - - delete node->set_strategy (old_strategy); - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp index afa51f04b6b..7a5d6ed0ce4 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ch.cpp @@ -52,114 +52,29 @@ be_visitor_interface_cdr_op_ch::visit_interface (be_interface *node) TAO_OutStream *os = this->ctx_->stream (); -#if 0 - int i; - int to_do; - - // Decide how much code to produce - if (idl_global->ami_call_back () == I_TRUE) - to_do = 3; - else - to_do = 1; - be_interface_strategy *old_strategy = 0; - - for (i = 0; i < to_do; i++) + // generate the CDR << and >> operator declarations + os->indent (); + *os << "CORBA::Boolean " << idl_global->stub_export_macro () << be_nl + << "operator<< (TAO_OutputCDR &, const " << node->full_name () + << "_ptr );" << be_nl; + *os << "CORBA::Boolean " << idl_global->stub_export_macro () << be_nl + << "operator>> (TAO_InputCDR &, " + << node->full_name () << "_ptr &);\n"; + + + // set the substate as generating code for the types defined in our scope + this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE); + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) { - switch (i) - { - case 0: - break; - case 1: - old_strategy = - node->set_strategy (new be_interface_ami_handler_strategy (node)); - break; - case 2: - delete node->set_strategy (old_strategy); - { - be_valuetype *excep_holder = new be_valuetype (node->name (), - 0, - 0, - 0, - 0); - - excep_holder->set_name (node->name ()); - - old_strategy = excep_holder->set_strategy ( - new be_interface_ami_exception_holder_strategy (excep_holder)); - - be_type *bt = be_type::narrow_from_decl (excep_holder); - - // grab the right visitor to generate the code - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_cdr_op_ch::" - "visit_operation - " - "Bad visitor to return type\n"), - -1); - } - - if (bt->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cdr_op_ch::" - "visit_interface - " - "codegen for return type failed\n"), - -1); - } - delete visitor; - //delete excep_holder; - delete node->set_strategy (old_strategy); - } - return 0; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cdr_op_ch::visit_interface - " - "codegen failed - invalid state\n"), -1); - } - -#endif /* 0 */ - // generate the CDR << and >> operator declarations - os->indent (); - *os << "CORBA::Boolean " << idl_global->stub_export_macro () << be_nl - << "operator<< (TAO_OutputCDR &, const " << node->full_name () - << "_ptr );" << be_nl; - *os << "CORBA::Boolean " << idl_global->stub_export_macro () << be_nl - << "operator>> (TAO_InputCDR &, " - << node->full_name () << "_ptr &);\n"; - + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_cdr_op_ch::" + "visit_interface - " + "codegen for scope failed\n"), -1); + } - // set the substate as generating code for the types defined in our scope - this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_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_interface_cdr_op_ch::" - "visit_interface - " - "codegen for scope failed\n"), -1); - } + node->cli_hdr_cdr_op_gen (1); - node->cli_hdr_cdr_op_gen (1); -#if 0 - switch (i) - { - case 0: - case 1: - case 2: - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cdr_op_ch::visit_interface - " - "codegen failed - invalid state\n"), -1); - } - } // for -#endif /* 0 */ return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp index df19909af97..27f3387d91c 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_ci.cpp @@ -54,183 +54,96 @@ be_visitor_interface_cdr_op_ci::visit_interface (be_interface *node) TAO_OutStream *os = this->ctx_->stream (); -#if 0 - int i; - int to_do; - - // Decide how much code to produce - if (idl_global->ami_call_back () == I_TRUE) - to_do = 3; - else - to_do = 1; - be_interface_strategy *old_strategy = 0; - - for (i = 0; i < to_do; i++) + // First generate code for our children. The reason we do this first is + // because the inlined code for our children must be available before we use + // it in our parent, but we must forward declare the parent + // operators, so code like this: + // + // // IDL + // interface Foo { + // exception Bar {Foo foo_member; }; + // }; + // + // can work properly (the Foo::Bar operators need the Foo operators + // defined). + // + + // generate the CDR << and >> operator declarations + os->indent (); + *os << "ACE_INLINE CORBA::Boolean" << be_nl + << "operator<< (" << be_idt << be_idt_nl + << "TAO_OutputCDR &," << be_nl + << "const " << node->full_name () << "_ptr" << be_uidt_nl + << ");" << be_uidt_nl; + *os << "ACE_INLINE CORBA::Boolean" << be_nl + << "operator>> (" << be_idt << be_idt_nl + << "TAO_InputCDR &," << be_nl + << node->full_name () << "_ptr &" << be_uidt_nl + << ");" << be_uidt << "\n\n"; + + // Now it really the type to generate the operators for the members + // of the interface... + + // set the substate as generating code for the types defined in our scope + this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE); + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) { - switch (i) - { - case 0: - break; - case 1: - old_strategy = - node->set_strategy (new be_interface_ami_handler_strategy (node)); - break; - case 2: - delete node->set_strategy (old_strategy); - { - be_valuetype *excep_holder = new be_valuetype (node->name (), - 0, - 0, - 0, - 0); - excep_holder->set_name (node->name ()); - - old_strategy = excep_holder->set_strategy ( - new be_interface_ami_exception_holder_strategy (excep_holder)); - - be_type *bt = be_type::narrow_from_decl (excep_holder); - - // grab the right visitor to generate the code - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_cdr_op_ci::" - "visit_operation - " - "Bad visitor to return type\n"), - -1); - } - - if (bt->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cdr_op_ci::" - "visit_interface - " - "codegen for return type failed\n"), - -1); - } - delete visitor; - //delete excep_holder; - delete node->set_strategy (old_strategy); - } - return 0; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cdr_op_ci::visit_interface - " - "codegen failed - invalid state\n"), -1); - } - -#endif /* 0 */ - - // First generate code for our children. The reason we do this first is - // because the inlined code for our children must be available before we use - // it in our parent, but we must forward declare the parent - // operators, so code like this: - // - // // IDL - // interface Foo { - // exception Bar {Foo foo_member; }; - // }; - // - // can work properly (the Foo::Bar operators need the Foo operators - // defined). - // - - // generate the CDR << and >> operator declarations - os->indent (); - *os << "ACE_INLINE CORBA::Boolean" << be_nl - << "operator<< (" << be_idt << be_idt_nl - << "TAO_OutputCDR &," << be_nl - << "const " << node->full_name () << "_ptr" << be_uidt_nl - << ");" << be_uidt_nl; - *os << "ACE_INLINE CORBA::Boolean" << be_nl - << "operator>> (" << be_idt << be_idt_nl - << "TAO_InputCDR &," << be_nl - << node->full_name () << "_ptr &" << be_uidt_nl - << ");" << be_uidt << "\n\n"; - - // Now it really the type to generate the operators for the members - // of the interface... - - // set the substate as generating code for the types defined in our scope - this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_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_interface_cdr_op_ci" - "::visit_interface - " - "codegen for scope failed\n"), -1); - } - - // set the sub state as generating code for the output operator - this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT); - // @@ TODO don't use the IIOP interpreter here, we should use << and - // >> operators, or even the operator for the base CORBA::Object!! - *os << "ACE_INLINE CORBA::Boolean" << be_nl - << "operator<< (" << be_idt << be_idt_nl - << "TAO_OutputCDR &strm," << be_nl - << "const " << node->full_name () << "_ptr _tao_objref" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - *os << "CORBA::Object_ptr _tao_corba_obj = _tao_objref;" << be_nl; - *os << "return (strm << _tao_corba_obj);" << be_uidt_nl - << "}\n\n"; - - // set the substate as generating code for the input operator - this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT); - // @@ TODO don't use the IIOP interpreter here, we should use << and - // >> operators, or even the operator for the base CORBA::Object!! - *os << "ACE_INLINE CORBA::Boolean" << be_nl - << "operator>> (" << be_idt << be_idt_nl - << "TAO_InputCDR &strm," << be_nl - << node->full_name () << "_ptr &_tao_objref" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - // hand over to the TAO's internal marshaling engine - // *os << "CORBA::Environment env;" << be_nl; - *os << "ACE_TRY_NEW_ENV" << be_nl - << "{" << be_idt_nl; - *os << "CORBA::Object_var obj;" << be_nl; - *os << "if ((strm >> obj.inout ()) == 0)" << be_idt_nl - << "return 0;" << be_uidt_nl - << "// narrow to the right type" << be_nl; - *os << "_tao_objref =" << be_idt_nl - << node->full_name () << "::_narrow (" << be_idt << be_idt_nl - << "obj.in ()," << be_nl - << "ACE_TRY_ENV" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl; - *os << "ACE_TRY_CHECK;" << be_nl; - *os << "return 1;" << be_uidt_nl; - *os << "}" << be_nl - << "ACE_CATCHANY" << be_nl - << "{" << be_idt_nl - << "// do nothing" << be_uidt_nl - << "}" << be_nl - << "ACE_ENDTRY;" << be_nl - << "return 0;" << be_uidt_nl; - *os << "}\n\n"; - - node->cli_inline_cdr_op_gen (1); - -#if 0 - switch (i) - { - case 0: - case 1: - case 2: - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cdr_op_ci::visit_interface - " - "codegen failed - invalid state\n"), -1); - } - } // for -#endif /* 0 */ + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_cdr_op_ci" + "::visit_interface - " + "codegen for scope failed\n"), -1); + } + + // set the sub state as generating code for the output operator + this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT); + // @@ TODO don't use the IIOP interpreter here, we should use << and + // >> operators, or even the operator for the base CORBA::Object!! + *os << "ACE_INLINE CORBA::Boolean" << be_nl + << "operator<< (" << be_idt << be_idt_nl + << "TAO_OutputCDR &strm," << be_nl + << "const " << node->full_name () << "_ptr _tao_objref" << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl; + *os << "CORBA::Object_ptr _tao_corba_obj = _tao_objref;" << be_nl; + *os << "return (strm << _tao_corba_obj);" << be_uidt_nl + << "}\n\n"; + + // set the substate as generating code for the input operator + this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT); + // @@ TODO don't use the IIOP interpreter here, we should use << and + // >> operators, or even the operator for the base CORBA::Object!! + *os << "ACE_INLINE CORBA::Boolean" << be_nl + << "operator>> (" << be_idt << be_idt_nl + << "TAO_InputCDR &strm," << be_nl + << node->full_name () << "_ptr &_tao_objref" << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl; + // hand over to the TAO's internal marshaling engine + // *os << "CORBA::Environment env;" << be_nl; + *os << "ACE_TRY_NEW_ENV" << be_nl + << "{" << be_idt_nl; + *os << "CORBA::Object_var obj;" << be_nl; + *os << "if ((strm >> obj.inout ()) == 0)" << be_idt_nl + << "return 0;" << be_uidt_nl + << "// narrow to the right type" << be_nl; + *os << "_tao_objref =" << be_idt_nl + << node->full_name () << "::_narrow (" << be_idt << be_idt_nl + << "obj.in ()," << be_nl + << "ACE_TRY_ENV" << be_uidt_nl + << ");" << be_uidt << be_uidt_nl; + *os << "ACE_TRY_CHECK;" << be_nl; + *os << "return 1;" << be_uidt_nl; + *os << "}" << be_nl + << "ACE_CATCHANY" << be_nl + << "{" << be_idt_nl + << "// do nothing" << be_uidt_nl + << "}" << be_nl + << "ACE_ENDTRY;" << be_nl + << "return 0;" << be_uidt_nl; + *os << "}\n\n"; + + node->cli_inline_cdr_op_gen (1); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp index b197901ca21..91774a2f324 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp @@ -47,60 +47,17 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node) if (node->cli_stub_cdr_op_gen () || node->imported ()) return 0; -#if 0 - int i; - int to_do; - - // Decide how much code to produce - if (idl_global->ami_call_back () == I_TRUE) - to_do = 2; - else - to_do = 1; - be_interface_strategy *old_strategy = 0; - - for (i = 0; i < to_do; i++) + // set the substate as generating code for the types defined in our scope + this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE); + // all we have to do is to visit the scope and generate code + if (this->visit_scope (node) == -1) { - switch (i) - { - case 0: - break; - case 1: - old_strategy = - node->set_strategy (new be_interface_ami_handler_strategy (node)); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cdr_op_cs::visit_interface - " - "codegen failed - invalid state\n"), -1); - } -#endif /* 0 */ - // set the substate as generating code for the types defined in our scope - this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_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_interface_cdr_op_cs::" - "visit_interface - " - "codegen for scope failed\n"), -1); - } - - node->cli_stub_cdr_op_gen (1); + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_cdr_op_cs::" + "visit_interface - " + "codegen for scope failed\n"), -1); + } -#if 0 - switch (i) - { - case 0: - break; - case 1: - delete node->set_strategy (old_strategy); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cdr_op_cs::visit_interface - " - "codegen failed - invalid state\n"), -1); - } - } // for -#endif /* 0 */ + node->cli_stub_cdr_op_gen (1); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/collocated_ami_handler_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/collocated_ami_handler_ch.cpp deleted file mode 100644 index e83b4c52290..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/collocated_ami_handler_ch.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// collocated_ami_handler_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for collocated classes for the Interface node -// inside the server header. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_interface.h" - -ACE_RCSID(be_visitor_interface, collocated_ami_handler_ch, "$Id$") - - -// ************************************************************ -// collocated class in header -// ************************************************************ - -be_visitor_interface_collocated_ami_handler_ch::be_visitor_interface_collocated_ami_handler_ch -(be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -be_visitor_interface_collocated_ami_handler_ch::~be_visitor_interface_collocated_ami_handler_ch (void) -{ -} - -int -be_visitor_interface_collocated_ami_handler_ch::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->gen_ifdef_macro (node->flat_name (), "_collocated"); - - // Output the class defn. - os->indent (); - *os << "class " << idl_global->stub_export_macro () << " "; - - if (idl_global->gen_direct_collocation ()) - *os << node->local_coll_name (be_interface::DIRECT); - else if (idl_global->gen_thru_poa_collocation ()) - *os << node->local_coll_name (be_interface::THRU_POA); - - os->incr_indent (); - *os << " : public virtual " << node->local_name (); - - *os << "\n"; - os->decr_indent (); - *os << "{" << be_nl; - *os << "public:\n"; - os->incr_indent (); - - if (idl_global->gen_direct_collocation ()) - *os << node->local_coll_name (be_interface::DIRECT) << " (\n"; - else if (idl_global->gen_thru_poa_collocation ()) - *os << node->local_coll_name (be_interface::THRU_POA) << " (\n"; - - - os->incr_indent (0); - os->incr_indent (); - - // XXXASG - can we make this a method to return the right name ?? - if (!node->is_nested ()) - { - // The skeleton name is the outermost, we need to printout the - // POA_ prefix that goes with it. - *os << "POA_"; - } - - *os << node->local_name () << "_ptr " - << " servant," << be_nl; - - *os << "TAO_Stub *stub\n"; - os->decr_indent (); - *os << ");\n"; - os->decr_indent (0); - - os->indent (); - - // _is_a method. - *os << "virtual CORBA::Boolean _is_a" << be_idt - << "(" << be_idt_nl - << "const CORBA::Char *logical_type_id," << be_nl - << "CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // _get_servant method. - - if (!node->is_nested ()) - { - // The skeleton name is the outermost, we need to printout the - // POA_ prefix that goes with it. - *os << "POA_"; - } - - *os << node->local_name () - << "_ptr _get_servant (void) const;" << be_nl << be_nl; - - // _non_existent method. - *os << "virtual CORBA::Boolean _non_existent" << be_idt - << "(" << be_idt_nl - << "CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Visit the scope to generate all the AMI call back hood methods. - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_collocated_ami_handler_ch::" - "visit_interface - " - "codegen for scope failed\n"), - -1); - } - - os->decr_indent (); - - *os << be_nl << "private:\n"; - os->incr_indent (); - if (!node->is_nested ()) - { - // The skeleton name is the outermost, we need to printout the - // POA_ prefix that goes with it. - *os << "POA_"; - } - *os << node->local_name () << "_ptr servant_;\n"; - os->decr_indent (); - *os << "};\n\n"; - - os->gen_endif (); - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp index ba895040f8a..47e6aac1cf6 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -52,62 +52,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) // Grab the stream. os = this->ctx_->stream (); -#if 0 - // Generate the AMI Reply Handler's forward declaration code, if - // the option is enabled, for this interface. - - if (idl_global->ami_call_back () == I_TRUE) - { - be_interface_strategy *old_strategy = - node->set_strategy (new be_interface_ami_handler_strategy (node)); - - // generate the ifdefined macro for the _ptr type - os->gen_ifdef_macro (node->flat_name (), "_ptr"); - - - // the following two are required to be under the ifdef macro to avoid - // multiple declarations - - os->indent (); // start with whatever indentation level we are at - // forward declaration - *os << "class " << node->local_name () << ";" << be_nl; - // generate the _ptr declaration - *os << "typedef " << node->local_name () << " *" << node->local_name () - << "_ptr;" << be_nl; - - os->gen_endif (); - - // generate the ifdefined macro for the var type - os->gen_ifdef_macro (node->flat_name (), "_var"); - - // generate the _var declaration - if (node->gen_var_defn () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ch::" - "visit_interface - " - "codegen for _var failed\n"), -1); - } - os->gen_endif (); - - // generate the ifdef macro for the _out class - os->gen_ifdef_macro (node->flat_name (), "_out"); - - // generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec - if (node->gen_out_defn () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ch::" - "visit_interface - " - "codegen for _out failed\n"), -1); - } - // generate the endif macro - os->gen_endif (); - - delete node->set_strategy (old_strategy); - } -#endif /* 0 */ - // == STEP 1: generate the class name and class names we inherit == // generate the ifdefined macro for the _ptr type diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp index 55ff1aa9a45..f9e731b669b 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp @@ -100,80 +100,6 @@ be_visitor_interface_ci::visit_interface (be_interface *node) "codegen for scope failed\n"), -1); } -#if 0 - // If AMI is enabled, generate all the inline stuff for the - // AMI_<interface_name>_Handler interface. - - if (idl_global->ami_call_back () == I_TRUE) - { - - // Generate the exception holder - - // Set the context. - be_visitor_context ctx (*this->ctx_); - // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_INTERFACE_CI); - - // Create the visitor. - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ch::" - "visit_interface - " - "Bad visitor\n"), - -1); - } - - // Call the visitor on this interface. - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ch::" - "visit_interface - " - "code gen for ami handler default stub failed\n"), - -1); - } - delete visitor; - visitor = 0; - - - be_interface_strategy *old_strategy = - node->set_strategy (new be_interface_ami_handler_strategy (node)); - - // Set the context. - ctx = *this->ctx_; - - // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_FWD_CI); - - // Create the visitor. - visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ci::" - "visit_interface - " - "Bad visitor\n"), - -1); - } - - // Call the visitor on this interface. - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ch::" - "visit_interface - " - "code gen for ami handler fwd failed\n"), - -1); - } - delete visitor; - - delete node->set_strategy (old_strategy); - } -#endif /* 0 */ return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp index 161d85272b6..61513077111 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -206,83 +206,5 @@ be_visitor_interface_cs::visit_interface (be_interface *node) -1); } - // AMI -#if 0 - // Generate code for the AMI Reply Handler. - if (idl_global->ami_call_back () == I_TRUE) - { - // Generate the exception holder - be_interface_strategy *old_strategy = - node->set_strategy (new be_interface_ami_exception_holder_strategy (node)); - - // Set the context. - be_visitor_context ctx (*this->ctx_); - // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_INTERFACE_CS); - - // Create the visitor. - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cs::" - "visit_interface - " - "Bad visitor\n"), - -1); - } - - // Call the visitor on this interface. - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cs::" - "visit_interface - " - "code gen for ami handler default stub failed\n"), - -1); - } - delete visitor; - visitor = 0; - - // = Generate the default stub code for Handler. - - // Remove the exception holder strategy, delete it, - // and set the ami handler strategy - delete node->set_strategy (new be_interface_ami_handler_strategy (node)); - - // = Generate the default stub code for Handler. - - // Set the context. - ctx = *this->ctx_; - - // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS); - - // Create the visitor. - visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cs::" - "visit_interface - " - "Bad visitor\n"), - -1); - } - - // Call the visitor on this interface. - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cs::" - "visit_interface - " - "code gen for ami handler default stub failed\n"), - -1); - } - delete visitor; - - delete node->set_strategy (old_strategy); - } -#endif /* 0 */ return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp index 1d48e2ff90d..2ebb0f24af8 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -208,12 +208,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) // generate the collocated class if (idl_global->gen_thru_poa_collocation ()) { -#if 0 - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH) - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH); - else -#endif /* 0 */ - ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SH); + ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SH); visitor = tao_cg->make_visitor (&ctx); if (!visitor || (node->accept (visitor) == -1)) { @@ -231,12 +226,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) if (idl_global->gen_direct_collocation ()) { ctx = *this->ctx_; -#if 0 - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH) - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_DIRECT_COLLOCATED_SH); - else -#endif /* 0 */ - ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH); + ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH); visitor = tao_cg->make_visitor (&ctx); if (!visitor || (node->accept (visitor) == -1)) { @@ -270,46 +260,6 @@ be_visitor_interface_sh::visit_interface (be_interface *node) delete visitor; } -#if 0 - // Only if AMI code generation is activated and we - // are not calling ourselves already - if (idl_global->ami_call_back () == I_TRUE - && this->ctx_->state () == TAO_CodeGen::TAO_INTERFACE_SH) - { - // Set the AMI Strategy for code generation - be_interface_strategy *old_strategy = - node->set_strategy (new be_interface_ami_handler_strategy (node)); - - // = Generate the Servant Skeleton code. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_sh::" - "visit_interface - " - "Bad visitor\n"), - -1); - } - - // call the visitor on this interface. - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_sh::" - "visit_interface - " - "code gen for ami handler failed\n"), - -1); - } - delete visitor; - - delete node->set_strategy (old_strategy); - } - -#endif /* 0 */ - *os << "\n"; ctx.stream (tao_cg->server_template_header ()); diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index 6fe215225a0..45d2c793096 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -435,12 +435,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) if (idl_global->gen_thru_poa_collocation ()) { be_visitor_context ctx (*this->ctx_); -#if 0 - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS) - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS); - else -#endif /* 0 */ - ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS); + ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS); be_visitor *visitor = tao_cg->make_visitor (&ctx); if (!visitor) { @@ -465,12 +460,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) if (idl_global->gen_direct_collocation ()) { be_visitor_context ctx (*this->ctx_); -#if 0 - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS) - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS); - else -#endif /* 0 */ - ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS); + ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS); be_visitor *visitor = tao_cg->make_visitor (&ctx); if (!visitor) { @@ -492,53 +482,6 @@ be_visitor_interface_ss::visit_interface (be_interface *node) delete visitor; } - - // AMI -#if 0 - // Generate code for the AMI Reply Handler. - if (idl_global->ami_call_back () == I_TRUE - && this->ctx_->state () != TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS) - { - be_interface_strategy *old_strategy = - node->set_strategy (new be_interface_ami_handler_strategy (node)); - - // = Generate the Servant Skeleton code. - - // Set the context. - be_visitor_context ctx (*this->ctx_); - - // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS); - - // Create the visitor. - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ss::" - "visit_interface - " - "Bad visitor\n"), - -1); - } - - // Call the visitor on this interface. - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_ss::" - "visit_interface - " - "code gen for ami handler failed\n"), - -1); - } - delete visitor; - - delete node->set_strategy (old_strategy); - } - -#endif /* 0 */ - - *os << "\n\n"; return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp index 6513c5ba59b..50825a92604 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp @@ -62,17 +62,4 @@ #include "be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp" #include "be_visitor_operation/ami_exception_holder_operation_cs.cpp" -#if 0 -#include "be_visitor_operation/ami_arglist.cpp" -#include "be_visitor_operation/ami_handler_arglist.cpp" -#include "be_visitor_operation/ami_handler_operation_ch.cpp" -#include "be_visitor_operation/ami_handler_operation_cs.cpp" -#include "be_visitor_operation/ami_handler_operation_ss.cpp" -#include "be_visitor_operation/ami_handler_argument_marshal.cpp" -#include "be_visitor_operation/ami_handler_thru_poa_collocated_sh.cpp" -#include "be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp" -#include "be_visitor_operation/ami_exception_holder_operation_ch.cpp" - -#endif /* 0 */ - ACE_RCSID(be, be_visitor_operation, "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist.cpp deleted file mode 100644 index 235553d870d..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist.cpp +++ /dev/null @@ -1,335 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_arglist.cpp -// -// = DESCRIPTION -// Visitor generating code for the parameter list of the AMI -// Handler's call back Operation signature. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, ami_handler_arglist, "$Id$") - - -// ************************************************************ -// operation visitor to generate the argument list. -// We have separated code generation for this from the 4 main -// visitors to avoid code duplication and tight coupling -// ************************************************************ - -be_visitor_operation_ami_handler_arglist::be_visitor_operation_ami_handler_arglist (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -// Visit the scope and its elements. -// This implementation is the same as -// <be_visitor_scope::visit_scope>. The variation is that it calls the -// <post_process> only if the return value of the <accept> is 1. We -// need to do this since we have to differentiate between an argument -// that was printed and an argument that was skipped in the signature. - -int -be_visitor_operation_ami_handler_arglist::visit_scope (be_scope *node) -{ - // Proceed if the number of members in our scope is greater than 0. - if (node->nmembers () > 0) - { - // initialize an iterator to iterate thru our scope - UTL_ScopeActiveIterator *si; - ACE_NEW_RETURN (si, - UTL_ScopeActiveIterator (node, - UTL_Scope::IK_decls), - -1); - this->elem_number_ = 0; - // continue until each element is visited - while (!si->is_done ()) - { - AST_Decl *d = si->item (); - if (!d) - { - delete si; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "bad node in this scope\n"), -1); - - } - be_decl *bd = be_decl::narrow_from_decl (d); - // 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); - this->elem_number_++; - - // Do any pre processing using the next item info. - if (this->pre_process (bd) == -1) - { - delete si; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "pre processing failed\n"), -1); - } - - // Send the visitor. - int visitor_result = 0; - if (bd == 0 || (visitor_result = bd->accept (this)) == -1) - { - delete si; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "codegen for scope failed\n"), -1); - - } - - // Do any post processing using this item info. - if (visitor_result == 1) - this->post_process (bd); - - // Next argument. - si->next (); - } // end of while loop - delete si; - } // end of if - - return 0; -} - -be_visitor_operation_ami_handler_arglist::~be_visitor_operation_ami_handler_arglist (void) -{ -} - -int -be_visitor_operation_ami_handler_arglist::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << " (" << be_idt << be_idt << "\n"; - - // First argument is a the return value of the operation. - - // Get the return type. - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_arglist::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the visitor. - - be_visitor_context ctx = *this->ctx_; - - // Root scope necessary to return user defined type, too. - ctx.scope(0); - - // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RESULT_ARG); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - - // Pass the visitor. - int result_printed = bt->accept (visitor); - if (result_printed == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_arglist::" - "visit_operation - " - "Bad return type\n"), - -1); - } - delete visitor; - visitor = 0; - - if (result_printed) - *os << ",\n"; - - // Rest of the arguments. - - // All we do is hand over code generation to our scope. - int args_printed = this->visit_scope (node); - if (args_printed == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_arglist::" - "visit_operation - " - "codegen for scope failed\n"), - -1); - } - - // Generate the CORBA::Environment parameter for the alternative - // mapping. - if (!idl_global->exception_support ()) - { - // If the operation node has parameters, then we need to insert - // a comma. - // @@ Fix this. - // if (result_printed || args_printed) - // *os << "," << be_nl; - - os->indent (); - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH: - // Last argument - is always CORBA::Environment - *os << "CORBA::Environment &ACE_TRY_ENV"; - *os << " = " << be_idt_nl - << "TAO_default_environment ()" - << be_uidt; - break; - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS: - // Last argument - is always CORBA::Environment. - *os << "CORBA::Environment &ACE_TRY_ENV"; - break; - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist::" - "visit_operation - " - "Bad context\n"), - -1); - } - } - } - *os << ")" << be_nl; - - // Now generate the throw specs. - *os << be_idt << "ACE_THROW_SPEC ((CORBA::SystemException))" - << be_uidt << be_uidt << be_uidt; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH: - *os << ";\n\n"; - break; - default: - *os << "\n"; - } - return 0; -} - -int -be_visitor_operation_ami_handler_arglist::visit_argument (be_argument *node) -{ - // Get the visitor that will dump the argument's mapping in the - // operation signature. - be_visitor_context ctx (*this->ctx_); - - // first grab the interface definition inside which this operation is - // defined. We need this since argument types may very well be declared - // inside the scope of the interface node. In such cases, we would like to - // generate the appropriate relative scoped names. - be_operation *op = this->ctx_->be_scope_as_operation (); - if (!op) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist::" - "visit_argument - " - "Bad operation\n"), - -1); - } - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context. - be_interface *intf; - intf = this->ctx_->attribute () - ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) - : be_interface::narrow_from_scope (op->defined_in ()); - - if (!intf) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist::" - "visit_argument - " - "Bad interface\n"), - -1); - } - // root scope for user defined types you allways need the root-scope - // to use them for the ReplyHandler-Class - ctx.scope (0); // set new scope - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH: - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CH); - break; - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS: - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CS); - break; - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist::" - "visit_argument - " - "Bad context\n"), - -1); - } - } - - // Grab a visitor. - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_arglist::" - "visit_argument - " - "Bad visitor\n"), - -1); - } - - // Pass the visitor. - - int result = node->accept (visitor); - if (result == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist::" - "visit_argument - " - "codegen for ami_handler_arglist failed\n"), - -1); - } - delete visitor; - return result; -} - -int -be_visitor_operation_ami_handler_arglist::post_process (be_decl *bd) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // if we are not the last node in the list of arguments, generate a comma - // else decide if we are generating code to support true exceptions - in - // which case there will not be any CORBA::Environment parameter - if (!this->last_node (bd)) - { - *os << ",\n"; - } - return 0; -} - diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist_ch.cpp deleted file mode 100644 index ad510501fdb..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist_ch.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_arglist_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for the parameter list of the AMI -// Handler's call back Operation signature. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, ami_handler_arglist_ch, "$Id$") - - -// ************************************************************ -// operation visitor to generate the argument list. -// We have separated code generation for this from the 4 main -// visitors to avoid code duplication and tight coupling -// ************************************************************ - -be_visitor_operation_ami_handler_arglist_ch::be_visitor_operation_ami_handler_arglist_ch (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_ami_handler_arglist_ch::~be_visitor_operation_ami_handler_arglist_ch (void) -{ -} - -int -be_visitor_operation_ami_handler_arglist_ch::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << " (" << be_idt << be_idt << "\n"; - - // All we do is hand over code generation to our scope. - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_arglist_ch::" - "visit_operation - " - "codegen for scope failed\n"), - -1); - } - - // No argument for exception. What will you do if you get the - // exception from the call back method? - - // Arglist is over. - *os << be_uidt_nl << ")" << be_uidt; - - // @@ No THROW SPECs. You can do anything if the call back guy - // throws an exception. But I am not too sure about - // this. (Alex). - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH: - // Each method is pure virtual in the header. - *os << " = 0;\n\n"; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist_ch::" - "visit_operation - " - "Bad operation\n"), - -1); - } - - return 0; -} - -int -be_visitor_operation_ami_handler_arglist_ch::visit_argument (be_argument *node) -{ - // Get the visitor that will dump the argument's mapping in the - // operation signature. - be_visitor_context ctx (*this->ctx_); - - // first grab the interface definition inside which this operation is - // defined. We need this since argument types may very well be declared - // inside the scope of the interface node. In such cases, we would like to - // generate the appropriate relative scoped names. - be_operation *op = this->ctx_->be_scope_as_operation (); - if (!op) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist_ch::" - "visit_argument - " - "Bad operation\n"), - -1); - } - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context. - be_interface *intf; - intf = this->ctx_->attribute () - ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) - : be_interface::narrow_from_scope (op->defined_in ()); - - if (!intf) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist_ch::" - "visit_argument - " - "Bad interface\n"), - -1); - } - ctx.scope (intf); // set new scope - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST: - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST); - break; - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist_ch::" - "visit_argument - " - "Bad context\n"), - -1); - } - } - - // Grab a visitor. - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist_ch::" - "visit_argument - " - "Bad visitor\n"), - -1); - } - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_arglist_ch::" - "visit_argument - " - "codegen for ami_handler_arglist_ch failed\n"), - -1); - } - delete visitor; - return 0; -} - -int -be_visitor_operation_ami_handler_arglist_ch::post_process (be_decl *bd) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // if we are not the last node in the list of arguments, generate a comma - // else decide if we are generating code to support true exceptions - in - // which case there will not be any CORBA::Environment parameter - if (!this->last_node (bd)) - { - *os << ",\n"; - } - return 0; -} - diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_argument_marshal.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_argument_marshal.cpp deleted file mode 100644 index 0707400379e..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_argument_marshal.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_argument_marshal.cpp -// -// = DESCRIPTION -// Visitor to pass arguments to the CDR operators. This one helps in -// generating the && and the , at the right place. This one is for the -// skeleton side. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, ami_handler_argument_marshal, "$Id$") - - -// ************************************************************ -// operation visitor to handle the passing of arguments to the CDR operators -// ************************************************************ - -be_compiled_visitor_operation_ami_handler_argument_marshal:: -be_compiled_visitor_operation_ami_handler_argument_marshal (be_visitor_context - *ctx) - : be_visitor_operation_argument (ctx), - last_arg_printed_ (be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_NONE) -{ -} - -be_compiled_visitor_operation_ami_handler_argument_marshal:: -~be_compiled_visitor_operation_ami_handler_argument_marshal (void) -{ -} - -int -be_compiled_visitor_operation_ami_handler_argument_marshal::pre_process (be_decl *bd) -{ - TAO_OutStream *os = this->ctx_->stream (); - - be_argument *arg = be_argument::narrow_from_decl (bd); - - if (!arg) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_compiled_visitor_operation_ami_handler_argument_marshal" - "::post_process - " - "Bad argument node\n"), - -1); - } - switch (arg->direction ()) - { - case AST_Argument::dir_IN: - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - // nothing - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - // nothing - } - break; - case AST_Argument::dir_INOUT: - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - if (this->last_arg_printed_ != - be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_NONE) - *os << " &&\n"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - if (this->last_arg_printed_ != - be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_NONE) - *os << " &&\n"; - } - break; - case AST_Argument::dir_OUT: - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - if (this->last_arg_printed_ != - be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_NONE) - *os << " &&\n"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - if (this->last_arg_printed_ != - be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_NONE) - *os << " &&\n"; - } - break; - } - - return 0; -} - -int -be_compiled_visitor_operation_ami_handler_argument_marshal::post_process (be_decl *bd) -{ - be_argument *arg = be_argument::narrow_from_decl (bd); - - if (!arg) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_compiled_visitor_operation_ami_handler_argument_marshal" - "::post_process - " - "Bad argument node\n"), - -1); - } - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - switch (arg->direction ()) - { - case AST_Argument::dir_IN: - // these arguments don't get printed for the << operator on the stub - break; - case AST_Argument::dir_INOUT: - // only these arguments get printed - this->last_arg_printed_ = - be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_INOUT; - break; - case AST_Argument::dir_OUT: - // only these arguments get printed - this->last_arg_printed_ = - be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_OUT; - break; - } - break; - case TAO_CodeGen::TAO_CDR_OUTPUT: - switch (arg->direction ()) - { - case AST_Argument::dir_IN: - // these arguments don't get printed for the >> on the stub - break; - case AST_Argument::dir_INOUT: - // only these arguments get printed - this->last_arg_printed_ = - be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_INOUT; - break; - case AST_Argument::dir_OUT: - // only these arguments get printed - this->last_arg_printed_ = - be_compiled_visitor_operation_ami_handler_argument_marshal::TAO_ARG_OUT; - break; - } - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_compiled_visitor_operation_ami_handler_argument_marshal" - "::post_process - " - "Bad sub state\n"), - -1); - } - return 0; -} - diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation.cpp deleted file mode 100644 index baa556ce88a..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_operation_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for AMI Handler call back operation in -// the client header. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, ami_handler_operation_ch, "$Id$") - - -// ************************************************************ -// Operation visitor for server header -// ************************************************************ - -be_visitor_operation_ami_handler_operation_ch::be_visitor_operation_ami_handler_operation_ch (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_ami_handler_operation_ch::~be_visitor_operation_ami_handler_operation_ch (void) -{ -} - -int -be_visitor_operation_ami_handler_operation_ch::visit_operation (be_operation *node) -{ - TAO_OutStream *os; // output stream - - os = this->ctx_->stream (); - this->ctx_->node (node); // save the node - - os->indent (); // start with the current indentation level - - // every operation is declared virtual in the client code - *os << "virtual "; - - // STEP I: generate the return type. Return type is simpy void. - *os << "void "; - - // STEP 2: generate the operation name. - *os << " " << node->local_name (); - - // STEP 3: generate the argument list with the appropriate - // mapping. For these we grab a visitor that generates the - // parameter listing. - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_ami_handler_operation_ch::" - "visit_operation - " - "Bad visitor to return type\n"), - -1); - } - - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - delete visitor; - - // Generating the skeleton method. - - // Skeleton not necessary for collocated class. - if (this->ctx_->state () == TAO_CodeGen::TAO_COLLOCATED_AMI_HANDLER_OPERATION_CH) - { - return 0; - /* NOT REACHED */ - } - - // Generate the corresponding static skeleton method for this - // operation only if there was no "native" type. - if (!node->has_native ()) - { - // Next line. - *os << be_nl; - - // Indent. - os->indent (); - - *os << "static void "; - // Check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->local_name () << - "_skel (" << be_idt << be_idt_nl; - - // Different skeletons for the AMI Handler class and the servant - // class. - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_OPERATION_CH: - *os << "CORBA::ServerRequest &_tao_req, " << be_nl - << "void *_tao_obj, " << be_nl - << "void *_tao_context, " << be_nl - << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl - << "TAO_default_environment ()" - << be_uidt << be_uidt_nl - << ");" << be_uidt << "\n\n"; - break; - - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH: - *os << "TAO_InputCDR &_tao_reply_cdr," << be_nl - << "Messaging::ReplyHandler_ptr _tao_reply_handler," << be_nl - << "CORBA::ULong reply_status," << be_nl - << "CORBA::Environment &ACE_TRY_ENV =" << be_idt_nl - << "TAO_default_environment ()" << be_uidt << be_uidt_nl - << ");" << be_uidt << "\n\n"; - break; - - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ch::" - "visit_operation - " - "Unknown state\n"), - -1); - } - } - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ch.cpp deleted file mode 100644 index aa5ef51d9f4..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ch.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_operation_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for AMI Handler call back operation in -// the client header. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, ami_handler_operation_ch, "$Id$") - - -// ************************************************************ -// Operation visitor for server header -// ************************************************************ - -be_visitor_operation_ami_handler_operation_ch::be_visitor_operation_ami_handler_operation_ch (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_ami_handler_operation_ch::~be_visitor_operation_ami_handler_operation_ch (void) -{ -} - -int -be_visitor_operation_ami_handler_operation_ch::visit_operation (be_operation *node) -{ - TAO_OutStream *os; // output stream - - os = this->ctx_->stream (); - this->ctx_->node (node); // save the node - - os->indent (); // start with the current indentation level - - // every operation is declared virtual in the client code - *os << "virtual "; - - // STEP I: generate the return type. Return type is simpy void. - *os << "void "; - - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "set_"; - else - *os << "get_"; - } - - // STEP 2: generate the operation name. - *os << node->local_name (); - - // STEP 3: generate the argument list with the appropriate - // mapping. For these we grab a visitor that generates the - // parameter listing. - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_ami_handler_operation_ch::" - "visit_operation - " - "Bad visitor to return type\n"), - -1); - } - - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - delete visitor; - - // Generating the skeleton method. - - // Skeleton not necessary for collocated class. - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SH - || this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SH - || this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_TIE_SH) - { - return 0; - /* NOT REACHED */ - } - - // Generate the corresponding static skeleton method for this - // operation only if there was no "native" type. - if (!node->has_native ()) - { - - // Indent. - os->indent (); - - // Next line. - *os << be_nl - << "static void "; - - // Check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->local_name () - << "_skel (" << be_idt << be_idt_nl; - - // Different skeletons for the AMI Handler class and the servant - // class. - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SH: - *os << "CORBA::ServerRequest &_tao_req, " << be_nl - << "void *_tao_obj, " << be_nl - << "void *_tao_context, " << be_nl - << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl - << "TAO_default_environment ());" - << be_uidt << be_uidt_nl - << be_uidt << "\n\n"; - break; - - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH: - *os << "TAO_InputCDR &_tao_reply_cdr," << be_nl - << "Messaging::ReplyHandler_ptr _tao_reply_handler," << be_nl - << "CORBA::ULong reply_status," << be_nl - << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl - << "TAO_default_environment ());" - << be_uidt << be_uidt_nl - << be_uidt << "\n\n"; - break; - - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ch::" - "visit_operation - " - "Unknown state\n"), - -1); - } - } - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_cs.cpp deleted file mode 100644 index ab64e73a68a..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_cs.cpp +++ /dev/null @@ -1,822 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_operation_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for Operation in the stubs file. -// -// = AUTHOR -// Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, ami_handler_operation_cs, "$Id$") - - -// ************************************************************ -// Operation visitor for client stubs -// ************************************************************ - -be_visitor_operation_ami_handler_operation_cs::be_visitor_operation_ami_handler_operation_cs (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_ami_handler_operation_cs::~be_visitor_operation_ami_handler_operation_cs (void) -{ -} - -// processing to be done after every element in the scope is processed -int -be_visitor_operation_ami_handler_operation_cs::post_process (be_decl *bd) -{ - // all we do here is to insert a comma and a newline - TAO_OutStream *os = this->ctx_->stream (); - if (!this->last_node (bd)) - *os << ",\n"; - return 0; -} - -int -be_visitor_operation_ami_handler_operation_cs::visit_operation (be_operation *node) -{ - TAO_OutStream *os; // output stream - be_type *bt; // type node - be_visitor_context ctx; // visitor context - be_visitor *visitor; // visitor - - os = this->ctx_->stream (); - this->ctx_->node (node); // save the node for future use - - // Start with the current indentation level. - os->indent (); - - // Init the return type variable. - bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ami_handler_operation_cs::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Generate the return type. Return type is simply void. - *os << "void " << be_nl; - - // Get the scope name. - be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl (); - if (parent == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_cs::" - "visit_operation - " - "scopeless operation :-<\n"), - -1); - } - - // Here we do not have our overridden be_interface methods, - // so the interface type strategy does not work here. - // We have to go by foot. - // Genereate scope name. - *os << parent->compute_name ("AMI_", "Handler"); - - // Generate the operation name. - *os << "::"; - - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "set_"; - else - *os << "get_"; - } - *os << node->local_name (); - - // Generate the argument list with the appropriate mapping (same as - // in the header file). - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS); - visitor = tao_cg->make_visitor (&ctx); - if ((!visitor) || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_cs::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - delete visitor; - - os->indent (); - // Generate the actual code for the stub. However, if any of the argument - // types is "native", we flag a MARSHAL exception. - // last argument - is always CORBA::Environment - *os << "{" << be_idt_nl; - - // Deal with differences between IDL mapping for true C++ exceptions and - // alternate mapping. Since our code uses the ACE_TRY_ENV variable in a - // number of places, for the true exception case, we will have to explicitly - // declare the ACE_TRY_ENV variable. - *os << this->gen_environment_var () << be_nl; - - // Generate any pre stub info if and only if none of our parameters is of the - // native type. - if (!node->has_native ()) - { - // native type does not exist. - - // Generate any "pre" stub information such as tables or declarations - // This is a template method and the actual work will be done by the - // derived class - if (this->gen_pre_stub_info (node, bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "gen_pre_stub_info failed\n"), - -1); - } - } - - // Declaring return type is not necessary. Since return type is - // void. - - // Native exists => no stub. - if (node->has_native ()) - { - if (this->gen_raise_exception (bt, "CORBA::MARSHAL", "") == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_cs::" - "visit_operation - " - "codegen for return var failed\n"), - -1); - } - } - else - { - os->indent (); - // Generate code that retrieves the underlying stub object and then - // invokes do_static_call on it. - *os << be_nl - << "TAO_Stub *istub = this->_stubobj ();" << be_nl - << "if (istub == 0)" << be_idt_nl; - - // If the stub object was bad, then we raise a system - // exception. - *os << "ACE_THROW (CORBA::INTERNAL ());\n\n"; - - *os << be_uidt; - - // do any pre marshal and invoke stuff with arguments - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for argument pre invoke failed\n"), - -1); - } - - // Generate the code for marshaling in the parameters and transmitting - // them. - if (this->gen_marshal_and_invoke (node, bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for marshal and invoke failed\n"), - -1); - - } - - // Return type is void, - - } // end of if (!native) - - *os << be_uidt_nl << "}" << be_nl << be_nl; - - // Generate the skeleton method. - - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CS); - visitor = tao_cg->make_visitor (&ctx); - - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for AMI Handler skeleton failed\n"), - -1); - } - delete visitor; - - return 0; -} - -int -be_visitor_operation_ami_handler_operation_cs::visit_argument (be_argument *node) -{ - // this method is used to generate the ParamData table entry - - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; // argument type - - // retrieve the type for this argument - bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - os->indent (); - *os << "{" << bt->tc_name () << ", "; - switch (node->direction ()) - { - case AST_Argument::dir_IN: - *os << "PARAM_IN, "; - break; - case AST_Argument::dir_INOUT: - *os << "PARAM_INOUT, "; - break; - case AST_Argument::dir_OUT: - *os << "PARAM_OUT, "; - break; - } - *os << "0}"; - - return 0; -} - -int -be_visitor_operation_ami_handler_operation_cs::gen_raise_exception (be_type *bt, - const char *excep, - const char *completion_status) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - if (this->void_return_type (bt)) - { - *os << "ACE_THROW (" - << excep << " (" << completion_status << "));\n"; - } - else - { - *os << "ACE_THROW_RETURN (" - << excep << " (" << completion_status << "), "; - - // return the appropriate return value - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_cs::" - "gen_raise_exception - " - "codegen for return var failed\n"), - -1); - } - *os << ");\n"; - } - return 0; -} - -int -be_visitor_operation_ami_handler_operation_cs::gen_check_exception (be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - os->indent (); - // check if there is an exception - if (this->void_return_type (bt)) - { - *os << "ACE_CHECK;\n"; - //<< "_tao_environment);\n"; - } - else - { - *os << "ACE_CHECK_RETURN ("; - // << "_tao_environment, "; - - // return the appropriate return value - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_cs::" - "gen_check_exception - " - "codegen failed\n"), - -1); - } - *os << ");" << be_nl; - } - - return 0; -} - -// ************************************************************ -// Operation visitor for interpretive client stubs -// ************************************************************ - -be_interpretive_visitor_operation_ami_handler_operation_cs:: -be_interpretive_visitor_operation_ami_handler_operation_cs (be_visitor_context *ctx) - : be_visitor_operation_ami_handler_operation_cs (ctx) -{ -} - -be_interpretive_visitor_operation_ami_handler_operation_cs::~be_interpretive_visitor_operation_ami_handler_operation_cs (void) -{ -} - -// concrete implementation of the template methods - -int -be_interpretive_visitor_operation_ami_handler_operation_cs::gen_pre_stub_info (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - // Generate the TAO_Param_Data table - os->indent (); - *os << "static const TAO_Param_Data "; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << - "_paramdata [] = " << be_nl; - *os << "{\n"; - os->incr_indent (); - - // entry for the return type - *os << "{" << bt->tc_name () << ", PARAM_RETURN, 0}"; - if (node->nmembers () > 0) - *os << ",\n"; - - // generate entries for the param data table for arguments - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interpretive_visitor_operation_ami_handler_operation_cs::" - "gen_pre_stub_info - " - "visit scope failed\n"), - -1); - } - - os->indent (); - *os << be_nl; - os->decr_indent (); - *os << "}; // " << node->flat_name () << "_paramdata\n\n"; - - // Check if this operation raises any exceptions. In that case, we must - // generate a list of exception typecodes. This is not valid for - // attributes - if (!this->ctx_->attribute ()) - { - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_interpretive_visitor_operation_ami_handler_operation_cs::" - "gen_pre_stub_info - " - "Exceptionlist generation error\n"), - -1); - } - } - - // now generate the calldata table - os->indent (); - *os << "static const TAO_Call_Data "; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () - << "_calldata = " << be_nl - << "{" - << "\""; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->local_name () << "\", "; - - // are we oneway or two operation? - if (node->flags () == AST_Operation::OP_oneway) - { - *os << "0, "; // for false - } - else - { - *os << "1, "; // for true - } - // insert the size of the paramdata table i.e., number of arguments + 1 - // for return type - *os << (node->argument_count () + 1) << ", "; - - // insert the address of the paramdata table - // first check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_paramdata, "; - - // insert exception list (if any) - node for attributes - if (this->ctx_->attribute ()) - *os << "0, 0};\n\n"; - else - { - if (node->exceptions ()) - { - *os << node->exceptions ()->length () - << ", _tao_" << node->flat_name () << "_exceptiondata};\n\n"; - } - else - *os << "0, 0};\n\n"; - } - return 0; -} - -int -be_interpretive_visitor_operation_ami_handler_operation_cs:: -gen_marshal_and_invoke (be_operation*node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - os->indent (); - *os << "void* _tao_arguments[" - << node->argument_count () + 1 << "];" << be_nl - << "const void** _tao_arg = ACE_const_cast (const void**,_tao_arguments);" << be_nl - << "*_tao_arg = "; - - // pass the appropriate return value to docall - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interpretive_visitor_operation_ami_handler_operation_cs::" - "gen_marshal_and_invoke - " - "codegen for return var in do_static_call failed\n"), - -1); - } - *os << "; _tao_arg++;\n"; - - // pass each argument to do_static_call - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interpretive_visitor_operation_ami_handler_operation_cs::" - "gen_marshal_and_invoke - " - "codegen for return var in do_static_call failed\n"), - -1); - } - delete visitor; - visitor=0; - - // call do_static_call with appropriate number of arguments - os->indent (); - *os << "istub->do_static_call (" << be_idt_nl - << "ACE_TRY_ENV, " << be_nl - << "&"; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_calldata," << be_nl - << "_tao_arguments" << be_uidt_nl - << ");\n"; - - os->indent (); - // check if there is an exception - if (this->gen_check_exception (bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interpretive_visitor_operation_ami_handler_operation_cs::" - "gen_marshal_and_invoke - " - "codegen for checking exception failed\n"), - -1); - - } - - // do any post processing for the arguments - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_cs::" - "visit_operation - " - "codegen for args post do_static_call failed\n"), - -1); - } - delete visitor; - visitor = 0; - - // do any post processing for the retval - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_POST_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_cs::" - "visit_operation - " - "codegen for return type post do_static_call failed\n"), - -1); - } - delete visitor; - - return 0; -} - -// ************************************************************ -// Operation visitor for compiled client stubs -// ************************************************************ - -be_compiled_visitor_operation_ami_handler_operation_cs:: -be_compiled_visitor_operation_ami_handler_operation_cs (be_visitor_context *ctx) - : be_visitor_operation_ami_handler_operation_cs (ctx) -{ -} - -be_compiled_visitor_operation_ami_handler_operation_cs::~be_compiled_visitor_operation_ami_handler_operation_cs (void) -{ -} - -// concrete implementation of the template methods - -int -be_compiled_visitor_operation_ami_handler_operation_cs::gen_pre_stub_info (be_operation *node, - be_type *) -{ - - // Check if this operation raises any exceptions. In that case, we must - // generate a list of exception typecodes. This is not valid for - // attributes - if (!this->ctx_->attribute ()) - { - be_visitor_context ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_compiled_visitor_operation_ami_handler_operation_cs::" - "gen_pre_stub_info - " - "Exceptionlist generation error\n"), - -1); - } - delete visitor; - } - - return 0; -} - -int -be_compiled_visitor_operation_ami_handler_operation_cs:: -gen_marshal_and_invoke (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - - // Create the GIOP_Invocation and grab the outgoing CDR stream. - switch (node->flags ()) - { - case AST_Operation::OP_oneway: - *os << "TAO_GIOP_Oneway_Invocation _tao_call "; - break; - default: - *os << "TAO_GIOP_Twoway_Invocation _tao_call "; - } - *os << "(" << be_idt << be_idt_nl - << "istub," << be_nl; - - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "\"_set_\""; - else - *os << "\"_get_\""; - } - - *os << "\"" << node->original_local_name () - << "\"," << be_nl - << "istub->orb_core ()" << be_uidt_nl - << ");" << be_uidt_nl; - - *os << "\n" << be_nl - << "for (;;)" << be_nl - << "{" << be_idt_nl; - - *os << "ACE_TRY_ENV.clear ();" << be_nl; - *os << "_tao_call.start (ACE_TRY_ENV);" << be_nl; - // Check if there is an exception. - *os << "ACE_CHECK;\n" << be_nl; - - // @@ Put interceptor here???? - - // Prepare the request header - *os << "_tao_call.prepare_header ("; - switch (node->flags ()) - { - case AST_Operation::OP_oneway: - *os << "0"; - break; - default: - *os << "1"; - } - *os << ", ACE_TRY_ENV);" << be_nl - << "ACE_CHECK;\n" << be_nl; - - // Now make sure that we have some AMI result parameter or OUT or - // INOUT parameters. Otherwise, there is nothing to be marshaled - // in. - if (!this->void_return_type (bt) || - this->has_param_type (node, AST_Argument::dir_OUT) || - this->has_param_type (node, AST_Argument::dir_INOUT)) - { - *os << be_nl - << "TAO_OutputCDR &_tao_out = _tao_call.out_stream ();" - << be_nl - << "if (!(\n" << be_idt << be_idt << be_idt; - - if (!this->void_return_type (bt)) - { - // demarshal - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RETVAL_DEMARSHAL_CS); - ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_compiled_visitor_operation_ami_handler_operation_cs::" - "gen_demarshal_params - " - "codegen for demarshal failed\n"), - -1); - } - delete visitor; - - // Print the && if there are OUT or INOUT arguements in the - // signature. - if (this->has_param_type (node, AST_Argument::dir_OUT) || - this->has_param_type (node, AST_Argument::dir_INOUT)) - *os << " &&\n"; - } - - // Marshal each out and inout argument. - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_MARSHAL_CS); - ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_compiled_visitor_operation_ami_handler_operation_cs::" - "gen_marshal_and_invoke - " - "codegen for return var in do_static_call failed\n"), - -1); - } - delete visitor; - visitor = 0; - - *os << be_uidt << be_uidt_nl - << "))" << be_nl; - - // if marshaling fails, raise exception. - *os << "ACE_THROW (CORBA::MARSHAL ());"; - - *os << be_uidt; - } - - *os << be_nl - << "int _invoke_status =" << be_idt_nl; - if (node->flags () == AST_Operation::OP_oneway) - { - // oneway operation - *os << "_tao_call.invoke (ACE_TRY_ENV);"; - } - else - { - if (node->exceptions ()) - { - *os << "_tao_call.invoke (_tao_" << node->flat_name () - << "_exceptiondata, " - << node->exceptions ()->length () - << ", ACE_TRY_ENV);"; - } - else - { - *os << "_tao_call.invoke (0, 0, ACE_TRY_ENV);"; - } - } - - *os << be_uidt_nl; - - // Check if there is an exception. - *os << "ACE_CHECK;"; - - *os << be_nl - << "if (_invoke_status == TAO_INVOKE_RESTART)" << be_idt_nl - << "continue;" << be_uidt_nl - << "if (_invoke_status != TAO_INVOKE_OK)" << be_nl - << "{" << be_idt_nl; - - // Check if there is an exception. - *os << "ACE_THROW (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_YES));"; - - *os << be_uidt_nl - << "}" << be_nl - << "break;" << be_nl - << be_uidt_nl << "}" << be_nl; - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ss.cpp deleted file mode 100644 index 4f0f7526cb5..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ss.cpp +++ /dev/null @@ -1,709 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_operation_ss.cpp -// -// = DESCRIPTION -// Visitor generating code for Operation in the server skeleton -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_operation, ami_handler_operation_ss, "$Id$") - - -// ************************************************************ -// Operation visitor for server skeletons -// ************************************************************ - -be_visitor_operation_ami_handler_operation_ss::be_visitor_operation_ami_handler_operation_ss (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_ami_handler_operation_ss::~be_visitor_operation_ami_handler_operation_ss (void) -{ -} - -// processing to be done after every element in the scope is processed -int -be_visitor_operation_ami_handler_operation_ss::post_process (be_decl *bd) -{ - // all we do here is to insert a comma and a newline - TAO_OutStream *os = this->ctx_->stream (); - if (!this->last_node (bd)) - *os << ",\n"; - return 0; -} - -int -be_visitor_operation_ami_handler_operation_ss::visit_operation (be_operation *node) -{ - TAO_OutStream *os; // output stream - be_type *bt; // type node for return type - - os = this->ctx_->stream (); // grab the o/p stream - this->ctx_->node (node); // save the node for future use - - os->indent (); // start with the current indentation level - - // if there is an argument of type "native", return immediately - if (node->has_native ()) - return 0; - - // retrieve the operation return type - bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context - be_interface *intf; - intf = this->ctx_->attribute () - ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) - : be_interface::narrow_from_scope (node->defined_in ()); - - if (!intf) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "bad interface scope\n"), - -1); - } - - // Default implementation - os->indent (); - *os << "void " << intf->full_skel_name () << "::"; - - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "set_"; - else - *os << "get_"; - } - - *os << node->local_name () << " "; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if ((!visitor) || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_thru_poa_collocated_cs::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - delete visitor; - visitor = 0; - os->indent (); - *os << "{" << be_idt_nl; - - *os << "ACE_DEBUG ((LM_DEBUG," << be_idt << be_idt_nl - <<"\"(%P | %t):" << intf->full_skel_name () << "\\n\"));" - << be_uidt << be_uidt_nl; - - *os << be_uidt_nl << "}" << be_nl << be_nl; - - - - // generate the signature of the static skeleton - os->indent (); - *os << "void " << intf->full_skel_name () << "::"; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->local_name () - << "_skel (" << be_idt << be_idt_nl; - - *os << "CORBA::ServerRequest &_tao_server_request, " << be_nl; - - *os << "void *_tao_object_reference, " << be_nl - << "void * /* context */, " << be_nl - << "CORBA::Environment &ACE_TRY_ENV)" << be_uidt << be_uidt_nl - << be_nl; - - // generate the actual code for the skeleton. However, if any of the argument - // types is "native", we do not generate any skeleton - // last argument - is always CORBA::Environment - *os << "{\n" << be_idt; - - // generate all the tables and other pre-skel info - if (this->gen_pre_skel_info (node, bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "gen_pre_skel_info failed\n"), - -1); - } - - os->indent (); - // get the right object implementation. - *os << intf->full_skel_name () << " *_tao_impl = (" - << intf->full_skel_name () << " *)_tao_object_reference;\n\n"; - - // declare a return type variable - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RETVAL_DECL_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "codegen for return var decl failed\n"), - -1); - } - delete visitor; - visitor = 0; - - // declare variables for arguments - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DECL_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "codegen for return var decl failed\n"), - -1); - } - delete visitor; - visitor = 0; - - // Demarshal parameters - if (this->gen_demarshal_params (node, bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "gen_demarshal_params failed\n"), - -1); - } - - // make the upcall - os->indent (); - *os << "_tao_impl->"; - - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "set_"; - else - *os << "get_"; - } - -#if 0 - *os << node->local_name () << " (" << be_idt << "\n"; - - if (!this->void_return_type (bt)) - { - os->indent (); - *os << "_tao_retval,\n"; - } -#endif /* 0 */ - - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_CS); -#if 0 - if (this->has_param_type (node, AST_Argument::dir_INOUT) - || this->has_param_type (node, AST_Argument::dir_OUT)) - ctx.sub_state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_HAS_ARGUMENTS); -#endif /* 0 */ - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "codegen for making upcall failed\n"), - -1); - } - delete visitor; - visitor = 0; - - // end the upcall - os->indent (); - *os << be_uidt_nl << ");" << be_nl; - - *os << "ACE_CHECK;" << be_nl - << "_tao_server_request.init_reply (ACE_TRY_ENV);" << be_nl - << "ACE_CHECK;" << be_uidt_nl; - - *os << "}" << be_nl << be_nl; - return 0; -} - -int -be_visitor_operation_ami_handler_operation_ss::visit_argument (be_argument *node) -{ - // this method is used to generate the ParamData table entry - - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; // argument type - - // retrieve the type for this argument - bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - os->indent (); - *os << "{" << bt->tc_name () << ", "; - switch (node->direction ()) - { - case AST_Argument::dir_IN: - *os << "CORBA::ARG_IN, "; - break; - case AST_Argument::dir_INOUT: - *os << "CORBA::ARG_INOUT, "; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::ARG_OUT, "; - break; - } - *os << "0}"; - - return 0; -} - -int -be_visitor_operation_ami_handler_operation_ss::gen_raise_exception (be_type *, - const char *excep, - const char *completion_status, - const char * /* env */) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - *os << "ACE_THROW (" - << excep << " (" << completion_status << ") " - << ");\n"; - return 0; -} - -int -be_visitor_operation_ami_handler_operation_ss::gen_check_exception (be_type *, const char * /* env */) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - // check if there is an exception - *os << "ACE_CHECK;\n"; - // << env << ");\n"; - - return 0; -} - - -// ********************************************************************* -// Operation visitor for server skeletons using interpretive marshaling -// ********************************************************************* - -be_interpretive_visitor_operation_ami_handler_operation_ss:: -be_interpretive_visitor_operation_ami_handler_operation_ss (be_visitor_context *ctx) - : be_visitor_operation_ami_handler_operation_ss (ctx) -{ -} - -be_interpretive_visitor_operation_ami_handler_operation_ss:: -~be_interpretive_visitor_operation_ami_handler_operation_ss (void) -{ -} - -int -be_interpretive_visitor_operation_ami_handler_operation_ss::gen_pre_skel_info (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor_context ctx; - - os->indent (); - // generate the param_data and call_data tables. We generate these if and - // only if none of our arguments is of "native" type. Native types cannot be - // marshaled. - // native type does not exist. Generate the static tables - - // generate the TAO_Param_Data_Skel table - *os << "static const TAO_Param_Data_Skel "; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << - "_paramdata [] = " << be_nl; - *os << "{\n"; - os->incr_indent (); - - // entry for the return type - *os << "{" << bt->tc_name () << ", 0, 0}"; - if (node->nmembers () > 0) - *os << ",\n"; - - // generate entries for the param data table for arguments - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "visit scope failed\n"), - -1); - } - *os << "\n"; - os->decr_indent (); - *os << "}; // " << node->flat_name () << "_paramdata\n\n"; - - // now generate the calldata table - os->indent (); - *os << "static const TAO_Call_Data_Skel "; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () - << "_calldata = " << be_nl - << "{" - << "\""; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->local_name () << "\", "; - - // are we oneway or two operation? - if (node->flags () == AST_Operation::OP_oneway) - { - *os << "0, "; // for false - } - else - { - *os << "1, "; // for true - } - // insert the size of the paramdata table i.e., number of arguments + 1 - // for return type - *os << (node->argument_count () + 1) << ", "; - - // insert the address of the paramdata table - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_paramdata};\n\n"; - - return 0; -} - -int -be_interpretive_visitor_operation_ami_handler_operation_ss::gen_demarshal_params (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - // setup parameters for demarshaling and demarshal them - os->indent (); - *os << "_tao_server_request.demarshal (" << be_idt_nl - << "ACE_TRY_ENV, " << be_nl - << "&"; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_calldata,\n"; - - // pass the appropriate return value to the demarshal operation - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DEMARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "codegen for return var in demarshal failed\n"), - -1); - } - // insert a comma after the return val if there are arguments - if (node->argument_count () > 0) - *os << ",\n"; - - // pass each argument to the demarshal operation - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "codegen for argument in demarshal failed\n"), - -1); - } - - // end the demarshal call - *os << be_uidt_nl; - *os << ");" << be_nl; - - *os << "ACE_CHECK;\n"; - - return 0; -} - -int -be_interpretive_visitor_operation_ami_handler_operation_ss::gen_marshal_params (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - // setup parameters for marshaling and marshal them into the - // outgoing stream - os->indent (); - *os << "_tao_server_request.marshal (" << be_idt_nl - << "ACE_TRY_ENV, " << be_nl - // << "_tao_skel_environment, " << be_nl - << "&"; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_calldata,\n"; - - // pass the appropriate return value to the marshal operation - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "codegen for return var in marshal failed\n"), - -1); - } - // insert a comma after the return val if there are arguments - if (node->argument_count () > 0) - { - *os << ",\n"; - } - - // pass each argument to the marshal operation - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_operation_ss::" - "visit_operation - " - "codegen for argument in marshal failed\n"), - -1); - } - // end the marshal call - *os << be_uidt_nl; - *os << ");\n"; - - return 0; -} - -// ********************************************************************* -// Operation visitor for server skeletons using compiled marshaling -// ********************************************************************* - -be_compiled_visitor_operation_ami_handler_operation_ss:: -be_compiled_visitor_operation_ami_handler_operation_ss (be_visitor_context *ctx) - : be_visitor_operation_ami_handler_operation_ss (ctx) -{ -} - -be_compiled_visitor_operation_ami_handler_operation_ss:: -~be_compiled_visitor_operation_ami_handler_operation_ss (void) -{ -} - -int -be_compiled_visitor_operation_ami_handler_operation_ss::gen_pre_skel_info (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // now make sure that we have some in and inout parameters. Otherwise, there - // is nothing to be marshaled in - if (this->has_param_type (node, AST_Argument::dir_INOUT) || - this->has_param_type (node, AST_Argument::dir_OUT) || - !this->void_return_type (bt)) - { - // instantiate a TAO_InputCDR variable - os->indent (); - *os << "TAO_InputCDR &_tao_in = _tao_server_request.incoming ();\n"; - } - - return 0; -} - -int -be_compiled_visitor_operation_ami_handler_operation_ss::gen_demarshal_params (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - // now make sure that we have some in and inout parameters. Otherwise, there - // is nothing to be marshaled in - if (this->has_param_type (node, AST_Argument::dir_INOUT) || - this->has_param_type (node, AST_Argument::dir_OUT) || - !this->void_return_type (bt)) - { - os->indent (); - - // demarshal the inout and out arguments and return values - *os << "if (!(\n" << be_idt; - - if (!this->void_return_type (bt)) - { - // demarshal - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RETVAL_DEMARSHAL_CS); - ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_compiled_visitor_operation_ami_handler_operation_ss::" - "gen_demarshal_params - " - "codegen for demarshal failed\n"), - -1); - } - - // Print the && if there are OUT or INOUT arguements in the - // signature. - if (this->has_param_type (node, AST_Argument::dir_OUT) || - this->has_param_type (node, AST_Argument::dir_INOUT)) - *os << " &&\n"; - } - - // marshal each in and inout argument - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_DEMARSHAL_CS); - ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_compiled_visitor_operation_ami_handler_operation_ss::" - "gen_demarshal_params - " - "codegen for demarshal failed\n"), - -1); - } - *os << be_uidt_nl << "))\n" << be_idt; - - // if marshaling fails, raise exception - if (this->gen_raise_exception (bt, "CORBA::MARSHAL", - "", - "ACE_TRY_ENV") == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_compiled_visitor_operation_ami_handler_operation_ss::" - "gen_marshal_and invoke - " - "codegen for return var failed\n"), - -1); - } - *os << be_uidt << "\n"; - - }; - - return 0; -} - -int -be_compiled_visitor_operation_ami_handler_operation_ss::gen_marshal_params (be_operation *, - be_type *) -{ - // because we do not want to return something. - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp index 26826d0ff9f..c972a18f690 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp @@ -150,14 +150,12 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (be_op *os << parent->full_name (); *os << "::_narrow(_tao_reply_handler, ACE_TRY_ENV);" << be_uidt_nl; -//#if 0 *os << "ACE_CHECK;" << be_nl << be_nl << "// Exception handling" << be_nl << "switch (reply_status)" << be_idt_nl << "{" << be_idt_nl << "case TAO_AMI_REPLY_OK:" << be_idt_nl << "{\n"; -//#endif /* 0 */ // declare variables for arguments ctx = *this->ctx_; @@ -185,7 +183,6 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (be_op -1); } -//#if 0 os->indent (); *os << be_uidt_nl << "}" << be_uidt_nl << "return;" << be_uidt_nl @@ -247,7 +244,6 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation (be_op << "// We have to think about this case." << be_nl << "break;" << be_uidt_nl << "}" << be_uidt_nl; -//#endif /* 0 */ *os << be_uidt_nl << "};" << be_nl << be_nl; return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_result_arg.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_result_arg.cpp deleted file mode 100644 index 034b57745f0..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_result_arg.cpp +++ /dev/null @@ -1,186 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_result_arg.cpp -// -// = DESCRIPTION -// Visitor that generates the result argument in a call back method -// of a Reply Handler. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_operation, ami_handler_result_arg, "$Id$") - - -// ************************************************************ -// Visitor for parameter list in AMI Handler call back declarations -// and definitions. -// ************************************************************ - -be_visitor_operation_ami_handler_result_arg::be_visitor_operation_ami_handler_result_arg (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_ami_handler_result_arg::~be_visitor_operation_ami_handler_result_arg (void) -{ -} - -int -be_visitor_operation_ami_handler_result_arg::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - be_type *bt = be_type::narrow_from_decl (node); - - *os << "const " << bt->type_name (node) << " _tao_ami_result"; - - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << this->type_name (node) << " _tao_ami_result" ; - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << this->type_name (node, "_ptr") << " _tao_ami_result"; - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << this->type_name (node, "_ptr") << " _tao_ami_result"; - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_native (be_native *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - *os << this->type_name (node) << " _tao_ami_result"; - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) - { - *os << "const " << this->type_name (node) << " &" << " _tao_ami_result"; - } - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - *os << this->type_name (node, "_ptr") << " _tao_ami_result"; - } - else // simple predefined types - { - *os << this->type_name (node) << " _tao_ami_result"; - } - - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const " << this->type_name (node) << " &" << " _tao_ami_result"; - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - if (node->width () == sizeof (char)) - { - *os << "const char *" << " _tao_ami_result"; - } - else - { - *os << "const CORBA::WChar *" << " _tao_ami_result"; - } - - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const " << this->type_name (node) << " &" << " _tao_ami_result"; - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const " << this->type_name (node) << " &" << " _tao_ami_result"; - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_ami_handler_result_arg::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - - -#ifdef IDL_HAS_VALUETYPE - -int -be_visitor_operation_ami_handler_result_arg::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << this->type_name (node) << " *" << " _tao_ami_result"; - return 0; -} - -int -be_visitor_operation_ami_handler_result_arg::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const " << this->type_name (node) << " *" << " _tao_ami_result"; - return 0; -} - -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_sh.cpp deleted file mode 100644 index 1109840094c..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_sh.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_thru_poa_collocated_sh.cpp -// -// = DESCRIPTION -// Visitor generating code for thru_poa_collocated operation in the client stub -// Special code for the AMI Reply Handler -// -// = AUTHOR -// Aniruddha Gokhale -// Michael Kircher -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, ami_handler_thru_poa_collocated_sh, "$Id$") - - -// ************************************************************************* -// be_visitor_operation_ami_handler_thru_poa_collocated_sh -- -// This visitor generates code for the thru_poa_collocated operation signature in a -// server header file -// ************************************************************************* - -be_visitor_operation_ami_handler_thru_poa_collocated_sh::be_visitor_operation_ami_handler_thru_poa_collocated_sh -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_operation_ami_handler_thru_poa_collocated_sh::~be_visitor_operation_ami_handler_thru_poa_collocated_sh (void) -{ -} - -int be_visitor_operation_ami_handler_thru_poa_collocated_sh::visit_operation (be_operation *node) -{ - TAO_OutStream *os; // output stream - be_type *bt; // type node representing the return type - - os = this->ctx_->stream (); - this->ctx_->node (node); // save the node - - os->indent (); // start with the current indentation level - - // every operation is declared virtual in the client code - *os << "virtual "; - - // STEP I: generate the return type - bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_sh::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // STEP 2: generate the operation name - *os << "void "; - - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "set_"; - else - *os << "get_"; - } - - *os << node->local_name (); - - // STEP 3: generate the argument list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_sh::" - "visit_operation - " - "Bad visitor to return type\n"), - -1); - } - - if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_sh::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - delete visitor; - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp deleted file mode 100644 index 3a9408d23a9..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp +++ /dev/null @@ -1,255 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_thru_poa_collocated_ss.cpp -// -// = DESCRIPTION -// Visitor generating code for thru_poa_collocated Operation in the skeleton. -// -// = AUTHOR -// Aniruddha Gokhale -// Michael Kircher -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, ami_handler_thru_poa_collocated_ss, "$Id$") - - -// ************************************************************************* -// be_visitor_operation_ami_handler_thru_poa_collocated_ss -- -// This visitor generates code for the thru_poa_collocated operation signature in a -// server skeletons file -// ************************************************************************* - -be_visitor_operation_ami_handler_thru_poa_collocated_ss::be_visitor_operation_ami_handler_thru_poa_collocated_ss -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_operation_ami_handler_thru_poa_collocated_ss::~be_visitor_operation_ami_handler_thru_poa_collocated_ss (void) -{ -} - -int be_visitor_operation_ami_handler_thru_poa_collocated_ss::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context - be_interface *intf; - intf = this->ctx_->attribute () - ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) - : be_interface::narrow_from_scope (node->defined_in ()); - - if (!intf) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_thru_poa_collocated_ss::" - "visit_operation - " - "bad interface scope\n"), - -1); - } - - // retrieve the operation return type - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_thru_poa_collocated_ss::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - - - *os << "void " << intf->full_coll_name (be_interface::THRU_POA) << "::"; - - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "set_"; - else - *os << "get_"; - } - - *os << node->local_name () << " "; - - // Generate the argument list with the appropriate mapping (same as - // in the header file) - // Generate the argument list with the appropriate mapping (same as - // in the header file). - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if ((!visitor) || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_thru_poa_collocated_ss::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - delete visitor; - - - *os << "{" << be_idt_nl; - - // @@ Michael: Not sure about this one. -#if 0 - if (!idl_global->exception_support ()) - *os << "ACE_DECLARE_NEW_CORBA_ENV;" << be_nl; -#endif /* 0 */ - - *os <<"TAO_Object_Adapter::Servant_Upcall servant_upcall (" - << be_idt << be_idt_nl - << "*this->_stubobj ()->servant_orb_var ()->orb_core ()->object_adapter ()" - << be_uidt_nl - << ");" << be_uidt_nl - << "servant_upcall.prepare_for_upcall (" << be_idt << be_idt_nl - << "this->_object_key ()," << be_nl - << "\"" << node->original_local_name () << "\""; - if (!idl_global->exception_support ()) - *os << "," << be_nl - << "ACE_TRY_ENV" << be_uidt_nl - << ");\n" << be_uidt; - else - *os << be_uidt_nl << ");\n" << be_uidt; - - // check if there is an exception - if (!idl_global->exception_support ()) - { - os->indent (); - *os << "ACE_CHECK;\n"; - } - - os->indent (); - *os << "ACE_reinterpret_cast (" << be_idt << be_idt_nl - << intf->full_skel_name () << "_ptr," << be_nl - << "servant_upcall.servant ()->_downcast (" << be_idt << be_idt_nl - << "\"" << intf->repoID () << "\"" << be_uidt_nl - << ")" << be_uidt << be_uidt_nl - << ")" << be_uidt; - - if (this->gen_invoke (ctx, node) == -1) - return -1; - - os->indent (); - *os << "return;"; - - *os << be_uidt_nl - << "}\n\n"; - - return 0; -} - -int be_visitor_operation_ami_handler_thru_poa_collocated_ss::gen_invoke (be_visitor_context &ctx, - be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "->"; - - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "set_"; - else - *os << "get_"; - } - - *os << node->local_name () << " (" - << be_idt << be_idt << "\n"; - - // retrieve the operation return type - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - if (!this->void_return_type (bt)) - { - os->indent (); - *os << "_tao_retval,\n"; - } - - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_COLLOCATED_ARG_UPCALL_SS); - if (this->has_param_type (node, AST_Argument::dir_INOUT) - || this->has_param_type (node, AST_Argument::dir_OUT)) - ctx.sub_state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_HAS_ARGUMENTS); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ami_handler_thru_poa_collocated_ss::" - "gen_invoke - " - "codegen for making upcall failed\n"), - -1); - } - - // end the upcall - *os << be_uidt_nl - << ");\n" << be_uidt; - return 0; -} - - -int -be_visitor_operation_ami_handler_thru_poa_collocated_ss::void_return_type (be_type *bt) -{ - // is the operation return type void? - - if (bt->node_type () == AST_Decl::NT_pre_defined - && (be_predefined_type::narrow_from_decl (bt)->pt () - == AST_PredefinedType::PT_void)) - return 1; - else - return 0; -} - -int -be_visitor_operation_ami_handler_thru_poa_collocated_ss::has_param_type (be_operation *node, - AST_Argument::Direction dir) -{ - // proceed if the number of members in our scope is greater than 0 - if (node->nmembers () > 0) - { - // initialize an iterator to iterate thru our scope - UTL_ScopeActiveIterator *si; - ACE_NEW_RETURN (si, - UTL_ScopeActiveIterator (node, - UTL_Scope::IK_decls), - 0); - // continue until each element is visited - while (!si->is_done ()) - { - be_argument *bd = be_argument::narrow_from_decl (si->item ()); - if (bd && (bd->direction () == dir)) - return 1; - - si->next (); - } // end of while loop - delete si; - } // end of if - - // not of the type we are looking for - return 0; -} diff --git a/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h index 99924fc6bdd..f5773906b07 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h +++ b/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h @@ -12,7 +12,10 @@ // be_visitor_ami_pre_proc.h // // = DESCRIPTION -// A visitor to generate the AMI implied IDL code. +// This visitor creates for AMI implied IDL constructs +// the appropriate AST (Abstract Syntax Tree) node, +// sets the corresponding interface or operation strategy +// on it and enteres the nodes into the AST. // // = AUTHOR // Michael Kircher <Michael.Kircher@mchp.siemens.de> diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument.h index 78f39acb854..560d37f2859 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument.h @@ -39,11 +39,5 @@ #include "be_visitor_argument/compiled_marshal_cs.h" #include "be_visitor_argument/compiled_marshal_ss.h" #include "be_visitor_argument/pre_invoke_cs.h" -#include "be_visitor_argument/ami_arglist.h" -#include "be_visitor_argument/ami_handler_arglist.h" -#include "be_visitor_argument/ami_handler_result_arg.h" -#include "be_visitor_argument/ami_handler_compiled_marshal_cs.h" -#include "be_visitor_argument/ami_handler_upcall_cs.h" -#include "be_visitor_argument/ami_handler_vardecl_cs.h" #endif /* _BE_VISITOR_ARGUMENT_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_arglist.h b/TAO/TAO_IDL/be_include/be_visitor_argument/ami_arglist.h deleted file mode 100644 index d5f11ad86b5..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_arglist.h +++ /dev/null @@ -1,96 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_arglist.h -// -// = DESCRIPTION -// Visitor for generation of code for Arguments as parameter lists -// in the operation signature of an AMI stub. -// -// = AUTHOR -// Aniruddha Gokhale & Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_AMI_ARGLIST_H_ -#define _BE_VISITOR_ARGUMENT_AMI_ARGLIST_H_ - -class be_visitor_args_ami_arglist : public be_visitor_args -{ - // - // = TITLE - // Generates the code for arguments output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. - // Sometimes the argument declarations must be generated (such as - // in the class declaration), other the arguments names (such as - // in method invocations). - // This class implements the declaration output, in other words, - // it outputs both the arguments and their types. - // -public: - be_visitor_args_ami_arglist (be_visitor_context *ctx); - // Constructor. - - virtual ~be_visitor_args_ami_arglist (void); - // Destructor. - - virtual int visit_argument (be_argument *node); - // Visit the argument node. - - // = visit all the nodes that can be the types for the argument. - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - - virtual int visit_native (be_native *node); - // visit native node - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype_fwd -#endif /* IDL_HAS_VALUETYPE */ -}; - -#endif /* _BE_VISITOR_ARGUMENT_ARGLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_arglist.h b/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_arglist.h deleted file mode 100644 index 63882f11020..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_arglist.h +++ /dev/null @@ -1,96 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_arglist.h -// -// = DESCRIPTION -// Visitor for generation of code for Arguments as parameter lists -// in the operation signature of an AMI stub. -// -// = AUTHOR -// Aniruddha Gokhale & Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_AMI_HANDLER_ARGLIST_H_ -#define _BE_VISITOR_ARGUMENT_AMI_HANDLER_ARGLIST_H_ - -class be_visitor_args_ami_handler_arglist : public be_visitor_args -{ - // - // = TITLE - // Generates the code for arguments output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. - // Sometimes the argument declarations must be generated (such as - // in the class declaration), other the arguments names (such as - // in method invocations). - // This class implements the declaration output, in other words, - // it outputs both the arguments and their types. - // -public: - be_visitor_args_ami_handler_arglist (be_visitor_context *ctx); - // Constructor. - - virtual ~be_visitor_args_ami_handler_arglist (void); - // Destructor. - - virtual int visit_argument (be_argument *node); - // Visit the argument node. - - // = visit all the nodes that can be the types for the argument. - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - - virtual int visit_native (be_native *node); - // visit native node - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype_fwd -#endif /* IDL_HAS_VALUETYPE */ -}; - -#endif /* _BE_VISITOR_ARGUMENT_ARGLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_compiled_marshal_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_compiled_marshal_cs.h deleted file mode 100644 index 11d8bef925f..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_compiled_marshal_cs.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_compiled_marshal_cs.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments for passing the arguments -// to the CDR << and >> operators -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_ami_handler_compiled_marshal_cs_H_ -#define _BE_VISITOR_ARGUMENT_ami_handler_compiled_marshal_cs_H_ - -// ************************************************************ -// class be_visitor_args_ami_handler_compiled_marshal_cs -// ************************************************************ -class be_visitor_args_ami_handler_compiled_marshal_cs : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_ami_handler_compiled_marshal_cs - // - // = DESCRIPTION - // Code to be generated when making the do_static_call - // -public: - be_visitor_args_ami_handler_compiled_marshal_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_ami_handler_compiled_marshal_cs (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward -#endif /* IDL_HAS_VALUETYPE */ - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -}; - -#endif /* _BE_VISITOR_ARGUMENT_ami_handler_compiled_marshal_cs_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_result_arg.h b/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_result_arg.h deleted file mode 100644 index 67e4d85b4a7..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_result_arg.h +++ /dev/null @@ -1,86 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_result_arg.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the return -// type of the operation -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGS_AMI_HANDLER_RESULT_ARG_H_ -#define _BE_VISITOR_ARGS_AMI_HANDLER_RESULT_ARG_H_ - -// *********************************************************************** -// Operation visitor for return types in the signature of the operation -// *********************************************************************** - -class be_visitor_args_ami_handler_result_arg : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_ch - // - // = DESCRIPTION - // This is a visitor to generate operation return types - // - // -public: - be_visitor_args_ami_handler_result_arg (be_visitor_context *ctx); - // constructor - - ~be_visitor_args_ami_handler_result_arg (void); - // destructor - - int visit_array (be_array *node); - // visit an array node - - int visit_enum (be_enum *node); - // visit an enum node - - int visit_interface (be_interface *node); - // visit an interface node - - int visit_interface_fwd (be_interface_fwd *node); - // visit an interface node - - int visit_native (be_native *node); - // visit native type - - int visit_predefined_type (be_predefined_type *node); - // visit a predefined type node - - int visit_sequence (be_sequence *node); - // visit a sequence node - - int visit_string (be_string *node); - // visit a sequence node - - int visit_structure (be_structure *node); - // visit a structure node - - int visit_typedef (be_typedef *node); - // visit a typedef node - - int visit_union (be_union *node); - // visit a union node - -# ifdef IDL_HAS_VALUETYPE - int visit_valuetype (be_valuetype *node); - int visit_valuetype_fwd (be_valuetype_fwd *node); -# endif /* IDL_HAS_VALUETYPE */ - -}; - -#endif /* _BE_VISITOR_ARGS_AMI_HANDLER_RESULT_ARG_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_upcall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_upcall_cs.h deleted file mode 100644 index a1da8fe0ed2..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_upcall_cs.h +++ /dev/null @@ -1,90 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_upcall_cs.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments. This generates the -// passing of arguments to the upcall. -// -// = AUTHOR -// Aniruddha Gokhale -// Michael Kircher -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_upcall_cs_H_ -#define _BE_VISITOR_ARGUMENT_upcall_cs_H_ - -// ************************************************************ -// class be_visitor_args_ami_handler_upcall_cs -// ************************************************************ -class be_visitor_args_ami_handler_upcall_cs : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_ami_handler_upcall_cs - // - // = DESCRIPTION - // Visitor for passing argument to the upcall - // -public: - be_visitor_args_ami_handler_upcall_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_ami_handler_upcall_cs (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward -#endif /* IDL_HAS_VALUETYPE */ - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -}; - -#endif /* _BE_VISITOR_ARGUMENT_upcall_cs_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_vardecl_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_vardecl_cs.h deleted file mode 100644 index fd2d80db63f..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/ami_handler_vardecl_cs.h +++ /dev/null @@ -1,126 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_vardecl_cs.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments. This generates the -// variable declartion for the argument in the server-sde skeleton -// -// = AUTHOR -// Aniruddha Gokhale -// Michael Kircher -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_ami_handler_vardecl_cs_H_ -#define _BE_VISITOR_ARGUMENT_ami_handler_vardecl_cs_H_ - -// ************************************************************ -// class be_visitor_args_ami_handler_vardecl_cs -// ************************************************************ -class be_visitor_args_ami_handler_vardecl_cs : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_ami_handler_vardecl_cs - // - // = DESCRIPTION - // Visitor for variable declaration for argument - // -public: - be_visitor_args_ami_handler_vardecl_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_ami_handler_vardecl_cs (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward -#endif /* IDL_HAS_VALUETYPE */ - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -}; - -// ************************************************************ -// class be_compiled_visitor_args_ami_handler_vardecl_cs -// ************************************************************ -class be_compiled_visitor_args_ami_handler_vardecl_cs : public be_visitor_args_ami_handler_vardecl_cs -{ - // - // = TITLE - // be_compiled_visitor_args_ami_handler_vardecl_cs - // - // = DESCRIPTION - // Visitor for variable declaration for argument for compiled marshaling - // skeletons - // -public: - be_compiled_visitor_args_ami_handler_vardecl_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_compiled_visitor_args_ami_handler_vardecl_cs (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward -#endif /* IDL_HAS_VALUETYPE */ - -}; - -#endif /* _BE_VISITOR_ARGUMENT_ami_handler_vardecl_cs_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h index d03f2d57874..cd39fb7ea1c 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h @@ -43,9 +43,5 @@ #include "be_visitor_interface/cdr_op_cs.h" #include "be_visitor_interface/tie_sh.h" #include "be_visitor_interface/tie_si.h" -#include "be_visitor_interface/ami_handler_fwd_ch.h" -#include "be_visitor_interface/ami_handler_fwd_ci.h" -#include "be_visitor_interface/ami_handler_stub_ch.h" -#include "be_visitor_interface/ami_handler_stub_cs.h" #endif /* _BE_VISITOR_INTERFACE_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ch.h deleted file mode 100644 index 158675919c9..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ch.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// $Id$ -// -/* -*- c++ -*- */ -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interface_fwd_ch.h -// -// = DESCRIPTION -// Concrete visitor for the Interface Forward node. -// This one provides code generation for interface forward node. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_INTERFACE_AMI_HANDLER_FWD_CH_H_ -#define _BE_INTERFACE_AMI_HANDLER_FWD_CH_H_ - -class be_visitor_interface_ami_handler_fwd_ch : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_interface_ami_handler_fwd_ch - // - // = DESCRIPTION - // This visitor visits the an interface and generates fwd - // declaration code for the AMI Handler interface. - // - // -public: - be_visitor_interface_ami_handler_fwd_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_ami_handler_fwd_ch (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit interface. -}; - -#endif /* _BE_INTERFACE_AMI_HANDLER_FWD_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ci.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ci.h deleted file mode 100644 index 5714eeeaac1..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_fwd_ci.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// $Id$ -// -/* -*- c++ -*- */ -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_fwd_ci.h -// -// = DESCRIPTION -// Concrete visitor for the Interface Forward node. -// This one provides code generation for interface forward node. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_INTERFACE_AMI_HANDLER_FWD_CI_H_ -#define _BE_INTERFACE_AMI_HANDLER_FWD_CI_H_ - -class be_visitor_interface_ami_handler_fwd_ci : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_interface_ami_handler_fwd_ci - // - // = DESCRIPTION - // This visitor visits the interface to generate the forward - // declration code for the AMI reply handler. - // - // -public: - be_visitor_interface_ami_handler_fwd_ci (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_ami_handler_fwd_ci (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit interface. - -}; - -#endif /* _BE_INTERFACE_INTERFACE_FWD_CH_I_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_servant_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_servant_ch.h deleted file mode 100644 index 8bc8857ed4f..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_servant_ch.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// $Id$ -// -/* -*- c++ -*- */ -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_servant_ch.h -// -// = DESCRIPTION -// Concrete visitor for the Interface node. -// This provides for code generation in the server header -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_INTERFACE_AMI_HANDLER_SERVANT_CH_H_ -#define _BE_INTERFACE_AMI_HANDLER_SERVANT_CH_H_ - -class be_visitor_interface_ami_handler_servant_ch : public be_visitor_interface -{ - // - // = TITLE - // be_visitor_interface_ami_handler_servant_ch - // - // = DESCRIPTION - // This is a concrete visitor to generate the server header for interface - // - // -public: - be_visitor_interface_ami_handler_servant_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_ami_handler_servant_ch (void); - // destructor - - virtual int visit_interface (be_interface *node); - // set the right context and make a visitor -}; - -#endif /* _BE_INTERFACE_AMI_HANDLER_SERVANT_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_servant_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_servant_cs.h deleted file mode 100644 index 71a082763e4..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_servant_cs.h +++ /dev/null @@ -1,46 +0,0 @@ -// $Id$ -// -// -/* -*- c++ -*- */ -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_servant_cs.h -// -// = DESCRIPTION -// Concrete visitor for the Interface node. -// This provides for code generation in the server skeleton -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_INTERFACE_INTERFACE_AMI_HANDLER_SERVANT_CS_H_ -#define _BE_INTERFACE_INTERFACE_AMI_HANDLER_SERVANT_CS_H_ - -class be_visitor_interface_ami_handler_servant_cs : public be_visitor_interface -{ - // - // = TITLE - // be_visitor_interface_ami_handler_servant_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons for interface - // - // -public: - be_visitor_interface_ami_handler_servant_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_ami_handler_servant_cs (void); - // destructor - - virtual int visit_interface (be_interface *node); - // set the right context and make a visitor -}; - -#endif /* _BE_INTERFACE_INTERFACE_AMI_HANDLER_SERVANT_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_stub_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_stub_ch.h deleted file mode 100644 index 149201d00db..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_stub_ch.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// $Id$ -// -/* -*- c++ -*- */ -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_stub_ch.h -// -// = DESCRIPTION -// Concrete visitor for the Interface node. -// This one provides code generation for interfaces in the client header. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_INTERFACE_AMI_HANDLER_STUB_CH_H_ -#define _BE_INTERFACE_AMI_HANDLER_STUB_CH_H_ - -// we need derived interface visitors for the client and server header files. For -// the others, they use the default interface visitor - -class be_visitor_interface_ami_handler_stub_ch : public be_visitor_interface -{ - // - // = TITLE - // be_visitor_ami_handler_stub_ch - // - // = DESCRIPTION - // This is a concrete visitor to generate the client header for - // interface. - // -public: - be_visitor_interface_ami_handler_stub_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_ami_handler_stub_ch (void); - // destructor - - virtual int visit_interface (be_interface *node); - // set the right context and make a visitor -}; - -#endif /* _BE_INTERFACE_AMI_HANDLER_STUB_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_stub_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_stub_cs.h deleted file mode 100644 index 3af5f1a4720..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/ami_handler_stub_cs.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// -/* -*- c++ -*- */ -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_cs.h -// -// = DESCRIPTION -// Concrete visitor for the Interface node. -// This one provides code generation for interfaces in the client stubs. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_INTERFACE_AMI_HANDLER_CS_H_ -#define _BE_INTERFACE_AMI_HANDLER_CS_H_ - -class be_visitor_interface_ami_handler_stub_cs : public be_visitor_interface -{ - // - // = TITLE - // be_visitor_interface_ami_handler_stub_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the AMI Handler - // skeletons for interface. - // -public: - be_visitor_interface_ami_handler_stub_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_interface_ami_handler_stub_cs (void); - // destructor - - virtual int visit_interface (be_interface *node); - // set the right context and make a visitor -}; - -#endif /* _BE_INTERFACE_AMI_HANDLER_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation.h index fb8cf03fed4..6b675d0f147 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation.h @@ -61,17 +61,4 @@ #include "be_visitor_operation/ami_handler_reply_stub_operation_cs.h" #include "be_visitor_operation/ami_exception_holder_operation_cs.h" -#if 0 -#include "be_visitor_operation/ami_arglist.h" -#include "be_visitor_operation/ami_handler_arglist.h" -#include "be_visitor_operation/ami_handler_operation_ch.h" -#include "be_visitor_operation/ami_handler_operation_cs.h" -#include "be_visitor_operation/ami_handler_operation_ss.h" -#include "be_visitor_operation/ami_handler_argument_marshal.h" -#include "be_visitor_operation/ami_handler_thru_poa_collocated_sh.h" -#include "be_visitor_operation/ami_handler_thru_poa_collocated_ss.h" -#include "be_visitor_operation/ami_exception_holder_operation_ch.h" - -#endif /* 0 */ - #endif // TAO_BE_VISITOR_OPERATION_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_arglist.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_arglist.h deleted file mode 100644 index 26c09921b7e..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_arglist.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_arglist.h -// -// = DESCRIPTION -// Visitor for generating IDL Stub code for IDL operations. This -// generates the operation signature for the IDL stub. -// -// = AUTHOR -// Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_AMI_ARGLIST_H_ -#define _BE_VISITOR_OPERATION_AMI_ARGLIST_H_ - -// ****************************************************************************** -// Operation visitor for argument list - generates parameters in the signature -// ****************************************************************************** - -class be_visitor_operation_ami_arglist : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_operaion_ami_arglist - // - // = DESCRIPTION - // This is a visitor to generate operation argument list for an - // AMI stub. - // - // -public: - be_visitor_operation_ami_arglist (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_arglist (void); - // destructor - - int visit_operation (be_operation *node); - // visit the operation - - int visit_argument (be_argument *node); - // visit each argument -}; - -#endif /* _BE_VISITOR_OPERATION_AMI_ARGLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_arglist.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_arglist.h deleted file mode 100644 index 9e0ceb2c62d..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_arglist.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_arglist.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the -// operation signature. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_AMI_HANDLER_ARGLIST_H_ -#define _BE_VISITOR_OPERATION_AMI_HANDLER_ARGLIST_H_ - -// ****************************************************************************** -// Operation visitor for argument list - generates parameters in the signature -// ****************************************************************************** - -class be_visitor_operation_ami_handler_arglist : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operaion_ami_handler_arglist - // - // = DESCRIPTION - // This is a visitor to generate operation argument list - // - // -public: - be_visitor_operation_ami_handler_arglist (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_handler_arglist (void); - // destructor - - virtual int visit_scope (be_scope *node); - // Visit the scope and its elements. - // This implementation is the same as - // <be_visitor_scope::visit_scope>. The variation is that it calls the - // <post_process> only if the return value of the <accept> is 1. We - // need to do this since we have to differentiate between an argument - // that was printed and an argument that was skipped in the signature. - - virtual int visit_operation (be_operation *node); - // visit the operation - - virtual int visit_argument (be_argument *node); - // visit each argument - - virtual int post_process (be_decl *); - // stuff to o/p after each element of the scope is handled - -}; - -#endif /* _BE_VISITOR_OPERATION_AMI_HANDLER_ARGLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_argument_marshal.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_argument_marshal.h deleted file mode 100644 index 1697ff6cdd0..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_argument_marshal.h +++ /dev/null @@ -1,67 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_argument_marshal.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This is a visitor for -// passing arguments to the CDR operators in a compiled marshaling -// stub/skeleton -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_ami_handler_argument_marshal_H_ -#define _BE_VISITOR_OPERATION_ami_handler_argument_marshal_H_ - -// ************************************************************ -// generic operation visitor for docall, upcall, pre/post -// ************************************************************ - -class be_compiled_visitor_operation_ami_handler_argument_marshal - : public be_visitor_operation_argument -{ - // - // = TITLE - // be_compiled_visitor_operation_ami_handler_argument_marshal - // - // = DESCRIPTION - // This is a visitor to generate a variable declaration of an operation - // return type - // -public: - be_compiled_visitor_operation_ami_handler_argument_marshal (be_visitor_context *ctx); - // constructor - - ~be_compiled_visitor_operation_ami_handler_argument_marshal (void); - // destructor - - virtual int pre_process (be_decl *bd); - // stuff to o/p before each element of the scope is handled - - virtual int post_process (be_decl *bd); - // stuff to o/p after each element of the scope is handled - - enum LAST_ARG_PRINTED - { - TAO_ARG_NONE, - TAO_ARG_IN, - TAO_ARG_INOUT, - TAO_ARG_OUT - }; - -private: - LAST_ARG_PRINTED last_arg_printed_; -}; - - -#endif /* _BE_VISITOR_OPERATION_ami_handler_argument_marshal_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation.h deleted file mode 100644 index cb7640b40b0..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation.h +++ /dev/null @@ -1,52 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_operation_ch.h -// -// = DESCRIPTION -// Visitor for generating code for AMI Handler call back operations -// in client header. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_AMI_HANDLER_OPERATION_CH_H_ -#define _BE_VISITOR_OPERATION_AMI_HANDLER_OPERATION_CH_H_ - -// ************************************************************ -// Operation visitor for server header -// ************************************************************ - -class be_visitor_operation_ami_handler_operation_ch : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_ami_handler_operation_ch - // - // = DESCRIPTION - // This is a concrete visitor to generate the server header for operation - // - // -public: - be_visitor_operation_ami_handler_operation_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_handler_operation_ch (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation. - -}; - -#endif /* _BE_VISITOR_OPERATION_AMI_HANDLER_OPERATION_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_ch.h deleted file mode 100644 index cb7640b40b0..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_ch.h +++ /dev/null @@ -1,52 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_operation_ch.h -// -// = DESCRIPTION -// Visitor for generating code for AMI Handler call back operations -// in client header. -// -// = AUTHOR -// Aniruddha Gokhale and Alexander Babu Arulanthu -// <alex@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_AMI_HANDLER_OPERATION_CH_H_ -#define _BE_VISITOR_OPERATION_AMI_HANDLER_OPERATION_CH_H_ - -// ************************************************************ -// Operation visitor for server header -// ************************************************************ - -class be_visitor_operation_ami_handler_operation_ch : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_ami_handler_operation_ch - // - // = DESCRIPTION - // This is a concrete visitor to generate the server header for operation - // - // -public: - be_visitor_operation_ami_handler_operation_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_handler_operation_ch (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation. - -}; - -#endif /* _BE_VISITOR_OPERATION_AMI_HANDLER_OPERATION_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_cs.h deleted file mode 100644 index 139cc1ecd37..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_cs.h +++ /dev/null @@ -1,126 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// operation_ami_handler_operation_cs.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations in client stubs -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_OPERATION_AMI_HANDLER_OPERATION_CS_H_ -#define _BE_VISITOR_OPERATION_OPERATION_AMI_HANDLER_OPERATION_CS_H_ - -// ************************************************************ -// Operation visitor for client stubs -// ************************************************************ - -class be_visitor_operation_ami_handler_operation_cs : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operation_ami_handler_operation_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the client stubs for operation - // - // -public: - be_visitor_operation_ami_handler_operation_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_handler_operation_cs (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation. - - virtual int visit_argument (be_argument *node); - // visit argument to generate ParamData entries - - // = template methods - virtual int gen_pre_stub_info (be_operation *, be_type *) = 0; - // generate any info before the actual code for the stub is generated - - virtual int gen_marshal_and_invoke (be_operation *, be_type *) = 0; - // generate code that marshals the arguments and transmits them - - // =helper - virtual int post_process (be_decl *); - // stuff to output after every member of the scope is handled - - virtual int gen_raise_exception (be_type *, - const char * excep, - const char * status); - // helper that generates code for raising an exception - - virtual int gen_check_exception (be_type *); - // helper that generates code for checking for an exception - -}; - -// specialized visitors - -class be_interpretive_visitor_operation_ami_handler_operation_cs : public be_visitor_operation_ami_handler_operation_cs -{ - // - // = TITLE - // be_interpretive_visitor_operation_ami_handler_operation_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the client stubs for operation - // using interpretive marshaling. - // - // -public: - be_interpretive_visitor_operation_ami_handler_operation_cs (be_visitor_context *); - // ctor - - ~be_interpretive_visitor_operation_ami_handler_operation_cs (void); - // dtor - - virtual int gen_pre_stub_info (be_operation *, be_type *); - // generate any info before the actual code for the stub is generated - - virtual int gen_marshal_and_invoke (be_operation *, be_type *); - // generate code that marshals the arguments and transmits them - -}; - -class be_compiled_visitor_operation_ami_handler_operation_cs : public be_visitor_operation_ami_handler_operation_cs -{ - // - // = TITLE - // be_compiled_visitor_operation_ami_handler_operation_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the client stubs for operation - // using compiled marshaling. - // - // -public: - be_compiled_visitor_operation_ami_handler_operation_cs (be_visitor_context *); - // ctor - - ~be_compiled_visitor_operation_ami_handler_operation_cs (void); - // dtor - - virtual int gen_pre_stub_info (be_operation *, be_type *); - // generate any info before the actual code for the stub is generated - - virtual int gen_marshal_and_invoke (be_operation *, be_type *); - // generate code that marshals the arguments and transmits them - -}; - -#endif /* _BE_VISITOR_OPERATION_OPERATION_AMI_HANDLER_OPERATION_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_ss.h deleted file mode 100644 index 2758e86fce3..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_operation_ss.h +++ /dev/null @@ -1,142 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_operation_ss.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations in server skeletons -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_ami_handler_operation_ss_H_ -#define _BE_VISITOR_OPERATION_ami_handler_operation_ss_H_ - -// ************************************************************ -// Operation visitor for server skeletons -// ************************************************************ - -class be_visitor_operation_ami_handler_operation_ss : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operation_ami_handler_operation_ss - // - // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons for operation - // - // -public: - - be_visitor_operation_ami_handler_operation_ss (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_handler_operation_ss (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation. We provide code for this method in the derived class - - virtual int visit_argument (be_argument *node); - // visit argument to generate ParamData entries - - // template methods - - virtual int gen_pre_skel_info (be_operation *, be_type *) = 0; - // generate any pre skeleton code info - - virtual int gen_demarshal_params (be_operation *, be_type *) = 0; - // generate code for demarshaling incoming parameters - - virtual int gen_marshal_params (be_operation *, be_type *) = 0; - // generate code for marshaling outgoing parameters - - // = helper - virtual int post_process (be_decl *); - // stuff to output after every member of the scope is handled - - virtual int gen_raise_exception (be_type *, - const char * excep, - const char * status, - const char * env); - // helper that generates code for raising an exception - - virtual int gen_check_exception (be_type *, const char *env); - // helper that generates code for checking for an exception - -}; - -// concrete visitors - -class be_interpretive_visitor_operation_ami_handler_operation_ss : public be_visitor_operation_ami_handler_operation_ss -{ - // - // = TITLE - // be_interpretive_visitor_operation_ami_handler_operation_ss - // - // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons for - // operation using interpretive marshaling - // - // -public: - be_interpretive_visitor_operation_ami_handler_operation_ss (be_visitor_context *ctx); - // constructor - - ~be_interpretive_visitor_operation_ami_handler_operation_ss (void); - // destructor - - // template methods - - virtual int gen_pre_skel_info (be_operation *, be_type *); - // generate any pre skeleton code info - - virtual int gen_demarshal_params (be_operation *, be_type *); - // generate code for demarshaling incoming parameters - - virtual int gen_marshal_params (be_operation *, be_type *); - // generate code for marshaling outgoing parameters - -}; - -class be_compiled_visitor_operation_ami_handler_operation_ss : public be_visitor_operation_ami_handler_operation_ss -{ - // - // = TITLE - // be_compiled_visitor_operation_ami_handler_operation_ss - // - // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons for - // operation using compiled marshaling - // - // -public: - be_compiled_visitor_operation_ami_handler_operation_ss (be_visitor_context *ctx); - // constructor - - ~be_compiled_visitor_operation_ami_handler_operation_ss (void); - // destructor - - // template methods - - virtual int gen_pre_skel_info (be_operation *, be_type *); - // generate any pre skeleton code info - - virtual int gen_demarshal_params (be_operation *, be_type *); - // generate code for demarshaling incoming parameters - - virtual int gen_marshal_params (be_operation *, be_type *); - // generate code for marshaling outgoing parameters - -}; - -#endif /* _BE_VISITOR_OPERATION_ami_handler_operation_ss_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_result_arg.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_result_arg.h deleted file mode 100644 index 4405174311f..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_result_arg.h +++ /dev/null @@ -1,86 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_result_arg.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the return -// type of the operation -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_AMI_HANDLER_RESULT_ARG_H_ -#define _BE_VISITOR_OPERATION_AMI_HANDLER_RESULT_ARG_H_ - -// *********************************************************************** -// Operation visitor for return types in the signature of the operation -// *********************************************************************** - -class be_visitor_operation_ami_handler_result_arg : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operation_ch - // - // = DESCRIPTION - // This is a visitor to generate operation return types - // - // -public: - be_visitor_operation_ami_handler_result_arg (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_handler_result_arg (void); - // destructor - - int visit_array (be_array *node); - // visit an array node - - int visit_enum (be_enum *node); - // visit an enum node - - int visit_interface (be_interface *node); - // visit an interface node - - int visit_interface_fwd (be_interface_fwd *node); - // visit an interface node - - int visit_native (be_native *node); - // visit native type - - int visit_predefined_type (be_predefined_type *node); - // visit a predefined type node - - int visit_sequence (be_sequence *node); - // visit a sequence node - - int visit_string (be_string *node); - // visit a sequence node - - int visit_structure (be_structure *node); - // visit a structure node - - int visit_typedef (be_typedef *node); - // visit a typedef node - - int visit_union (be_union *node); - // visit a union node - -# ifdef IDL_HAS_VALUETYPE - int visit_valuetype (be_valuetype *node); - int visit_valuetype_fwd (be_valuetype_fwd *node); -# endif /* IDL_HAS_VALUETYPE */ - -}; - -#endif /* _BE_VISITOR_OPERATION_AMI_HANDLER_RESULT_ARG_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_sh.h deleted file mode 100644 index 1c9382db67f..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_sh.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// thru_poa_collocated_sh.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations for the thru_poa collocated case -// inside of the servant header -// Special code for the AMI Reply Handler -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_AMI_HANDLER_THRU_POA_COLLOCATED_SH_H_ -#define _BE_VISITOR_OPERATION_AMI_HANDLER_THRU_POA_COLLOCATED_SH_H_ - -// ************************************************************ -// Operation visitor for server header in the thru_poa collocated class -// ************************************************************ - -class be_visitor_operation_ami_handler_thru_poa_collocated_sh : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_operation_ami_handler_thru_poa_collocated_sh - // - // = DESCRIPTION - // This is a concrete visitor to generate the server header for operation - // in the thru_poa collocated class - // - // -public: - be_visitor_operation_ami_handler_thru_poa_collocated_sh (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_handler_thru_poa_collocated_sh (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation node. - -}; - -#endif /* _BE_VISITOR_OPERATION_AMI_HANDLER_THRU_POA_COLLOCATED_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_ss.h deleted file mode 100644 index 878db449adf..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_ss.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_handler_thru_poa_collocated_ss.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations for the thru_poa collocated case -// inside of the servant skeleton -// -// = AUTHOR -// Aniruddha Gokhale -// Michael Kircher -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_AMI_HANDLER_THRU_POA_COLLOCATED_SS_H_ -#define _BE_VISITOR_OPERATION_AMI_HANDLER_THRU_POA_COLLOCATED_SS_H_ - -// ***************************************************************** -// Operation visitor for server skeletons for the thru_poa collocated class -// ***************************************************************** - -class be_visitor_operation_ami_handler_thru_poa_collocated_ss : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_operation_ss - // - // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons for - // operation in the thru_poa collocated class - // - // -public: - be_visitor_operation_ami_handler_thru_poa_collocated_ss (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_ami_handler_thru_poa_collocated_ss (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation node. - - virtual int gen_invoke (be_visitor_context &ctx, be_operation *node); - // A helper method to generate operation invocation code. - - virtual int void_return_type (be_type *bt); - // is my return type void? - - virtual int has_param_type (be_operation *, AST_Argument::Direction); - // does any of the argument node have the specified direct -}; - -#endif /* _BE_VISITOR_OPERATION_AMI_HANDLER_THRU_POA_COLLOCATED_SS_H_ */ |