ios_system.h
Go to the documentation of this file.
1 /** @file ios_system.h Generator with I/O-system attributes */
2 
3 /*
4  Standart IO Systems Plug-In for FAU Discrete Event Systems
5  Library (libfaudes)
6 
7  Copyright (C) 2010, Thomas Wittmann, Thomas Moor
8 
9 */
10 
11 #ifndef FAUDES_IOS_SYSTEM_H
12 #define FAUDES_IOS_SYSTEM_H
13 
14 #include "corefaudes.h"
15 #include "ios_attributes.h"
16 
17 namespace faudes {
18 
19 
20 /**
21  * Generator with I/O-system attributes.
22  *
23  * An IoSystem is a generator with attributes for the
24  * representation of I/O systems, i.e., systems with alternating
25  * input events U and output events Y.
26  *
27  * The IoSystem template assumes that the StateAttr and EventAttr parameter is
28  * derived from AttributeIosState and AttributeIosEvent, respectively.
29  *
30  * @ingroup IoSysPlugin
31  */
32 
33 template <class GlobalAttr,class StateAttr,class EventAttr,class TransAttr>
34  class TioGenerator : public TaGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr> {
35 
36  public:
37 
38  /** @name Constructors & Destructor */
39  /** @{ doxygen group */
40 
41  /**
42  * Default constructor
43  */
44  TioGenerator(void);
45 
46  /**
47  * Default destructor
48  */
49  ~TioGenerator(void);
50 
51  /**
52  * Construtor
53  *
54  * Create IoSystem from file
55  *
56  * @param rFileName
57  * Filename
58  *
59  * @exception Exception
60  * - File io error (id 1)
61  * - Token mismatch (id 50, 51, ...)
62  */
63  TioGenerator(const std::string& rFileName);
64 
65  /**
66  * Constructor
67  *
68  * Create IoSystem on heap
69  *
70  * @return
71  * new Generator
72  */
73  virtual TioGenerator* New(void) const;
74 
75 
76  /**
77  * Copy constructor
78  *
79  * Create IoSystem from a std. Generator
80  *
81  * @param rOtherGen
82  */
83  TioGenerator(const vGenerator& rOtherGen);
84 
85 
86  /**
87  * Copy constructor
88  *
89  * Create IoSystem from another IoSystem
90  *
91  * @param rOtherGen
92  */
93  TioGenerator(const TioGenerator& rOtherGen);
94 
95 
96  /**
97  * Copy Constructor
98  *
99  * Construct copy on heap
100  *
101  * @return
102  * new Generator
103  */
104  virtual TioGenerator* Copy(void) const;
105 
106 
107  /**
108  * Create empty IoSystem with same symboltable as this
109  *
110  * @return
111  * New Generator
112  */
113  TioGenerator NewIoSystem(void) const;
114 
115 
116  /** @} */
117 
118  /** @name Assignment */
119  /** @{ doxygen group */
120 
121 
122  /**
123  * Assignment operator
124  *
125  * Note: you must reimplement this operator in derived
126  * classes in order to handle internal pointers correctly
127  *
128  * @param rOtherGen
129  * Other generator
130  */
131  virtual TioGenerator& operator= (const TioGenerator& rOtherGen) {
132  this->Assign(rOtherGen);
133  return *this;
134  };
135 
136  /**
137  * Assignment operator
138  *
139  * @param rOtherGen
140  * Other generator
141  */
142  virtual TioGenerator& operator= (const vGenerator& rOtherGen)
143  {
144  this->Assign(rOtherGen);
145  return *this;
146  };
147 
148 
149  /** @} */
150 
151  /** @name Insertion with attributes */
152  /** @{ doxygen group */
153 
154 
155  /**
156  * Insert an output-event by index
157  *
158  * An entry in the global event table will be made.
159  *
160  * Note: event has to exist in the global event table
161  *
162  * @param index
163  * Event index
164  */
165  void InsOutputEvent(Idx index);
166 
167  /**
168  * Insert output event by name.
169  *
170  * An entry in the global event table will be made if event is new.
171  *
172  * @param rName
173  * Name of the event to add
174  *
175  * @return
176  * New global unique index
177  */
178  Idx InsOutputEvent(const std::string& rName);
179 
180  /**
181  * Insert a input event by index.
182  *
183  * Note: event must to exist in the global event table
184  *
185  * @param index
186  * Event index
187  */
188  void InsInputEvent(Idx index);
189 
190 
191  /**
192  * Insert input event by name.
193  *
194  * An entry in the global event table will be made if event is new.
195  *
196  * @param rName
197  * Name of the event to add
198  *
199  * @return
200  * New global unique index
201  */
202  Idx InsInputEvent(const std::string& rName);
203 
204 
205  /** @} */
206 
207  /** @name Event attributes */
208  /** @{ doxygen group */
209 
210  /**
211  * Retrieve all output events
212  *
213  * @return
214  * Set of all output events
215  */
216  EventSet OutputEvents(void) const;
217 
218  /**
219  * Set all output events.
220  *
221  * Mark given events as output events, unmark
222  * any other event.
223  *
224  * @param rEventSet
225  * Set of all output events
226  * @exception Exception
227  * - Event does ot exist in generator (id 60)
228  */
229  void OutputEvents(const EventSet& rEventSet);
230 
231  /**
232  * Test for output event
233  *
234  * @param index
235  * Event index
236  * @return
237  * True / false
238  * @exception Exception
239  * - Event does ot exist in generator(id 60)
240  */
241  bool OutputEvent(Idx index) const;
242 
243  /**
244  * Test for output event
245  *
246  * @param rName
247  * Event name
248  * @return
249  * True / false
250  * @exception Exception
251  * - Event does ot exist in generator (id 60)
252  */
253  bool OutputEvent(const std::string& rName) const;
254 
255  /**
256  * Mark event as output event
257  *
258  * @param index
259  * Event index
260  * @exception Exception
261  * - Event does ot exist in generator (id 60)
262  */
263  void SetOutputEvent(Idx index);
264 
265  /**
266  * Mark event as output event
267  *
268  * @param rName
269  * Event name
270  * @exception Exception
271  * - Event does ot exist in generator (id 60)
272  */
273  void SetOutputEvent(const std::string& rName);
274 
275  /**
276  * Mark event as output events
277  *
278  * @param rEventSet
279  * Set of events to mark
280  * @exception Exception
281  * - Some event does ot exist in generator (id 60)
282  */
283  void SetOutputEvent(const EventSet& rEventSet);
284 
285  /**
286  * Unmark event as output event
287  *
288  * @param index
289  * Event index
290  * @exception Exception
291  * - Event does ot exist in generator (id 60)
292  */
293  void ClrOutputEvent(Idx index);
294 
295  /**
296  * Unmark event as output event
297  *
298  * @param rName
299  * Event name
300  * @exception Exception
301  * - Event does ot exist in generator (id 60)
302  */
303  void ClrOutputEvent(const std::string& rName);
304 
305  /**
306  * Unmak events as output events
307  *
308  * @param rEventSet
309  * Set of events to unmark
310  * @exception Exception
311  * - Some event does ot exist in generator (id 60)
312  */
313  void ClrOutputEvent(const EventSet& rEventSet);
314 
315 
316  /**
317  * Retrieve all input events
318  *
319  * @return
320  * Set of all input events
321  */
322  EventSet InputEvents(void) const;
323 
324  /**
325  * Set all input events.
326  *
327  * Mark given events as input events, unmark
328  * any other event.
329  *
330  * @param rEventSet
331  * Set of all input events
332  * @exception Exception
333  * - Event does ot exist in generator (id 60)
334  */
335  void InputEvents(const EventSet& rEventSet);
336 
337  /**
338  * Test for input event
339  *
340  * @param index
341  * Event index
342  *
343  * @return
344  * True / false
345  * @exception Exception
346  * - Event not found in alphabet (id 60)
347  */
348  bool InputEvent(Idx index) const;
349 
350  /**
351  * Test for input event
352  *
353  * @param rName
354  * Event name
355  *
356  * @return
357  * True / false
358  * @exception Exception
359  * - Event not found in alphabet (id 60)
360  */
361  bool InputEvent(const std::string& rName) const;
362 
363  /**
364  * Mark event as input event
365  *
366  * @param index
367  * Event index
368  * @exception Exception
369  * - Event not found in alphabet (id 60)
370  */
371  void SetInputEvent(Idx index);
372 
373  /**
374  * Mark event as input event
375  *
376  * @param rName
377  * Event name
378  * @exception Exception
379  * - Event not found in alphabet (id 60)
380  */
381  void SetInputEvent(const std::string& rName);
382 
383  /**
384  * Mark event as input events
385  *
386  * @param rEventSet
387  * Set of events to mark
388  * @exception Exception
389  * - Some event not found in alphabet (id 60)
390  */
391  void SetInputEvent(const EventSet& rEventSet);
392 
393  /**
394  * Unmark event as input event
395  *
396  * @param index
397  * Event index
398  * @exception Exception
399  * - Event not found in alphabet (id 60)
400  */
401  void ClrInputEvent(Idx index);
402 
403  /**
404  * Unmark event as input event
405  *
406  * @param rName
407  * Event name
408  * @exception Exception
409  * - Event not found in alphabet (id 60)
410  */
411  void ClrInputEvent(const std::string& rName);
412 
413  /**
414  * Unmak events as input events
415  *
416  * @param rEventSet
417  * Set of events to unmark
418  * @exception Exception
419  * - Some event not found in alphabet (id 60)
420  */
421  void ClrInputEvent(const EventSet& rEventSet);
422 
423 
424  /** @} */
425 
426  /** @name State attributes */
427  /** @{ doxygen group */
428 
429  /**
430  * Retrieve all output states
431  *
432  * @return
433  * Set of all output states
434  */
435  StateSet OutputStates(void) const;
436 
437  /**
438  * Set all output states.
439  *
440  * Mark given states as output states, unmark
441  * any other state.
442  *
443  * @param rStateSet
444  * Set of all output states
445  * @exception Exception
446  * - State does ot exist in generator (id 60)
447  */
448  void OutputStates(const StateSet& rStateSet);
449 
450  /**
451  * Test for output state
452  *
453  * @param index
454  * State index
455  * @return
456  * True / false
457  * @exception Exception
458  * - State does ot exist in generator(id 60)
459  */
460  bool OutputState(Idx index) const;
461 
462  /**
463  * Test for output state
464  *
465  * @param rName
466  * State name
467  * @return
468  * True / false
469  * @exception Exception
470  * - State does ot exist in generator (id 60)
471  */
472  bool OutputState(const std::string& rName) const;
473 
474  /**
475  * Mark state as output state
476  *
477  * @param index
478  * State index
479  * @exception Exception
480  * - State does ot exist in generator (id 60)
481  */
482  void SetOutputState(Idx index);
483 
484  /**
485  * Mark state as output state
486  *
487  * @param rName
488  * State name
489  * @exception Exception
490  * - State does ot exist in generator (id 60)
491  */
492  void SetOutputState(const std::string& rName);
493 
494  /**
495  * Mark state as output states
496  *
497  * @param rStateSet
498  * Set of states to mark
499  * @exception Exception
500  * - Some state does ot exist in generator (id 60)
501  */
502  void SetOutputState(const StateSet& rStateSet);
503 
504  /**
505  * Unmark state as output state
506  *
507  * @param index
508  * State index
509  * @exception Exception
510  * - State does ot exist in generator (id 60)
511  */
512  void ClrOutputState(Idx index);
513 
514  /**
515  * Unmark state as output state
516  *
517  * @param rName
518  * State name
519  * @exception Exception
520  * - State does ot exist in generator (id 60)
521  */
522  void ClrOutputState(const std::string& rName);
523 
524  /**
525  * Unmak states as output states
526  *
527  * @param rStateSet
528  * Set of states to unmark
529  * @exception Exception
530  * - Some state does ot exist in generator (id 60)
531  */
532  void ClrOutputState(const StateSet& rStateSet);
533 
534 
535  /**
536  * Retrieve all input states
537  *
538  * @return
539  * Set of all input states
540  */
541  StateSet InputStates(void) const;
542 
543  /**
544  * Set all input states.
545  *
546  * Mark given states as input states, unmark
547  * any other state.
548  *
549  * @param rStateSet
550  * Set of all input states
551  * @exception Exception
552  * - State does ot exist in generator (id 60)
553  */
554  void InputStates(const StateSet& rStateSet);
555 
556  /**
557  * Test for input state
558  *
559  * @param index
560  * State index
561  *
562  * @return
563  * True / false
564  * @exception Exception
565  * - State not found in alphabet (id 60)
566  */
567  bool InputState(Idx index) const;
568 
569  /**
570  * Test for input state
571  *
572  * @param rName
573  * State name
574  *
575  * @return
576  * True / false
577  * @exception Exception
578  * - State not found in alphabet (id 60)
579  */
580  bool InputState(const std::string& rName) const;
581 
582  /**
583  * Mark state as input state
584  *
585  * @param index
586  * State index
587  * @exception Exception
588  * - State not found in alphabet (id 60)
589  */
590  void SetInputState(Idx index);
591 
592  /**
593  * Mark state as input state
594  *
595  * @param rName
596  * State name
597  * @exception Exception
598  * - State not found in alphabet (id 60)
599  */
600  void SetInputState(const std::string& rName);
601 
602  /**
603  * Mark state as input states
604  *
605  * @param rStateSet
606  * Set of states to mark
607  * @exception Exception
608  * - Some state not found in alphabet (id 60)
609  */
610  void SetInputState(const StateSet& rStateSet);
611 
612  /**
613  * Unmark state as input state
614  *
615  * @param index
616  * State index
617  * @exception Exception
618  * - State not found in alphabet (id 60)
619  */
620  void ClrInputState(Idx index);
621 
622  /**
623  * Unmark state as input state
624  *
625  * @param rName
626  * State name
627  * @exception Exception
628  * - State not found in alphabet (id 60)
629  */
630  void ClrInputState(const std::string& rName);
631 
632  /**
633  * Unmak states as input states
634  *
635  * @param rStateSet
636  * Set of states to unmark
637  * @exception Exception
638  * - Some state not found in alphabet (id 60)
639  */
640  void ClrInputState(const StateSet& rStateSet);
641 
642 
643  /**
644  * Retrieve all error states
645  *
646  * @return
647  * Set of all error states
648  */
649  StateSet ErrorStates(void) const;
650 
651  /**
652  * Set all error states.
653  *
654  * Mark given states as error states, unmark
655  * any other state.
656  *
657  * @param rStateSet
658  * Set of all error states
659  * @exception Exception
660  * - State does ot exist in generator (id 60)
661  */
662  void ErrorStates(const StateSet& rStateSet);
663 
664  /**
665  * Test for error state
666  *
667  * @param index
668  * State index
669  * @return
670  * True / false
671  * @exception Exception
672  * - State does ot exist in generator(id 60)
673  */
674  bool ErrorState(Idx index) const;
675 
676  /**
677  * Test for error state
678  *
679  * @param rName
680  * State name
681  * @return
682  * True / false
683  * @exception Exception
684  * - State does ot exist in generator (id 60)
685  */
686  bool ErrorState(const std::string& rName) const;
687 
688  /**
689  * Mark state as error state
690  *
691  * @param index
692  * State index
693  * @exception Exception
694  * - State does ot exist in generator (id 60)
695  */
696  void SetErrorState(Idx index);
697 
698  /**
699  * Mark state as error state
700  *
701  * @param rName
702  * State name
703  * @exception Exception
704  * - State does ot exist in generator (id 60)
705  */
706  void SetErrorState(const std::string& rName);
707 
708  /**
709  * Mark state as error states
710  *
711  * @param rStateSet
712  * Set of states to mark
713  * @exception Exception
714  * - Some state does ot exist in generator (id 60)
715  */
716  void SetErrorState(const StateSet& rStateSet);
717 
718  /**
719  * Unmark state as error state
720  *
721  * @param index
722  * State index
723  * @exception Exception
724  * - State does ot exist in generator (id 60)
725  */
726  void ClrErrorState(Idx index);
727 
728  /**
729  * Unmark state as error state
730  *
731  * @param rName
732  * State name
733  * @exception Exception
734  * - State does ot exist in generator (id 60)
735  */
736  void ClrErrorState(const std::string& rName);
737 
738  /**
739  * Unmak states as error states
740  *
741  * @param rStateSet
742  * Set of states to unmark
743  * @exception Exception
744  * - Some state does ot exist in generator (id 60)
745  */
746  void ClrErrorState(const StateSet& rStateSet);
747 
748 
749 
750  /** @} */
751 
752  /** @name Misc */
753  /** @{ doxygen group */
754 
755  /**
756  * Updates internal attributes.
757  * This method sets the state partition attributes.
758  *
759  * @return True if value changed
760  */
761 
762  virtual bool UpdateAttributes(void);
763 
764  /** @} */
765  private:
766 
767  protected:
768 
769 }; // end class IoSystem
770 
771 
772 /*
773 **********************************************************************
774 **********************************************************************
775 **********************************************************************
776 
777 implementation of IoSystem
778 
779 
780 **********************************************************************
781 **********************************************************************
782 **********************************************************************
783 */
784 
785 
786 // typedef for std IoSystem
787 
788 // globalAttribute: Void
789 // stateAttribute: IosStateFlags
790 // eventAttribute: IosEventFlags
791 // transAttribute: Void
793 
794 // convenience shortcuts for relevant class and template types
795 #define THIS TioGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr>
796 #define BASE TaGenerator<GlobalAttr,StateAttr,EventAttr,TransAttr>
797 #define TEMP template <class GlobalAttr,class StateAttr,class EventAttr,class TransAttr>
798 
799 
800 // TioGenerator(void)
801 TEMP THIS::TioGenerator(void) : BASE() {
802  //FD_DIO("IoSystem(" << this << ")::IoSystem()");
803 }
804 
805 // ~TIOSystem(void)
806 TEMP THIS::~TioGenerator(void) {
807  //FD_DIO("IoSystem(" << this << "::~IoSystem()");
808 }
809 
810 // TioGenerator(rFileName)
811 TEMP THIS::TioGenerator(const std::string& rFileName) : BASE(rFileName) {
812  //FD_DIO("IoSystem(" << this << ")::IoSystem(rFilename) : done");
813 }
814 
815 
816 // TioGenerator(rOtherGen)
817 TEMP THIS::TioGenerator(const TioGenerator& rOtherGen) : BASE(rOtherGen) {
818  //FD_DIO("IoSystem(" << this << ")::IoSystem(rOtherGen)");
819 }
820 
821 // TioGenerator(rOtherGen)
822 TEMP THIS::TioGenerator(const vGenerator& rOtherGen) : BASE(rOtherGen) {
823  //FD_DIO("IoSystem(" << this << ")::IoSystem(rOtherGen)");
824 }
825 
826 // New()
827 TEMP THIS* THIS::New(void) const {
828  //FD_DIO("IoSystem(" << this << ")::New()");
829  // allocate
830  THIS* res = new THIS();
831  // fix base data
832  res->EventSymbolTablep(BASE::mpEventSymbolTable);
833  res->mStateNamesEnabled=BASE::mStateNamesEnabled;
834  res->mReindexOnWrite=BASE::mReindexOnWrite;
835  return res;
836 }
837 
838 // Copy()
839 TEMP THIS* THIS::Copy(void) const {
840  return new THIS(*this);
841 }
842 
843 // NewIoSystem()
844 TEMP THIS THIS::NewIoSystem(void) const {
845  // call base (fixes by assignment constructor)
846  THIS res= BASE::NewAGen();
847  return res;
848 }
849 
850 // InsOutputEvent(index)
851 TEMP void THIS::InsOutputEvent(Idx index){
852  FD_DIO("IoSystem(" << this << ")::InsOutputEvent(" << index << ")");
853  EventAttr attr;
854  attr.SetOutput();
855  BASE::InsEvent(index,attr);
856 }
857 
858 // InsOutputEvent(rName)
859 TEMP Idx THIS::InsOutputEvent(const std::string& rName) {
860  //FD_DIO("IoSystem(" << this << ")::InsOutputEvent(" << rName << ")");
861  EventAttr attr;
862  attr.SetOutput();
863  return BASE::InsEvent(rName,attr);
864 }
865 
866 // InsInputEvent(index)
867 TEMP void THIS::InsInputEvent(Idx index){
868  //FD_DIO("IoSystem(" << this << ")::InsInputEvent(" << index << ")");
869  EventAttr attr;
870  attr.SetInput();
871  BASE::InsEvent(index,attr);
872 }
873 
874 // InsInputEvent(rName)
875 TEMP Idx THIS::InsInputEvent(const std::string& rName) {
876  //FD_DIO("IoSystem(" << this << ")::InsInputEvent(" << rName << ")");
877  EventAttr attr;
878  attr.SetInput();
879  return BASE::InsEvent(rName,attr);
880 }
881 
882 
883 
884 // OutputEvents()
885 TEMP EventSet THIS::OutputEvents(void) const {
886  //FD_DIO("IoSystem(" << this << ")::OutputEvents()");
887  EventSet res;
888  res.Name("OutputEvents");
889  EventSet::Iterator eit;
890  for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
891  if(OutputEvent(*eit)) res.Insert(*eit);
892  return res;
893 }
894 
895 // OutputEvents(rEventSet)
896 TEMP void THIS::OutputEvents(const EventSet& rEventSet) {
897  //FD_DIO("IoSystem(" << this << ")::OutputEvents(" << rEventSet.Name() << ")");
898  EventSet::Iterator eit;
899  for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
900  if(rEventSet.Exists(*eit)) SetOutputEvent(*eit);
901  else ClrOutputEvent(*eit);
902 }
903 
904 // OutputEvent(index)
905 TEMP bool THIS::OutputEvent(Idx index) const {
906  return BASE::EventAttribute(index).Output();
907 }
908 
909 // OutputEvent(rName)
910 TEMP bool THIS::OutputEvent(const std::string& rName) const {
911  return BASE::EventAttribute(rName).Output();
912 }
913 
914 // SetOutputEvent(index)
915 TEMP void THIS::SetOutputEvent(Idx index) {
916  //FD_DIO("IoSystem(" << this << ")::SetOutputEvent(" << index << ")");
917  EventAttr attr=BASE::EventAttribute(index);
918  attr.SetOutput();
919  BASE::pAlphabet->Attribute(index,attr);
920 }
921 
922 // SetOutputEvent(rName)
923 TEMP void THIS::SetOutputEvent(const std::string& rName) {
924  //FD_DIO("IoSystem(" << this << ")::SetOutputEvent(" << rName << ")");
925  Idx index = BASE::EventIndex(rName);
926  SetOutputEvent(index);
927 }
928 
929 // SetOutputEvent(rEventSet)
930 TEMP void THIS::SetOutputEvent(const EventSet& rEventSet) {
931  //FD_DIO("IoSystem(" << this << ")::SetOutputEvent(" << rEventSet.Name() << ")");
932  for(EventSet::Iterator eit=rEventSet.Begin(); eit!=rEventSet.End(); eit++)
933  SetOutputEvent(*eit);
934 }
935 
936 
937 // ClrOutputEvent(index)
938 TEMP void THIS::ClrOutputEvent(Idx index) {
939  //FD_DIO("IoSystem(" << this << ")::ClrOutputEvent(" << index << ")");
940  EventAttr attr=BASE::EventAttribute(index);
941  attr.ClrOutput();
942  BASE::pAlphabet->Attribute(index,attr);
943 }
944 
945 // ClrOutputEvent(rName)
946 TEMP void THIS::ClrOutputEvent(const std::string& rName) {
947  //FD_DIO("IoSystem(" << this << ")::ClrOutputEvent(" << rName << ")");
948  Idx index = BASE::EventIndex(rName);
949  ClrOutputEvent(index);
950 }
951 
952 // ClrOutputEvent(rEventSet)
953 TEMP void THIS::ClrOutputEvent(const EventSet& rEventSet) {
954  //FD_DIO("IoSystem(" << this << ")::ClrOutputEvent(" << rEventSet.Name() << ")");
955  for(EventSet::Iterator eit=rEventSet.Begin(); eit!=rEventSet.End(); eit++)
956  ClrOutputEvent(*eit);
957 }
958 
959 
960 // InputEvents()
961 TEMP EventSet THIS::InputEvents(void) const {
962  //FD_DIO("IoSystem(" << this << ")::InputEvents()");
963  EventSet res;
964  res.Name("InputEvents");
965  EventSet::Iterator eit;
966  for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
967  if(InputEvent(*eit)) res.Insert(*eit);
968  return res;
969 }
970 
971 // InputEvents(rEventSet)
972 TEMP void THIS::InputEvents(const EventSet& rEventSet) {
973  //FD_DIO("IoSystem(" << this << ")::InputEvents(" << rEventSet.Name() << ")");
974  EventSet::Iterator eit;
975  for(eit=BASE::AlphabetBegin(); eit!=BASE::AlphabetEnd(); eit++)
976  if(rEventSet.Exists(*eit)) SetInputEvent(*eit);
977  else ClrInputEvent(*eit);
978 }
979 
980 
981 // InputEvent(index)
982 TEMP bool THIS::InputEvent(Idx index) const {
983  return BASE::EventAttribute(index).Input();
984 }
985 
986 // InputEvent(rName)
987 TEMP bool THIS::InputEvent(const std::string& rName) const {
988  return BASE::EventAttribute(rName).Input();
989 }
990 
991 // SetInputEvent(index)
992 TEMP void THIS::SetInputEvent(Idx index) {
993  //FD_DIO("IoSystem(" << this << ")::SetInputEvent(" << index << ")");
994  EventAttr attr=BASE::EventAttribute(index);
995  attr.SetInput();
996  BASE::pAlphabet->Attribute(index,attr);
997 }
998 
999 // SetInputEvent(rName)
1000 TEMP void THIS::SetInputEvent(const std::string& rName) {
1001  //FD_DIO("IoSystem(" << this << ")::SetInputEvent(" << rName << ")");
1002  Idx index = BASE::EventIndex(rName);
1003  SetInputEvent(index);
1004 }
1005 
1006 // SetInputEvent(rEventSet)
1007 TEMP void THIS::SetInputEvent(const EventSet& rEventSet) {
1008  //FD_DIO("IoSystem(" << this << ")::SetInputEvent(" << rEventSet.Name() << ")");
1009  for(EventSet::Iterator eit=rEventSet.Begin(); eit!=rEventSet.End(); eit++)
1010  SetInputEvent(*eit);
1011 }
1012 
1013 
1014 // ClrInputEvent(index)
1015 TEMP void THIS::ClrInputEvent(Idx index) {
1016  //FD_DIO("IoSystem(" << this << ")::ClrInputEvent(" << index << ")");
1017  EventAttr attr=BASE::EventAttribute(index);
1018  attr.ClrInput();
1019  BASE::pAlphabet->Attribute(index,attr);
1020 }
1021 
1022 // ClrInputEvent(rName)
1023 TEMP void THIS::ClrInputEvent(const std::string& rName) {
1024  //FD_DIO("IoSystem(" << this << ")::ClrInputEvent(" << rName << ")");
1025  Idx index = BASE::EventIndex(rName);
1026  ClrInputEvent(index);
1027 }
1028 
1029 // ClrInputEvent(rEventSet)
1030 TEMP void THIS::ClrInputEvent(const EventSet& rEventSet) {
1031  //FD_DIO("IoSystem(" << this << ")::ClrInputEvent(" << rEventSet.Name() << ")");
1032  for(EventSet::Iterator eit=rEventSet.Begin(); eit!=rEventSet.End(); eit++)
1033  ClrInputEvent(*eit);
1034 }
1035 
1036 
1037 // OutputStates()
1038 TEMP StateSet THIS::OutputStates(void) const {
1039  //FD_DIO("IoSystem(" << this << ")::OutputStates()");
1040  StateSet res;
1041  res.Name("OutputStates");
1042  StateSet::Iterator sit;
1043  for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1044  if(OutputState(*sit)) res.Insert(*sit);
1045  return res;
1046 }
1047 
1048 // OutputStates(rStateSet)
1049 TEMP void THIS::OutputStates(const StateSet& rStateSet) {
1050  FD_DIO("IoSystem(" << this << ")::OutputStates(" << rStateSet.Name() << ")");
1051  StateSet::Iterator sit;
1052  for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1053  if(rStateSet.Exists(*sit)) SetOutputState(*sit);
1054  else ClrOutputState(*sit);
1055 }
1056 
1057 // OutputState(index)
1058 TEMP bool THIS::OutputState(Idx index) const {
1059  return BASE::StateAttribute(index).Output();
1060 }
1061 
1062 // OutputState(rName)
1063 TEMP bool THIS::OutputState(const std::string& rName) const {
1064  Idx index = BASE::StateIndex(rName);
1065  return BASE::StateAttribute(index).Output();
1066 }
1067 
1068 // SetOutputState(index)
1069 TEMP void THIS::SetOutputState(Idx index) {
1070  //FD_DIO("IoSystem(" << this << ")::SetOutputState(" << index << ")");
1071  StateAttr attr=BASE::StateAttribute(index);
1072  attr.SetOutput();
1073  BASE::pStates->Attribute(index,attr);
1074 }
1075 
1076 // SetOutputState(rName)
1077 TEMP void THIS::SetOutputState(const std::string& rName) {
1078  //FD_DIO("IoSystem(" << this << ")::SetOutputState(" << rName << ")");
1079  Idx index = BASE::StateIndex(rName);
1080  SetOutputState(index);
1081 }
1082 
1083 // SetOutputState(rStateSet)
1084 TEMP void THIS::SetOutputState(const StateSet& rStateSet) {
1085  //FD_DIO("IoSystem(" << this << ")::SetOutputState(" << rStateSet.Name() << ")");
1086  for(StateSet::Iterator eit=rStateSet.Begin(); eit!=rStateSet.End(); eit++)
1087  SetOutputState(*eit);
1088 }
1089 
1090 
1091 // ClrOutputState(index)
1092 TEMP void THIS::ClrOutputState(Idx index) {
1093  //FD_DIO("IoSystem(" << this << ")::ClrOutputState(" << index << ")");
1094  StateAttr attr=BASE::StateAttribute(index);
1095  attr.ClrOutput();
1096  BASE::pStates->Attribute(index,attr);
1097 }
1098 
1099 // ClrOutputStateLRName)
1100 TEMP void THIS::ClrOutputState(const std::string& rName) {
1101  //FD_DIO("IoSystem(" << this << ")::ClrOutputState(" << rName << ")");
1102  Idx index = BASE::StateIndex(rName);
1103  ClrOutputState(index);
1104 }
1105 
1106 // ClrOutputState(rStateSet)
1107 TEMP void THIS::ClrOutputState(const StateSet& rStateSet) {
1108  //FD_DIO("IoSystem(" << this << ")::ClrOutputState(" << rStateSet.Name() << ")");
1109  for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++)
1110  ClrOutputState(*sit);
1111 }
1112 
1113 
1114 // InputStates()
1115 TEMP StateSet THIS::InputStates(void) const {
1116  //FD_DIO("IoSystem(" << this << ")::InputStates()");
1117  StateSet res;
1118  res.Name("InputStates");
1119  StateSet::Iterator sit;
1120  for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1121  if(InputState(*sit)) res.Insert(*sit);
1122  return res;
1123 }
1124 
1125 // InputStates(rStateSet)
1126 TEMP void THIS::InputStates(const StateSet& rStateSet) {
1127  //FD_DIO("IoSystem(" << this << ")::InputStates(" << rStateSet.Name() << ")");
1128  StateSet::Iterator sit;
1129  for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1130  if(rStateSet.Exists(*sit)) SetInputState(*sit);
1131  else ClrInputState(*sit);
1132 }
1133 
1134 // InputState(index)
1135 TEMP bool THIS::InputState(Idx index) const {
1136  return BASE::StateAttribute(index).Input();
1137 }
1138 
1139 // InputState(rName)
1140 TEMP bool THIS::InputState(const std::string& rName) const {
1141  Idx index = BASE::StateIndex(rName);
1142  return BASE::StateAttribute(index).Input();
1143 }
1144 
1145 // SetInputState(index)
1146 TEMP void THIS::SetInputState(Idx index) {
1147  //FD_DIO("IoSystem(" << this << ")::SetInputState(" << index << ")");
1148  StateAttr attr=BASE::StateAttribute(index);
1149  attr.SetInput();
1150  BASE::pStates->Attribute(index,attr);
1151 }
1152 
1153 // SetInputState(rName)
1154 TEMP void THIS::SetInputState(const std::string& rName) {
1155  //FD_DIO("IoSystem(" << this << ")::SetInputState(" << rName << ")");
1156  Idx index = BASE::StateIndex(rName);
1157  SetInputState(index);
1158 }
1159 
1160 // SetInputState(rStateSet)
1161 TEMP void THIS::SetInputState(const StateSet& rStateSet) {
1162  //FD_DIO("IoSystem(" << this << ")::SetInputState(" << rStateSet.Name() << ")");
1163  for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++)
1164  SetInputState(*sit);
1165 }
1166 
1167 
1168 // ClrInputState(index)
1169 TEMP void THIS::ClrInputState(Idx index) {
1170  //FD_DIO("IoSystem(" << this << ")::ClrInputState(" << index << ")");
1171  StateAttr attr=BASE::StateAttribute(index);
1172  attr.ClrInput();
1173  BASE::pStates->Attribute(index,attr);
1174 }
1175 
1176 // ClrInputState(rName)
1177 TEMP void THIS::ClrInputState(const std::string& rName) {
1178  //FD_DIO("IoSystem(" << this << ")::ClrInputState(" << rName << ")");
1179  Idx index = BASE::StateIndex(rName);
1180  ClrInputState(index);
1181 }
1182 
1183 // ClrInputState(rStateSet)
1184 TEMP void THIS::ClrInputState(const StateSet& rStateSet) {
1185  //FD_DIO("IoSystem(" << this << ")::ClrInputState(" << rStateSet.Name() << ")");
1186  for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++)
1187  ClrInputState(*sit);
1188 }
1189 
1190 
1191 
1192 
1193 // ErrorStates()
1194 TEMP StateSet THIS::ErrorStates(void) const {
1195  //FD_DIO("IoSystem(" << this << ")::ErrorStates()");
1196  StateSet res;
1197  res.Name("ErrorStates");
1198  StateSet::Iterator sit;
1199  for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1200  if(ErrorState(*sit)) res.Insert(*sit);
1201  return res;
1202 }
1203 
1204 // ErrorStates(rStateSet)
1205 TEMP void THIS::ErrorStates(const StateSet& rStateSet) {
1206  //FD_DIO("IoSystem(" << this << ")::ErrorStates(" << rStateSet.Name() << ")");
1207  StateSet::Iterator sit;
1208  for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++)
1209  if(rStateSet.Exists(*sit)) SetErrorState(*sit);
1210  else ClrErrorState(*sit);
1211 }
1212 
1213 // ErrorState(index)
1214 TEMP bool THIS::ErrorState(Idx index) const {
1215  return BASE::StateAttribute(index).Error();
1216 }
1217 
1218 // ErrorState(rName)
1219 TEMP bool THIS::ErrorState(const std::string& rName) const {
1220  Idx index = BASE::StateIndex(rName);
1221  return BASE::StateAttribute(index).Error();
1222 }
1223 
1224 // SetErrorState(index)
1225 TEMP void THIS::SetErrorState(Idx index) {
1226  //FD_DIO("IoSystem(" << this << ")::SetErrorState(" << index << ")");
1227  StateAttr attr=BASE::StateAttribute(index);
1228  attr.SetError();
1229  BASE::pStates->Attribute(index,attr);
1230 }
1231 
1232 // SetErrorState(rName)
1233 TEMP void THIS::SetErrorState(const std::string& rName) {
1234  //FD_DIO("IoSystem(" << this << ")::SetErrorState(" << rName << ")");
1235  Idx index = BASE::StateIndex(rName);
1236  SetErrorState(index);
1237 }
1238 
1239 // SetErrorState(rStateSet)
1240 TEMP void THIS::SetErrorState(const StateSet& rStateSet) {
1241  //FD_DIO("IoSystem(" << this << ")::SetErrorState(" << rStateSet.Name() << ")");
1242  for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++)
1243  SetErrorState(*sit);
1244 }
1245 
1246 
1247 // ClrErrorState(index)
1248 TEMP void THIS::ClrErrorState(Idx index) {
1249  //FD_DIO("IoSystem(" << this << ")::ClrErrorState(" << index << ")");
1250  StateAttr attr=BASE::StateAttribute(index);
1251  attr.ClrError();
1252  BASE::pStates->Attribute(index,attr);
1253 }
1254 
1255 // ClrErrorState(rName)
1256 TEMP void THIS::ClrErrorState(const std::string& rName) {
1257  //FD_DIO("IoSystem(" << this << ")::ClrErrorState(" << rName << ")");
1258  Idx index = BASE::StateIndex(rName);
1259  ClrErrorState(index);
1260 }
1261 
1262 // ClrErrorState(rStateSet)
1263 TEMP void THIS::ClrErrorState(const StateSet& rStateSet) {
1264  //FD_DIO("IoSystem(" << this << ")::ClrErrorState(" << rStateSet.Name() << ")");
1265  for(StateSet::Iterator sit=rStateSet.Begin(); sit!=rStateSet.End(); sit++)
1266  ClrErrorState(*sit);
1267 }
1268 
1269 
1270 // Update faudes attributes
1271 TEMP bool THIS::UpdateAttributes(void) {
1272  //IsIoSystem(*this);
1273  return true;
1274 }
1275 
1276 
1277 
1278 #undef TEMP
1279 #undef BASE
1280 #undef THIS
1281 
1282 
1283 } // namespace faudes
1284 
1285 #endif

libFAUDES 2.24g --- 2014.09.15 --- c++ api documentaion by doxygen