cfl_cgenerator.h
Go to the documentation of this file.
1/** @file cfl_cgenerator.h Classes TcGenerator, System and AttributeCFlags */
2
3/* FAU Discrete Event Systems Library (libfaudes)
4
5Copyright (C) 2006 Bernd Opitz
6Copyright (C) 2007 Thomas Moor
7Exclusive copyright is granted to Klaus Schmidt
8
9This library is free software; you can redistribute it and/or
10modify it under the terms of the GNU Lesser General Public
11License as published by the Free Software Foundation; either
12version 2.1 of the License, or (at your option) any later version.
13
14This library is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public
20License along with this library; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23
24#ifndef FAUDES_CGENERATOR_H
25#define FAUDES_CGENERATOR_H
26
27#include "cfl_definitions.h"
28#include "cfl_agenerator.h"
29#include "cfl_parallel.h"
30#include "cfl_project.h"
31
32
33namespace faudes {
34
35
36
37
38/**
39 * Convenience typedef for event sets with controllability attributes.
40 *
41 * @ingroup ContainerClasses
42 */
44
45/** Convenience typedef */
47
48/** Compatibility: pre 2.20b used cEventSet as C++ class name*/
49#ifdef FAUDES_COMPATIBILITY
52#endif
53
54
55/**
56 * Generator with controllability attributes.
57 *
58 * @subsection CGeneratorOverview Overview
59 *
60 * The TcGenerator is a variant of the TaGenerator to add an interface for events with
61 * controllabilty attributes, ie an event may be controllable, observable or forcible.
62 *
63 * Technically, the construct is based on the specialized attribute class faudes::AttributeCFlags
64 * that provides attributes with semantics for controllability properties. The TcGenerator
65 * expects an event attribute template parameter with the minimum interface defined in AttribueCFlags.
66 * Thus, you can add further semantics by deriving a class AttributeCFlagsAndMore from
67 * AttribueeCFlags and use this as event attribute parameter for TcGenerator. To model
68 * a plain finite state machine plus controllability properties, use TcGenerator with
69 * AttributeCFlags for the event attribute parameter and AttributeVoid for the other
70 * parameters. For convenience, this has been typedef-ed as System.
71 *
72 * @ingroup GeneratorClasses
73 */
74
75template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
76 class FAUDES_TAPI TcGenerator : public TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr> {
77 public:
78
79
80 /**
81 * Creates an emtpy System object
82 */
83 TcGenerator(void);
84
85 /**
86 * System from a std Generator. Copy constructor
87 *
88 * @param rOtherGen
89 */
90 TcGenerator(const vGenerator& rOtherGen);
91
92 /**
93 * System from a System. Copy constructor
94 *
95 * @param rOtherGen
96 */
97 TcGenerator(const TcGenerator& rOtherGen);
98
99 /**
100 * construct a System from file
101 *
102 * @param rFileName
103 * Filename
104 *
105 * @exception Exception
106 * If opening/reading fails an Exception object is thrown (id 1, 50, 51)
107 */
108 TcGenerator(const std::string& rFileName);
109
110 /**
111 * Construct on heap
112 *
113 * @return
114 * new Generator
115 */
116 TcGenerator* New(void) const;
117
118 /**
119 * Construct copy on heap
120 *
121 * @return
122 * new Generator
123 */
124 TcGenerator* Copy(void) const;
125
126 /**
127 * Type test.
128 * Uses C++ dynamic cast to test whether the specified object
129 * casts to a System.
130 *
131 * @param pOther
132 * poinetr to object to test
133 *
134 * @return
135 * TcGenerator reference if dynamic cast succeeds, else NULL
136 */
137 virtual const Type* Cast(const Type* pOther) const {
138 return dynamic_cast< const TcGenerator* > (pOther); };
139
140
141 /**
142 * Construct on stack
143 *
144 * @return
145 * new Generator
146 */
147 TcGenerator NewCGen(void) const;
148
149 /**
150 * Assignment operator (uses Assign)
151 *
152 * Note: you must reimplement this operator in derived
153 * classes in order to handle internal pointers correctly
154 *
155 * @param rOtherGen
156 * Other generator
157 */
158 /*virtual*/ TcGenerator& operator= (const TcGenerator& rOtherGen);
159 //using TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>::operator=;
160
161 /**
162 * Assignment method
163 *
164 * Note: you must reimplement this method in derived
165 * classes in order to handle internal pointers correctly
166 *
167 * @param rSource
168 * Other generator
169 */
170 virtual TcGenerator& Assign(const Type& rSource);
171
172 /**
173 * Add an existing controllable event to generator.
174 * An entry in the global eventtable will be made.
175 *
176 * @param index
177 * Event index
178 */
179 void InsControllableEvent(Idx index);
180
181 /**
182 * Add new named controllable event to generator.
183 * An entry in the global eventtable will be made if event is new.
184 *
185 * @param rName
186 * Name of the event to add
187 *
188 * @return
189 * New global unique index
190 */
191 Idx InsControllableEvent(const std::string& rName);
192
193 /**
194 * Add an existing uncontrollable event to generator.
195 * An entry in the global eventtable will be made.
196 *
197 * @param index
198 * Event index
199 */
200 void InsUncontrollableEvent(Idx index);
201
202 /**
203 * Add new named uncontrollable event to generator.
204 * An entry in the global eventtable will be made if event is new.
205 *
206 * @param rName
207 * Name of the event to add
208 *
209 * @return
210 * New global unique index
211 */
212 Idx InsUncontrollableEvent(const std::string& rName);
213
214 /**
215 * Mark event controllable (by index)
216 *
217 * @param index
218 * Event index
219 */
220 void SetControllable(Idx index);
221
222 /**
223 * Mark event controllable (by name)
224 *
225 * @param rName
226 * Event name
227 */
228 void SetControllable(const std::string& rName);
229
230 /**
231 * Mark set of events controllable (by index)
232 *
233 * @param rEvents
234 * EventSet
235 */
236 void SetControllable(const EventSet& rEvents);
237
238 /**
239 * Mark event uncontrollable (by index)
240 *
241 * @param index
242 * Event index
243 */
244 void ClrControllable(Idx index);
245
246 /**
247 * Mark event uncontrollable (by name)
248 *
249 * @param rName
250 * Event name
251 */
252 void ClrControllable(const std::string& rName);
253
254 /**
255 * Mark set of events uncontrollable (by index)
256 *
257 * @param rEvents
258 * EventSet
259 */
260 void ClrControllable(const EventSet& rEvents);
261
262 /**
263 * Is event controllable (by index)
264 *
265 * @param index
266 * Event index
267 *
268 * @return
269 * True / false
270 */
271 bool Controllable(Idx index) const;
272
273 /**
274 * Is event controllable (by name)
275 *
276 * @param rName
277 * Event name
278 *
279 * @return
280 * True / false
281 */
282 bool Controllable(const std::string& rName) const;
283
284 /**
285 * Get EventSet with controllable events
286 *
287 * @return
288 * EventSet of controllable events
289 */
290 EventSet ControllableEvents(void) const;
291
292 /**
293 * Get EventSet with uncontrollable events
294 *
295 * @return
296 * EventSet of uncontrollable events
297 */
298 EventSet UncontrollableEvents(void) const;
299
300 /**
301 * Add an existing observable event to generator.
302 * An entry in the global eventtable will be made.
303 *
304 * @param index
305 * Event index
306 */
307 void InsObservableEvent(Idx index);
308
309 /**
310 * Add new named observable event to generator.
311 * An entry in the global eventtable will be made if event is new.
312 *
313 * @param rName
314 * Name of the event to add
315 *
316 * @return
317 * New global unique index
318 */
319 Idx InsObservableEvent(const std::string& rName);
320
321 /**
322 * Add an existing unobservable event to generator.
323 * An entry in the global eventtable will be made.
324 *
325 * @param index
326 * Event index
327 */
328 void InsUnobservableEvent(Idx index);
329
330 /**
331 * Add new named unobservable event to generator.
332 * An entry in the global eventtable will be made if event is new.
333 *
334 * @param rName
335 * Name of the event to add
336 *
337 * @return
338 * New global unique index
339 */
340 Idx InsUnobservableEvent(const std::string& rName);
341
342 /**
343 * Mark event observable (by index)
344 *
345 * @param index
346 * Event index
347 */
348 void SetObservable(Idx index);
349
350 /**
351 * Mark event observable (by name)
352 *
353 * @param rName
354 * Event name
355 */
356 void SetObservable(const std::string& rName);
357
358 /**
359 * Mark set of events observable
360 *
361 * @param rEvents
362 * EventSet
363 */
364 void SetObservable(const EventSet& rEvents);
365
366 /**
367 * Mark event unobservable (by index)
368 *
369 * @param index
370 * Event index
371 */
372 void ClrObservable(Idx index);
373
374 /**
375 * Mark event unobservable (by name)
376 *
377 * @param rName
378 * Event name
379 */
380 void ClrObservable(const std::string& rName);
381
382 /**
383 * Mark set of events unobservable
384 *
385 * @param rEvents
386 * EventSet
387 */
388 void ClrObservable(const EventSet& rEvents);
389
390 /**
391 * Is event observable (by index)
392 *
393 * @param index
394 * Event index
395 *
396 * @return
397 * True / false
398 */
399 bool Observable(Idx index) const;
400
401 /**
402 * Is event observable (by name)
403 *
404 * @param rName
405 * Event name
406 *
407 * @return
408 * True / false
409 */
410 bool Observable(const std::string& rName) const;
411
412 /**
413 * Get EventSet with observable events
414 *
415 * @return
416 * EventSet of controllable events
417 */
418 EventSet ObservableEvents(void) const;
419
420 /**
421 * Get EventSet with unobservable events
422 *
423 * @return
424 * EventSet of uncontrollable events
425 */
426 EventSet UnobservableEvents(void) const;
427
428 /**
429 * Add an existing forcible event to generator.
430 * An entry in the global eventtable will be made.
431 *
432 * @param index
433 * Event index
434 */
435 void InsForcibleEvent(Idx index);
436
437 /**
438 * Add new named forcible event to generator.
439 * An entry in the global eventtable will be made if event is new.
440 *
441 * @param rName
442 * Name of the event to add
443 *
444 * @return
445 * New global unique index
446 */
447 Idx InsForcibleEvent(const std::string& rName);
448
449 /**
450 * Add an existing unforcible event to generator.
451 * An entry in the global eventtable will be made.
452 *
453 * @param index
454 * Event index
455 */
456 void InsUnforcibleEvent(Idx index);
457
458 /**
459 * Add new named unforcible event to generator.
460 * An entry in the global eventtable will be made if event is new.
461 *
462 * @param rName
463 * Name of the event to add
464 *
465 * @return
466 * New global unique index
467 */
468 Idx InsUnforcibleEvent(const std::string& rName);
469
470 /**
471 * Mark event forcible (by index)
472 *
473 * @param index
474 * Event index
475 */
476 void SetForcible(Idx index);
477
478 /**
479 * Mark event forcible (by name)
480 *
481 * @param rName
482 * Event name
483 */
484 void SetForcible(const std::string& rName);
485
486 /**
487 * Mark set of events forcible
488 *
489 * @param rEvents
490 * EventSet
491 */
492 void SetForcible(const EventSet& rEvents);
493
494 /**
495 * Mark event unforcible (by index)
496 *
497 * @param index
498 * Event index
499 */
500 void ClrForcible(Idx index);
501
502 /**
503 * Mark event unforcible (by name)
504 *
505 * @param rName
506 * Event name
507 */
508 void ClrForcible(const std::string& rName);
509
510 /**
511 * Mark set of events unforcible
512 *
513 * @param rEvents
514 * EventSet
515 */
516 void ClrForcible(const EventSet& rEvents);
517
518 /**
519 * Is event forcible (by index)
520 *
521 * @param index
522 * Event index
523 *
524 * @return
525 * True / false
526 */
527 bool Forcible(Idx index) const;
528
529 /**
530 * Is event forcible (by name)
531 *
532 * @param rName
533 * Event name
534 *
535 * @return
536 * True / false
537 */
538 bool Forcible(const std::string& rName) const;
539
540 /**
541 * Get EventSet with forcible events
542 *
543 * @return
544 * EventSet of controllable events
545 */
546 EventSet ForcibleEvents(void) const;
547
548 /**
549 * Get EventSet with unforcible events
550 *
551 * @return
552 * EventSet of uncontrollable events
553 */
554 EventSet UnforcibleEvents(void) const;
555
556 /**
557 * Add an existing abstraction event to generator.
558 * An entry in the global eventtable will be made.
559 *
560 * @param index
561 * Event index
562 */
563 void InsHighlevelEvent(Idx index);
564
565 /**
566 * Add new named abstraction event to generator.
567 * An entry in the global eventtable will be made if event is new.
568 *
569 * @param rName
570 * Name of the event to add
571 *
572 * @return
573 * New global unique index
574 */
575 Idx InsHighlevelEvent(const std::string& rName);
576
577 /**
578 * Add an existing low-level event to generator.
579 * An entry in the global eventtable will be made.
580 *
581 * @param index
582 * Event index
583 */
584 void InsLowlevelEvent(Idx index);
585
586 /**
587 * Add new named low-level event to generator.
588 * An entry in the global eventtable will be made if event is new.
589 *
590 * @param rName
591 * Name of the event to add
592 *
593 * @return
594 * New global unique index
595 */
596 Idx InsLowlevelEvent(const std::string& rName);
597
598 /**
599 * Mark event as highlevel event (by index)
600 *
601 * @param index
602 * Event index
603 */
604 void SetHighlevel(Idx index);
605
606 /**
607 * Mark event as highlevel event (by name)
608 *
609 * @param rName
610 * Event name
611 */
612 void SetHighlevel(const std::string& rName);
613
614 /**
615 * Mark set of events as high-level events
616 *
617 * @param rEvents
618 * EventSet
619 */
620 void SetHighlevel(const EventSet& rEvents);
621
622 /**
623 * Mark event as low-level event (by index)
624 *
625 * @param index
626 * Event index
627 */
628 void SetLowlevel(Idx index);
629
630 /**
631 * Mark event as low-level event (by name)
632 *
633 * @param rName
634 * Event name
635 */
636 void SetLowlevel(const std::string& rName);
637
638 /**
639 * Mark set of events as low-level events.
640 *
641 * @param rEvents
642 * EventSet
643 */
644 void SetLowlevel(const EventSet& rEvents);
645
646 /**
647 * Test for high-level event (by index)
648 *
649 * @param index
650 * Event index
651 *
652 * @return
653 * True / false
654 */
655 bool Highlevel(Idx index) const;
656
657 /**
658 * Test for high-level event (by name)
659 *
660 * @param rName
661 * Event name
662 *
663 * @return
664 * True / false
665 */
666 bool Highlevel(const std::string& rName) const;
667
668 /**
669 * Test for low-level event (by index)
670 *
671 * @param index
672 * Event index
673 *
674 * @return
675 * True / false
676 */
677 bool Lowlevel(Idx index) const;
678
679 /**
680 * Test for low-level event (by name)
681 *
682 * @param rName
683 * Event name
684 *
685 * @return
686 * True / false
687 */
688 bool Lowlevel(const std::string& rName) const;
689
690 /**
691 * Get EventSet of all high-level events
692 *
693 * @return
694 * EventSet of high-level events
695 */
696 EventSet HighlevelEvents(void) const;
697
698 /**
699 * Get EventSet of all low-level events
700 *
701 * @return
702 * EventSet of low-level events
703 */
704 EventSet LowlevelEvents(void) const;
705
706
707 private:
708
709 protected:
710
711}; // end class TcGenerator
712
713
714/**
715 * Convenience typedef for std System.
716 *
717 * @ingroup GeneratorClasses
718 */
720
721/**
722 * Convenience typedef for vectors of systems
723 * \ingroup GeneratorClasses
724 */
726
727/** Compatibility: pre 2.20b used cGenerator as C++ class name*/
728#ifdef FAUDES_COMPATIBILITY
731#endif
732
733
734
735/*
736***************************************************************************
737***************************************************************************
738***************************************************************************
739
740Implementation cgenerator
741
742***************************************************************************
743***************************************************************************
744***************************************************************************
745*/
746
747/* convenience access to relevant scopes */
748#define THIS TcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
749#define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
750#define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
751
752
753// TcGenerator(void)
754TEMP THIS::TcGenerator(void) : BASE() {
755 FD_DG("TcGenerator(" << this << ")::TcGenerator()");
756}
757
758// TcGenerator(rOtherGen)
759TEMP THIS::TcGenerator(const TcGenerator& rOtherGen) : BASE(rOtherGen) {
760 FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
761}
762
763// TcGenerator(rOtherGen)
764TEMP THIS::TcGenerator(const vGenerator& rOtherGen) : BASE(rOtherGen) {
765 FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
766}
767
768// TcGenerator(rFilename)
769TEMP THIS::TcGenerator(const std::string& rFileName) : BASE(rFileName) {
770 FD_DG("TcGenerator(" << this << ")::TcGenerator(rFilename) : done");
771}
772
773// operator=
774TEMP THIS& THIS::operator= (const TcGenerator& rOtherGen) {
775 FD_DG("TcGenerator(" << this << ")::operator = [v]" << &rOtherGen);
776 return Assign(rOtherGen);
777}
778
779// copy from other faudes type
780TEMP THIS& THIS::Assign(const Type& rSrc) {
781 FD_DG("TcGenerator(" << this << ")::Assign([type] " << &rSrc << ")");
782 // bail out on match
783 if(&rSrc==static_cast<const Type*>(this)) return *this;
784
785 // cast tests (clang 8.0.0 issues, 2017)
786 /*
787 const THIS* cgen=dynamic_cast<const THIS*>(&rSrc);
788 FD_WARN("TcGenerator(" << this << ")::Assign(..): cgen " << cgen);
789 const BASE* agen=dynamic_cast<const BASE*>(&rSrc);
790 FD_WARN("TcGenerator(" << this << ")::Assign(..): agen " << agen);
791 const vGenerator* vgen=dynamic_cast<const vGenerator*>(&rSrc);
792 FD_WARN("TcGenerator(" << this << ")::Assign(..): vgen " << vgen);
793 const BASE* agen2=dynamic_cast<const BASE*>(cgen);
794 FD_WARN("TcGenerator(" << this << ")::Assign(..): agen2 " << agen);
795 */
796
797 // pass on to base
798 FD_DG("TcGenerator(" << this << ")::Assign([type] " << &rSrc << "): call base");
799 BASE::Assign(rSrc);
800 return *this;
801}
802
803// New
804TEMP THIS* THIS::New(void) const {
805 // allocate
806 THIS* res = new THIS;
807 // fix base data
808 res->EventSymbolTablep(BASE::mpEventSymbolTable);
809 res->mStateNamesEnabled=BASE::mStateNamesEnabled;
810 res->mReindexOnWrite=BASE::mReindexOnWrite;
811 return res;
812}
813
814// Copy
815TEMP THIS* THIS::Copy(void) const {
816 // allocate
817 THIS* res = new THIS(*this);
818 // done
819 return res;
820}
821
822// NewCGen
823TEMP THIS THIS::NewCGen(void) const {
824 // call base (fixes by assignment constructor)
825 THIS res= BASE::NewAGen();
826 return res;
827}
828
829
830// CAST
831//TEMP const Type* THIS::Cast(const Type* pOther) const {
832// return dynamic_cast< const THIS* > (pOther);
833//}
834
835
836
837 // Controllable(index)
838 TEMP bool THIS::Controllable(Idx index) const {
839 EventAttr attr=BASE::EventAttribute(index);
840 return attr.Controllable();
841 }
842
843 // Controllable(rName)
844 TEMP bool THIS::Controllable(const std::string& rName) const {
845 EventAttr attr=BASE::EventAttribute(rName);
846 return attr.Controllable();
847 }
848
849 // InsControllableEvent(index)
850 TEMP void THIS::InsControllableEvent(Idx index) {
851 FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << index << ")");
852 EventAttr attr;
853 attr.SetControllable();
854 BASE::InsEvent(index,attr);
855 }
856
857 // InsControllableEvent(rName)
858 TEMP Idx THIS::InsControllableEvent(const std::string& rName) {
859 FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << rName << ")");
860 EventAttr attr;
861 attr.SetControllable();
862 return BASE::InsEvent(rName,attr);
863 }
864
865 // InsUncontrollableEvent(index)
866 TEMP void THIS::InsUncontrollableEvent(Idx index) {
867 FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << index << ")");
868 EventAttr attr;
869 attr.ClrControllable();
870 BASE::InsEvent(index,attr);
871 }
872
873 // InsUncontrollableEvent(rName)
874 TEMP Idx THIS::InsUncontrollableEvent(const std::string& rName) {
875 FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << rName << ")");
876 EventAttr attr;
877 attr.ClrControllable();
878 return BASE::InsEvent(rName,attr);
879 }
880
881 // SetControllable(index)
882 TEMP void THIS::SetControllable(Idx index) {
883 FD_DG("TcGenerator(" << this << ")::SetControllable(" << index << ")");
884 EventAttr attr=BASE::EventAttribute(index);
885 attr.SetControllable();
886 BASE::pAlphabet->Attribute(index,attr);
887 }
888
889 // SetControllable(rName)
890 TEMP void THIS::SetControllable(const std::string& rName) {
891 FD_DG("TcGenerator(" << this << ")::SetControllable(" << rName << ")");
892 Idx index = BASE::EventIndex(rName);
893 SetControllable(index);
894 }
895
896 //SetControllable(rEvents)
897 TEMP void THIS::SetControllable(const EventSet& rEvents) {
898 FD_DG("TcGenerator(" << this << ")::SetControllable(rEvents)");
899 EventSet::Iterator it;
900 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
901 SetControllable(*it);
902 }
903 }
904
905 // ClrControllable(index)
906 TEMP void THIS::ClrControllable(Idx index) {
907 FD_DG("TcGenerator(" << this << ")::ClrControllable(" << index << ")");
908 EventAttr attr=BASE::EventAttribute(index);
909 attr.ClrControllable();
910 BASE::pAlphabet->Attribute(index,attr);
911 }
912
913 // ClrControllable(rName)
914 TEMP void THIS::ClrControllable(const std::string& rName) {
915 FD_DG("TcGenerator(" << this << ")::ClrControllable(" << rName << ")");
916 Idx index = BASE::EventIndex(rName);
917 ClrControllable(index);
918 }
919
920 //ClrControllable(rEvents)
921 TEMP void THIS::ClrControllable(const EventSet& rEvents) {
922 FD_DG("TcGenerator(" << this << ")::ClrControllable(rEvents)");
923 EventSet::Iterator it;
924 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
925 ClrControllable(*it);
926 }
927 }
928
929 //ControllableEvents()
930 TEMP EventSet THIS::ControllableEvents(void) const {
931 FD_DG("TcGenerator(" << this << ")::ControllableEvents()");
932 EventSet res;
933 EventSet::Iterator it;
934 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
935 if(Controllable(*it)) res.Insert(*it);
936 }
937 return res;
938 }
939
940 //UncontrollableEvents()
941 TEMP
942 EventSet THIS::UncontrollableEvents(void) const {
943 FD_DG("TcGenerator(" << this << ")::UncontrollableEvents()");
944 EventSet res;
945 EventSet::Iterator it;
946 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
947 if(!Controllable(*it)) res.Insert(*it);
948 }
949 return res;
950 }
951
952 // Observable(index)
953 TEMP bool THIS::Observable(Idx index) const {
954 EventAttr attr=BASE::EventAttribute(index);
955 return attr.Observable();
956 }
957
958 // Observable(rName)
959 TEMP bool THIS::Observable(const std::string& rName) const {
960 EventAttr attr=BASE::EventAttribute(rName);
961 return attr.Observable();
962 }
963
964 // InsObservableEvent(index)
965 TEMP void THIS::InsObservableEvent(Idx index) {
966 FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << index << ")");
967 EventAttr attr;
968 attr.SetObservable();
969 BASE::InsEvent(index,attr);
970 }
971
972 // InsObservableEvent(rName)
973 TEMP Idx THIS::InsObservableEvent(const std::string& rName) {
974 FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << rName << ")");
975 EventAttr attr;
976 attr.SetObservable();
977 return BASE::InsEvent(rName,attr);
978 }
979
980 // InsUnobservableEvent(index)
981 TEMP void THIS::InsUnobservableEvent(Idx index) {
982 FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << index << ")");
983 EventAttr attr;
984 attr.ClrObservable();
985 BASE::InsEvent(index,attr);
986 }
987
988 // InsUnobservableEvent(rName)
989 TEMP Idx THIS::InsUnobservableEvent(const std::string& rName) {
990 FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << rName << ")");
991 EventAttr attr;
992 attr.ClrObservable();
993 return BASE::InsEvent(rName,attr);
994 }
995
996 // SetObservable(index)
997 TEMP void THIS::SetObservable(Idx index) {
998 FD_DG("TcGenerator(" << this << ")::SetObservable(" << index << ")");
999 EventAttr attr=BASE::EventAttribute(index);
1000 attr.SetObservable();
1001 BASE::pAlphabet->Attribute(index,attr);
1002 }
1003
1004 // SetObservable(rName)
1005 TEMP void THIS::SetObservable(const std::string& rName) {
1006 FD_DG("TcGenerator(" << this << ")::SetObservable(" << rName << ")");
1007 Idx index = BASE::EventIndex(rName);
1008 SetObservable(index);
1009 }
1010
1011 //SetObservable(rEvents)
1012 TEMP void THIS::SetObservable(const EventSet& rEvents) {
1013 FD_DG("TcGenerator(" << this << ")::SetObservable(rEvents)");
1014 EventSet::Iterator it;
1015 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1016 SetObservable(*it);
1017 }
1018 }
1019
1020 // ClrObservable(index)
1021 TEMP void THIS::ClrObservable(Idx index) {
1022 FD_DG("TcGenerator(" << this << ")::ClrObservable(" << index << ")");
1023 EventAttr attr=BASE::EventAttribute(index);
1024 attr.ClrObservable();
1025 BASE::pAlphabet->Attribute(index,attr);
1026 }
1027
1028 // ClrObservable(rName)
1029 TEMP void THIS::ClrObservable(const std::string& rName) {
1030 FD_DG("TcGenerator(" << this << ")::ClrObservable(" << rName << ")");
1031 Idx index = BASE::EventIndex(rName);
1032 ClrObservable(index);
1033 }
1034
1035 //ClrObservable(rEvents)
1036 TEMP void THIS::ClrObservable(const EventSet& rEvents) {
1037 FD_DG("TcGenerator(" << this << ")::ClrObservable(rEvents)");
1038 EventSet::Iterator it;
1039 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1040 ClrObservable(*it);
1041 }
1042 }
1043
1044 //ObservableEvents()
1045 TEMP EventSet THIS::ObservableEvents(void) const {
1046 FD_DG("TcGenerator(" << this << ")::ObservableEvents()");
1047 EventSet res;
1048 EventSet::Iterator it;
1049 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1050 if(Observable(*it)) res.Insert(*it);
1051 }
1052 return res;
1053 }
1054
1055 //UnobservableEvents()
1056 TEMP
1057 EventSet THIS::UnobservableEvents(void) const {
1058 FD_DG("TcGenerator(" << this << ")::UnobservableEvents()");
1059 EventSet res;
1060 EventSet::Iterator it;
1061 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1062 if(!Observable(*it)) res.Insert(*it);
1063 }
1064 return res;
1065 }
1066
1067
1068 //Forcible(index)
1069 TEMP bool THIS::Forcible(Idx index) const {
1070 EventAttr attr=BASE::EventAttribute(index);
1071 return attr.Forcible();
1072 }
1073
1074 // Forcible(rName)
1075 TEMP bool THIS::Forcible(const std::string& rName) const {
1076 EventAttr attr=BASE::EventAttribute(rName);
1077 return attr.Forcible();
1078 }
1079
1080 // InsForcibleEvent(index)
1081 TEMP void THIS::InsForcibleEvent(Idx index) {
1082 FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << index << ")");
1083 EventAttr attr;
1084 attr.SetForcible();
1085 BASE::InsEvent(index,attr);
1086 }
1087
1088 // InsForcibleEvent(rName)
1089 TEMP Idx THIS::InsForcibleEvent(const std::string& rName) {
1090 FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << rName << ")");
1091 EventAttr attr;
1092 attr.SetForcible();
1093 return BASE::InsEvent(rName,attr);
1094 }
1095
1096 // InsUnforcibleEvent(index)
1097 TEMP void THIS::InsUnforcibleEvent(Idx index) {
1098 FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << index << ")");
1099 EventAttr attr;
1100 attr.ClrForcible();
1101 BASE::InsEvent(index,attr);
1102 }
1103
1104 // InsUnforcibleEvent(rName)
1105 TEMP Idx THIS::InsUnforcibleEvent(const std::string& rName) {
1106 FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << rName << ")");
1107 EventAttr attr;
1108 attr.ClrForcible();
1109 return BASE::InsEvent(rName,attr);
1110 }
1111
1112 // SetForcible(index)
1113 TEMP void THIS::SetForcible(Idx index) {
1114 FD_DG("TcGenerator(" << this << ")::SetForcible(" << index << ")");
1115 EventAttr attr=BASE::EventAttribute(index);
1116 attr.SetForcible();
1117 BASE::pAlphabet->Attribute(index,attr);
1118 }
1119
1120 // SetForcible(rName)
1121 TEMP void THIS::SetForcible(const std::string& rName) {
1122 FD_DG("TcGenerator(" << this << ")::SetForcible(" << rName << ")");
1123 Idx index = BASE::EventIndex(rName);
1124 SetForcible(index);
1125 }
1126
1127 //SetForcible(rEvents)
1128 TEMP void THIS::SetForcible(const EventSet& rEvents) {
1129 FD_DG("TcGenerator(" << this << ")::SetForcible(rEvents)");
1130 EventSet::Iterator it;
1131 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1132 SetForcible(*it);
1133 }
1134 }
1135
1136 // ClrForcible(index)
1137 TEMP void THIS::ClrForcible(Idx index) {
1138 FD_DG("TcGenerator(" << this << ")::ClrForcible(" << index << ")");
1139 EventAttr attr=BASE::EventAttribute(index);
1140 attr.ClrForcible();
1141 BASE::pAlphabet->Attribute(index,attr);
1142 }
1143
1144 // ClrForcible(rName)
1145 TEMP void THIS::ClrForcible(const std::string& rName) {
1146 FD_DG("TcGenerator(" << this << ")::ClrForcible(" << rName << ")");
1147 Idx index = BASE::EventIndex(rName);
1148 ClrForcible(index);
1149 }
1150
1151 //ClrForcible(rEvents)
1152 TEMP void THIS::ClrForcible(const EventSet& rEvents) {
1153 FD_DG("TcGenerator(" << this << ")::ClrForcible(rEvents)");
1154 EventSet::Iterator it;
1155 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1156 ClrForcible(*it);
1157 }
1158 }
1159
1160 //ForcibleEvents()
1161 TEMP EventSet THIS::ForcibleEvents(void) const {
1162 FD_DG("TcGenerator(" << this << ")::ForcibleEvents()");
1163 EventSet res;
1164 EventSet::Iterator it;
1165 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1166 if(Forcible(*it)) res.Insert(*it);
1167 }
1168 return res;
1169 }
1170
1171 //UnforcibleEvents()
1172 TEMP
1173 EventSet THIS::UnforcibleEvents(void) const {
1174 FD_DG("TcGenerator(" << this << ")::UnforcibleEvents()");
1175 EventSet res;
1176 EventSet::Iterator it;
1177 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1178 if(!Forcible(*it)) res.Insert(*it);
1179 }
1180 return res;
1181 }
1182
1183
1184 //Highlevel(index)
1185 TEMP bool THIS::Highlevel(Idx index) const {
1186 EventAttr attr=BASE::EventAttribute(index);
1187 return attr.Highlevel();
1188 }
1189
1190 // Highlevel(rName)
1191 TEMP bool THIS::Highlevel(const std::string& rName) const {
1192 EventAttr attr=BASE::EventAttribute(rName);
1193 return attr.Highlevel();
1194 }
1195
1196 //Lowlevel(index)
1197 TEMP bool THIS::Lowlevel(Idx index) const {
1198 EventAttr attr=BASE::EventAttribute(index);
1199 return attr.Lowlevel();
1200 }
1201
1202 // Lowlevel(rName)
1203 TEMP bool THIS::Lowlevel(const std::string& rName) const {
1204 EventAttr attr=BASE::EventAttribute(rName);
1205 return attr.Lowlevel();
1206 }
1207
1208 // InsHighlevelEvent(index)
1209 TEMP void THIS::InsHighlevelEvent(Idx index) {
1210 FD_DG("TcGenerator(" << this << ")::InsHighlevelEvent(" << index << ")");
1211 EventAttr attr;
1212 attr.SetHighlevel();
1213 BASE::InsEvent(index,attr);
1214 }
1215
1216 // InsHighlevelEvent(rName)
1217 TEMP Idx THIS::InsHighlevelEvent(const std::string& rName) {
1218 FD_DG("TcGenerator(" << this << ")::InsHighlevelEvent(" << rName << ")");
1219 EventAttr attr;
1220 attr.SetHighlevel();
1221 return BASE::InsEvent(rName,attr);
1222 }
1223
1224 // InsLowlevelEvent(index)
1225 TEMP void THIS::InsLowlevelEvent(Idx index) {
1226 FD_DG("TcGenerator(" << this << ")::InsLowlevelEvent(" << index << ")");
1227 EventAttr attr;
1228 attr.SetLowlevel();
1229 BASE::InsEvent(index,attr);
1230 }
1231
1232 // InsLowlevelEvent(rName)
1233 TEMP Idx THIS::InsLowlevelEvent(const std::string& rName) {
1234 FD_DG("TcGenerator(" << this << ")::InsLowlevelEvent(" << rName << ")");
1235 EventAttr attr;
1236 attr.SetLowlevel();
1237 return BASE::InsEvent(rName,attr);
1238 }
1239
1240 // SetHighlevel(index)
1241 TEMP void THIS::SetHighlevel(Idx index) {
1242 FD_DG("TcGenerator(" << this << ")::SetHighlevel(" << index << ")");
1243 EventAttr attr=BASE::EventAttribute(index);
1244 attr.SetHighlevel();
1245 BASE::pAlphabet->Attribute(index,attr);
1246 }
1247
1248 // SetHighlevel(rName)
1249 TEMP void THIS::SetHighlevel(const std::string& rName) {
1250 FD_DG("TcGenerator(" << this << ")::SetHighlevel(" << rName << ")");
1251 Idx index = BASE::EventIndex(rName);
1252 SetHighlevel(index);
1253 }
1254
1255 //SetHighlevel(rEvents)
1256 TEMP void THIS::SetHighlevel(const EventSet& rEvents) {
1257 FD_DG("TcGenerator(" << this << ")::SetHighlevel(rEvents)");
1258 EventSet::Iterator it;
1259 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1260 SetHighlevel(*it);
1261 }
1262 }
1263
1264 // SetLowlevel(index)
1265 TEMP void THIS::SetLowlevel(Idx index) {
1266 FD_DG("TcGenerator(" << this << ")::SetLowlevel(" << index << ")");
1267 EventAttr attr=BASE::EventAttribute(index);
1268 attr.SetLowlevel();
1269 BASE::pAlphabet->Attribute(index,attr);
1270 }
1271
1272 // SetLowlevel(rName)
1273 TEMP void THIS::SetLowlevel(const std::string& rName) {
1274 FD_DG("TcGenerator(" << this << ")::SetLowlevel(" << rName << ")");
1275 Idx index = BASE::EventIndex(rName);
1276 SetLowlevel(index);
1277 }
1278
1279 //SetLowlevel(rEvents)
1280 TEMP void THIS::SetLowlevel(const EventSet& rEvents) {
1281 FD_DG("TcGenerator(" << this << ")::SetLowlevel(rEvents)");
1282 EventSet::Iterator it;
1283 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1284 SetLowlevel(*it);
1285 }
1286 }
1287
1288 //HighlevelEvents()
1289 TEMP EventSet THIS::HighlevelEvents(void) const {
1290 FD_DG("TcGenerator(" << this << ")::HighlevelEvents()");
1291 EventSet res;
1292 EventSet::Iterator it;
1293 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1294 if(Highlevel(*it)) res.Insert(*it);
1295 }
1296 return res;
1297 }
1298
1299 //LowlevelEvents()
1300 TEMP EventSet THIS::LowlevelEvents(void) const {
1301 FD_DG("TcGenerator(" << this << ")::LowlevelEvents()");
1302 EventSet res;
1303 EventSet::Iterator it;
1304 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1305 if(Lowlevel(*it)) res.Insert(*it);
1306 }
1307 return res;
1308 }
1309
1310
1311
1312#undef TEMP
1313#undef BASE
1314#undef THIS
1315
1316
1317} // namespace faudes
1318
1319#endif
1320
#define TEMP
#define BASE
#define THIS
#define FD_DG(message)
#define FAUDES_TAPI
bool Insert(const Idx &rIndex)
virtual const Type * Cast(const Type *pOther) const
TaNameSet< AttributeCFlags > Alphabet
Iterator End(void) const
Iterator Begin(void) const
TBaseVector< System > SystemVector
TcGenerator< AttributeVoid, AttributeVoid, AttributeCFlags, AttributeVoid > System
uint32_t Idx
TBaseVector< Alphabet > AlphaberVector
TcGenerator< AttributeVoid, AttributeVoid, AttributeCFlags, AttributeVoid > cGenerator
TBaseVector< cGenerator > cGeneratorVector
TaNameSet< AttributeCFlags > cEventSet
TBaseVector< cEventSet > cEventSetVector

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