2 //=============================================================================
4 * @file operation_is.cpp
6 * Visitor generating code for Operation in the implementation skeleton
8 * @author Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
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 ()
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 ())
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 ());
42 ACE_ERROR_RETURN ((LM_ERROR
,
43 "(%N:%l) be_visitor_operation_is::"
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::"
62 "codegen for return type failed\n"),
66 const char *classname
= nullptr;
71 classname
= intf
->flat_name ();
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
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::"
94 "codegen for argument list failed\n"),
98 *os
<< be_nl
<< "{" << be_idt_nl
;
99 *os
<< "// Add your implementation here" << be_uidt_nl
;
100 *os
<< "}" << be_nl_2
;