diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1998-06-03 00:12:43 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1998-06-03 00:12:43 +0000 |
commit | 72365054f34b183fd406413e403318561c853816 (patch) | |
tree | 4ae922d838703c22d7dd8262a61ed173a6018790 /TAO/TAO_IDL/be/be_visitor_operation.cpp | |
parent | edde21f0c7ea24bca69315de322ed9bb2c4205c0 (diff) | |
download | ATCD-72365054f34b183fd406413e403318561c853816.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_operation.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation.cpp | 229 |
1 files changed, 229 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp index 3ceb559ac9f..6a60aa62722 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp @@ -3254,3 +3254,232 @@ be_visitor_operation_exceptlist_cs::visit_operation (be_operation *node) } // end of if return 0; } + +// ************************************************************ +// Operation visitor for server header for TIE class operations +// ************************************************************ + +be_visitor_operation_tie_sh::be_visitor_operation_tie_sh (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_tie_sh::~be_visitor_operation_tie_sh (void) +{ +} + +int +be_visitor_operation_tie_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 + + // 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_tie_sh::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // grab the right visitor to generate the return type + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_tie_sh::" + "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_tie_sh::" + "visit_operation - " + "codegen for return type failed\n"), + -1); + } + delete visitor; + + // 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 + ctx = *this->ctx_; + // we use the _CH state here because the _SH state produces pure virtual + // methods. + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_tie_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_tie_sh::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; +} + +// ************************************************************ +// Operation visitor for server inline for TIE class operations +// ************************************************************ + +be_visitor_operation_tie_si::be_visitor_operation_tie_si +(be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_operation_tie_si::~be_visitor_operation_tie_si (void) +{ +} + +int be_visitor_operation_tie_si::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_tie_si::" + "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_tie_si::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + os->indent (); + *os << "template <class T> ACE_INLINE\n"; + + // generate the return type mapping (same as in the header file) + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_tie_si::" + "visit_operation - " + "Bad visitor for return type\n"), + -1); + } + + if (bt->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_tie_si::" + "visit_operation - " + "codegen for return type failed\n"), + -1); + } + delete visitor; + + *os << " " << intf->full_skel_name () << "_tie<T>::" + << node->local_name () << " "; + + // STEP 4: generate the argument list with the appropriate mapping (same as + // in the header file) + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_cs::" + "visit_operation - " + "Bad visitor for argument list\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; + + *os << "{" << be_idt << "\n"; + + os->indent (); + if (bt->node_type () != AST_Decl::NT_pre_defined + || be_predefined_type::narrow_from_decl (bt)->pt () != AST_PredefinedType::PT_void) + { + *os << "return "; + } + + *os << "this->ptr_->" << node->local_name () << " (" << be_idt << "\n"; + + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_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_ss::" + "visit_operation - " + "codegen for making upcall failed\n"), + -1); + } + // last argument is the environment + if (node->argument_count () > 0) + *os << ",\n"; + os->indent (); + *os << "_tao_environment"; + // end the upcall + *os << be_uidt_nl; + *os << ");" << be_uidt_nl; + *os << "}\n\n"; + + return 0; +} |