#include <ifr_removing_visitor.h>
Inheritance diagram for ifr_removing_visitor:
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) |
|
Definition at line 12 of file ifr_removing_visitor.cpp.
00013 { 00014 } |
|
Definition at line 16 of file ifr_removing_visitor.cpp.
00017 { 00018 } |
|
Reimplemented from ifr_visitor. Definition at line 91 of file ifr_removing_visitor.cpp. References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ERROR_RETURN, ACE_PRINT_EXCEPTION, ACE_TEXT(), ACE_TRY, ACE_TRY_CHECK, be_global, BE_GlobalData::ifr_scopes(), LM_ERROR, BE_GlobalData::repository(), and visit_scope().
00092 { 00093 ACE_DECLARE_NEW_CORBA_ENV; 00094 ACE_TRY 00095 { 00096 CORBA::Container_var new_scope = 00097 CORBA::Container::_narrow (be_global->repository () 00098 ACE_ENV_ARG_PARAMETER); 00099 ACE_TRY_CHECK; 00100 00101 if (be_global->ifr_scopes ().push (new_scope.in ()) != 0) 00102 { 00103 ACE_ERROR_RETURN (( 00104 LM_ERROR, 00105 ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -") 00106 ACE_TEXT (" scope push failed\n") 00107 ), 00108 -1 00109 ); 00110 } 00111 00112 if (this->visit_scope (node) == -1) 00113 { 00114 ACE_ERROR_RETURN (( 00115 LM_ERROR, 00116 ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -") 00117 ACE_TEXT (" visit_scope failed\n") 00118 ), 00119 -1 00120 ); 00121 } 00122 00123 CORBA::Container_ptr tmp = CORBA::Container::_nil (); 00124 00125 if (be_global->ifr_scopes ().pop (tmp) != 0) 00126 { 00127 ACE_ERROR_RETURN (( 00128 LM_ERROR, 00129 ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -") 00130 ACE_TEXT (" scope pop failed\n") 00131 ), 00132 -1 00133 ); 00134 } 00135 } 00136 ACE_CATCHANY 00137 { 00138 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, 00139 ACE_TEXT ("visit_root")); 00140 00141 return -1; 00142 } 00143 ACE_ENDTRY; 00144 00145 return 0; 00146 } |
|
Reimplemented from ifr_visitor. Definition at line 21 of file ifr_removing_visitor.cpp. References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_ERROR_RETURN, ACE_PRINT_EXCEPTION, ACE_TEXT(), ACE_TRY, ACE_TRY_CHECK, 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 ACE_DECLARE_NEW_CORBA_ENV; 00033 ACE_TRY 00034 { 00035 // Continue until each element is visited. 00036 while (!si.is_done ()) 00037 { 00038 d = si.item (); 00039 00040 if (d == 0) 00041 { 00042 ACE_ERROR_RETURN (( 00043 LM_ERROR, 00044 ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_scope -") 00045 ACE_TEXT (" bad node in this scope\n") 00046 ), 00047 -1 00048 ); 00049 } 00050 00051 if (d->node_type () == AST_Decl::NT_pre_defined) 00052 { 00053 // We can skip these - they don't get destroyed in the IfR. 00054 si.next (); 00055 continue; 00056 } 00057 00058 CORBA::Contained_var top_level = 00059 be_global->repository ()->lookup_id (d->repoID () 00060 ACE_ENV_ARG_PARAMETER); 00061 ACE_TRY_CHECK; 00062 00063 if (!CORBA::is_nil (top_level.in ())) 00064 { 00065 // All we have to do is call destroy() on each IR object 00066 // in the global scope, because destroy() works on all 00067 // the contents recursively. 00068 top_level->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); 00069 ACE_TRY_CHECK; 00070 } 00071 00072 si.next (); 00073 } 00074 } 00075 ACE_CATCHANY 00076 { 00077 ACE_PRINT_EXCEPTION ( 00078 ACE_ANY_EXCEPTION, 00079 ACE_TEXT ("ifr_removing_visitor::visit_scope") 00080 ); 00081 00082 return -1; 00083 } 00084 ACE_ENDTRY; 00085 } 00086 00087 return 0; 00088 } |