summaryrefslogtreecommitdiff
path: root/TAO/CIAO/CCF/CCF/IDL3/SyntaxTree/Home.hpp
blob: 6bfbc8434a86039a7bb4c70ddbf68a1f58074ca6 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// file      : CCF/IDL3/SyntaxTree/Home.hpp
// author    : Boris Kolpackov <boris@dre.vanderbilt.edu>
// cvs-id    : $Id$

#ifndef CCF_IDL3_SYNTAX_TREE_HOME_HPP
#define CCF_IDL3_SYNTAX_TREE_HOME_HPP

#include "CCF/IDL2/SyntaxTree/Elements.hpp"
#include "CCF/IDL2/SyntaxTree/Interface.hpp"
#include "CCF/IDL3/SyntaxTree/Component.hpp"

namespace CCF
{
  namespace IDL3
  {
    namespace SyntaxTree
    {
      // Import nodes from IDL2
      using namespace IDL2::SyntaxTree;

      // According to the spec Home cannot be forward-declared. Did they
      // goof again? - you would probably think...
      //

      class HomeDef;

      typedef
      StrictPtr<HomeDef>
      HomeDefPtr;

      typedef
      DeclarationRef<HomeDef>
      HomeDefRef;

      class HomeDef : public virtual TypeDef,
                      public virtual Scope
      {
      public:
        virtual
        ~HomeDef () throw () {}

        HomeDef (SimpleName const& name,
                 ScopePtr const& scope,
                 ScopedName const& inherits,
                 ScopedNameSet const& supports,
                 ScopedName const& manages)

            : Declaration (name, scope),
              inherits_ (table (), inherits),
              manages_ (table (), manages)
        {
          type_info (static_type_info ());
          copy_supports_list (supports);
        }

        HomeDef (SimpleName const& name,
                 ScopePtr const& scope,
                 ScopedNameSet const& supports,
                 ScopedName const& manages)

            : Declaration (name, scope),
              inherits_ (table ()),
              manages_ (table (), manages)
        {
          type_info (static_type_info ());
          copy_supports_list (supports);
        }

      private:
        void
        copy_supports_list (ScopedNameSet const& supports)
        {
          for (ScopedNameSet::const_iterator i = supports.begin ();
               i != supports.end ();
               i++)
          {
            supports_.insert (InterfaceDefRef (table (), *i));
          }
        }

      public:
        HomeDefRef
        inherits ()
        {
          return inherits_;
        }

      public:
        typedef
        InterfaceDefRefSetName::const_iterator
        Iterator;

        Iterator
        supports_begin ()
        {
          return supports_.begin ();
        }

        Iterator
        supports_end ()
        {
          return supports_.end ();
        }

      public:
        ComponentDefPtr
        manages () const
        {
          return manages_.resolve ();
        }

        // Runtime declaration type information
      public:
        virtual std::string
        declaration_class ()
        {
          return "home";
        }

      public:
        static Introspection::TypeInfo const&
        static_type_info ();

      private:
        HomeDefRef inherits_;
        InterfaceDefRefSetName supports_;
        ComponentDefRef manages_;
      };

      typedef
      DeclarationOrderComparator<HomeDefPtr>
      HomeDefOrderComparator;

      typedef
      std::set<HomeDefPtr, HomeDefOrderComparator>
      HomeDefSet;
    }
  }
}

#endif  // CCF_IDL3_SYNTAX_TREE_HOME_HPP