From 33433e5e1b4d5eabff2e20dd834f6939f5f49aec Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 10 Jun 1999 00:38:53 +0000 Subject: ChangeLog Entry: Wed Jun 9 19:19:43 1999 Alexander Babu Arulanthu --- TAO/TAO_IDL/be/be_visitor_argument/arglist_ami.cpp | 91 ++++++++++++++++++++ .../be_include/be_visitor_argument/arglist_ami.h | 96 ++++++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 TAO/TAO_IDL/be/be_visitor_argument/arglist_ami.cpp create mode 100644 TAO/TAO_IDL/be_include/be_visitor_argument/arglist_ami.h diff --git a/TAO/TAO_IDL/be/be_visitor_argument/arglist_ami.cpp b/TAO/TAO_IDL/be/be_visitor_argument/arglist_ami.cpp new file mode 100644 index 00000000000..d8c343f9188 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_argument/arglist_ami.cpp @@ -0,0 +1,91 @@ +// +// $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, arglist_ami, "$Id$") + + +// ************************************************************ +// be_visitor_args_arglist for parameter list in method declarations and +// definitions for AMI stubs. +// ************************************************************ + +be_visitor_args_arglist_ami::be_visitor_args_arglist_ami (be_visitor_context *ctx) + : be_visitor_args (ctx) +{ +} + +be_visitor_args_arglist_ami::~be_visitor_args_arglist_ami (void) +{ +} + +int +be_visitor_args_arglist_ami::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 + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_arglist::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + *os << " " << node->local_name () << ",\n"; + return 0; +} + +int +be_visitor_args_arglist_ami::visit_native (be_native *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + switch (this->direction ()) + { + // No out Parameters in the AMI stub: + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << this->type_name (node); + break; + } + return 0; +} diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/arglist_ami.h b/TAO/TAO_IDL/be_include/be_visitor_argument/arglist_ami.h new file mode 100644 index 00000000000..3c9256d4b2f --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/arglist_ami.h @@ -0,0 +1,96 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// arglist_ami.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 +// +// ============================================================================ + +#ifndef _BE_VISITOR_ARGUMENT_ARGLIST_AMI_H_ +#define _BE_VISITOR_ARGUMENT_ARGLIST_AMI_H_ + +class be_visitor_args_arglist_ami : 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_arglist_ami (be_visitor_context *ctx); + // Constructor. + + virtual ~be_visitor_args_arglist_ami (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_ */ -- cgit v1.2.1