Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / TAO_IDL / be / be_home.cpp
blobb3e00cc5739f5ec67c88e8c9ec088d1ec8880f3d
2 //=============================================================================
3 /**
4 * @file be_home.cpp
6 * Extension of class AST_Home that provides additional means for C++
7 * mapping of a component home.
9 * @author Jeff Parsons
11 //=============================================================================
13 #include "be_home.h"
14 #include "be_component.h"
15 #include "be_visitor.h"
17 #include "ast_attribute.h"
19 #include "global_extern.h"
20 #include "utl_err.h"
22 be_home::be_home (UTL_ScopedName *n,
23 AST_Home *base_home,
24 AST_Component *managed_component,
25 AST_Type *primary_key,
26 AST_Type **supports,
27 long n_supports,
28 AST_Interface **supports_flat,
29 long n_supports_flat)
30 : COMMON_Base (false,
31 false),
32 AST_Decl (AST_Decl::NT_home,
33 n),
34 AST_Type (AST_Decl::NT_home,
35 n),
36 UTL_Scope (AST_Decl::NT_home),
37 AST_Interface (n,
38 supports,
39 n_supports,
40 supports_flat,
41 n_supports_flat,
42 false,
43 false),
44 AST_Home (n,
45 base_home,
46 managed_component,
47 primary_key,
48 supports,
49 n_supports,
50 supports_flat,
51 n_supports_flat),
52 be_scope (AST_Decl::NT_home),
53 be_decl (AST_Decl::NT_home,
54 n),
55 be_type (AST_Decl::NT_home,
56 n),
57 be_interface (n,
58 supports,
59 n_supports,
60 supports_flat,
61 n_supports_flat,
62 false,
63 false)
65 this->size_type (AST_Type::VARIABLE);
67 // Some previous error may have caused a lookup failure, in which
68 // case we'll crash if we do the narrow below.
69 if (managed_component == nullptr)
71 idl_global->set_err_count (idl_global->err_count () + 1);
72 return;
75 be_component *bt =
76 dynamic_cast<be_component*> (managed_component);
78 bt->seen_in_operation (true);
80 idl_global->object_arg_seen_ = true;
83 be_home::~be_home ()
87 void
88 be_home::scan (UTL_Scope *s)
90 if (s == nullptr)
92 return;
95 for (UTL_ScopeActiveIterator i (s, UTL_Scope::IK_both);
96 !i.is_done ();
97 i.next ())
99 AST_Decl *d = i.item ();
100 AST_Attribute *attr =
101 dynamic_cast<AST_Attribute*> (d);
103 if (attr != nullptr && ! attr->readonly ())
105 this->has_rw_attributes_ = true;
106 return;
110 AST_Home *h = dynamic_cast<AST_Home*> (s);
112 if (h != nullptr)
114 this->scan (h->base_home ());
118 void
119 be_home::destroy ()
121 delete [] this->full_skel_name_;
122 this->full_skel_name_ = nullptr;
124 delete [] this->full_coll_name_;
125 this->full_coll_name_ = nullptr;
127 delete [] this->local_coll_name_;
128 this->local_coll_name_ = nullptr;
130 delete [] this->relative_skel_name_;
131 this->relative_skel_name_ = nullptr;
133 delete [] this->direct_proxy_impl_name_;
134 this->direct_proxy_impl_name_ = nullptr;
136 delete [] this->full_direct_proxy_impl_name_;
137 this->full_direct_proxy_impl_name_ = nullptr;
139 delete [] this->client_scope_;
140 this->client_scope_ = nullptr;
142 delete [] this->flat_client_scope_;
143 this->flat_client_scope_ = nullptr;
145 delete [] this->server_scope_;
146 this->server_scope_ = nullptr;
148 delete [] this->flat_server_scope_;
149 this->flat_server_scope_ = nullptr;
151 this->be_scope::destroy ();
152 this->be_type::destroy ();
154 // This skips AST_Interface, for the reason above.
155 this->AST_Home::destroy ();
159 be_home::accept (be_visitor *visitor)
161 return (idl_global->ignore_idl3 ()
163 : visitor->visit_home (this));