ios_system.hGo to the documentation of this file.00001 /** @file ios_system.h Generator with I/O-system attributes */ 00002 00003 /* 00004 Standart IO Systems Plug-In for FAU Discrete Event Systems 00005 Library (libfaudes) 00006 00007 Copyright (C) 2010, Thomas Wittmann, Thomas Moor 00008 00009 */ 00010 00011 #ifndef FAUDES_IOS_SYSTEM_H 00012 #define FAUDES_IOS_SYSTEM_H 00013 00014 #include "corefaudes.h" 00015 #include "ios_attributes.h" 00016 00017 namespace faudes { 00018 00019 00020 /** 00021 * Generator with I/O-system attributes. 00022 * 00023 * An IoSystem is a generator with attributes for the 00024 * representation of I/O systems, i.e., systems with alternating 00025 * input events U and output events Y. 00026 * 00027 * The IoSystem template assumes that the StateAttr and EventAttr parameter is 00028 * derived from AttributeIosState and AttributeIosEvent, respectively. 00029 * 00030 * @ingroup IoSysPlugin 00031 */ 00032 00033 template <class GlobalAttr,class StateAttr,class EventAttr,class TransAttr> 00034 class TioGenerator : public TaGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr> { 00035 00036 public: 00037 00038 /** @name Constructors & Destructor */ 00039 /** @{ doxygen group */ 00040 00041 /** 00042 * Default constructor 00043 */ 00044 TioGenerator(void); 00045 00046 /** 00047 * Default destructor 00048 */ 00049 ~TioGenerator(void); 00050 00051 /** 00052 * Construtor 00053 * 00054 * Create IoSystem from file 00055 * 00056 * @param rFileName 00057 * Filename 00058 * 00059 * @exception Exception 00060 * - File io error (id 1) 00061 * - Token mismatch (id 50, 51, ...) 00062 */ 00063 TioGenerator(const std::string& rFileName); 00064 00065 /** 00066 * Constructor 00067 * 00068 * Create IoSystem on heap 00069 * 00070 * @return 00071 * new Generator 00072 */ 00073 virtual TioGenerator* New(void) const; 00074 00075 00076 /** 00077 * Copy constructor 00078 * 00079 * Create IoSystem from a std. Generator 00080 * 00081 * @param rOtherGen 00082 */ 00083 TioGenerator(const vGenerator& rOtherGen); 00084 00085 00086 /** 00087 * Copy constructor 00088 * 00089 * Create IoSystem from another IoSystem 00090 * 00091 * @param rOtherGen 00092 */ 00093 TioGenerator(const TioGenerator& rOtherGen); 00094 00095 00096 /** 00097 * Copy Constructor 00098 * 00099 * Construct copy on heap 00100 * 00101 * @return 00102 * new Generator 00103 */ 00104 virtual TioGenerator* Copy(void) const; 00105 00106 00107 /** 00108 * Create empty IoSystem with same symboltable as this 00109 * 00110 * @return 00111 * New Generator 00112 */ 00113 TioGenerator NewIoSystem(void) const; 00114 00115 00116 /** @} */ 00117 00118 /** @name Assignment */ 00119 /** @{ doxygen group */ 00120 00121 00122 /** 00123 * Assignment operator 00124 * 00125 * Note: you must reimplement this operator in derived 00126 * classes in order to handle internal pointers correctly 00127 * 00128 * @param rOtherGen 00129 * Other generator 00130 */ 00131 virtual TioGenerator& operator= (const TioGenerator& rOtherGen) { 00132 this->Assign(rOtherGen); 00133 return *this; 00134 }; 00135 00136 /** 00137 * Assignment operator 00138 * 00139 * @param rOtherGen 00140 * Other generator 00141 */ 00142 virtual TioGenerator& operator= (const vGenerator& rOtherGen) 00143 { 00144 this->Assign(rOtherGen); 00145 return *this; 00146 }; 00147 00148 00149 /** @} */ 00150 00151 /** @name Insertion with attributes */ 00152 /** @{ doxygen group */ 00153 00154 00155 /** 00156 * Insert an output-event by index 00157 * 00158 * An entry in the global event table will be made. 00159 * 00160 * Note: event has to exist in the global event table 00161 * 00162 * @param index 00163 * Event index 00164 */ 00165 void InsOutputEvent(Idx index); 00166 00167 /** 00168 * Insert output event by name. 00169 * 00170 * An entry in the global event table will be made if event is new. 00171 * 00172 * @param rName 00173 * Name of the event to add 00174 * 00175 * @return 00176 * New global unique index 00177 */ 00178 Idx InsOutputEvent(const std::string& rName); 00179 00180 /** 00181 * Insert a input event by index. 00182 * 00183 * Note: event must to exist in the global event table 00184 * 00185 * @param index 00186 * Event index 00187 */ 00188 void InsInputEvent(Idx index); 00189 00190 00191 /** 00192 * Insert input event by name. 00193 * 00194 * An entry in the global event table will be made if event is new. 00195 * 00196 * @param rName 00197 * Name of the event to add 00198 * 00199 * @return 00200 * New global unique index 00201 */ 00202 Idx InsInputEvent(const std::string& rName); 00203 00204 00205 /** @} */ 00206 00207 /** @name Event attributes */ 00208 /** @{ doxygen group */ 00209 00210 /** 00211 * Retrieve all output events 00212 * 00213 * @return 00214 * Set of all output events 00215 */ 00216 EventSet OutputEvents(void) const; 00217 00218 /** 00219 * Set all output events. 00220 * 00221 * Mark given events as output events, unmark 00222 * any other event. 00223 * 00224 * @param rEventSet 00225 * Set of all output events 00226 * @exception Exception 00227 * - Event does ot exist in generator (id 60) 00228 */ 00229 void OutputEvents(const EventSet& rEventSet); 00230 00231 /** 00232 * Test for output event 00233 * 00234 * @param index 00235 * Event index 00236 * @return 00237 * True / false 00238 * @exception Exception 00239 * - Event does ot exist in generator(id 60) 00240 */ 00241 bool OutputEvent(Idx index) const; 00242 00243 /** 00244 * Test for output event 00245 * 00246 * @param rName 00247 * Event name 00248 * @return 00249 * True / false 00250 * @exception Exception 00251 * - Event does ot exist in generator (id 60) 00252 */ 00253 bool OutputEvent(const std::string& rName) const; 00254 00255 /** 00256 * Mark event as output event 00257 * 00258 * @param index 00259 * Event index 00260 * @exception Exception 00261 * - Event does ot exist in generator (id 60) 00262 */ 00263 void SetOutputEvent(Idx index); 00264 00265 /** 00266 * Mark event as output event 00267 * 00268 * @param rName 00269 * Event name 00270 * @exception Exception 00271 * - Event does ot exist in generator (id 60) 00272 */ 00273 void SetOutputEvent(const std::string& rName); 00274 00275 /** 00276 * Mark event as output events 00277 * 00278 * @param rEventSet 00279 * Set of events to mark 00280 * @exception Exception 00281 * - Some event does ot exist in generator (id 60) 00282 */ 00283 void SetOutputEvent(const EventSet& rEventSet); 00284 00285 /** 00286 * Unmark event as output event 00287 * 00288 * @param index 00289 * Event index 00290 * @exception Exception 00291 * - Event does ot exist in generator (id 60) 00292 */ 00293 void ClrOutputEvent(Idx index); 00294 00295 /** 00296 * Unmark event as output event 00297 * 00298 * @param rName 00299 * Event name 00300 * @exception Exception 00301 * - Event does ot exist in generator (id 60) 00302 */ 00303 void ClrOutputEvent(const std::string& rName); 00304 00305 /** 00306 * Unmak events as output events 00307 * 00308 * @param rEventSet 00309 * Set of events to unmark 00310 * @exception Exception 00311 * - Some event does ot exist in generator (id 60) 00312 */ 00313 void ClrOutputEvent(const EventSet& rEventSet); 00314 00315 00316 /** 00317 * Retrieve all input events 00318 * 00319 * @return 00320 * Set of all input events 00321 */ 00322 EventSet InputEvents(void) const; 00323 00324 /** 00325 * Set all input events. 00326 * 00327 * Mark given events as input events, unmark 00328 * any other event. 00329 * 00330 * @param rEventSet 00331 * Set of all input events 00332 * @exception Exception 00333 * - Event does ot exist in generator (id 60) 00334 */ 00335 void InputEvents(const EventSet& rEventSet); 00336 00337 /** 00338 * Test for input event 00339 * 00340 * @param index 00341 * Event index 00342 * 00343 * @return 00344 * True / false 00345 * @exception Exception 00346 * - Event not found in alphabet (id 60) 00347 */ 00348 bool InputEvent(Idx index) const; 00349 00350 /** 00351 * Test for input event 00352 * 00353 * @param rName 00354 * Event name 00355 * 00356 * @return 00357 * True / false 00358 * @exception Exception 00359 * - Event not found in alphabet (id 60) 00360 */ 00361 bool InputEvent(const std::string& rName) const; 00362 00363 /** 00364 * Mark event as input event 00365 * 00366 * @param index 00367 * Event index 00368 * @exception Exception 00369 * - Event not found in alphabet (id 60) 00370 */ 00371 void SetInputEvent(Idx index); 00372 00373 /** 00374 * Mark event as input event 00375 * 00376 * @param rName 00377 * Event name 00378 * @exception Exception 00379 * - Event not found in alphabet (id 60) 00380 */ 00381 void SetInputEvent(const std::string& rName); 00382 00383 /** 00384 * Mark event as input events 00385 * 00386 * @param rEventSet 00387 * Set of events to mark 00388 * @exception Exception 00389 * - Some event not found in alphabet (id 60) 00390 */ 00391 void SetInputEvent(const EventSet& rEventSet); 00392 00393 /** 00394 * Unmark event as input event 00395 * 00396 * @param index 00397 * Event index 00398 * @exception Exception 00399 * - Event not found in alphabet (id 60) 00400 */ 00401 void ClrInputEvent(Idx index); 00402 00403 /** 00404 * Unmark event as input event 00405 * 00406 * @param rName 00407 * Event name 00408 * @exception Exception 00409 * - Event not found in alphabet (id 60) 00410 */ 00411 void ClrInputEvent(const std::string& rName); 00412 00413 /** 00414 * Unmak events as input events 00415 * 00416 * @param rEventSet 00417 * Set of events to unmark 00418 * @exception Exception 00419 * - Some event not found in alphabet (id 60) 00420 */ 00421 void ClrInputEvent(const EventSet& rEventSet); 00422 00423 00424 /** @} */ 00425 00426 /** @name State attributes */ 00427 /** @{ doxygen group */ 00428 00429 /** 00430 * Retrieve all output states 00431 * 00432 * @return 00433 * Set of all output states 00434 */ 00435 StateSet OutputStates(void) const; 00436 00437 /** 00438 * Set all output states. 00439 * 00440 * Mark given states as output states, unmark 00441 * any other state. 00442 * 00443 * @param rStateSet 00444 * Set of all output states 00445 * @exception Exception 00446 * - State does ot exist in generator (id 60) 00447 */ 00448 void OutputStates(const StateSet& rStateSet); 00449 00450 /** 00451 * Test for output state 00452 * 00453 * @param index 00454 * State index 00455 * @return 00456 * True / false 00457 * @exception Exception 00458 * - State does ot exist in generator(id 60) 00459 */ 00460 bool OutputState(Idx index) const; 00461 00462 /** 00463 * Test for output state 00464 * 00465 * @param rName 00466 * State name 00467 * @return 00468 * True / false 00469 * @exception Exception 00470 * - State does ot exist in generator (id 60) 00471 */ 00472 bool OutputState(const std::string& rName) const; 00473 00474 /** 00475 * Mark state as output state 00476 * 00477 * @param index 00478 * State index 00479 * @exception Exception 00480 * - State does ot exist in generator (id 60) 00481 */ 00482 void SetOutputState(Idx index); 00483 00484 /** 00485 * Mark state as output state 00486 * 00487 * @param rName 00488 * State name 00489 * @exception Exception 00490 * - State does ot exist in generator (id 60) 00491 */ 00492 void SetOutputState(const std::string& rName); 00493 00494 /** 00495 * Mark state as output states 00496 * 00497 * @param rStateSet 00498 * Set of states to mark 00499 * @exception Exception 00500 * - Some state does ot exist in generator (id 60) 00501 */ 00502 void SetOutputState(const StateSet& rStateSet); 00503 00504 /** 00505 * Unmark state as output state 00506 * 00507 * @param index 00508 * State index 00509 * @exception Exception 00510 * - State does ot exist in generator (id 60) 00511 */ 00512 void ClrOutputState(Idx index); 00513 00514 /** 00515 * Unmark state as output state 00516 * 00517 * @param rName 00518 * State name 00519 * @exception Exception 00520 * - State does ot exist in generator (id 60) 00521 */ 00522 void ClrOutputState(const std::string& rName); 00523 00524 /** 00525 * Unmak states as output states 00526 * 00527 * @param rStateSet 00528 * Set of states to unmark 00529 * @exception Exception 00530 * - Some state does ot exist in generator (id 60) 00531 */ 00532 void ClrOutputState(const StateSet& rStateSet); 00533 00534 00535 /** 00536 * Retrieve all input states 00537 * 00538 * @return 00539 * Set of all input states 00540 */ 00541 StateSet InputStates(void) const; 00542 00543 /** 00544 * Set all input states. 00545 * 00546 * Mark given states as input states, unmark 00547 * any other state. 00548 * 00549 * @param rStateSet 00550 * Set of all input states 00551 * @exception Exception 00552 * - State does ot exist in generator (id 60) 00553 */ 00554 void InputStates(const StateSet& rStateSet); 00555 00556 /** 00557 * Test for input state 00558 * 00559 * @param index 00560 * State index 00561 * 00562 * @return 00563 * True / false 00564 * @exception Exception 00565 * - State not found in alphabet (id 60) 00566 */ 00567 bool InputState(Idx index) const; 00568 00569 /** 00570 * Test for input state 00571 * 00572 * @param rName 00573 * State name 00574 * 00575 * @return 00576 * True / false 00577 * @exception Exception 00578 * - State not found in alphabet (id 60) 00579 */ 00580 bool InputState(const std::string& rName) const; 00581 00582 /** 00583 * Mark state as input state 00584 * 00585 * @param index 00586 * State index 00587 * @exception Exception 00588 * - State not found in alphabet (id 60) 00589 */ 00590 void SetInputState(Idx index); 00591 00592 /** 00593 * Mark state as input state 00594 * 00595 * @param rName 00596 * State name 00597 * @exception Exception 00598 * - State not found in alphabet (id 60) 00599 */ 00600 void SetInputState(const std::string& rName); 00601 00602 /** 00603 * Mark state as input states 00604 * 00605 * @param rStateSet 00606 * Set of states to mark 00607 * @exception Exception 00608 * - Some state not found in alphabet (id 60) 00609 */ 00610 void SetInputState(const StateSet& rStateSet); 00611 00612 /** 00613 * Unmark state as input state 00614 * 00615 * @param index 00616 * State index 00617 * @exception Exception 00618 * - State not found in alphabet (id 60) 00619 */ 00620 void ClrInputState(Idx index); 00621 00622 /** 00623 * Unmark state as input state 00624 * 00625 * @param rName 00626 * State name 00627 * @exception Exception 00628 * - State not found in alphabet (id 60) 00629 */ 00630 void ClrInputState(const std::string& rName); 00631 00632 /** 00633 * Unmak states as input states 00634 * 00635 * @param rStateSet 00636 * Set of states to unmark 00637 * @exception Exception 00638 * - Some state not found in alphabet (id 60) 00639 */ 00640 void ClrInputState(const StateSet& rStateSet); 00641 00642 00643 /** 00644 * Retrieve all error states 00645 * 00646 * @return 00647 * Set of all error states 00648 */ 00649 StateSet ErrorStates(void) const; 00650 00651 /** 00652 * Set all error states. 00653 * 00654 * Mark given states as error states, unmark 00655 * any other state. 00656 * 00657 * @param rStateSet 00658 * Set of all error states 00659 * @exception Exception 00660 * - State does ot exist in generator (id 60) 00661 */ 00662 void ErrorStates(const StateSet& rStateSet); 00663 00664 /** 00665 * Test for error state 00666 * 00667 * @param index 00668 * State index 00669 * @return 00670 * True / false 00671 * @exception Exception 00672 * - State does ot exist in generator(id 60) 00673 */ 00674 bool ErrorState(Idx index) const; 00675 00676 /** 00677 * Test for error state 00678 * 00679 * @param rName 00680 * State name 00681 * @return 00682 * True / false 00683 * @exception Exception 00684 * - State does ot exist in generator (id 60) 00685 */ 00686 bool ErrorState(const std::string& rName) const; 00687 00688 /** 00689 * Mark state as error state 00690 * 00691 * @param index 00692 * State index 00693 * @exception Exception 00694 * - State does ot exist in generator (id 60) 00695 */ 00696 void SetErrorState(Idx index); 00697 00698 /** 00699 * Mark state as error state 00700 * 00701 * @param rName 00702 * State name 00703 * @exception Exception 00704 * - State does ot exist in generator (id 60) 00705 */ 00706 void SetErrorState(const std::string& rName); 00707 00708 /** 00709 * Mark state as error states 00710 * 00711 * @param rStateSet 00712 * Set of states to mark 00713 * @exception Exception 00714 * - Some state does ot exist in generator (id 60) 00715 */ 00716 void SetErrorState(const StateSet& rStateSet); 00717 00718 /** 00719 * Unmark state as error state 00720 * 00721 * @param index 00722 * State index 00723 * @exception Exception 00724 * - State does ot exist in generator (id 60) 00725 */ 00726 void ClrErrorState(Idx index); 00727 00728 /** 00729 * Unmark state as error state 00730 * 00731 * @param rName 00732 * State name 00733 * @exception Exception 00734 * - State does ot exist in generator (id 60) 00735 */ 00736 void ClrErrorState(const std::string& rName); 00737 00738 /** 00739 * Unmak states as error states 00740 * 00741 * @param rStateSet 00742 * Set of states to unmark 00743 * @exception Exception 00744 * - Some state does ot exist in generator (id 60) 00745 */ 00746 void ClrErrorState(const StateSet& rStateSet); 00747 00748 00749 00750 /** @} */ 00751 00752 /** @name Misc */ 00753 /** @{ doxygen group */ 00754 00755 /** 00756 * Updates internal attributes. 00757 * This method sets the state partition attributes. 00758 * 00759 * @return True if value changed 00760 */ 00761 00762 virtual bool UpdateAttributes(void); 00763 00764 /** @} */ 00765 private: 00766 00767 protected: 00768 00769 }; // end class IoSystem 00770 00771 00772 /* 00773 ********************************************************************** 00774 ********************************************************************** 00775 ********************************************************************** 00776 00777 implementation of IoSystem 00778 00779 00780 ********************************************************************** 00781 ********************************************************************** 00782 ********************************************************************** 00783 */ 00784 00785 00786 // typedef for std IoSystem 00787 00788 // globalAttribute: Void 00789 // stateAttribute: IosStateFlags 00790 // eventAttribute: IosEventFlags 00791 // transAttribute: Void 00792 typedef TioGenerator<AttributeVoid,AttributeIosState, AttributeIosEvent, AttributeVoid> IoSystem; 00793 00794 // convenience shortcuts for relevant class and template types 00795 #define THIS TioGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr> 00796 #define BASE TaGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr> 00797 #define TEMP template <class GlobalAttr,class StateAttr,class EventAttr,class TransAttr> 00798 00799 00800 // TioGenerator(void) 00801 TEMP THIS::TioGenerator(void) : BASE() { 00802 //FD_DIO("IoSystem(" << this << ")::IoSystem()"); 00803 } 00804 00805 // ~TIOSystem(void) 00806 TEMP THIS::~TioGenerator(void) { 00807 //FD_DIO("IoSystem(" << this << "::~IoSystem()"); 00808 } 00809 00810 // TioGenerator(rFileName) 00811 TEMP THIS::TioGenerator(const std::string& rFileName) : BASE(rFileName) { 00812 //FD_DIO("IoSystem(" << this << ")::IoSystem(rFilename) : done"); 00813 } 00814 00815 00816 // TioGenerator(rOtherGen) 00817 TEMP THIS::TioGenerator(const TioGenerator& rOtherGen) : BASE(rOtherGen) { 00818 //FD_DIO("IoSystem(" << this << ")::IoSystem(rOtherGen)"); 00819 } 00820 00821 // TioGenerator(rOtherGen) 00822 TEMP THIS::TioGenerator(const vGenerator& rOtherGen) : BASE(rOtherGen) { 00823 //FD_DIO("IoSystem(" << this << ")::IoSystem(rOtherGen)"); 00824 } 00825 00826 // New() 00827 TEMP THIS* THIS::New(void) const { 00828 //FD_DIO("IoSystem(" << this << ")::New()"); 00829 // allocate 00830 THIS* res = new THIS(); 00831 // fix base data 00832 res->EventSymbolTablep(BASE::mpEventSymbolTable); 00833 res->mStateNamesEnabled=BASE::mStateNamesEnabled; 00834 res->mReindexOnWrite=BASE::mReindexOnWrite; 00835 return res; 00836 } 00837 00838 // Copy() 00839 TEMP THIS* THIS::Copy(void) const { 00840 return new THIS(*this); 00841 } 00842 00843 // NewIoSystem() 00844 TEMP THIS THIS::NewIoSystem(void) const { 00845 // call base (fixes by assignment constructor) 00846 THIS res= BASE::NewAGen(); 00847 return res; 00848 } 00849 00850 // InsOutputEvent(index) 00851 TEMP void THIS::InsOutputEvent(Idx index){ 00852 FD_DIO("IoSystem(" << this << ")::InsOutputEvent(" << index << ")"); 00853 EventAttr attr; 00854 attr.SetOutput(); 00855 BASE::InsEvent(index,attr); 00856 } 00857 00858 // InsOutputEvent(rName) 00859 TEMP Idx THIS::InsOutputEvent(const std::string& rName) { 00860 //FD_DIO("IoSystem(" << this << ")::InsOutputEvent(" << rName << ")"); 00861 EventAttr attr; 00862 attr.SetOutput(); 00863 return BASE::InsEvent(rName,attr); 00864 } 00865 00866 // InsInputEvent(index) 00867 TEMP void THIS::InsInputEvent(Idx index){ 00868 //FD_DIO("IoSystem(" << this << ")::InsInputEvent(" << index << ")"); 00869 EventAttr attr; 00870 attr.SetInput(); 00871 BASE::InsEvent(index,attr); 00872 } 00873 00874 // InsInputEvent(rName) 00875 TEMP Idx THIS::InsInputEvent(const std::string& rName) { 00876 //FD_DIO("IoSystem(" << this << ")::InsInputEvent(" << rName << ")"); 00877 EventAttr attr; 00878 attr.SetInput(); 00879 return BASE::InsEvent(rName,attr); 00880 } 00881 00882 00883 00884 // OutputEvents() 00885 TEMP EventSet THIS::OutputEvents(void) const { 00886 //FD_DIO("IoSystem(" << this << ")::OutputEvents()"); 00887 EventSet res; 00888 res.Name("OutputEvents"); 00889 EventSet::Iterator eit; 00890 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++) 00891 if(OutputEvent(*eit)) res.Insert(*eit); 00892 return res; 00893 } 00894 00895 // OutputEvents(rEventSet) 00896 TEMP void THIS::OutputEvents(const EventSet& rEventSet) { 00897 //FD_DIO("IoSystem(" << this << ")::OutputEvents(" << rEventSet.Name() << ")"); 00898 EventSet::Iterator eit; 00899 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++) 00900 if(rEventSet.Exists(*eit)) SetOutputEvent(*eit); 00901 else ClrOutputEvent(*eit); 00902 } 00903 00904 // OutputEvent(index) 00905 TEMP bool THIS::OutputEvent(Idx index) const { 00906 return BASE::EventAttribute(index).Output(); 00907 } 00908 00909 // OutputEvent(rName) 00910 TEMP bool THIS::OutputEvent(const std::string& rName) const { 00911 return BASE::EventAttribute(rName).Output(); 00912 } 00913 00914 // SetOutputEvent(index) 00915 TEMP void THIS::SetOutputEvent(Idx index) { 00916 //FD_DIO("IoSystem(" << this << ")::SetOutputEvent(" << index << ")"); 00917 EventAttr attr=BASE::EventAttribute(index); 00918 attr.SetOutput(); 00919 BASE::pAlphabet->Attribute(index,attr); 00920 } 00921 00922 // SetOutputEvent(rName) 00923 TEMP void THIS::SetOutputEvent(const std::string& rName) { 00924 //FD_DIO("IoSystem(" << this << ")::SetOutputEvent(" << rName << ")"); 00925 Idx index = BASE::EventIndex(rName); 00926 SetOutputEvent(index); 00927 } 00928 00929 // SetOutputEvent(rEventSet) 00930 TEMP void THIS::SetOutputEvent(const EventSet& rEventSet) { 00931 //FD_DIO("IoSystem(" << this << ")::SetOutputEvent(" << rEventSet.Name() << ")"); 00932 for(EventSet::Iterator eit=rEventSet.Begin(); eit!=rEventSet.End(); eit++) 00933 SetOutputEvent(*eit); 00934 } 00935 00936 00937 // ClrOutputEvent(index) 00938 TEMP void THIS::ClrOutputEvent(Idx index) { 00939 //FD_DIO("IoSystem(" << this << ")::ClrOutputEvent(" << index << ")"); 00940 EventAttr attr=BASE::EventAttribute(index); 00941 attr.ClrOutput(); 00942 BASE::pAlphabet->Attribute(index,attr); 00943 } 00944 00945 // ClrOutputEvent(rName) 00946 TEMP void THIS::ClrOutputEvent(const std::string& rName) { 00947 //FD_DIO("IoSystem(" << this << ")::ClrOutputEvent(" << rName << ")"); 00948 Idx index = BASE::EventIndex(rName); 00949 ClrOutputEvent(index); 00950 } 00951 00952 // ClrOutputEvent(rEventSet) 00953 TEMP void THIS::ClrOutputEvent(const EventSet& rEventSet) { 00954 //FD_DIO("IoSystem(" << this << ")::ClrOutputEvent(" << rEventSet.Name() << ")"); 00955 for(EventSet::Iterator eit=rEventSet.Begin(); eit!=rEventSet.End(); eit++) 00956 ClrOutputEvent(*eit); 00957 } 00958 00959 00960 // InputEvents() 00961 TEMP EventSet THIS::InputEvents(void) const { 00962 //FD_DIO("IoSystem(" << this << ")::InputEvents()"); 00963 EventSet res; 00964 res.Name("InputEvents"); 00965 EventSet::Iterator eit; 00966 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++) 00967 if(InputEvent(*eit)) res.Insert(*eit); 00968 return res; 00969 } 00970 00971 // InputEvents(rEventSet) 00972 TEMP void THIS::InputEvents(const EventSet& rEventSet) { 00973 //FD_DIO("IoSystem(" << this << ")::InputEvents(" << rEventSet.Name() << ")"); 00974 EventSet::Iterator eit; 00975 for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++) 00976 if(rEventSet.Exists(*eit)) SetInputEvent(*eit); 00977 else ClrInputEvent(*eit); 00978 } 00979 00980 00981 // InputEvent(index) 00982 TEMP bool THIS::InputEvent(Idx index) const { 00983 return BASE::EventAttribute(index).Input(); 00984 } 00985 00986 // InputEvent(rName) 00987 TEMP bool THIS::InputEvent(const std::string& rName) const { 00988 return BASE::EventAttribute(rName).Input(); 00989 } 00990 00991 // SetInputEvent(index) 00992 TEMP void THIS::SetInputEvent(Idx index) { 00993 //FD_DIO("IoSystem(" << this << ")::SetInputEvent(" << index << ")"); 00994 EventAttr attr=BASE::EventAttribute(index); 00995 attr.SetInput(); 00996 BASE::pAlphabet->Attribute(index,attr); 00997 } 00998 00999 // SetInputEvent(rName) 01000 TEMP void THIS::SetInputEvent(const std::string& rName) { 01001 //FD_DIO("IoSystem(" << this << ")::SetInputEvent(" << rName << ")"); 01002 Idx index = BASE::EventIndex(rName); 01003 SetInputEvent(index); 01004 } 01005 01006 // SetInputEvent(rEventSet) 01007 TEMP void THIS::SetInputEvent(const EventSet& rEventSet) { 01008 //FD_DIO("IoSystem(" << this << ")::SetInputEvent(" << rEventSet.Name() << ")"); 01009 for(EventSet::Iterator eit=rEventSet.Begin(); eit!=rEventSet.End(); eit++) 01010 SetInputEvent(*eit); 01011 } 01012 01013 01014 // ClrInputEvent(index) 01015 TEMP void THIS::ClrInputEvent(Idx index) { 01016 //FD_DIO("IoSystem(" << this << ")::ClrInputEvent(" << index << ")"); 01017 EventAttr attr=BASE::EventAttribute(index); 01018 attr.ClrInput(); 01019 BASE::pAlphabet->Attribute(index,attr); 01020 } 01021 01022 // ClrInputEvent(rName) 01023 TEMP void THIS::ClrInputEvent(const std::string& rName) { 01024 //FD_DIO("IoSystem(" << this << ")::ClrInputEvent(" << rName << ")"); 01025 Idx index = BASE::EventIndex(rName); 01026 ClrInputEvent(index); 01027 } 01028 01029 // ClrInputEvent(rEventSet) 01030 TEMP void THIS::ClrInputEvent(const EventSet& rEventSet) { 01031 //FD_DIO("IoSystem(" << this << ")::ClrInputEvent(" << rEventSet.Name() << ")"); 01032 for(EventSet::Iterator eit=rEventSet.Begin(); eit!=rEventSet.End(); eit++) 01033 ClrInputEvent(*eit); 01034 } 01035 01036 01037 // OutputStates() 01038 TEMP StateSet THIS::OutputStates(void) const { 01039 //FD_DIO("IoSystem(" << this << ")::OutputStates()"); 01040 StateSet res; 01041 res.Name("OutputStates"); 01042 StateSet::Iterator sit; 01043 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) 01044 if(OutputState(*sit)) res.Insert(*sit); 01045 return res; 01046 } 01047 01048 // OutputStates(rStateSet) 01049 TEMP void THIS::OutputStates(const StateSet& rStateSet) { 01050 FD_DIO("IoSystem(" << this << ")::OutputStates(" << rStateSet.Name() << ")"); 01051 StateSet::Iterator sit; 01052 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) 01053 if(rStateSet.Exists(*sit)) SetOutputState(*sit); 01054 else ClrOutputState(*sit); 01055 } 01056 01057 // OutputState(index) 01058 TEMP bool THIS::OutputState(Idx index) const { 01059 return BASE::StateAttribute(index).Output(); 01060 } 01061 01062 // OutputState(rName) 01063 TEMP bool THIS::OutputState(const std::string& rName) const { 01064 Idx index = BASE::StateIndex(rName); 01065 return BASE::StateAttribute(index).Output(); 01066 } 01067 01068 // SetOutputState(index) 01069 TEMP void THIS::SetOutputState(Idx index) { 01070 //FD_DIO("IoSystem(" << this << ")::SetOutputState(" << index << ")"); 01071 StateAttr attr=BASE::StateAttribute(index); 01072 attr.SetOutput(); 01073 BASE::pStates->Attribute(index,attr); 01074 } 01075 01076 // SetOutputState(rName) 01077 TEMP void THIS::SetOutputState(const std::string& rName) { 01078 //FD_DIO("IoSystem(" << this << ")::SetOutputState(" << rName << ")"); 01079 Idx index = BASE::StateIndex(rName); 01080 SetOutputState(index); 01081 } 01082 01083 // SetOutputState(rStateSet) 01084 TEMP void THIS::SetOutputState(const StateSet& rStateSet) { 01085 //FD_DIO("IoSystem(" << this << ")::SetOutputState(" << rStateSet.Name() << ")"); 01086 for(StateSet::Iterator eit=rStateSet.Begin(); eit!=rStateSet.End(); eit++) 01087 SetOutputState(*eit); 01088 } 01089 01090 01091 // ClrOutputState(index) 01092 TEMP void THIS::ClrOutputState(Idx index) { 01093 //FD_DIO("IoSystem(" << this << ")::ClrOutputState(" << index << ")"); 01094 StateAttr attr=BASE::StateAttribute(index); 01095 attr.ClrOutput(); 01096 BASE::pStates->Attribute(index,attr); 01097 } 01098 01099 // ClrOutputStateLRName) 01100 TEMP void THIS::ClrOutputState(const std::string& rName) { 01101 //FD_DIO("IoSystem(" << this << ")::ClrOutputState(" << rName << ")"); 01102 Idx index = BASE::StateIndex(rName); 01103 ClrOutputState(index); 01104 } 01105 01106 // ClrOutputState(rStateSet) 01107 TEMP void THIS::ClrOutputState(const StateSet& rStateSet) { 01108 //FD_DIO("IoSystem(" << this << ")::ClrOutputState(" << rStateSet.Name() << ")"); 01109 for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++) 01110 ClrOutputState(*sit); 01111 } 01112 01113 01114 // InputStates() 01115 TEMP StateSet THIS::InputStates(void) const { 01116 //FD_DIO("IoSystem(" << this << ")::InputStates()"); 01117 StateSet res; 01118 res.Name("InputStates"); 01119 StateSet::Iterator sit; 01120 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) 01121 if(InputState(*sit)) res.Insert(*sit); 01122 return res; 01123 } 01124 01125 // InputStates(rStateSet) 01126 TEMP void THIS::InputStates(const StateSet& rStateSet) { 01127 //FD_DIO("IoSystem(" << this << ")::InputStates(" << rStateSet.Name() << ")"); 01128 StateSet::Iterator sit; 01129 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) 01130 if(rStateSet.Exists(*sit)) SetInputState(*sit); 01131 else ClrInputState(*sit); 01132 } 01133 01134 // InputState(index) 01135 TEMP bool THIS::InputState(Idx index) const { 01136 return BASE::StateAttribute(index).Input(); 01137 } 01138 01139 // InputState(rName) 01140 TEMP bool THIS::InputState(const std::string& rName) const { 01141 Idx index = BASE::StateIndex(rName); 01142 return BASE::StateAttribute(index).Input(); 01143 } 01144 01145 // SetInputState(index) 01146 TEMP void THIS::SetInputState(Idx index) { 01147 //FD_DIO("IoSystem(" << this << ")::SetInputState(" << index << ")"); 01148 StateAttr attr=BASE::StateAttribute(index); 01149 attr.SetInput(); 01150 BASE::pStates->Attribute(index,attr); 01151 } 01152 01153 // SetInputState(rName) 01154 TEMP void THIS::SetInputState(const std::string& rName) { 01155 //FD_DIO("IoSystem(" << this << ")::SetInputState(" << rName << ")"); 01156 Idx index = BASE::StateIndex(rName); 01157 SetInputState(index); 01158 } 01159 01160 // SetInputState(rStateSet) 01161 TEMP void THIS::SetInputState(const StateSet& rStateSet) { 01162 //FD_DIO("IoSystem(" << this << ")::SetInputState(" << rStateSet.Name() << ")"); 01163 for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++) 01164 SetInputState(*sit); 01165 } 01166 01167 01168 // ClrInputState(index) 01169 TEMP void THIS::ClrInputState(Idx index) { 01170 //FD_DIO("IoSystem(" << this << ")::ClrInputState(" << index << ")"); 01171 StateAttr attr=BASE::StateAttribute(index); 01172 attr.ClrInput(); 01173 BASE::pStates->Attribute(index,attr); 01174 } 01175 01176 // ClrInputState(rName) 01177 TEMP void THIS::ClrInputState(const std::string& rName) { 01178 //FD_DIO("IoSystem(" << this << ")::ClrInputState(" << rName << ")"); 01179 Idx index = BASE::StateIndex(rName); 01180 ClrInputState(index); 01181 } 01182 01183 // ClrInputState(rStateSet) 01184 TEMP void THIS::ClrInputState(const StateSet& rStateSet) { 01185 //FD_DIO("IoSystem(" << this << ")::ClrInputState(" << rStateSet.Name() << ")"); 01186 for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++) 01187 ClrInputState(*sit); 01188 } 01189 01190 01191 01192 01193 // ErrorStates() 01194 TEMP StateSet THIS::ErrorStates(void) const { 01195 //FD_DIO("IoSystem(" << this << ")::ErrorStates()"); 01196 StateSet res; 01197 res.Name("ErrorStates"); 01198 StateSet::Iterator sit; 01199 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) 01200 if(ErrorState(*sit)) res.Insert(*sit); 01201 return res; 01202 } 01203 01204 // ErrorStates(rStateSet) 01205 TEMP void THIS::ErrorStates(const StateSet& rStateSet) { 01206 //FD_DIO("IoSystem(" << this << ")::ErrorStates(" << rStateSet.Name() << ")"); 01207 StateSet::Iterator sit; 01208 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) 01209 if(rStateSet.Exists(*sit)) SetErrorState(*sit); 01210 else ClrErrorState(*sit); 01211 } 01212 01213 // ErrorState(index) 01214 TEMP bool THIS::ErrorState(Idx index) const { 01215 return BASE::StateAttribute(index).Error(); 01216 } 01217 01218 // ErrorState(rName) 01219 TEMP bool THIS::ErrorState(const std::string& rName) const { 01220 Idx index = BASE::StateIndex(rName); 01221 return BASE::StateAttribute(index).Error(); 01222 } 01223 01224 // SetErrorState(index) 01225 TEMP void THIS::SetErrorState(Idx index) { 01226 //FD_DIO("IoSystem(" << this << ")::SetErrorState(" << index << ")"); 01227 StateAttr attr=BASE::StateAttribute(index); 01228 attr.SetError(); 01229 BASE::pStates->Attribute(index,attr); 01230 } 01231 01232 // SetErrorState(rName) 01233 TEMP void THIS::SetErrorState(const std::string& rName) { 01234 //FD_DIO("IoSystem(" << this << ")::SetErrorState(" << rName << ")"); 01235 Idx index = BASE::StateIndex(rName); 01236 SetErrorState(index); 01237 } 01238 01239 // SetErrorState(rStateSet) 01240 TEMP void THIS::SetErrorState(const StateSet& rStateSet) { 01241 //FD_DIO("IoSystem(" << this << ")::SetErrorState(" << rStateSet.Name() << ")"); 01242 for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++) 01243 SetErrorState(*sit); 01244 } 01245 01246 01247 // ClrErrorState(index) 01248 TEMP void THIS::ClrErrorState(Idx index) { 01249 //FD_DIO("IoSystem(" << this << ")::ClrErrorState(" << index << ")"); 01250 StateAttr attr=BASE::StateAttribute(index); 01251 attr.ClrError(); 01252 BASE::pStates->Attribute(index,attr); 01253 } 01254 01255 // ClrErrorState(rName) 01256 TEMP void THIS::ClrErrorState(const std::string& rName) { 01257 //FD_DIO("IoSystem(" << this << ")::ClrErrorState(" << rName << ")"); 01258 Idx index = BASE::StateIndex(rName); 01259 ClrErrorState(index); 01260 } 01261 01262 // ClrErrorState(rStateSet) 01263 TEMP void THIS::ClrErrorState(const StateSet& rStateSet) { 01264 //FD_DIO("IoSystem(" << this << ")::ClrErrorState(" << rStateSet.Name() << ")"); 01265 for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++) 01266 ClrErrorState(*sit); 01267 } 01268 01269 01270 // Update faudes attributes 01271 TEMP bool THIS::UpdateAttributes(void) { 01272 //IsIoSystem(*this); 01273 return true; 01274 } 01275 01276 01277 01278 #undef TEMP 01279 #undef BASE 01280 #undef THIS 01281 01282 01283 } // namespace faudes 01284 01285 #endif libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |