Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_module / module_sh.cpp
blob46fafeaae82935e9ce76e5237c926c653c296915
2 //=============================================================================
3 /**
4 * @file module_sh.cpp
6 * Visitor generating code for Module in the server header
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "module.h"
14 be_visitor_module_sh::be_visitor_module_sh (be_visitor_context *ctx)
15 : be_visitor_module (ctx)
19 be_visitor_module_sh::~be_visitor_module_sh (void)
23 int
24 be_visitor_module_sh::visit_module (be_module *node)
26 // Not generated and not imported.
27 if (node->srv_hdr_gen () || node->imported ())
29 return 0;
32 TAO_OutStream *os = this->ctx_->stream ();
34 TAO_INSERT_COMMENT (os);
36 // Generate the skeleton class name.
38 // Now generate the class definition. The prefix POA_ is prepended to our
39 // name only if we are the outermost module.
40 *os << "namespace ";
42 if (!node->is_nested ())
44 // We are outermost module.
45 *os << "POA_" << node->local_name () << be_nl;
47 else
49 // We are inside another module.
50 *os << node->local_name () << be_nl;
53 *os << "{" << be_idt_nl;
55 if (this->visit_scope (node) == -1)
57 ACE_ERROR_RETURN ((LM_ERROR,
58 "(%N:%l) be_visitor_module_sh::"
59 "visit_module - "
60 "codegen for scope failed\n"),
61 -1);
64 *os << be_uidt_nl << be_nl;
65 TAO_INSERT_COMMENT (os);
67 *os << "} // module "
68 << node->name ();
70 return 0;