summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
new file mode 100644
index 00000000000..11f1678c300
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_module/module_ch.cpp
@@ -0,0 +1,93 @@
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// module_ch.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Module in the client header
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_module,
+ module_ch,
+ "$Id$")
+
+// ******************************************************
+// Module visitor for client header
+// ******************************************************
+
+be_visitor_module_ch::be_visitor_module_ch (be_visitor_context *ctx)
+ : be_visitor_module (ctx)
+{
+}
+
+be_visitor_module_ch::~be_visitor_module_ch (void)
+{
+}
+
+int
+be_visitor_module_ch::visit_module (be_module *node)
+{
+ if (node->cli_hdr_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ TAO_OutStream *aos = 0;
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *os << "namespace " << node->local_name () << be_nl
+ << "{" << be_idt;
+
+ if (be_global->gen_anyop_files ())
+ {
+ aos = tao_cg->anyop_header ();
+
+ *aos << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ *aos << "namespace " << node->local_name () << be_nl
+ << "{" << be_idt;
+ }
+
+ // Generate code for the module definition by traversing thru the
+ // elements of its scope. We depend on the front-end to have made sure
+ // that only legal syntactic elements appear in our scope.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_module_ch::"
+ "visit_module - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << be_uidt_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *os << be_nl
+ << "} // module " << node->name ();
+
+ if (be_global->gen_anyop_files ())
+ {
+ *aos << be_uidt_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl;
+
+ *aos << be_nl
+ << "} // module " << node->name () << be_nl;
+ }
+
+ return 0;
+}