ifr_removing_visitor Class Reference

#include <ifr_removing_visitor.h>

Inheritance diagram for ifr_removing_visitor:

Inheritance graph
[legend]
Collaboration diagram for ifr_removing_visitor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ifr_removing_visitor (void)
virtual ~ifr_removing_visitor (void)
virtual int visit_scope (UTL_Scope *node)
virtual int visit_root (AST_Root *node)

Constructor & Destructor Documentation

ifr_removing_visitor::ifr_removing_visitor void   ) 
 

Definition at line 12 of file ifr_removing_visitor.cpp.

00013 {
00014 }

ifr_removing_visitor::~ifr_removing_visitor void   )  [virtual]
 

Definition at line 16 of file ifr_removing_visitor.cpp.

00017 {
00018 }


Member Function Documentation

int ifr_removing_visitor::visit_root AST_Root *  node  )  [virtual]
 

Reimplemented from ifr_visitor.

Definition at line 85 of file ifr_removing_visitor.cpp.

References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::ifr_scopes(), LM_ERROR, BE_GlobalData::repository(), and visit_scope().

00086 {
00087   try
00088     {
00089       CORBA::Container_var new_scope =
00090         CORBA::Container::_narrow (be_global->repository ());
00091 
00092       if (be_global->ifr_scopes ().push (new_scope.in ()) != 0)
00093         {
00094           ACE_ERROR_RETURN ((
00095               LM_ERROR,
00096               ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
00097               ACE_TEXT (" scope push failed\n")
00098             ),
00099             -1
00100           );
00101         }
00102 
00103       if (this->visit_scope (node) == -1)
00104         {
00105           ACE_ERROR_RETURN ((
00106               LM_ERROR,
00107               ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
00108               ACE_TEXT (" visit_scope failed\n")
00109             ),
00110             -1
00111           );
00112         }
00113 
00114       CORBA::Container_ptr tmp = CORBA::Container::_nil ();
00115 
00116       if (be_global->ifr_scopes ().pop (tmp) != 0)
00117         {
00118           ACE_ERROR_RETURN ((
00119               LM_ERROR,
00120               ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
00121               ACE_TEXT (" scope pop failed\n")
00122             ),
00123             -1
00124           );
00125         }
00126     }
00127   catch (const CORBA::Exception& ex)
00128     {
00129       ex._tao_print_exception (ACE_TEXT ("visit_root"));
00130 
00131       return -1;
00132     }
00133 
00134   return 0;
00135 }

int ifr_removing_visitor::visit_scope UTL_Scope *  node  )  [virtual]
 

Reimplemented from ifr_visitor.

Definition at line 21 of file ifr_removing_visitor.cpp.

References ACE_ERROR_RETURN, ACE_TEXT(), be_global, CORBA::is_nil(), LM_ERROR, and BE_GlobalData::repository().

Referenced by BE_produce(), and visit_root().

00022 {
00023   // Proceed if the number of members in our scope is greater than 0.
00024   if (node->nmembers () > 0)
00025     {
00026       // Initialize an iterator to iterate over our scope.
00027       UTL_ScopeActiveIterator si (node,
00028                                   UTL_Scope::IK_decls);
00029 
00030       AST_Decl *d = 0;
00031 
00032       try
00033         {
00034           // Continue until each element is visited.
00035           while (!si.is_done ())
00036             {
00037               d = si.item ();
00038 
00039               if (d == 0)
00040                 {
00041                   ACE_ERROR_RETURN ((
00042                       LM_ERROR,
00043                       ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_scope -")
00044                       ACE_TEXT (" bad node in this scope\n")
00045                     ),
00046                     -1
00047                   );
00048                 }
00049 
00050               if (d->node_type () == AST_Decl::NT_pre_defined)
00051                 {
00052                   // We can skip these - they don't get destroyed in the IfR.
00053                   si.next ();
00054                   continue;
00055                 }
00056 
00057               CORBA::Contained_var top_level =
00058                 be_global->repository ()->lookup_id (d->repoID ());
00059 
00060               if (!CORBA::is_nil (top_level.in ()))
00061                 {
00062                   // All we have to do is call destroy() on each IR object
00063                   // in the global scope, because destroy() works on all
00064                   // the contents recursively.
00065                   top_level->destroy ();
00066                 }
00067 
00068               si.next ();
00069             }
00070         }
00071       catch (const CORBA::Exception& ex)
00072         {
00073           ex._tao_print_exception (
00074             ACE_TEXT (
00075               "ifr_removing_visitor::visit_scope"));
00076 
00077           return -1;
00078         }
00079     }
00080 
00081   return 0;
00082 }


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 16:32:27 2008 for TAO_IFR by doxygen 1.3.6