2 //=============================================================================
4 * @file operation_sh.cpp
6 * Visitor generating code for Operation in the server header
8 * @author Aniruddha Gokhale
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 ()
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 ())
32 TAO_OutStream
*os
= this->ctx_
->stream ();
33 this->ctx_
->node (node
);
35 TAO_INSERT_COMMENT (os
);
39 // STEP I: generate the return type.
40 be_type
*bt
= dynamic_cast<be_type
*> (node
->return_type ());
44 ACE_ERROR_RETURN ((LM_ERROR
,
45 "(%N:%l) be_visitor_operation_sh::"
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::"
59 "codegen for return type failed\n"),
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
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::"
77 "codegen for argument list failed\n"),
81 // Generate the corresponding static skeleton method for this operation only
82 // if there was no "native" type.
83 if (!node
->has_native ())
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)
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