Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_operation / operation_is.cpp
blob8ed90f466bbd495683eda3a9b53bee06e3084a12
2 //=============================================================================
3 /**
4 * @file operation_is.cpp
6 * Visitor generating code for Operation in the implementation skeleton
8 * @author Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
9 */
10 //=============================================================================
12 #include "operation.h"
14 be_visitor_operation_is::be_visitor_operation_is (be_visitor_context *ctx)
15 : be_visitor_operation (ctx)
19 be_visitor_operation_is::~be_visitor_operation_is ()
23 int
24 be_visitor_operation_is::visit_operation (be_operation *node)
26 // Impl classes shouldn't have implied AMI operations.
27 if (node->is_sendc_ami ())
29 return 0;
32 TAO_OutStream *os = this->ctx_->stream ();
33 be_interface *intf = this->ctx_->interface ();
35 this->ctx_->node (node); // save the node
37 // STEP I: generate the return type
38 be_type *bt = dynamic_cast<be_type*> (node->return_type ());
40 if (!bt)
42 ACE_ERROR_RETURN ((LM_ERROR,
43 "(%N:%l) be_visitor_operation_is::"
44 "visit_operation - "
45 "Bad return type\n"),
46 -1);
49 if (be_global->gen_impl_debug_info ())
51 TAO_INSERT_COMMENT (os);
54 be_visitor_context ctx (*this->ctx_);
55 be_visitor_operation_rettype oro_visitor (&ctx);
57 if (bt->accept (&oro_visitor) == -1)
59 ACE_ERROR_RETURN ((LM_ERROR,
60 "(%N:%l) be_visitor_operation_is::"
61 "visit_operation - "
62 "codegen for return type failed\n"),
63 -1);
66 const char *classname = nullptr;
68 if (intf)
70 // If derived class/
71 classname = intf->flat_name ();
73 else
75 classname = ScopeAsDecl (node->defined_in ())->flat_name ();
78 // STEP 2: generate the operation name
79 *os << " " << be_global->impl_class_prefix () << classname
80 << be_global->impl_class_suffix () << "::"
81 << node->local_name ();
83 // STEP 3: generate the argument list with the appropriate mapping. For these
84 // we grab a visitor that generates the parameter listing
85 ctx = *this->ctx_;
86 ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_IS);
87 be_visitor_operation_arglist oa_visitor (&ctx);
89 if (node->accept (&oa_visitor) == -1)
91 ACE_ERROR_RETURN ((LM_ERROR,
92 "(%N:%l) be_visitor_operation_is::"
93 "visit_operation - "
94 "codegen for argument list failed\n"),
95 -1);
98 *os << be_nl << "{" << be_idt_nl;
99 *os << "// Add your implementation here" << be_uidt_nl;
100 *os << "}" << be_nl_2;
102 return 0;