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

libFAUDES 2.33k --- 2025.09.16 --- c++ api documentaion by doxygen