Remove redundant void from tao_idl
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_interface / interface_ih.cpp
blobb6de87989a59184abfe808af172e733cd4b56f39
2 //=============================================================================
3 /**
4 * @file interface_ih.cpp
6 * Visitor generating code for Interfaces in the implementation header
8 * @author Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
9 */
10 //=============================================================================
12 #include "interface.h"
14 be_visitor_interface_ih::be_visitor_interface_ih (be_visitor_context *ctx)
15 : be_visitor_interface (ctx)
19 be_visitor_interface_ih::~be_visitor_interface_ih ()
23 int
24 be_visitor_interface_ih::visit_interface (be_interface *node)
26 if (node->impl_hdr_gen () || node->imported () || node->is_abstract ())
28 return 0;
31 TAO_OutStream *os = this->ctx_->stream ();
32 static char namebuf [NAMEBUFSIZE];
35 ACE_OS::memset (namebuf,
36 '\0',
37 NAMEBUFSIZE);
39 // Generate the skeleton class name.
41 ACE_OS::sprintf (namebuf, "%s", node->flat_name ());
43 if (be_global->gen_impl_debug_info ())
45 TAO_INSERT_COMMENT (os);
48 // Now generate the class definition.
49 *os << "class " << be_global->stub_export_macro ()
50 << " " << be_global->impl_class_prefix () << namebuf
51 << be_global->impl_class_suffix () << be_idt_nl << ": public virtual ";
53 // Inherit from the base skeleton name, unless the interface
54 // is local.
55 if (node->is_local ())
57 *os << node->full_name ();
59 else
61 *os << node->full_skel_name ();
64 if (node->is_local ())
66 *os << "," << be_idt_nl
67 << "public virtual ::CORBA::LocalObject"
68 << be_uidt;
71 *os << be_uidt_nl
72 << "{" << be_nl
73 << "public:" << be_idt_nl
74 << "// Constructor" << be_nl
75 << be_global->impl_class_prefix () << namebuf
76 << be_global->impl_class_suffix () << " (void);" << be_nl_2;
78 if (be_global->gen_copy_ctor () && !node->is_local ())
80 *os << "// Copy Constructor"<<be_nl
81 << be_global->impl_class_prefix () << namebuf
82 << be_global->impl_class_suffix () << " (const "
83 << be_global->impl_class_prefix () << namebuf
84 << be_global->impl_class_suffix () << "&);" <<be_nl <<be_nl;
87 if (be_global->gen_assign_op ())
89 *os << "// Copy Assignment" << be_nl
90 << be_global->impl_class_prefix () << namebuf
91 << be_global->impl_class_suffix () << "& " << "operator=(const "
92 << be_global->impl_class_prefix () << namebuf
93 << be_global->impl_class_suffix () << "&);" << be_nl_2;
97 *os << "// Destructor" << be_nl
98 << "virtual " << "~" << be_global->impl_class_prefix () << namebuf
99 << be_global->impl_class_suffix () << " (void);";
102 // Generate code for elements in the scope (e.g., operations).
103 if (this->visit_scope (node) == -1)
105 ACE_ERROR_RETURN ((LM_ERROR,
106 "be_visitor_interface_ih::"
107 "visit_interface - "
108 "codegen for scope failed\n"),
109 -1);
113 // Generate the code for the members of the derived classes.
114 int status =
115 node->traverse_inheritance_graph (
116 be_visitor_interface_ih::method_helper,
117 os);
119 if (status == -1)
121 ACE_ERROR_RETURN ((LM_ERROR,
122 "be_visitor_interface_tie_sh_ss::"
123 "visit_interface - "
124 "traversal of inhertance graph failed\n"),
125 -1);
129 *os << be_uidt_nl
130 << "};" << be_nl_2;
132 return 0;
136 // Helper method to generate members within the scope of the base classes.
138 be_visitor_interface_ih::method_helper (be_interface *derived,
139 be_interface *node,
140 TAO_OutStream *os)
142 int compare =
143 ACE_OS::strcmp (derived->flat_name (), node->flat_name ());
145 if (compare != 0)
147 be_visitor_context ctx;
148 ctx.state (TAO_CodeGen::TAO_ROOT_IH);
149 ctx.interface (derived);
150 ctx.stream (os);
151 be_visitor_interface_ih visitor (&ctx);
153 if (visitor.visit_scope (node) == -1)
155 ACE_ERROR_RETURN ((LM_ERROR,
156 "be_visitor_interface_is::"
157 "method_helper\n"),
158 -1);
162 return 0;