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_sh.cpp
blob4ebc3183199b4b32ec1a52b8c47bf63229f468c7
2 //=============================================================================
3 /**
4 * @file operation_sh.cpp
6 * Visitor generating code for Operation in the server header
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "operation.h"
14 be_visitor_operation_sh::be_visitor_operation_sh (be_visitor_context *ctx)
15 : be_visitor_operation (ctx)
19 be_visitor_operation_sh::~be_visitor_operation_sh ()
23 int
24 be_visitor_operation_sh::visit_operation (be_operation *node)
26 /// No server-side code generation for these implied IDL nodes.
27 if (node->is_sendc_ami ())
29 return 0;
32 TAO_OutStream *os = this->ctx_->stream ();
33 this->ctx_->node (node);
35 TAO_INSERT_COMMENT (os);
37 *os << "virtual ";
39 // STEP I: generate the return type.
40 be_type *bt = dynamic_cast<be_type*> (node->return_type ());
42 if (!bt)
44 ACE_ERROR_RETURN ((LM_ERROR,
45 "(%N:%l) be_visitor_operation_sh::"
46 "visit_operation - "
47 "Bad return type\n"),
48 -1);
51 be_visitor_context ctx (*this->ctx_);
52 be_visitor_operation_rettype oro_visitor (&ctx);
54 if (bt->accept (&oro_visitor) == -1)
56 ACE_ERROR_RETURN ((LM_ERROR,
57 "(%N:%l) be_visitor_operation_sh::"
58 "visit_operation - "
59 "codegen for return type failed\n"),
60 -1);
63 // STEP 2: generate the operation name
64 *os << " " << node->local_name ();
66 // STEP 3: generate the argument list with the appropriate mapping. For these
67 // we grab a visitor that generates the parameter listing
68 ctx = *this->ctx_;
69 ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_SH);
70 be_visitor_operation_arglist oa_visitor (&ctx);
72 if (node->accept (&oa_visitor) == -1)
74 ACE_ERROR_RETURN ((LM_ERROR,
75 "(%N:%l) be_visitor_operation_sh::"
76 "visit_operation - "
77 "codegen for argument list failed\n"),
78 -1);
81 // Generate the corresponding static skeleton method for this operation only
82 // if there was no "native" type.
83 if (!node->has_native ())
85 *os << be_nl_2
86 << "static void ";
88 // Check if we are an attribute node in disguise.
89 if (this->ctx_->attribute ())
91 // Now check if we are a "get" or "set" operation
92 if (node->nmembers () == 1)
94 *os << "_set_";
96 else
98 *os << "_get_";
102 *os << node->local_name ()
103 << "_skel (" << be_idt << be_idt_nl
104 << "TAO_ServerRequest &server_request," << be_nl
105 << "TAO::Portable_Server::Servant_Upcall *servant_upcall," << be_nl
106 << "TAO_ServantBase *servant);" << be_uidt
107 << be_uidt;
110 return 0;