00001 #ifndef wali_nwa_TransitionInfo_GUARD 00002 #define wali_nwa_TransitionInfo_GUARD 1 00003 00004 /** 00005 * @author Amanda Burton 00006 */ 00007 00008 //#define LABEL 00009 00010 #include "opennwa/NwaFwd.hpp" 00011 00012 // ::wali 00013 #include "wali/KeyContainer.hpp" 00014 #include "opennwa/details/SymbolStorage.hpp" 00015 #include "wali/Key.hpp" 00016 00017 // std::c++ 00018 #include <map> 00019 #include <set> 00020 00021 namespace opennwa 00022 { 00023 namespace details 00024 { 00025 00026 /** 00027 * 00028 * This class is used to keep track of the maps from state to transition for an NWA. 00029 * 00030 */ 00031 class TransitionInfo 00032 { 00033 public: 00034 00035 typedef wali::Triple<State,Symbol,State> Internal; 00036 typedef wali::Triple<State,Symbol,State> Call; 00037 typedef wali::Quad<State,State,Symbol,State> Return; 00038 00039 typedef wali::Triple<State,Label,State> Int; 00040 typedef wali::Triple<State,Label,State> Cal; 00041 typedef wali::Quad<State,State,Label,State> Ret; 00042 00043 typedef std::set<Internal> Internals; 00044 DEPRECATE("Use capitalized version (InternalIterator), not that you shoud be using the one from this class in the first place.") 00045 typedef Internals::const_iterator internalIterator; 00046 typedef Internals::const_iterator InternalIterator; 00047 00048 typedef std::set<Call> Calls; 00049 DEPRECATE("Use capitalized version (CallIterator), not that you shoud be using the one from this class in the first place.") 00050 typedef Calls::const_iterator callIterator; 00051 typedef Calls::const_iterator CallIterator; 00052 00053 typedef std::set<Return> Returns; 00054 DEPRECATE("Use capitalized version (ReturnIterator), not that you shoud be using the one from this class in the first place.") 00055 typedef Returns::const_iterator returnIterator; 00056 typedef Returns::const_iterator ReturnIterator; 00057 #if !defined(LABEL) 00058 typedef std::map<State,Internals> IntraMap; 00059 typedef std::map<State,Calls> CallMap; 00060 typedef std::map<State,Returns> RetMap; 00061 #else 00062 typedef std::map<St,Int> IntraMap; 00063 typedef std::map<St,Cal> CallMap; 00064 typedef std::map<St,Ret> RetMap; 00065 #endif 00066 00067 static Internals const & emptyInternals() { 00068 static Internals r; 00069 return r; 00070 } 00071 static Calls const & emptyCalls() { 00072 static Calls c; 00073 return c; 00074 } 00075 static Returns const & emptyReturns() { 00076 static Returns r; 00077 return r; 00078 } 00079 00080 // 00081 // Methods 00082 // 00083 00084 public: 00085 00086 //Constructors and Destructor 00087 TransitionInfo & operator=( const TransitionInfo & other ) 00088 { 00089 if( this == &other ) 00090 return *this; 00091 00092 clearMaps(); 00093 00094 from_ITrans = other.from_ITrans; 00095 to_ITrans = other.to_ITrans; 00096 00097 call_CTrans = other.call_CTrans; 00098 entry_CTrans = other.entry_CTrans; 00099 00100 exit_RTrans = other.exit_RTrans; 00101 pred_RTrans = other.pred_RTrans; 00102 ret_RTrans = other.ret_RTrans; 00103 00104 return *this; 00105 } 00106 00107 00108 #if !defined(LABEL) 00109 /** 00110 * 00111 * @brief add an internal transition to the maps 00112 * 00113 * This method updates the maps associated with the source and target of the given 00114 * internal transition. 00115 * 00116 * @param - intra: the internal transition to add to the maps 00117 * 00118 */ 00119 void addIntra( const Internal & intra ) 00120 { 00121 from_ITrans[intra.first].insert(intra); 00122 to_ITrans[intra.third].insert(intra); 00123 } 00124 00125 /** 00126 * 00127 * @brief remove an internal transition from the maps 00128 * 00129 * This method updates the maps associated with the source and target of the given 00130 * internal transition. 00131 * 00132 * @param - intra: the internal transition to remove from the maps 00133 * 00134 */ 00135 void removeIntra( const Internal & intra ) 00136 { 00137 //Update the map for the source of the transition. 00138 IntraMap::iterator it = from_ITrans.find(intra.first); 00139 if( it != from_ITrans.end() ) 00140 { 00141 it->second.erase(intra); 00142 if( it->second.empty() ) 00143 from_ITrans.erase(it); 00144 } 00145 00146 //Update the map for the target of the transition. 00147 it = to_ITrans.find(intra.third); 00148 if( it != to_ITrans.end() ) 00149 { 00150 it->second.erase(intra); 00151 if( it->second.empty() ) 00152 to_ITrans.erase(it); 00153 } 00154 } 00155 00156 /** 00157 * 00158 * @brief add a call transition to the maps 00159 * 00160 * This method updates the maps associated with the call point and entry point of 00161 * the given call transition. 00162 * 00163 * @param - call: the call transition to add to the maps 00164 * 00165 */ 00166 void addCall( const Call & call ) 00167 { 00168 call_CTrans[call.first].insert(call); 00169 entry_CTrans[call.third].insert(call); 00170 } 00171 00172 /** 00173 * 00174 * @brief remove a call transition from the maps 00175 * 00176 * This method updates the maps associated with the call point and entry point of 00177 * the given call transition. 00178 * 00179 * @param - call: the call transition to remove from the maps 00180 * 00181 */ 00182 void removeCall( const Call & call ) 00183 { 00184 //Update the maps for the call point of the transition. 00185 CallMap::iterator it = call_CTrans.find(call.first); 00186 if( it != call_CTrans.end() ) 00187 { 00188 it->second.erase(call); 00189 if( it->second.empty() ) 00190 call_CTrans.erase(it); 00191 } 00192 00193 //Update the maps for the entry point of the transition. 00194 it = entry_CTrans.find(call.third); 00195 if( it != entry_CTrans.end() ) 00196 { 00197 it->second.erase(call); 00198 if( it->second.empty() ) 00199 entry_CTrans.erase(it); 00200 } 00201 } 00202 00203 /** 00204 * 00205 * @brief add a return transition to the maps 00206 * 00207 * This method updates the maps associated with the exit point, call predecessor, 00208 * and return point of the given return transition. 00209 * 00210 * @param - ret: the return transition to add to the maps 00211 * 00212 */ 00213 void addRet( const Return & ret ) 00214 { 00215 exit_RTrans[ret.first].insert(ret); 00216 pred_RTrans[ret.second].insert(ret); 00217 ret_RTrans[ret.fourth].insert(ret); 00218 } 00219 00220 /** 00221 * 00222 * @brief remove a return transition from the maps 00223 * 00224 * This method updates the maps associated with the exit point, call predecessor, 00225 * and return point of the given return transition. 00226 * 00227 * @param - ret: the return transition to remove from the maps 00228 * 00229 */ 00230 void removeRet( const Return & ret ) 00231 { 00232 //Update the maps for the exit point of the transition. 00233 RetMap::iterator it = exit_RTrans.find(ret.first); 00234 if( it != exit_RTrans.end() ) 00235 { 00236 it->second.erase(ret); 00237 if( it->second.empty() ) 00238 exit_RTrans.erase(it); 00239 } 00240 00241 //Update the maps for the call predecessor of the transition. 00242 it = pred_RTrans.find(ret.second); 00243 if( it != pred_RTrans.end() ) 00244 { 00245 it->second.erase(ret); 00246 if( it->second.empty() ) 00247 pred_RTrans.erase(it); 00248 } 00249 00250 //Update the maps for the return point of the transition. 00251 it = ret_RTrans.find(ret.fourth); 00252 if( it != ret_RTrans.end() ) 00253 { 00254 it->second.erase(ret); 00255 if( it->second.empty() ) 00256 ret_RTrans.erase(it); 00257 } 00258 } 00259 00260 /** 00261 * 00262 * @brief returns all internal transitions with the given state as the source 00263 * 00264 * This method returns the set of all internal transitions whose source is the 00265 * given state. 00266 * 00267 * @param - name: the state whose outgoing transitions to obtain 00268 * @return a set of outgoing transitions for the given state 00269 * 00270 */ 00271 const Internals & fromTrans( State state ) const 00272 { 00273 IntraMap::const_iterator it = from_ITrans.find(state); 00274 if( it == from_ITrans.end() ) 00275 return emptyInternals(); 00276 else 00277 return it->second; 00278 } 00279 00280 /** 00281 * 00282 * @brief returns all internal transitions with the given state as the target 00283 * 00284 * This method returns the set of all internal transitions whose target is the 00285 * given state. 00286 * 00287 * @param - name: the state whose incoming transitions to obtain 00288 * @returm a set of incoming transitions for the given state 00289 * 00290 */ 00291 const Internals & toTrans( State state ) const 00292 { 00293 IntraMap::const_iterator it = to_ITrans.find(state); 00294 if( it == to_ITrans.end() ) 00295 return emptyInternals(); 00296 else 00297 return it->second; 00298 } 00299 00300 /** 00301 * 00302 * @brief returns all call transitions with the given state as the call site 00303 * 00304 * This method returns the set of all call transitions whose call site is the 00305 * given state. 00306 * 00307 * @param - name: the state whose call site transitions to obtain 00308 * @return a set of call transitions with the given state playing the part of 00309 * the call site 00310 * 00311 */ 00312 const Calls & callTrans( State state ) const 00313 { 00314 CallMap::const_iterator it = call_CTrans.find(state); 00315 if( it == call_CTrans.end() ) 00316 return emptyCalls(); 00317 else 00318 return it->second; 00319 } 00320 00321 /** 00322 * 00323 * @brief returns all call transitions with the given state as the entry point 00324 * 00325 * This method returns the set of all call transitions whose entry point is the 00326 * given state. 00327 * 00328 * @param - name: the state whose entry transitions to obtain 00329 * @return a set of call transitions with the given state playing the part of 00330 * the entry point 00331 * 00332 */ 00333 const Calls & entryTrans( State state ) const 00334 { 00335 CallMap::const_iterator it = entry_CTrans.find(state); 00336 if( it == entry_CTrans.end() ) 00337 return emptyCalls(); 00338 else 00339 return it->second; 00340 } 00341 00342 /** 00343 * 00344 * @brief returns all return transitions with the given state as the exit point 00345 * 00346 * This method returns the set of all return transitions whose exit point is 00347 * the given state. 00348 * 00349 * @param - name: the state whose exit transitions to obtain 00350 * @return a set of return transitions with the given state playing the part of 00351 * the exit point 00352 * 00353 */ 00354 const Returns & exitTrans( State state ) const 00355 { 00356 RetMap::const_iterator it = exit_RTrans.find(state); 00357 if( it == exit_RTrans.end() ) 00358 return emptyReturns(); 00359 else 00360 return it->second; 00361 } 00362 00363 /** 00364 * 00365 * @brief returns all return transitions with the given state as the call predecessor 00366 * 00367 * This method returns the set of all return transitions whose call predecessor 00368 * is the given state. 00369 * 00370 * @param - name: the state whose call predecessor transitions to obtain 00371 * @return a set of return transitions with the given state playing the part of 00372 * the call predecessor. 00373 * 00374 */ 00375 const Returns & predTrans( State state )const 00376 { 00377 RetMap::const_iterator it = pred_RTrans.find(state); 00378 if( it == pred_RTrans.end() ) 00379 return emptyReturns(); 00380 else 00381 return it->second; 00382 } 00383 00384 /** 00385 * 00386 * @brief returns all return transitions with the given state as the return site 00387 * 00388 * This method returns the set of all return transitions whose return site is 00389 * the given state. 00390 * 00391 * @param - name: the state whose return site transitions to obtain 00392 * @return a set of return transitions with the given state playing the part 00393 * of the return site. 00394 * 00395 */ 00396 const Returns & retTrans( State state )const 00397 { 00398 RetMap::const_iterator it = ret_RTrans.find(state); 00399 if( it == ret_RTrans.end() ) 00400 return emptyReturns(); 00401 else 00402 return it->second; 00403 } 00404 00405 /** 00406 * 00407 * @brief tests whether the given state is the source of any internal transition 00408 * 00409 * This method determines whether the given state is the source of any 00410 * internal transition. 00411 * 00412 * @param - name: the state to test 00413 * @return true if the given state is the source of some internal transition, 00414 * false otherwise 00415 * 00416 */ 00417 bool isFrom( State state ) const 00418 { 00419 Internals const & outgoing = fromTrans(state); 00420 return !outgoing.empty(); 00421 } 00422 00423 /** 00424 * 00425 * @brief tests whether the given state is the target of any internal transition 00426 * 00427 * This method determines whether the given state is the target of any 00428 * internal transition. 00429 * 00430 * @param - name: the state to test 00431 * @return true if the given state is the target of some internal transition, 00432 * false otherwise 00433 * 00434 */ 00435 bool isTo( State state ) const 00436 { 00437 Internals const & incoming = toTrans(state); 00438 return !incoming.empty(); 00439 } 00440 00441 /** 00442 * 00443 * @brief tests whether the given state is the call site of any call transition 00444 * 00445 * This method determines whether the given state is the call site of any 00446 * call transition. 00447 * 00448 * @param - name: the state to test 00449 * @return true if the given state is the call site of some call transition, 00450 * false otherwise 00451 * 00452 */ 00453 bool isCall( State state ) const 00454 { 00455 Calls const & outgoing = callTrans(state); 00456 return !outgoing.empty(); 00457 } 00458 00459 /** 00460 * 00461 * @brief tests whether the given state is the entry point of any call transition 00462 * 00463 * This method determines whether the given state is the entry point of any 00464 * call transition. 00465 * 00466 * @param - name: the state to test 00467 * @return true if the given state is the entry point of some call transition, 00468 * false otherwise 00469 * 00470 */ 00471 bool isEntry( State state ) const 00472 { 00473 Calls const & incoming = entryTrans(state); 00474 return !incoming.empty(); 00475 } 00476 00477 /** 00478 * 00479 * @brief tests whether the given state is the exit point of any return transition 00480 * 00481 * This method determines whether the given state is the exit point of any 00482 * return transition. 00483 * 00484 * @param - name: the state to test 00485 * @return true if the given state is the exit point of some return transition, 00486 * false otherwise 00487 * 00488 */ 00489 bool isExit( State state ) const 00490 { 00491 Returns const & outgoing = exitTrans(state); 00492 return !outgoing.empty(); 00493 } 00494 00495 /** 00496 * 00497 * @brief tests whether the given state is the call predecessor for any return 00498 * transition 00499 * 00500 * This method determines whether the given state is the call predecessor for 00501 * any return transition. 00502 * 00503 * @param - name: the state to test 00504 * @return true if the given state is the call predecessor of some return 00505 * transition, false otherwise 00506 * 00507 */ 00508 bool isPred( State state ) const 00509 { 00510 Returns const & outgoing = predTrans(state); 00511 return !outgoing.empty(); 00512 } 00513 00514 /** 00515 * 00516 * @brief tests whether the given state is the return site of any return transition 00517 * 00518 * This method determines whether the given state is the return site of any 00519 * return transition. 00520 * 00521 * @param - name: the state to test 00522 * @return true if the given state is the return site of some return transition, 00523 * false otherwise 00524 * 00525 */ 00526 bool isRet( State state ) const 00527 { 00528 Returns const & incoming = retTrans(state); 00529 return !incoming.empty(); 00530 } 00531 #else 00532 /** 00533 * 00534 * @brief add an internal transition to the maps 00535 * 00536 * This method updates the maps associated with the source and target of the given 00537 * internal transition. 00538 * 00539 * @param - intra: the internal transition to add to the maps 00540 * 00541 */ 00542 void addIntra( const Internal & intra ) 00543 { 00544 //Update the map for the source of the transition. 00545 IntraMap::iterator it = from_ITrans.find(intra.first); 00546 if( it == from_ITrans.end() ) 00547 { 00548 //Make a new label 00549 Label lbl; 00550 lbl.addSymbol(intra.second); 00551 Int iTrans = Triple(intra.first,lbl,intra.third); 00552 from_ITrans.insert(std::pair<St,Int>(intra.first,iTrans)); 00553 } 00554 else 00555 { 00556 //Add a symbol to the label. 00557 ((it->second).second).addSymbol(intra.second); 00558 } 00559 00560 //Update the map for the target of the transition. 00561 it = to_ITrans.find(intra.third); 00562 if( it == to_ITrans.end() ) 00563 { 00564 //Make a new label 00565 Label lbl; 00566 lbl.addSymbol(intra.second); 00567 Int iTrans = Triple(intra.first,lbl,intra.third); 00568 to_ITrans.insert(std::pair<St,Int>(intra.third,iTrans)); 00569 } 00570 else 00571 { 00572 //Add a symbol to the label. 00573 ((it->second).second).addSymbol(intra.second); 00574 } 00575 } 00576 00577 /** 00578 * 00579 * @brief remove an internal transition from the maps 00580 * 00581 * This method updates the maps associated with the source and target of the given 00582 * internal transition. 00583 * 00584 * @param - intra: the internal transition to remove from the maps 00585 * 00586 */ 00587 void removeIntra( const Internal & intra ) 00588 { 00589 /* //Update the map for the source of the transition. 00590 IntraMap::iterator it = from_ITrans.find(intra.first); 00591 if( it != from_ITrans.end() ) 00592 { 00593 it->second.erase(intra); 00594 if( it->second.empty() ) 00595 from_ITrans.erase(it); 00596 } 00597 00598 //Update the map for the target of the transition. 00599 it = to_ITrans.find(intra.third); 00600 if( it != to_ITrans.end() ) 00601 { 00602 it->second.erase(intra); 00603 if( it->second.empty() ) 00604 to_ITrans.erase(it); 00605 } 00606 */ } 00607 00608 /** 00609 * 00610 * @brief add a call transition to the maps 00611 * 00612 * This method updates the maps associated with the call point and entry point of 00613 * the given call transition. 00614 * 00615 * @param - call: the call transition to add to the maps 00616 * 00617 */ 00618 void addCall( const Call & call ) 00619 { 00620 /* //Update the maps for the call point of the transition. 00621 CallMap::iterator it = call_CTrans.find(call.first); 00622 if( it == call_CTrans.end() ) 00623 { 00624 Calls cTrans; 00625 cTrans.insert(call); 00626 call_CTrans.insert(std::pair<St,Calls>(call.first,cTrans)); 00627 } 00628 else 00629 it->second.insert(call); 00630 00631 //Update the maps for the entry point of the transition. 00632 it = entry_CTrans.find(call.third); 00633 if( it == entry_CTrans.end() ) 00634 { 00635 Calls cTrans; 00636 cTrans.insert(call); 00637 entry_CTrans.insert(std::pair<St,Calls>(call.third,cTrans)); 00638 } 00639 else 00640 it->second.insert(call); 00641 */ } 00642 00643 /** 00644 * 00645 * @brief remove a call transition from the maps 00646 * 00647 * This method updates the maps associated with the call point and entry point of 00648 * the given call transition. 00649 * 00650 * @param - call: the call transition to remove from the maps 00651 * 00652 */ 00653 void removeCall( const Call & call ) 00654 { 00655 /* //Update the maps for the call point of the transition. 00656 CallMap::iterator it = call_CTrans.find(call.first); 00657 if( it != call_CTrans.end() ) 00658 { 00659 it->second.erase(call); 00660 if( it->second.empty() ) 00661 call_CTrans.erase(it); 00662 } 00663 00664 //Update the maps for the entry point of the transition. 00665 it = entry_CTrans.find(call.third); 00666 if( it != entry_CTrans.end() ) 00667 { 00668 it->second.erase(call); 00669 if( it->second.empty() ) 00670 entry_CTrans.erase(it); 00671 } 00672 */ } 00673 00674 /** 00675 * 00676 * @brief add a return transition to the maps 00677 * 00678 * This method updates the maps associated with the exit point, call predecessor, 00679 * and return point of the given return transition. 00680 * 00681 * @param - ret: the return transition to add to the maps 00682 * 00683 */ 00684 void addRet( const Return & ret ) 00685 { 00686 /* //Update the maps for the exit point of the transition. 00687 RetMap::iterator it = exit_RTrans.find(ret.first); 00688 if( it == exit_RTrans.end() ) 00689 { 00690 Returns rTrans; 00691 rTrans.insert(ret); 00692 exit_RTrans.insert(std::pair<St,Returns>(ret.first,rTrans)); 00693 } 00694 else 00695 it->second.insert(ret); 00696 00697 //Update the maps for the call predecessor of the transition. 00698 it = pred_RTrans.find(ret.second); 00699 if( it == pred_RTrans.end() ) 00700 { 00701 Returns rTrans; 00702 rTrans.insert(ret); 00703 pred_RTrans.insert(std::pair<St,Returns>(ret.second,rTrans)); 00704 } 00705 else 00706 it->second.insert(ret); 00707 00708 //Update the maps for the return point of the transition. 00709 it = ret_RTrans.find(ret.fourth); 00710 if( it == ret_RTrans.end() ) 00711 { 00712 Returns rTrans; 00713 rTrans.insert(ret); 00714 ret_RTrans.insert(std::pair<St,Returns>(ret.fourth,rTrans)); 00715 } 00716 else 00717 it->second.insert(ret); 00718 */ } 00719 00720 /** 00721 * 00722 * @brief remove a return transition from the maps 00723 * 00724 * This method updates the maps associated with the exit point, call predecessor, 00725 * and return point of the given return transition. 00726 * 00727 * @param - ret: the return transition to remove from the maps 00728 * 00729 */ 00730 void removeRet( const Return & ret ) 00731 { 00732 /* //Update the maps for the exit point of the transition. 00733 RetMap::iterator it = exit_RTrans.find(ret.first); 00734 if( it != exit_RTrans.end() ) 00735 { 00736 it->second.erase(ret); 00737 if( it->second.empty() ) 00738 exit_RTrans.erase(it); 00739 } 00740 00741 //Update the maps for the call predecessor of the transition. 00742 it = pred_RTrans.find(ret.second); 00743 if( it != pred_RTrans.end() ) 00744 { 00745 it->second.erase(ret); 00746 if( it->second.empty() ) 00747 pred_RTrans.erase(it); 00748 } 00749 00750 //Update the maps for the return point of the transition. 00751 it = ret_RTrans.find(ret.fourth); 00752 if( it != ret_RTrans.end() ) 00753 { 00754 it->second.erase(ret); 00755 if( it->second.empty() ) 00756 ret_RTrans.erase(it); 00757 } 00758 */ } 00759 00760 /** 00761 * 00762 * @brief returns all internal transitions with the given state as the source 00763 * 00764 * This method returns the set of all internal transitions whose source is the 00765 * given state. 00766 * 00767 * @param - name: the state whose outgoing transitions to obtain 00768 * @return a set of outgoing transitions for the given state 00769 * 00770 */ 00771 const Internals fromTrans( St state ) const 00772 { 00773 /* IntraMap::const_iterator it = from_ITrans.find(state); 00774 if( it == from_ITrans.end() ) 00775 */ return Internals(); 00776 /* else 00777 return it->second; 00778 */ } 00779 00780 /** 00781 * 00782 * @brief returns all internal transitions with the given state as the target 00783 * 00784 * This method returns the set of all internal transitions whose target is the 00785 * given state. 00786 * 00787 * @param - name: the state whose incoming transitions to obtain 00788 * @returm a set of incoming transitions for the given state 00789 * 00790 */ 00791 const Internals toTrans( St state ) const 00792 { 00793 /* IntraMap::const_iterator it = to_ITrans.find(state); 00794 if( it == to_ITrans.end() ) 00795 */ return Internals(); 00796 /* else 00797 return it->second; 00798 */ } 00799 00800 /** 00801 * 00802 * @brief returns all call transitions with the given state as the call site 00803 * 00804 * This method returns the set of all call transitions whose call site is the 00805 * given state. 00806 * 00807 * @param - name: the state whose call site transitions to obtain 00808 * @return a set of call transitions with the given state playing the part of 00809 * the call site 00810 * 00811 */ 00812 const Calls callTrans( St state ) const 00813 { 00814 /* CallMap::const_iterator it = call_CTrans.find(state); 00815 if( it == call_CTrans.end() ) 00816 */ return Calls(); 00817 /* else 00818 return it->second; 00819 */ } 00820 00821 /** 00822 * 00823 * @brief returns all call transitions with the given state as the entry point 00824 * 00825 * This method returns the set of all call transitions whose entry point is the 00826 * given state. 00827 * 00828 * @param - name: the state whose entry transitions to obtain 00829 * @return a set of call transitions with the given state playing the part of 00830 * the entry point 00831 * 00832 */ 00833 const Calls entryTrans( St state ) const 00834 { 00835 /* CallMap::const_iterator it = entry_CTrans.find(state); 00836 if( it == entry_CTrans.end() ) 00837 */ return Calls(); 00838 /* else 00839 return it->second; 00840 */ } 00841 00842 /** 00843 * 00844 * @brief returns all return transitions with the given state as the exit point 00845 * 00846 * This method returns the set of all return transitions whose exit point is 00847 * the given state. 00848 * 00849 * @param - name: the state whose exit transitions to obtain 00850 * @return a set of return transitions with the given state playing the part of 00851 * the exit point 00852 * 00853 */ 00854 const Returns exitTrans( St state ) const 00855 { 00856 /* RetMap::const_iterator it = exit_RTrans.find(state); 00857 if( it == exit_RTrans.end() ) 00858 */ return Returns(); 00859 /* else 00860 return it->second; 00861 */ } 00862 00863 /** 00864 * 00865 * @brief returns all return transitions with the given state as the call predecessor 00866 * 00867 * This method returns the set of all return transitions whose call predecessor 00868 * is the given state. 00869 * 00870 * @param - name: the state whose call predecessor transitions to obtain 00871 * @return a set of return transitions with the given state playing the part of 00872 * the call predecessor. 00873 * 00874 */ 00875 const Returns predTrans( St state )const 00876 { 00877 /* RetMap::const_iterator it = pred_RTrans.find(state); 00878 if( it == pred_RTrans.end() ) 00879 */ return Returns(); 00880 /* else 00881 return it->second; 00882 */ } 00883 00884 /** 00885 * 00886 * @brief returns all return transitions with the given state as the return site 00887 * 00888 * This method returns the set of all return transitions whose return site is 00889 * the given state. 00890 * 00891 * @param - name: the state whose return site transitions to obtain 00892 * @return a set of return transitions with the given state playing the part 00893 * of the return site. 00894 * 00895 */ 00896 const Returns retTrans( St state )const 00897 { 00898 /* RetMap::const_iterator it = ret_RTrans.find(state); 00899 if( it == ret_RTrans.end() ) 00900 */ return Returns(); 00901 /* else 00902 return it->second; 00903 */ } 00904 00905 /** 00906 * 00907 * @brief tests whether the given state is the source of any internal transition 00908 * 00909 * This method determines whether the given state is the source of any 00910 * internal transition. 00911 * 00912 * @param - name: the state to test 00913 * @return true if the given state is the source of some internal transition, 00914 * false otherwise 00915 * 00916 */ 00917 bool isFrom( St state ) const 00918 { 00919 /* IntraMap::iterator it = from_ITrans.find(state); 00920 if( it != from_ITrans.end() ) 00921 { 00922 if( !(it.second.empty()) ) 00923 return true; 00924 } 00925 */ return false; 00926 } 00927 00928 /** 00929 * 00930 * @brief tests whether the given state is the target of any internal transition 00931 * 00932 * This method determines whether the given state is the target of any 00933 * internal transition. 00934 * 00935 * @param - name: the state to test 00936 * @return true if the given state is the target of some internal transition, 00937 * false otherwise 00938 * 00939 */ 00940 bool isTo( St state ) const 00941 { 00942 /* IntraMap::iterator it = to_ITrans.find(state); 00943 if( it != to_ITrans.end() ) 00944 { 00945 if( !(it.second.empty()) ) 00946 return true; 00947 } 00948 */ return false; 00949 } 00950 00951 /** 00952 * 00953 * @brief tests whether the given state is the call site of any call transition 00954 * 00955 * This method determines whether the given state is the call site of any 00956 * call transition. 00957 * 00958 * @param - name: the state to test 00959 * @return true if the given state is the call site of some call transition, 00960 * false otherwise 00961 * 00962 */ 00963 bool isCall( St state ) const 00964 { 00965 /* CallMap::iterator it = call_CTrans.find(state); 00966 if( it != call_CTrans.end() ) 00967 { 00968 if( !(it.second.empty()) ) 00969 return true; 00970 } 00971 */ return false; 00972 } 00973 00974 /** 00975 * 00976 * @brief tests whether the given state is the entry point of any call transition 00977 * 00978 * This method determines whether the given state is the entry point of any 00979 * call transition. 00980 * 00981 * @param - name: the state to test 00982 * @return true if the given state is the entry point of some call transition, 00983 * false otherwise 00984 * 00985 */ 00986 bool isEntry( St state ) const 00987 { 00988 /* CallMap::iterator it = entry_CTrans.find(state); 00989 if( it != entry_CTrans.end() ) 00990 { 00991 if( !(it.second.empty()) ) 00992 return true; 00993 } 00994 */ return false; 00995 } 00996 00997 /** 00998 * 00999 * @brief tests whether the given state is the exit point of any return transition 01000 * 01001 * This method determines whether the given state is the exit point of any 01002 * return transition. 01003 * 01004 * @param - name: the state to test 01005 * @return true if the given state is the exit point of some return transition, 01006 * false otherwise 01007 * 01008 */ 01009 bool isExit( St state ) const 01010 { 01011 /* RetMap::iterator it = exit_RTrans.find(state); 01012 if( it != exit_RTrans.end() ) 01013 { 01014 if( !(it.second.empty()) ) 01015 return true; 01016 } 01017 */ return false; 01018 } 01019 01020 /** 01021 * 01022 * @brief tests whether the given state is the call predecessor for any return 01023 * transition 01024 * 01025 * This method determines whether the given state is the call predecessor for 01026 * any return transition. 01027 * 01028 * @param - name: the state to test 01029 * @return true if the given state is the call predecessor of some return 01030 * transition, false otherwise 01031 * 01032 */ 01033 bool isPred( St state ) const 01034 { 01035 /* RetMap::iterator it = pred_RTrans.find(state); 01036 if( it != pred_RTrans.end() ) 01037 { 01038 if( !(it.second.empty()) ) 01039 return true; 01040 } 01041 */ return false; 01042 } 01043 01044 /** 01045 * 01046 * @brief tests whether the given state is the return site of any return transition 01047 * 01048 * This method determines whether the given state is the return site of any 01049 * return transition. 01050 * 01051 * @param - name: the state to test 01052 * @return true if the given state is the return site of some return transition, 01053 * false otherwise 01054 * 01055 */ 01056 bool isRet( St state ) const 01057 { 01058 /* RetMap::iterator it = ret_RTrans.find(state); 01059 if( it != ret_RTrans.end() ) 01060 { 01061 if( !(it.second.empty()) ) 01062 return true; 01063 } 01064 */ return false; 01065 } 01066 #endif 01067 01068 /** 01069 * 01070 * @brief tests whether this collection of transition maps is equivalent 01071 * to the collection of transition maps 'other' 01072 * 01073 * This method tests the equivalence of these transition maps and the transition 01074 * maps in 'other'. 01075 * 01076 * @param - other: the TransitionInfo to compare this TransitionInfo to 01077 * @return true if this TransitionInfo is equivalent to the TransitionInfo 01078 * 'other' 01079 * 01080 */ 01081 bool operator==( const TransitionInfo & other ) const 01082 { 01083 return ( (from_ITrans == other.from_ITrans) && 01084 (to_ITrans == other.to_ITrans) && 01085 (call_CTrans == other.call_CTrans) && 01086 (entry_CTrans == other.entry_CTrans) && 01087 (exit_RTrans == other.exit_RTrans) && 01088 (pred_RTrans == other.pred_RTrans) && 01089 (ret_RTrans == other.ret_RTrans) ); 01090 } 01091 01092 /** 01093 * 01094 * @brief clears the transition maps 01095 * 01096 * This method removes all transition information from the transition maps. 01097 * 01098 */ 01099 void clearMaps() 01100 { 01101 from_ITrans.clear(); 01102 to_ITrans.clear(); 01103 01104 call_CTrans.clear(); 01105 entry_CTrans.clear(); 01106 01107 exit_RTrans.clear(); 01108 pred_RTrans.clear(); 01109 ret_RTrans.clear(); 01110 } 01111 01112 // 01113 // Variables 01114 // 01115 01116 private: 01117 01118 // maps to speed up transition search 01119 IntraMap from_ITrans; 01120 IntraMap to_ITrans; 01121 01122 CallMap call_CTrans; 01123 CallMap entry_CTrans; 01124 01125 RetMap exit_RTrans; 01126 RetMap pred_RTrans; 01127 RetMap ret_RTrans; 01128 }; 01129 01130 01131 } 01132 } 01133 #endif