2 #include "orbsvcs/Log_Macros.h"
3 #include "ifr_removing_visitor.h"
7 ifr_removing_visitor::ifr_removing_visitor (void)
11 ifr_removing_visitor::~ifr_removing_visitor (void)
16 ifr_removing_visitor::visit_scope (UTL_Scope
*node
)
18 // Proceed if the number of members in our scope is greater than 0.
19 if (node
->nmembers () > 0)
21 // Initialize an iterator to iterate over our scope.
22 UTL_ScopeActiveIterator
si (node
,
29 // Continue until each element is visited.
30 while (!si
.is_done ())
36 ORBSVCS_ERROR_RETURN ((
38 ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_scope -")
39 ACE_TEXT (" bad node in this scope\n")
45 if (d
->node_type () == AST_Decl::NT_pre_defined
)
47 // We can skip these - they don't get destroyed in the IfR.
52 CORBA::Contained_var top_level
=
53 be_global
->repository ()->lookup_id (d
->repoID ());
55 if (!CORBA::is_nil (top_level
.in ()))
57 // All we have to do is call destroy() on each IR object
58 // in the global scope, because destroy() works on all
59 // the contents recursively.
60 top_level
->destroy ();
66 catch (const CORBA::Exception
& ex
)
68 ex
._tao_print_exception (
70 "ifr_removing_visitor::visit_scope"));
80 ifr_removing_visitor::visit_root (AST_Root
*node
)
84 CORBA::Container_var new_scope
=
85 CORBA::Container::_narrow (be_global
->repository ());
87 if (be_global
->ifr_scopes ().push (new_scope
.in ()) != 0)
89 ORBSVCS_ERROR_RETURN ((
91 ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
92 ACE_TEXT (" scope push failed\n")
98 if (this->visit_scope (node
) == -1)
100 ORBSVCS_ERROR_RETURN ((
102 ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
103 ACE_TEXT (" visit_scope failed\n")
109 CORBA::Container_ptr tmp
= CORBA::Container::_nil ();
111 if (be_global
->ifr_scopes ().pop (tmp
) != 0)
113 ORBSVCS_ERROR_RETURN ((
115 ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
116 ACE_TEXT (" scope pop failed\n")
122 catch (const CORBA::Exception
& ex
)
124 ex
._tao_print_exception (ACE_TEXT ("visit_root"));