1 //=============================================================================
5 * Specialized interface visitor for AMH-RH generates code that is
6 * specific to AMH interfaces.
8 * @author Mayur Deshpande <mayur@ics.uci.edu>
10 //=============================================================================
12 #include "interface.h"
14 be_visitor_amh_interface_ch::be_visitor_amh_interface_ch (
15 be_visitor_context
*ctx
)
16 : be_visitor_interface (ctx
)
20 be_visitor_amh_interface_ch::~be_visitor_amh_interface_ch ()
25 be_visitor_amh_interface_ch::visit_interface (be_interface
*node
)
27 // If not already generated and not imported.
28 if (node
->cli_hdr_gen () || node
->imported ())
33 // This will be a no-op if it has already been done by a forward
35 node
->gen_var_out_seq_decls ();
37 TAO_OutStream
*os
= this->ctx_
->stream ();
39 // Now generate the class definition.
40 *os
<< "class " << be_global
->stub_export_macro ()
41 << " " << node
->local_name () << be_idt_nl
44 // If node interface inherits from other interfaces.
45 if (node
->n_inherits () > 0)
49 for (int i
= 0; i
< node
->n_inherits (); i
++)
51 *os
<< "public virtual "
52 << node
->inherits ()[i
]->name ();
54 if (i
< node
->n_inherits () - 1)
56 // Node has multiple inheritance, so put a comma.
61 *os
<< be_uidt
<< be_uidt_nl
;
65 // We do not inherit from anybody, hence we do so from the base
66 // CORBA::Object class.
67 *os
<< "public virtual ::CORBA::Object" << be_uidt_nl
;
73 << "public:" << be_idt_nl
75 // Generate the _ptr_type and _var_type typedefs.
76 << "typedef " << node
->local_name () << "_ptr _ptr_type;"
78 << "typedef " << node
->local_name () << "_var _var_type;"
80 << "typedef " << node
->local_name () << "_out _out_type;"
83 // Generate code for the interface definition by traversing thru the
84 // elements of its scope. We depend on the front-end to have made sure
85 // that only legal syntactic elements appear in our scope.
87 if (this->visit_scope (node
) == -1)
89 ACE_ERROR_RETURN ((LM_ERROR
,
90 "(%N:%l) be_visitor_interface_ch::"
92 "codegen for scope failed\n"), -1);
95 node
->cli_hdr_gen (true);