hio_environment.hGo to the documentation of this file.00001 /** @file hio_environment.h Generator with I/O-environment attributes */ 00002 00003 /* Hierarchical IO Systems Plug-In for FAU Discrete Event Systems Library (libfaudes) 00004 00005 Copyright (C) 2006 Sebastian Perk 00006 Copyright (C) 2006 Thomas Moor 00007 Copyright (C) 2006 Klaus Schmidt 00008 00009 */ 00010 00011 #ifndef FAUDES_HIO_ENVIRONMENT_H 00012 #define FAUDES_HIO_ENVIRONMENT_H 00013 00014 #include "corefaudes.h" 00015 #include "hio_attributes.h" 00016 00017 namespace faudes { 00018 00019 /** 00020 * Generator with I/O-environment attributes. The HioEnvironment is a variant of the 00021 * Generator to add an interface for events and states with I/O-environment attributes, 00022 * built from HioEvent- and HioStateFlags 00023 * - event attributes: YE = Y && E 00024 * UE = U && E 00025 * YL = Y && L 00026 * UL = U && L 00027 * - state attributes: QYe = QY && QE 00028 * QUe = QU && QE 00029 * QUl = QU && QL 00030 * QYlUe 00031 * 00032 * Technically, the construct is based on the specialized attribute classes 00033 * faudes::HioEventFlags and faudes::HioStateFlags that provide attributes with 00034 * semantics for hierarchical I/O properties. The THioEnvironment expects attribute template 00035 * parameters with the minimum interface defined in HioEventFlags and HioStateFlags. 00036 * Thus, you can add further semantics by deriving a class HioEventFlagsAndMore from 00037 * HioEventFlags (same for HioStateFlags) and use this as event attribute parameter for 00038 * THioEnvironment. To model a plain finite state machine plus I/O-environment properties, use THioEnvironment 00039 * with HioEventFlags and HioStateFlags for the event and state attribute parameters 00040 * and AttributeVoid for the other parameters. 00041 * For convenience, this has been typedefed as HioEnvironment. 00042 * 00043 * @ingroup hiosysplugin 00044 */ 00045 00046 template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr> 00047 class THioEnvironment : public TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr> { 00048 public: 00049 /** 00050 * Creates an empty HioEnvironment object 00051 */ 00052 THioEnvironment(void); 00053 00054 /** 00055 * HioEnvironment from a std Generator. Copy constructor 00056 * 00057 * @param rOtherGen 00058 */ 00059 THioEnvironment(const Generator& rOtherGen); 00060 00061 /** 00062 * HioEnvironment from a std Generator and event sets. Copy constructor 00063 * 00064 * @param rOtherGen 00065 * Generator 00066 * @param rYl 00067 * alphabet Yl 00068 * @param rUl 00069 * alphabet Ul 00070 * @param rYe 00071 * alphabet Ye 00072 * @param rUe 00073 * alphabet Ue 00074 */ 00075 THioEnvironment( 00076 const Generator& rOtherGen, 00077 const EventSet& rYl, 00078 const EventSet& rUl, 00079 const EventSet& rYe, 00080 const EventSet& rUe 00081 ); 00082 00083 /** 00084 * HioEnvironment from a HioEnvironment. Copy constructor 00085 * 00086 * @param rOtherGen 00087 */ 00088 THioEnvironment(const THioEnvironment& rOtherGen); 00089 00090 /** 00091 * construct a HioEnvironment from file 00092 * 00093 * @param rFileName 00094 * Filename 00095 * 00096 * @exception Exception 00097 * If opening/reading fails an Exception object is thrown (id 1, 50, 51) 00098 */ 00099 THioEnvironment(const std::string& rFileName); 00100 00101 /** 00102 * Construct on heap 00103 * 00104 * @return 00105 * new Generator 00106 */ 00107 THioEnvironment* New(void) const; 00108 00109 /** 00110 * Construct copy on heap 00111 * 00112 * @return 00113 * new Generator 00114 */ 00115 virtual THioEnvironment* Copy(void) const; 00116 00117 /** 00118 * Create empty HioEnvironment with same symboltable as this 00119 * 00120 * @return 00121 * New Generator 00122 */ 00123 THioEnvironment NewHioEnvironment(void) const; 00124 00125 /** 00126 * Assignment operator (uses copy ) 00127 * Note: you must reimplement this operator in derived 00128 * classes in order to handle internal pointers correctly 00129 * 00130 * @param rOtherGen 00131 * Other generator 00132 */ 00133 virtual THioEnvironment& operator= (const THioEnvironment& rOtherGen) {this->Assign(rOtherGen); return *this;}; 00134 00135 /** 00136 * Assignment operator (uses copy ) 00137 * 00138 * @param rOtherGen 00139 * Other generator 00140 */ 00141 virtual THioEnvironment& operator= (const Generator& rOtherGen) {this->Assign(rOtherGen); return *this;}; 00142 00143 //**************** I/O environment event attributes ********************/ 00144 00145 /** 00146 * Add an existing Ye-event to generator. 00147 * An entry in the global event table will be made. 00148 * 00149 * @param index 00150 * Event index 00151 */ 00152 void InsYeEvent(Idx index); 00153 00154 /** 00155 * Add new named Ye-event to generator. 00156 * An entry in the global event table will be made if event is new. 00157 * 00158 * @param rName 00159 * Name of the event to add 00160 * 00161 * @return 00162 * New global unique index 00163 */ 00164 Idx InsYeEvent(const std::string& rName); 00165 00166 /** 00167 * Add an existing Ue-event to generator. 00168 * An entry in the global event table will be made. 00169 * 00170 * @param index 00171 * Event index 00172 */ 00173 void InsUeEvent(Idx index); 00174 00175 /** 00176 * Add new named Ue-event to generator. 00177 * An entry in the global event table will be made if event is new. 00178 * 00179 * @param rName 00180 * Name of the event to add 00181 * 00182 * @return 00183 * New global unique index 00184 */ 00185 Idx InsUeEvent(const std::string& rName); 00186 00187 /** 00188 * Mark event as Ye-event (by index) 00189 * 00190 * @param index 00191 * Event index 00192 */ 00193 void SetYe(Idx index); 00194 00195 /** 00196 * Mark event as Ye-event(by name) 00197 * 00198 * @param rName 00199 * Event name 00200 */ 00201 void SetYe(const std::string& rName); 00202 00203 /** 00204 * Mark set of events as Ye-events 00205 * 00206 * @param rEvents 00207 * EventSet 00208 */ 00209 void SetYe(const EventSet& rEvents); 00210 00211 /** 00212 * Mark event Ue-event(by index) 00213 * 00214 * @param index 00215 * Event index 00216 */ 00217 void SetUe(Idx index); 00218 00219 /** 00220 * Mark event Ue-event(by name) 00221 * 00222 * @param rName 00223 * Event name 00224 */ 00225 void SetUe(const std::string& rName); 00226 00227 /** 00228 * Mark set of events as Ue-events 00229 * 00230 * @param rEvents 00231 * EventSet 00232 */ 00233 void SetUe(const EventSet& rEvents); 00234 00235 /** 00236 * Is event Ye-event(by index) 00237 * 00238 * @param index 00239 * Event index 00240 * 00241 * @return 00242 * True / false 00243 */ 00244 bool IsYe(Idx index) const; 00245 00246 /** 00247 * Is event Ye-event(by name) 00248 * 00249 * @param rName 00250 * Event name 00251 * 00252 * @return 00253 * True / false 00254 */ 00255 bool IsYe(const std::string& rName) const; 00256 00257 /** 00258 * Is event Ue-event(by index) 00259 * 00260 * @param index 00261 * Event index 00262 * 00263 * @return 00264 * True / false 00265 */ 00266 bool IsUe(Idx index) const; 00267 00268 /** 00269 * Is event Ue-event(by name) 00270 * 00271 * @param rName 00272 * Event name 00273 * 00274 * @return 00275 * True / false 00276 */ 00277 bool IsUe(const std::string& rName) const; 00278 00279 /** 00280 * Get EventSet with Ye-events 00281 * 00282 * @return 00283 * EventSet of Ye-events 00284 */ 00285 EventSet YeEvents(void) const; 00286 00287 /** 00288 * Get EventSet with Ue-events 00289 * 00290 * @return 00291 * EventSet of Ue-events 00292 */ 00293 EventSet UeEvents(void) const; 00294 00295 /** 00296 * Add an existing Yl-event to generator. 00297 * An entry in the global event table will be made. 00298 * 00299 * @param index 00300 * Event index 00301 */ 00302 void InsYlEvent(Idx index); 00303 00304 /** 00305 * Add new named Yl-event to generator. 00306 * An entry in the global event table will be made if event is new. 00307 * 00308 * @param rName 00309 * Name of the event to add 00310 * 00311 * @return 00312 * New global unique index 00313 */ 00314 Idx InsYlEvent(const std::string& rName); 00315 00316 /** 00317 * Add an existing Ul-event to generator. 00318 * An entry in the global event table will be made. 00319 * 00320 * @param index 00321 * Event index 00322 */ 00323 void InsUlEvent(Idx index); 00324 00325 /** 00326 * Add new named Ul-event to generator. 00327 * An entry in the global event table will be made if event is new. 00328 * 00329 * @param rName 00330 * Name of the event to add 00331 * 00332 * @return 00333 * New global unique index 00334 */ 00335 Idx InsUlEvent(const std::string& rName); 00336 00337 /** 00338 * Mark event as Yl-event (by index) 00339 * 00340 * @param index 00341 * Event index 00342 */ 00343 void SetYl(Idx index); 00344 00345 /** 00346 * Mark event as Yl-event (by name) 00347 * 00348 * @param rName 00349 * Event name 00350 */ 00351 void SetYl(const std::string& rName); 00352 00353 /** 00354 * Mark set of events as Yl-events 00355 * 00356 * @param rEvents 00357 * EventSet 00358 */ 00359 void SetYl(const EventSet& rEvents); 00360 00361 /** 00362 * Mark event as Ul-event (by index) 00363 * 00364 * @param index 00365 * Event index 00366 */ 00367 void SetUl(Idx index); 00368 00369 /** 00370 * Mark event as Ul-event (by name) 00371 * 00372 * @param rName 00373 * Event name 00374 */ 00375 void SetUl(const std::string& rName); 00376 00377 /** 00378 * Mark set of events as Ul-events 00379 * 00380 * @param rEvents 00381 * EventSet 00382 */ 00383 void SetUl(const EventSet& rEvents); 00384 00385 /** 00386 * Is event Yl-event (by index) 00387 * 00388 * @param index 00389 * Event index 00390 * 00391 * @return 00392 * True / false 00393 */ 00394 bool IsYl(Idx index) const; 00395 00396 /** 00397 * Is event Yl-event (by name) 00398 * 00399 * @param rName 00400 * Event name 00401 * 00402 * @return 00403 * True / false 00404 */ 00405 bool IsYl(const std::string& rName) const; 00406 00407 /** 00408 * Is event Ul-event (by index) 00409 * 00410 * @param index 00411 * Event index 00412 * 00413 * @return 00414 * True / false 00415 */ 00416 bool IsUl(Idx index) const; 00417 00418 /** 00419 * Is event Ul-event (by name) 00420 * 00421 * @param rName 00422 * Event name 00423 * 00424 * @return 00425 * True / false 00426 */ 00427 bool IsUl(const std::string& rName) const; 00428 00429 /** 00430 * Get EventSet with Yl-events 00431 * 00432 * @return 00433 * EventSet of Yl-events 00434 */ 00435 EventSet YlEvents(void) const; 00436 00437 /** 00438 * Get EventSet with Ul-events 00439 * 00440 * @return 00441 * EventSet of Ul-events 00442 */ 00443 EventSet UlEvents(void) const; 00444 00445 00446 //************** query elementary event attributes ****************************/ 00447 /** 00448 * Is event Y-event? (by index) 00449 * 00450 * @param index 00451 * Event index 00452 * 00453 * @return 00454 * True / false 00455 */ 00456 bool IsY(Idx index) const; 00457 00458 /** 00459 * Is event Y-event? (by name) 00460 * 00461 * @param rName 00462 * Event name 00463 * 00464 * @return 00465 * True / false 00466 */ 00467 bool IsY(const std::string& rName) const; 00468 00469 /** 00470 * Get EventSet with Y-events 00471 * 00472 * @return 00473 * EventSet of Y-events 00474 */ 00475 EventSet YEvents(void) const; 00476 00477 /** 00478 * Is event U-event? (by index) 00479 * 00480 * @param index 00481 * Event index 00482 * 00483 * @return 00484 * True / false 00485 */ 00486 bool IsU(Idx index) const; 00487 00488 /** 00489 * Is event U-event? (by name) 00490 * 00491 * @param rName 00492 * Event name 00493 * 00494 * @return 00495 * True / false 00496 */ 00497 bool IsU(const std::string& rName) const; 00498 00499 /** 00500 * Get EventSet with U-events 00501 * 00502 * @return 00503 * EventSet of U-events 00504 */ 00505 EventSet UEvents(void) const; 00506 00507 /** 00508 * Is event P-event? (by index) 00509 * 00510 * @param index 00511 * Event index 00512 * 00513 * @return 00514 * True / false 00515 */ 00516 bool IsE(Idx index) const; 00517 00518 /** 00519 * Is event P-event? (by name) 00520 * 00521 * @param rName 00522 * Event name 00523 * 00524 * @return 00525 * True / false 00526 */ 00527 bool IsE(const std::string& rName) const; 00528 00529 /** 00530 * Get EventSet with P-events 00531 * 00532 * @return 00533 * EventSet of P-events 00534 */ 00535 EventSet EEvents(void) const; 00536 00537 /** 00538 * Is event E-event? (by index) 00539 * 00540 * @param index 00541 * Event index 00542 * 00543 * @return 00544 * True / false 00545 */ 00546 bool IsL(Idx index) const; 00547 00548 /** 00549 * Is event E-event? (by name) 00550 * 00551 * @param rName 00552 * Event name 00553 * 00554 * @return 00555 * True / false 00556 */ 00557 bool IsL(const std::string& rName) const; 00558 00559 /** 00560 * Get EventSet with E-events 00561 * 00562 * @return 00563 * EventSet of E-events 00564 */ 00565 EventSet LEvents(void) const; 00566 /******************************************************/ 00567 00568 00569 /*************** I/O environment state attributes **********************/ 00570 00571 /** 00572 * Mark event as QYe-state (by index) 00573 * 00574 * @param index 00575 * State index 00576 */ 00577 void SetQYe(Idx index); 00578 00579 /** 00580 * Mark state as QYe-state (by name) 00581 * 00582 * @param rName 00583 * State name 00584 */ 00585 void SetQYe(const std::string& rName); 00586 00587 /** 00588 * Mark set of states as QYe-states 00589 * 00590 * @param rStates 00591 * StateSet 00592 */ 00593 void SetQYe(const StateSet& rStates); 00594 00595 /** Mark state as NOT QYe-state (by index) 00596 * 00597 * @param index 00598 * State index 00599 */ 00600 void ClrQYe(Idx index); 00601 00602 /** 00603 * Mark state as NOT QYe-state (by name) 00604 * 00605 * @param rName 00606 * State name 00607 */ 00608 void ClrQYe(const std::string& rName); 00609 00610 /** 00611 * Mark set of states as NOT QYe-states (by index) 00612 * 00613 * @param rStates 00614 * StateSet 00615 */ 00616 void ClrQYe(const StateSet& rStates); 00617 00618 /** Is state QYe-state (by index) 00619 * 00620 * @param index 00621 * State index 00622 * 00623 * @return 00624 * True / false 00625 */ 00626 bool IsQYe(Idx index) const; 00627 00628 /** 00629 * Is state QYe-state (by name) 00630 * 00631 * @param rName 00632 * State name 00633 * 00634 * @return 00635 * True / false 00636 */ 00637 bool IsQYe(const std::string& rName) const; 00638 00639 /** 00640 * Get StateSet with QYe-states 00641 * 00642 * @return 00643 * StateSet of QYe-states 00644 */ 00645 StateSet QYeStates(void) const; 00646 00647 /** 00648 * Mark event as QUe-state (by index) 00649 * 00650 * @param index 00651 * State index 00652 */ 00653 void SetQUe(Idx index); 00654 00655 /** 00656 * Mark state as QUe-state (by name) 00657 * 00658 * @param rName 00659 * State name 00660 */ 00661 void SetQUe(const std::string& rName); 00662 00663 /** 00664 * Mark set of states as QUe-states 00665 * 00666 * @param rStates 00667 * StateSet 00668 */ 00669 void SetQUe(const StateSet& rStates); 00670 00671 /** Mark state as NOT QUe-state (by index) 00672 * 00673 * @param index 00674 * State index 00675 */ 00676 void ClrQUe(Idx index); 00677 00678 /** 00679 * Mark state as NOT QUe-state (by name) 00680 * 00681 * @param rName 00682 * State name 00683 */ 00684 void ClrQUe(const std::string& rName); 00685 00686 /** 00687 * Mark set of states as NOT QUe-states (by index) 00688 * 00689 * @param rStates 00690 * StateSet 00691 */ 00692 void ClrQUe(const StateSet& rStates); 00693 00694 /** Is state QUe-state (by index) 00695 * 00696 * @param index 00697 * State index 00698 * 00699 * @return 00700 * True / false 00701 */ 00702 bool IsQUe(Idx index) const; 00703 00704 /** 00705 * Is state QUe-state (by name) 00706 * 00707 * @param rName 00708 * State name 00709 * 00710 * @return 00711 * True / false 00712 */ 00713 bool IsQUe(const std::string& rName) const; 00714 00715 /** 00716 * Get StateSet with QUe-states 00717 * 00718 * @return 00719 * StateSet of QUe-states 00720 */ 00721 StateSet QUeStates(void) const; 00722 00723 /** 00724 * Mark event as QUl-state (by index) 00725 * 00726 * @param index 00727 * State index 00728 */ 00729 void SetQUl(Idx index); 00730 00731 /** 00732 * Mark state as QUl-state (by name) 00733 * 00734 * @param rName 00735 * State name 00736 */ 00737 void SetQUl(const std::string& rName); 00738 00739 /** 00740 * Mark set of states as QUl-states 00741 * 00742 * @param rStates 00743 * StateSet 00744 */ 00745 void SetQUl(const StateSet& rStates); 00746 00747 /** Mark state as NOT QUl-state (by index) 00748 * 00749 * @param index 00750 * State index 00751 */ 00752 void ClrQUl(Idx index); 00753 00754 /** 00755 * Mark state as NOT QUl-state (by name) 00756 * 00757 * @param rName 00758 * State name 00759 */ 00760 void ClrQUl(const std::string& rName); 00761 00762 /** 00763 * Mark set of states as NOT QUl-states (by index) 00764 * 00765 * @param rStates 00766 * StateSet 00767 */ 00768 void ClrQUl(const StateSet& rStates); 00769 00770 /** Is state QUl-state (by index) 00771 * 00772 * @param index 00773 * State index 00774 * 00775 * @return 00776 * True / false 00777 */ 00778 bool IsQUl(Idx index) const; 00779 00780 /** 00781 * Is state QUl-state (by name) 00782 * 00783 * @param rName 00784 * State name 00785 * 00786 * @return 00787 * True / false 00788 */ 00789 bool IsQUl(const std::string& rName) const; 00790 00791 /** 00792 * Get StateSet with QUl-states 00793 * 00794 * @return 00795 * StateSet of QUl-states 00796 */ 00797 StateSet QUlStates(void) const; 00798 00799 /** 00800 * Mark event as QYlUe-state (by index) 00801 * 00802 * @param index 00803 * State index 00804 */ 00805 void SetQYlUe(Idx index); 00806 00807 /** 00808 * Mark state as QYlUe-state (by name) 00809 * 00810 * @param rName 00811 * State name 00812 */ 00813 void SetQYlUe(const std::string& rName); 00814 00815 /** 00816 * Mark set of states as QYlUe-states 00817 * 00818 * @param rStates 00819 * StateSet 00820 */ 00821 void SetQYlUe(const StateSet& rStates); 00822 00823 /** Mark state as NOT QYlUe-state (by index) 00824 * 00825 * @param index 00826 * State index 00827 */ 00828 void ClrQYlUe(Idx index); 00829 00830 /** 00831 * Mark state as NOT QYlUe-state (by name) 00832 * 00833 * @param rName 00834 * State name 00835 */ 00836 void ClrQYlUe(const std::string& rName); 00837 00838 /** 00839 * Mark set of states as NOT QYlUe-states (by index) 00840 * 00841 * @param rStates 00842 * StateSet 00843 */ 00844 void ClrQYlUe(const StateSet& rStates); 00845 00846 /** Is state QYlUe-state (by index) 00847 * 00848 * @param index 00849 * State index 00850 * 00851 * @return 00852 * True / false 00853 */ 00854 bool IsQYlUe(Idx index) const; 00855 00856 /** 00857 * Is state QYlUe-state (by name) 00858 * 00859 * @param rName 00860 * State name 00861 * 00862 * @return 00863 * True / false 00864 */ 00865 bool IsQYlUe(const std::string& rName) const; 00866 00867 /** 00868 * Get StateSet with QYlUe-states 00869 * 00870 * @return 00871 * StateSet of QYlUe-states 00872 */ 00873 StateSet QYlUeStates(void) const; 00874 00875 /** 00876 * Mark state as Err-state (by index) 00877 * 00878 * @param index 00879 * State index 00880 */ 00881 void SetErr(Idx index); 00882 00883 /** 00884 * Mark state as Err-state (by name) 00885 * 00886 * @param rName 00887 * State name 00888 */ 00889 void SetErr(const std::string& rName); 00890 00891 /** 00892 * Mark set of states as Err-states 00893 * 00894 * @param rStates 00895 * StateSet 00896 */ 00897 void SetErr(const StateSet& rStates); 00898 00899 /** Mark state as NOT Err-state (by index) 00900 * 00901 * @param index 00902 * State index 00903 */ 00904 void ClrErr(Idx index); 00905 00906 /** 00907 * Mark state as NOT Err-state (by name) 00908 * 00909 * @param rName 00910 * State name 00911 */ 00912 void ClrErr(const std::string& rName); 00913 00914 /** 00915 * Mark set of states as NOT Err-states (by index) 00916 * 00917 * @param rStates 00918 * StateSet 00919 */ 00920 void ClrErr(const StateSet& rStates); 00921 00922 /** Is state Err-state (by index) 00923 * 00924 * @param index 00925 * State index 00926 * 00927 * @return 00928 * True / false 00929 */ 00930 bool IsErr(Idx index) const; 00931 00932 /** 00933 * Is state Err-state (by name) 00934 * 00935 * @param rName 00936 * State name 00937 * 00938 * @return 00939 * True / false 00940 */ 00941 bool IsErr(const std::string& rName) const; 00942 00943 /** 00944 * Get StateSet with Err-states 00945 * 00946 * @return 00947 * StateSet of Err-states 00948 */ 00949 StateSet ErrStates(void) const; 00950 00951 /** 00952 * Updates internal attributes. 00953 * This method sets the state partition attributes. 00954 * 00955 * @return True if value changed 00956 */ 00957 virtual bool UpdateAttributes(void) {IsHioEnvironmentForm(*this); return true;}; 00958 00959 private: 00960 00961 protected: 00962 }; // end class THioEnvironment 00963 00964 00965 // convenience typedef for std HioEnvironment 00966 typedef THioEnvironment<AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid> HioEnvironment; 00967 00968 /* convenience access to relevant scopes */ 00969 #define THIS THioEnvironment<GlobalAttr, StateAttr, EventAttr, TransAttr> 00970 #define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr> 00971 #define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr> 00972 00973 00974 // THioEnvironment(void) 00975 TEMP THIS::THioEnvironment(void) : BASE() { 00976 FD_DG("HioEnvironment(" << this << ")::HioEnvironment()"); 00977 } 00978 00979 // THioEnvironment(rOtherGen) 00980 TEMP THIS::THioEnvironment(const THioEnvironment& rOtherGen) : BASE(rOtherGen) { 00981 FD_DG("HioEnvironment(" << this << ")::HioEnvironment(rOtherGen)"); 00982 } 00983 00984 // THioEnvironment(rOtherGen) 00985 TEMP THIS::THioEnvironment(const Generator& rOtherGen) : BASE(rOtherGen) { 00986 FD_DG("HioEnvironment(" << this << ")::HioEnvironment(rOtherGen)"); 00987 } 00988 00989 // THioEnvironment(rOtherGen,rYe,rUe,rYl,rUl) 00990 TEMP THIS::THioEnvironment( 00991 const Generator& rOtherGen, 00992 const EventSet& rYl, 00993 const EventSet& rUl, 00994 const EventSet& rYe, 00995 const EventSet& rUe 00996 ) : BASE(rOtherGen) { 00997 FD_DG("HioEnvironment(" << this << ")::HioEnvironment(rOtherGen)"); 00998 SetYe(rYe); 00999 SetUe(rUe); 01000 SetYl(rYl); 01001 SetUl(rUl); 01002 } 01003 01004 // THioEnvironment(rFileName) 01005 TEMP THIS::THioEnvironment(const std::string& rFileName) : BASE(rFileName) { 01006 FD_DG("HioEnvironment(" << this << ")::HioEnvironment(rFilename) : done"); 01007 } 01008 01009 // New() 01010 TEMP THIS* THIS::New(void) const { 01011 // allocate 01012 THIS* res = new THIS; 01013 // fix base data 01014 res->EventSymbolTablep(BASE::mpEventSymbolTable); 01015 res->mStateNamesEnabled=BASE::mStateNamesEnabled; 01016 return res; 01017 } 01018 01019 // Copy() 01020 TEMP THIS* THIS::Copy(void) const { 01021 return new THIS(*this); 01022 } 01023 01024 // NewHioEnvironment() 01025 TEMP THIS THIS::NewHioEnvironment(void) const { 01026 // call base (fixes by assignment constructor) 01027 THIS res= BASE::NewAGen(); 01028 return res; 01029 } 01030 01031 /******************************************************/ 01032 01033 // IsY(index) 01034 TEMP bool THIS::IsY(Idx index) const { 01035 EventAttr attr=BASE::EventAttribute(index); 01036 return attr.IsY(); 01037 } 01038 01039 // IsY(rName) 01040 TEMP bool THIS::IsY(const std::string& rName) const { 01041 EventAttr attr=BASE::EventAttribute(rName); 01042 return attr.IsY(); 01043 } 01044 01045 // IsU(index) 01046 TEMP bool THIS::IsU(Idx index) const { 01047 EventAttr attr=BASE::EventAttribute(index); 01048 return attr.IsU(); 01049 } 01050 01051 // IsU(rName) 01052 TEMP bool THIS::IsU(const std::string& rName) const { 01053 EventAttr attr=BASE::EventAttribute(rName); 01054 return attr.IsU(); 01055 } 01056 01057 //YEvents() 01058 TEMP EventSet THIS::YEvents(void) const { 01059 FD_DG("HioEnvironment(" << this << ")::YEvents()"); 01060 EventSet res; 01061 EventSet::Iterator it; 01062 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) { 01063 if(IsY(*it)) res.Insert(*it); 01064 } 01065 return res; 01066 } 01067 01068 //UEvents() 01069 TEMP EventSet THIS::UEvents(void) const { 01070 FD_DG("HioEnvironment(" << this << ")::UEvents()"); 01071 EventSet res; 01072 EventSet::Iterator it; 01073 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) { 01074 if(IsU(*it)) res.Insert(*it); 01075 } 01076 return res; 01077 } 01078 01079 /*****************************************************************/ 01080 01081 // InsYeEvent(index) 01082 TEMP void THIS::InsYeEvent(Idx index) { 01083 FD_DG("HioEnvironment(" << this << ")::InsYeEvent(" << index << ")"); 01084 EventAttr attr; 01085 attr.SetY(); 01086 attr.SetE(); 01087 BASE::InsEvent(index,attr); 01088 } 01089 01090 // InsYeEvent(rName) 01091 TEMP Idx THIS::InsYeEvent(const std::string& rName) { 01092 FD_DG("HioEnvironment(" << this << ")::InsYeEvent(" << rName << ")"); 01093 EventAttr attr; 01094 attr.SetY(); 01095 attr.SetE(); 01096 return BASE::InsEvent(rName,attr); 01097 } 01098 01099 // InsUeEvent(index) 01100 TEMP void THIS::InsUeEvent(Idx index) { 01101 FD_DG("HioEnvironment(" << this << ")::InsUeEvent(" << index << ")"); 01102 EventAttr attr; 01103 attr.SetU(); 01104 attr.SetE(); 01105 BASE::InsEvent(index,attr); 01106 } 01107 01108 // InsUeEvent(rName) 01109 TEMP Idx THIS::InsUeEvent(const std::string& rName) { 01110 FD_DG("HioEnvironment(" << this << ")::InsUeEvent(" << rName << ")"); 01111 EventAttr attr; 01112 attr.SetU(); 01113 attr.SetE(); 01114 return BASE::InsEvent(rName,attr); 01115 } 01116 01117 // SetYe(index) 01118 TEMP void THIS::SetYe(Idx index) { 01119 FD_DG("HioEnvironment(" << this << ")::SetYe(" << index << ")"); 01120 EventAttr attr=BASE::EventAttribute(index); 01121 attr.SetY(); 01122 attr.SetE(); 01123 BASE::pAlphabet->Attribute(index,attr); 01124 } 01125 01126 // SetYe(rName) 01127 TEMP void THIS::SetYe(const std::string& rName) { 01128 FD_DG("HioEnvironment(" << this << ")::SetYe(" << rName << ")"); 01129 Idx index = BASE::EventIndex(rName); 01130 SetYe(index); 01131 } 01132 01133 //SetYe(rEvents) 01134 TEMP void THIS::SetYe(const EventSet& rEvents) { 01135 FD_DG("HioEnvironment(" << this << ")::SetYe(rEvents)"); 01136 EventSet::Iterator it; 01137 for(it=rEvents.Begin(); it!=rEvents.End(); it++) { 01138 SetYe(*it); 01139 } 01140 } 01141 01142 // SetUe(index) 01143 TEMP void THIS::SetUe(Idx index) { 01144 FD_DG("HioEnvironment(" << this << ")::SetUe(" << index << ")"); 01145 EventAttr attr=BASE::EventAttribute(index); 01146 attr.SetU(); 01147 attr.SetE(); 01148 BASE::pAlphabet->Attribute(index,attr); 01149 } 01150 01151 // SetUe(rName) 01152 TEMP void THIS::SetUe(const std::string& rName) { 01153 FD_DG("HioEnvironment(" << this << ")::SetUe(" << rName << ")"); 01154 Idx index = BASE::EventIndex(rName); 01155 SetUe(index); 01156 } 01157 01158 //SetUe(rEvents) 01159 TEMP void THIS::SetUe(const EventSet& rEvents) { 01160 FD_DG("HioEnvironment(" << this << ")::SetUe(rEvents)"); 01161 EventSet::Iterator it; 01162 for(it=rEvents.Begin(); it!=rEvents.End(); it++) { 01163 SetUe(*it); 01164 } 01165 } 01166 01167 // IsYe(index) 01168 TEMP bool THIS::IsYe(Idx index) const { 01169 EventAttr attr=BASE::EventAttribute(index); 01170 return (attr.IsY() && attr.IsE()); 01171 } 01172 01173 // IsYe(rName) 01174 TEMP bool THIS::IsYe(const std::string& rName) const { 01175 EventAttr attr=BASE::EventAttribute(rName); 01176 return (attr.IsY() && attr.IsE()); 01177 } 01178 01179 // IsUe(index) 01180 TEMP bool THIS::IsUe(Idx index) const { 01181 EventAttr attr=BASE::EventAttribute(index); 01182 return (attr.IsU() && attr.IsE()); 01183 } 01184 01185 // IsUe(rName) 01186 TEMP bool THIS::IsUe(const std::string& rName) const { 01187 EventAttr attr=BASE::EventAttribute(rName); 01188 return (attr.IsU() && attr.IsE()); 01189 } 01190 01191 //YeEvents() 01192 TEMP EventSet THIS::YeEvents(void) const { 01193 FD_DG("HioEnvironment(" << this << ")::YeEvents()"); 01194 EventSet res; 01195 EventSet::Iterator it; 01196 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) { 01197 if(IsYe(*it)) res.Insert(*it); 01198 } 01199 return res; 01200 } 01201 01202 //UeEvents() 01203 TEMP EventSet THIS::UeEvents(void) const { 01204 FD_DG("HioEnvironment(" << this << ")::UeEvents()"); 01205 EventSet res; 01206 EventSet::Iterator it; 01207 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) { 01208 if(IsUe(*it)) res.Insert(*it); 01209 } 01210 return res; 01211 } 01212 01213 /*******************************************************************/ 01214 01215 // InsYlEvent(index) 01216 TEMP void THIS::InsYlEvent(Idx index) { 01217 FD_DG("HioEnvironment(" << this << ")::InsYlEvent(" << index << ")"); 01218 EventAttr attr; 01219 attr.SetY(); 01220 attr.SetL(); 01221 BASE::InsEvent(index,attr); 01222 } 01223 01224 // InsYlEvent(rName) 01225 TEMP Idx THIS::InsYlEvent(const std::string& rName) { 01226 FD_DG("HioEnvironment(" << this << ")::InsYlEvent(" << rName << ")"); 01227 EventAttr attr; 01228 attr.SetY(); 01229 attr.SetL(); 01230 return BASE::InsEvent(rName,attr); 01231 } 01232 01233 // InsUlEvent(index) 01234 TEMP void THIS::InsUlEvent(Idx index) { 01235 FD_DG("HioEnvironment(" << this << ")::InsUlEvent(" << index << ")"); 01236 EventAttr attr; 01237 attr.SetU(); 01238 attr.SetL(); 01239 BASE::InsEvent(index,attr); 01240 } 01241 01242 // InsUlEvent(rName) 01243 TEMP Idx THIS::InsUlEvent(const std::string& rName) { 01244 FD_DG("HioEnvironment(" << this << ")::InsUlEvent(" << rName << ")"); 01245 EventAttr attr; 01246 attr.SetU(); 01247 attr.SetL(); 01248 return BASE::InsEvent(rName,attr); 01249 } 01250 01251 // SetYl(index) 01252 TEMP void THIS::SetYl(Idx index) { 01253 FD_DG("HioEnvironment(" << this << ")::SetYl(" << index << ")"); 01254 EventAttr attr=BASE::EventAttribute(index); 01255 attr.SetY(); 01256 attr.SetL(); 01257 BASE::pAlphabet->Attribute(index,attr); 01258 } 01259 01260 // SetYl(rName) 01261 TEMP void THIS::SetYl(const std::string& rName) { 01262 FD_DG("HioEnvironment(" << this << ")::SetYl(" << rName << ")"); 01263 Idx index = BASE::EventIndex(rName); 01264 SetYl(index); 01265 } 01266 01267 //SetYl(rEvents) 01268 TEMP void THIS::SetYl(const EventSet& rEvents) { 01269 FD_DG("HioEnvironment(" << this << ")::SetYl(rEvents)"); 01270 EventSet::Iterator it; 01271 for(it=rEvents.Begin(); it!=rEvents.End(); it++) { 01272 SetYl(*it); 01273 } 01274 } 01275 01276 // SetUl(index) 01277 TEMP void THIS::SetUl(Idx index) { 01278 FD_DG("HioEnvironment(" << this << ")::SetUl(" << index << ")"); 01279 EventAttr attr=BASE::EventAttribute(index); 01280 attr.SetU(); 01281 attr.SetL(); 01282 BASE::pAlphabet->Attribute(index,attr); 01283 } 01284 01285 // SetUl(rName) 01286 TEMP void THIS::SetUl(const std::string& rName) { 01287 FD_DG("HioEnvironment(" << this << ")::SetUl(" << rName << ")"); 01288 Idx index = BASE::EventIndex(rName); 01289 SetUl(index); 01290 } 01291 01292 //SetUl(rEvents) 01293 TEMP void THIS::SetUl(const EventSet& rEvents) { 01294 FD_DG("HioEnvironment(" << this << ")::SetUl(rEvents)"); 01295 EventSet::Iterator it; 01296 for(it=rEvents.Begin(); it!=rEvents.End(); it++) { 01297 SetUl(*it); 01298 } 01299 } 01300 01301 // IsYl(index) 01302 TEMP bool THIS::IsYl(Idx index) const { 01303 EventAttr attr=BASE::EventAttribute(index); 01304 return (attr.IsY() && attr.IsL()); 01305 } 01306 01307 // IsYl(rName) 01308 TEMP bool THIS::IsYl(const std::string& rName) const { 01309 EventAttr attr=BASE::EventAttribute(rName); 01310 return (attr.IsY() && attr.IsL()); 01311 } 01312 01313 // IsUl(index) 01314 TEMP bool THIS::IsUl(Idx index) const { 01315 EventAttr attr=BASE::EventAttribute(index); 01316 return (attr.IsU() && attr.IsL()); 01317 } 01318 01319 // IsUl(rName) 01320 TEMP bool THIS::IsUl(const std::string& rName) const { 01321 EventAttr attr=BASE::EventAttribute(rName); 01322 return (attr.IsU() && attr.IsL()); 01323 } 01324 01325 //YlEvents() 01326 TEMP EventSet THIS::YlEvents(void) const { 01327 FD_DG("HioEnvironment(" << this << ")::YlEvents()"); 01328 EventSet res; 01329 EventSet::Iterator it; 01330 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) { 01331 if(IsYl(*it)) res.Insert(*it); 01332 } 01333 return res; 01334 } 01335 01336 //UlEvents() 01337 TEMP EventSet THIS::UlEvents(void) const { 01338 FD_DG("HioEnvironment(" << this << ")::UlEvents()"); 01339 EventSet res; 01340 EventSet::Iterator it; 01341 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) { 01342 if(IsUl(*it)) res.Insert(*it); 01343 } 01344 return res; 01345 } 01346 01347 /*****************************************************************/ 01348 01349 // IsE(index) 01350 TEMP bool THIS::IsE(Idx index) const { 01351 EventAttr attr=BASE::EventAttribute(index); 01352 return attr.IsE(); 01353 } 01354 01355 // IsE(rName) 01356 TEMP bool THIS::IsE(const std::string& rName) const { 01357 EventAttr attr=BASE::EventAttribute(rName); 01358 return attr.IsE(); 01359 } 01360 01361 // IsL(index) 01362 TEMP bool THIS::IsL(Idx index) const { 01363 EventAttr attr=BASE::EventAttribute(index); 01364 return attr.IsL(); 01365 } 01366 01367 // IsL(rName) 01368 TEMP bool THIS::IsL(const std::string& rName) const { 01369 EventAttr attr=BASE::EventAttribute(rName); 01370 return attr.IsL(); 01371 } 01372 01373 //EEvents() 01374 TEMP EventSet THIS::EEvents(void) const { 01375 FD_DG("HioEnvironment(" << this << ")::EEvents()"); 01376 EventSet res; 01377 EventSet::Iterator it; 01378 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) { 01379 if(IsE(*it)) res.Insert(*it); 01380 } 01381 return res; 01382 } 01383 01384 //LEvents() 01385 TEMP EventSet THIS::LEvents(void) const { 01386 FD_DG("HioEnvironment(" << this << ")::EEvents()"); 01387 EventSet res; 01388 EventSet::Iterator it; 01389 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) { 01390 if(IsL(*it)) res.Insert(*it); 01391 } 01392 return res; 01393 } 01394 01395 /*******************************************************************/ 01396 01397 /******************************************************************* 01398 *****************Implementation of the state attributes************* 01399 *******************************************************************/ 01400 01401 // SetQYe(index) 01402 TEMP void THIS::SetQYe(Idx index) { 01403 FD_DG("HioEnvironment(" << this << ")::SetQYe(" << index << ")"); 01404 StateAttr attr=BASE::StateAttribute(index); 01405 attr.SetQY(); 01406 attr.SetQE(); 01407 attr.ClrQU(); 01408 attr.ClrQC(); 01409 attr.ClrQP(); 01410 attr.ClrQL(); 01411 attr.ClrQYcUp(); 01412 attr.ClrQYlUe(); 01413 BASE::pStates->Attribute(index,attr); 01414 } 01415 01416 // SetQYe(rName) 01417 TEMP void THIS::SetQYe(const std::string& rName) { 01418 FD_DG("HioEnvironment(" << this << ")::SetQYe(" << rName << ")"); 01419 Idx index = BASE::StateIndex(rName); 01420 SetQYe(index); 01421 } 01422 01423 //SetQYe(rStates) 01424 TEMP void THIS::SetQYe(const StateSet& rStates) { 01425 FD_DG("HioEnvironment(" << this << ")::SetQYe(rStates)"); 01426 StateSet::Iterator sit; 01427 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01428 SetQYe(*sit); 01429 } 01430 } 01431 01432 // ClrQYe(index) 01433 TEMP void THIS::ClrQYe(Idx index) { 01434 FD_DG("HioEnvironment(" << this << ")::ClrQYe(" << index << ")"); 01435 StateAttr attr=BASE::StateAttribute(index); 01436 attr.ClrQY(); 01437 attr.ClrQE(); 01438 BASE::pStates->Attribute(index,attr); 01439 } 01440 01441 // ClrQYe(rName) 01442 TEMP void THIS::ClrQYe(const std::string& rName) { 01443 FD_DG("HioEnvironment(" << this << ")::ClrQYe(" << rName << ")"); 01444 Idx index = BASE::StateIndex(rName); 01445 ClrQYe(index); 01446 } 01447 01448 //ClrQYe(rStates) 01449 TEMP void THIS::ClrQYe(const StateSet& rStates) { 01450 FD_DG("HioEnvironment(" << this << ")::ClrQYe(rStates)"); 01451 StateSet::Iterator sit; 01452 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01453 ClrQYe(*sit); 01454 } 01455 } 01456 01457 // IsQYe(index) 01458 TEMP bool THIS::IsQYe(Idx index) const { 01459 StateAttr attr=BASE::StateAttribute(index); 01460 return attr.IsQY() && attr.IsQE() && attr.IsQL(); 01461 } 01462 01463 // IsQYe(rName) 01464 TEMP bool THIS::IsQYe(const std::string& rName) const { 01465 Idx index = BASE::StateIndex(rName); 01466 return IsQYe(index); 01467 } 01468 01469 //QYeStates() 01470 TEMP StateSet THIS::QYeStates(void) const { 01471 FD_DG("HioEnvironment(" << this << ")::QYeStates()"); 01472 StateSet res; 01473 StateSet::Iterator sit; 01474 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) { 01475 if(IsQYe(*sit)) res.Insert(*sit); 01476 } 01477 return res; 01478 } 01479 /***************************************************************************/ 01480 01481 // SetQUe(index) 01482 TEMP void THIS::SetQUe(Idx index) { 01483 FD_DG("HioEnvironment(" << this << ")::SetQUe(" << index << ")"); 01484 StateAttr attr=BASE::StateAttribute(index); 01485 attr.SetQU(); 01486 attr.SetQE(); 01487 attr.ClrQY(); 01488 attr.ClrQC(); 01489 attr.ClrQP(); 01490 attr.ClrQL(); 01491 attr.ClrQYcUp(); 01492 attr.ClrQYlUe(); 01493 BASE::pStates->Attribute(index,attr); 01494 } 01495 01496 // SetQUe(rName) 01497 TEMP void THIS::SetQUe(const std::string& rName) { 01498 FD_DG("HioEnvironment(" << this << ")::SetQUe(" << rName << ")"); 01499 Idx index = BASE::StateIndex(rName); 01500 SetQUe(index); 01501 } 01502 01503 //SetQUe(rStates) 01504 TEMP void THIS::SetQUe(const StateSet& rStates) { 01505 FD_DG("HioEnvironment(" << this << ")::SetQUe(rStates)"); 01506 StateSet::Iterator sit; 01507 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01508 SetQUe(*sit); 01509 } 01510 } 01511 01512 // ClrQUe(index) 01513 TEMP void THIS::ClrQUe(Idx index) { 01514 FD_DG("HioEnvironment(" << this << ")::ClrQUe(" << index << ")"); 01515 StateAttr attr=BASE::StateAttribute(index); 01516 attr.ClrQU(); 01517 attr.ClrQE(); 01518 BASE::pStates->Attribute(index,attr); 01519 } 01520 01521 // ClrQUe(rName) 01522 TEMP void THIS::ClrQUe(const std::string& rName) { 01523 FD_DG("HioEnvironment(" << this << ")::ClrQUe(" << rName << ")"); 01524 Idx index = BASE::StateIndex(rName); 01525 ClrQUe(index); 01526 } 01527 01528 //ClrQUe(rStates) 01529 TEMP void THIS::ClrQUe(const StateSet& rStates) { 01530 FD_DG("HioEnvironment(" << this << ")::ClrQUe(rStates)"); 01531 StateSet::Iterator sit; 01532 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01533 ClrQUe(*sit); 01534 } 01535 } 01536 01537 // IsQUe(index) 01538 TEMP bool THIS::IsQUe(Idx index) const { 01539 StateAttr attr=BASE::StateAttribute(index); 01540 return attr.IsQU() && attr.IsQE(); 01541 } 01542 01543 // IsQUe(rName) 01544 TEMP bool THIS::IsQUe(const std::string& rName) const { 01545 Idx index = BASE::StateIndex(rName); 01546 return IsQUe(index); 01547 } 01548 01549 //QUeStates() 01550 TEMP StateSet THIS::QUeStates(void) const { 01551 FD_DG("HioEnvironment(" << this << ")::QUeStates()"); 01552 StateSet res; 01553 StateSet::Iterator sit; 01554 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) { 01555 if(IsQUe(*sit)) res.Insert(*sit); 01556 } 01557 return res; 01558 } 01559 /***************************************************************************/ 01560 01561 /***************************************************************************/ 01562 01563 // SetQUl(index) 01564 TEMP void THIS::SetQUl(Idx index) { 01565 FD_DG("HioEnvironment(" << this << ")::SetQUl(" << index << ")"); 01566 StateAttr attr=BASE::StateAttribute(index); 01567 attr.SetQU(); 01568 attr.SetQL(); 01569 attr.ClrQY(); 01570 attr.ClrQC(); 01571 attr.ClrQP(); 01572 attr.ClrQE(); 01573 attr.ClrQYcUp(); 01574 attr.ClrQYlUe(); 01575 BASE::pStates->Attribute(index,attr); 01576 } 01577 01578 // SetQUl(rName) 01579 TEMP void THIS::SetQUl(const std::string& rName) { 01580 FD_DG("HioEnvironment(" << this << ")::SetQUl(" << rName << ")"); 01581 Idx index = BASE::StateIndex(rName); 01582 SetQUl(index); 01583 } 01584 01585 //SetQUl(rStates) 01586 TEMP void THIS::SetQUl(const StateSet& rStates) { 01587 FD_DG("HioEnvironment(" << this << ")::SetQUl(rStates)"); 01588 StateSet::Iterator sit; 01589 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01590 SetQUl(*sit); 01591 } 01592 } 01593 01594 // ClrQUl(index) 01595 TEMP void THIS::ClrQUl(Idx index) { 01596 FD_DG("HioEnvironment(" << this << ")::ClrQUl(" << index << ")"); 01597 StateAttr attr=BASE::StateAttribute(index); 01598 attr.ClrQU(); 01599 attr.ClrQL(); 01600 BASE::pStates->Attribute(index,attr); 01601 } 01602 01603 // ClrQUl(rName) 01604 TEMP void THIS::ClrQUl(const std::string& rName) { 01605 FD_DG("HioEnvironment(" << this << ")::ClrQUl(" << rName << ")"); 01606 Idx index = BASE::StateIndex(rName); 01607 ClrQUl(index); 01608 } 01609 01610 //ClrQUl(rStates) 01611 TEMP void THIS::ClrQUl(const StateSet& rStates) { 01612 FD_DG("HioEnvironment(" << this << ")::ClrQUl(rStates)"); 01613 StateSet::Iterator sit; 01614 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01615 ClrQUl(*sit); 01616 } 01617 } 01618 01619 // IsQUl(index) 01620 TEMP bool THIS::IsQUl(Idx index) const { 01621 StateAttr attr=BASE::StateAttribute(index); 01622 return attr.IsQU() && attr.IsQL(); 01623 } 01624 01625 // IsQUl(rName) 01626 TEMP bool THIS::IsQUl(const std::string& rName) const { 01627 Idx index = BASE::StateIndex(rName); 01628 return IsQUl(index); 01629 } 01630 01631 //QUlStates() 01632 TEMP StateSet THIS::QUlStates(void) const { 01633 FD_DG("HioEnvironment(" << this << ")::QUlStates()"); 01634 StateSet res; 01635 StateSet::Iterator sit; 01636 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) { 01637 if(IsQUl(*sit)) res.Insert(*sit); 01638 } 01639 return res; 01640 } 01641 01642 /***************************************************************************/ 01643 01644 // SetQYlUe(index) 01645 TEMP void THIS::SetQYlUe(Idx index) { 01646 FD_DG("HioEnvironment(" << this << ")::SetQYlUe(" << index << ")"); 01647 StateAttr attr=BASE::StateAttribute(index); 01648 attr.SetQYlUe(); 01649 attr.ClrQY(); 01650 attr.ClrQU(); 01651 attr.ClrQC(); 01652 attr.ClrQP(); 01653 attr.ClrQE(); 01654 attr.ClrQL(); 01655 attr.ClrQYcUp(); 01656 BASE::pStates->Attribute(index,attr); 01657 } 01658 01659 // SetQYlUe(rName) 01660 TEMP void THIS::SetQYlUe(const std::string& rName) { 01661 FD_DG("HioEnvironment(" << this << ")::SetQYlUe(" << rName << ")"); 01662 Idx index = BASE::StateIndex(rName); 01663 SetQYlUe(index); 01664 } 01665 01666 //SetQYlUe(rStates) 01667 TEMP void THIS::SetQYlUe(const StateSet& rStates) { 01668 FD_DG("HioEnvironment(" << this << ")::SetQYlUe(rStates)"); 01669 StateSet::Iterator sit; 01670 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01671 SetQYlUe(*sit); 01672 } 01673 } 01674 01675 // ClrQYlUe(index) 01676 TEMP void THIS::ClrQYlUe(Idx index) { 01677 FD_DG("HioEnvironment(" << this << ")::ClrQYlUe(" << index << ")"); 01678 StateAttr attr=BASE::StateAttribute(index); 01679 attr.ClrQYlUe(); 01680 BASE::pStates->Attribute(index,attr); 01681 } 01682 01683 // ClrQYlUe(rName) 01684 TEMP void THIS::ClrQYlUe(const std::string& rName) { 01685 FD_DG("HioEnvironment(" << this << ")::ClrQYlUe(" << rName << ")"); 01686 Idx index = BASE::StateIndex(rName); 01687 ClrQYlUe(index); 01688 } 01689 01690 //ClrQYlUe(rStates) 01691 TEMP void THIS::ClrQYlUe(const StateSet& rStates) { 01692 FD_DG("HioEnvironment(" << this << ")::ClrQYlUe(rStates)"); 01693 StateSet::Iterator sit; 01694 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01695 ClrQYlUe(*sit); 01696 } 01697 } 01698 01699 // IsQYlUe(index) 01700 TEMP bool THIS::IsQYlUe(Idx index) const { 01701 StateAttr attr=BASE::StateAttribute(index); 01702 return attr.IsQYlUe(); 01703 } 01704 01705 // IsQYlUe(rName) 01706 TEMP bool THIS::IsQYlUe(const std::string& rName) const { 01707 Idx index = BASE::StateIndex(rName); 01708 return IsQYlUe(index); 01709 } 01710 01711 //QYlUeStates() 01712 TEMP StateSet THIS::QYlUeStates(void) const { 01713 FD_DG("HioEnvironment(" << this << ")::QYlUeStates()"); 01714 StateSet res; 01715 StateSet::Iterator sit; 01716 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) { 01717 if(IsQYlUe(*sit)) res.Insert(*sit); 01718 } 01719 return res; 01720 } 01721 01722 // SetErr(index) 01723 TEMP void THIS::SetErr(Idx index) { 01724 FD_DG("HioPlant(" << this << ")::SetErr(" << index << ")"); 01725 StateAttr attr=BASE::StateAttribute(index); 01726 attr.SetErr(); 01727 BASE::pStates->Attribute(index,attr); 01728 } 01729 01730 // SetErr(rName) 01731 TEMP void THIS::SetErr(const std::string& rName) { 01732 FD_DG("HioPlant(" << this << ")::SetErr(" << rName << ")"); 01733 Idx index = BASE::StateIndex(rName); 01734 SetErr(index); 01735 } 01736 01737 //SetErr(rStates) 01738 TEMP void THIS::SetErr(const StateSet& rStates) { 01739 FD_DG("HioPlant(" << this << ")::SetErr(rStates)"); 01740 StateSet::Iterator sit; 01741 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01742 SetErr(*sit); 01743 } 01744 } 01745 01746 // ClrErr(index) 01747 TEMP void THIS::ClrErr(Idx index) { 01748 FD_DG("HioPlant(" << this << ")::ClrErr(" << index << ")"); 01749 StateAttr attr=BASE::StateAttribute(index); 01750 attr.ClrErr(); 01751 BASE::pStates->Attribute(index,attr); 01752 } 01753 01754 // ClrErr(rName) 01755 TEMP void THIS::ClrErr(const std::string& rName) { 01756 FD_DG("HioPlant(" << this << ")::ClrErr(" << rName << ")"); 01757 Idx index = BASE::StateIndex(rName); 01758 ClrErr(index); 01759 } 01760 01761 //ClrErr(rStates) 01762 TEMP void THIS::ClrErr(const StateSet& rStates) { 01763 FD_DG("HioPlant(" << this << ")::ClrErr(rStates)"); 01764 StateSet::Iterator sit; 01765 for(sit=rStates.Begin(); sit!=rStates.End(); sit++) { 01766 ClrErr(*sit); 01767 } 01768 } 01769 01770 // IsErr(index) 01771 TEMP bool THIS::IsErr(Idx index) const { 01772 StateAttr attr=BASE::StateAttribute(index); 01773 return attr.IsErr(); 01774 } 01775 01776 // IsErr(rName) 01777 TEMP bool THIS::IsErr(const std::string& rName) const { 01778 Idx index = BASE::StateIndex(rName); 01779 return IsErr(index); 01780 } 01781 01782 //ErrStates() 01783 TEMP StateSet THIS::ErrStates(void) const { 01784 FD_DG("HioPlant(" << this << ")::ErrStates()"); 01785 StateSet res; 01786 StateSet::Iterator sit; 01787 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) { 01788 if(IsErr(*sit)) res.Insert(*sit); 01789 } 01790 return res; 01791 } 01792 01793 /***************************************************************************/ 01794 01795 #undef TEMP 01796 #undef BASE 01797 #undef THIS 01798 01799 /** 01800 * IsHioEnvironmentForm: check if rHioEnvironment is in I/O-environment form and assign state 01801 * attributes. 01802 * This function tests if rHioEnvironment meets the I/O-environment form that has been formally 01803 * defined by S.Perk. If so, then the alphabet of and the language marked by 01804 * rHioEnvironment formally describe an I/O environment. During the test, the HioStateFlags are 01805 * set according to the active event set or the respective state, for example: 01806 * The QYlUe flag is assigned to a state if its active eventset is a subset of the 01807 * union of the YL- and the UE-Alphabet. 01808 * The assignment of HioStateFlags is complete only if IsHioEnvironmentForm() returns true. 01809 * Method: all conditions in the formal I/O-environment form definition are checked 01810 * individually. If crucial conditions are violated, the test of remaining 01811 * conditions is omitted. 01812 * 01813 * @param rHioEnvironment 01814 * HioEnvironment to check, HioStateFlags are set 01815 * @param rQYe 01816 * State set containing all QYe states 01817 * @param rQUe 01818 * State set containing all QUe states 01819 * @param rQUl 01820 * State set containing all QUl states 01821 * @param rQYlUe 01822 * State set containing all QYlUe states 01823 * @param rErrEvSet 01824 * Event set for possible 'bad' events 01825 * @param rErrTrSet 01826 * Event set for possible 'bad' transition relations 01827 * @param rErrStSet 01828 * Event set for possible 'bad' states 01829 * @param rReportStr 01830 * Information about test results 01831 * @return 01832 * true if rHioEnvironment is in I/O-environment form 01833 */ 01834 bool IsHioEnvironmentForm(HioEnvironment& rHioEnvironment, 01835 StateSet& rQYe, 01836 StateSet& rQUe, 01837 StateSet& rQUl, 01838 StateSet& rQYlUe, 01839 EventSet& rErrEvSet, 01840 TransSet& rErrTrSet, 01841 StateSet& rErrStSet, 01842 std::string& rReportStr); 01843 01844 /** 01845 * IsHioEnvironmentForm: check if rHioEnvironment is in I/O-environment form and assign state 01846 * attributes. 01847 * This function tests if rHioEnvironment meets the I/O-environment form that has been formally 01848 * defined by S.Perk. If so, then the alphabet of and the language marked by 01849 * rHioEnvironment formally describe an I/O environment. During the test, the HioStateFlags are 01850 * set according to the active event set or the respective state, for example: 01851 * The QYlUe flag is assigned to a state if its active eventset is a subset of the 01852 * union of the YL- and the UE-Alphabet. 01853 * The assignment of HioStateFlags is complete only if IsHioEnvironmentForm() returns true. 01854 * Method: all conditions in the formal I/O-environment form definition are checked 01855 * individually. If crucial conditions are violated, the test of remaining 01856 * conditions is omitted. 01857 * 01858 * @param rHioEnvironment 01859 * HioEnvironment to check, HioStateFlags are set 01860 * @param rReportStr 01861 * Information about test results 01862 * @return 01863 * true if rHioEnvironment is in I/O-environment form 01864 */ 01865 bool IsHioEnvironmentForm(HioEnvironment& rHioEnvironment,std::string& rReportStr); 01866 01867 /** 01868 * IsHioEnvironmentForm: check if rHioEnvironment is in I/O-environment form and assign state 01869 * attributes. 01870 * This function tests if rHioEnvironment meets the I/O-environment form that has been formally 01871 * defined by S.Perk. If so, then the alphabet of and the language marked by 01872 * rHioEnvironment formally describe an I/O environment. During the test, the HioStateFlags are 01873 * set according to the active event set or the respective state, for example: 01874 * The QYlUe flag is assigned to a state if its active eventset is a subset of the 01875 * union of the YL- and the UE-Alphabet. 01876 * The assignment of HioStateFlags is complete only if IsHioEnvironmentForm() returns true. 01877 * Method: all conditions of the formal I/O-environment form definition are checked 01878 * individually. If crucial conditions are violated, the test of remaining 01879 * conditions is omitted. 01880 * 01881 * @param rHioEnvironment 01882 * HioEnvironment to check, HioStateFlags are set 01883 * @return 01884 * true if rHioEnvironment is in I/O-environment form 01885 */ 01886 bool IsHioEnvironmentForm(HioEnvironment& rHioEnvironment); 01887 01888 /** 01889 * Function definition for run-time interface 01890 * 01891 * @param rEnvironment 01892 * HioEnvironment 01893 */ 01894 void HioStatePartition(HioEnvironment& rEnvironment); 01895 01896 } // namespace faudes 01897 01898 #define HIOENVIRONMENT_H 01899 #endif libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |