summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_module/module_sh.cpp
blob: f3080384f595c1eb943ef3b75573bfca152c6062 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// $Id$
//

// ============================================================================
//
// = LIBRARY
//    TAO IDL
//
// = FILENAME
//    module_sh.cpp
//
// = DESCRIPTION
//    Visitor generating code for Module in the server header
//
// = AUTHOR
//    Aniruddha Gokhale
//
// ============================================================================

#include	"idl.h"
#include	"idl_extern.h"
#include	"be.h"

#include "be_visitor_module.h"

ACE_RCSID(be_visitor_module, module_sh, "$Id$")


// ************************************************************
// Module visitor for server header
// ************************************************************

be_visitor_module_sh::be_visitor_module_sh (be_visitor_context *ctx)
  : be_visitor_module (ctx)
{
}

be_visitor_module_sh::~be_visitor_module_sh (void)
{
}

int
be_visitor_module_sh::visit_module (be_module *node)
{
  TAO_OutStream *os; // output stream

  if (!node->srv_hdr_gen () && !node->imported ()) // not generated and not imported
    {
      os = this->ctx_->stream ();

      // generate the skeleton class name

      os->indent (); // start with whatever indentation level we are at

      // now generate the class definition. The prefix POA_ is prepended to our
      // name only if we are the outermost module
      *os << "TAO_NAMESPACE "; // << idl_global->export_macro ()

      if (!node->is_nested ())
          // we are outermost module
          *os << " POA_" << node->local_name () << be_nl;
      else
          // we are inside another module
          *os << " " << node->local_name () << be_nl;

      *os << "{" << be_nl
          << be_idt;

      if (this->visit_scope (node) == -1)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             "(%N:%l) be_visitor_module_sh::"
                             "visit_module - "
                             "codegen for scope failed\n"), -1);
        }

      os->decr_indent ();
      *os << "};\n\n";
    }
  return 0;

}