Remove redundant void from tao_idl
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_operation / operation_ch.cpp
blobc367cd2c401616013be279800fa45370be40a10a
2 //=============================================================================
3 /**
4 * @file operation_ch.cpp
6 * Visitor generating code for Operation node in the client header.
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "operation.h"
14 // ******************************************************
15 // Primary visitor for "operation" in client header.
16 // ******************************************************
18 be_visitor_operation_ch::be_visitor_operation_ch (be_visitor_context *ctx)
19 : be_visitor_operation (ctx)
23 be_visitor_operation_ch::~be_visitor_operation_ch ()
27 int
28 be_visitor_operation_ch::visit_operation (be_operation *node)
30 TAO_OutStream *os = this->ctx_->stream ();
32 this->ctx_->node (node);
34 *os << be_nl_2;
36 // STEP I: generate the return type.
37 be_type *bt = dynamic_cast<be_type*> (node->return_type ());
39 if (!bt)
41 ACE_ERROR_RETURN ((LM_ERROR,
42 ACE_TEXT ("be_visitor_operation_ch::")
43 ACE_TEXT ("visit_operation - ")
44 ACE_TEXT ("Bad return type\n")),
45 -1);
47 //Only if we are generating exec header file, generate DOxygen documentation
48 if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_EXH)
50 if (this->void_return_type (bt))
52 *os << "/// Setter for " << node->local_name() << " attribute" << be_nl
53 << "/// @param[in] " << node->local_name() << " - New value for "
54 << node->local_name() << " attribute" << be_nl;
58 else
60 *os << "/// Getter for " << node->local_name() << " attribute" << be_nl
61 << "/// @return value of " << node->local_name() << " attribute" << be_nl;
64 *os << "virtual ";
66 // Grab the right visitor to generate the return type.
67 be_visitor_context ctx (*this->ctx_);
68 be_visitor_operation_rettype or_visitor (&ctx);
70 if (bt->accept (&or_visitor) == -1)
72 ACE_ERROR_RETURN ((LM_ERROR,
73 "(%N:%l) be_visitor_operation_ch::"
74 "visit_operation - "
75 "codegen for return type failed\n"),
76 -1);
79 // STEP 2: generate the operation name. The port prefix should
80 // be an empty string except for operations from attributes
81 // defined in a porttype.
82 *os << " " << node->local_name ();
84 // STEP 3: generate the argument list with the appropriate mapping. For these
85 // we grab a visitor that generates the parameter listing.
86 ctx = *this->ctx_;
87 ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH);
88 be_visitor_operation_arglist oa_visitor (&ctx);
90 if (node->accept (&oa_visitor) == -1)
92 ACE_ERROR_RETURN ((LM_ERROR,
93 "(%N:%l) be_visitor_operation_ch::"
94 "visit_operation - "
95 "codegen for argument list failed\n"),
96 -1);
99 be_interface *intf =
100 dynamic_cast<be_interface*> (node->defined_in ());
102 /// If we are in a reply handler, are not an excep_* operation,
103 /// and have no native args, then generate the AMI static
104 /// reply stub declaration.
105 if (intf != 0
106 && intf->is_ami_rh ()
107 && !node->is_excep_ami ()
108 && !node->has_native ())
110 *os << be_nl_2
111 << "static void" << be_nl
112 << node->local_name () << "_reply_stub (" << be_idt_nl
113 << "TAO_InputCDR &_tao_reply_cdr," << be_nl
114 << "::Messaging::ReplyHandler_ptr _tao_reply_handler,"
115 << be_nl
116 << "::CORBA::ULong reply_status);" << be_uidt;
119 return 0;