summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_collocated_sh.cpp
blob: 7193ad36241f7b75e3d743c398894f8d0490a576 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// $Id$
//

// ============================================================================
//
// = LIBRARY
//    TAO IDL
//
// = FILENAME
//    thru_poa_collocated_sh.cpp
//
// = DESCRIPTION
//    Visitor generating code for thru_poa_collocated classes for the Interface node
//    inside the server header.
//
// = AUTHOR
//    Aniruddha Gokhale
//
// ============================================================================

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

#include "be_visitor_interface.h"

ACE_RCSID(be_visitor_interface, thru_poa_collocated_sh, "$Id$")


// ************************************************************
//  thru_poa_collocated class in header
// ************************************************************

be_visitor_interface_thru_poa_collocated_sh::be_visitor_interface_thru_poa_collocated_sh
(be_visitor_context *ctx)
  : be_visitor_interface (ctx)
{
}

be_visitor_interface_thru_poa_collocated_sh::~be_visitor_interface_thru_poa_collocated_sh (void)
{
}

int be_visitor_interface_thru_poa_collocated_sh::visit_interface (be_interface *node)
{
  TAO_OutStream *os = this->ctx_->stream ();

  os->gen_ifdef_macro (node->flat_name (), "_thru_poa_collocated");

  // output the class defn
  os->indent ();
  *os << "class " << be_global->skel_export_macro ()
      << " " << node->local_coll_name (be_interface::THRU_POA);
  os->incr_indent ();
  *os << " : public virtual ::" << node->full_name ();

  // generate base classes if any
  if (node->n_inherits () > 0)
    {
      for (int i = 0; i < node->n_inherits (); ++i)
        {
          *os << "," << be_nl;
          be_interface* parent =
            be_interface::narrow_from_decl (node->inherits()[i]);
          *os << "  public virtual "
              << be_interface::relative_name (parent->full_coll_name (be_interface::THRU_POA),
                                              node->full_coll_name (be_interface::THRU_POA));
        }
    }
  *os << "\n";
  os->decr_indent ();
  *os << "{" << be_nl;
  *os << "public:\n";
  os->incr_indent ();

  *os << node->local_coll_name (be_interface::THRU_POA) << " (\n";

  os->incr_indent (0);
  os->incr_indent ();

  *os << "TAO_Stub *stub\n";
  os->decr_indent ();
  *os << ");\n";
  os->decr_indent (0);

  os->indent ();

  *os << "virtual CORBA::Boolean _is_a" << be_idt
      << "(" << be_idt_nl
      << "const CORBA::Char *logical_type_id" << be_nl
      << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
      << ");" << be_uidt_nl << be_nl;

  *os << "virtual CORBA::Boolean _non_existent" << be_idt
      << "(" << be_idt_nl
      << "ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
      << ");" << be_uidt_nl << be_nl;

  if (this->visit_scope (node) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         "be_visitor_interface_thru_poa_collocated_sh::"
                         "visit_interface - "
                         "codegen for scope failed\n"),
                        -1);
    }

  os->decr_indent ();

  *os << "};\n\n";

  os->gen_endif ();

  return 0;
}