summaryrefslogtreecommitdiff
path: root/trunk/TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp
blob: cbe0a71da1e56c26a1fdf74f1ca38ae5a86621e5 (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
//
// $Id$
//

// ============================================================================
//
// = LIBRARY
//    TAO IDL
//
// = FILENAME
//    home_ch.cpp
//
// = DESCRIPTION
//    Visitor generating code for Component Home node in the client header.
//
// = AUTHOR
//    Jeff Parsons
//
// ============================================================================

ACE_RCSID (be_visitor_home, 
           home_ch, 
           "$Id$")

be_visitor_home_ch::be_visitor_home_ch (
    be_visitor_context *ctx
  )
  : be_visitor_decl (ctx)
{
}

be_visitor_home_ch::~be_visitor_home_ch (void)
{
}

int
be_visitor_home_ch::visit_home (be_home *node)
{
  if (node->cli_hdr_gen () || node->imported ())
    {
      return 0;
    }

  TAO_OutStream *os = this->ctx_->stream ();

  *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
      << "// " << __FILE__ << ":" << __LINE__;

  // All we do in this is generate a forward declaration of the class.
  *os << be_nl << be_nl << "class " << node->local_name () << ";";

  // Generate the ifdefined macro for the _ptr type.
  os->gen_ifdef_macro (node->flat_name (), "_ptr");

  // Generate the _ptr typedef.
  *os << be_nl << be_nl 
      << "typedef " << node->local_name () << " *" << node->local_name ()
      << "_ptr;";

  os->gen_endif ();

    if (be_global->tc_support ())
      {
        be_visitor_context ctx (*this->ctx_);
        ctx.node (node);
        be_visitor_typecode_decl tc_visitor (&ctx);

        if (node->accept (&tc_visitor) == -1)
          {
            ACE_ERROR_RETURN ((LM_ERROR,
                              "(%N:%l) be_visitor_home_ch::"
                              "visit_home - "
                              "TypeCode definition failed\n"),
                              -1);
          }
      }

  node->cli_hdr_gen (true);
  return 0;
}