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* NewCpy(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 * Copyment operator (uses Copy)
143 *
144 * Note: you must reimplement this operator in derived
145 * classes in order to handle internal pointers correctly
146 *
147 * @param rOtherGen
148 * Other generator
149 */
150 TcGenerator& operator= (const TcGenerator& rOtherGen);
151
152 /**
153 * Copyment operator (uses Move)
154 *
155 * Note: you must reimplement this operator in derived
156 * classes in order to handle internal pointers correctly
157 *
158 * @param rOtherGen
159 * Other generator
160 */
161 TcGenerator& operator= (TcGenerator&& rOtherGen);
162
163 /**
164 * Copyment method
165 *
166 * Note: you must reimplement this method in derived
167 * classes in order to handle internal pointers correctly
168 *
169 * @param rSource
170 * Other generator
171 */
172 virtual TcGenerator& Copy(const Type& rSource);
173
174 /**
175 * Move method
176 *
177 * Note: you must reimplement this method in derived
178 * classes in order to handle internal pointers correctly
179 *
180 * @param rSource
181 * Other generator
182 */
183 virtual TcGenerator& Move(Type& rSource);
184
185 /**
186 * Add an existing controllable event to generator.
187 * An entry in the global eventtable will be made.
188 *
189 * @param index
190 * Event index
191 */
192 void InsControllableEvent(Idx index);
193
194 /**
195 * Add new named controllable event to generator.
196 * An entry in the global eventtable will be made if event is new.
197 *
198 * @param rName
199 * Name of the event to add
200 *
201 * @return
202 * New global unique index
203 */
204 Idx InsControllableEvent(const std::string& rName);
205
206 /**
207 * Add an existing uncontrollable event to generator.
208 * An entry in the global eventtable will be made.
209 *
210 * @param index
211 * Event index
212 */
213 void InsUncontrollableEvent(Idx index);
214
215 /**
216 * Add new named uncontrollable event to generator.
217 * An entry in the global eventtable will be made if event is new.
218 *
219 * @param rName
220 * Name of the event to add
221 *
222 * @return
223 * New global unique index
224 */
225 Idx InsUncontrollableEvent(const std::string& rName);
226
227 /**
228 * Mark event controllable (by index)
229 *
230 * @param index
231 * Event index
232 */
233 void SetControllable(Idx index);
234
235 /**
236 * Mark event controllable (by name)
237 *
238 * @param rName
239 * Event name
240 */
241 void SetControllable(const std::string& rName);
242
243 /**
244 * Mark set of events controllable (by index)
245 *
246 * @param rEvents
247 * EventSet
248 */
249 void SetControllable(const EventSet& rEvents);
250
251 /**
252 * Mark event uncontrollable (by index)
253 *
254 * @param index
255 * Event index
256 */
257 void ClrControllable(Idx index);
258
259 /**
260 * Mark event uncontrollable (by name)
261 *
262 * @param rName
263 * Event name
264 */
265 void ClrControllable(const std::string& rName);
266
267 /**
268 * Mark set of events uncontrollable (by index)
269 *
270 * @param rEvents
271 * EventSet
272 */
273 void ClrControllable(const EventSet& rEvents);
274
275 /**
276 * Is event controllable (by index)
277 *
278 * @param index
279 * Event index
280 *
281 * @return
282 * True / false
283 */
284 bool Controllable(Idx index) const;
285
286 /**
287 * Is event controllable (by name)
288 *
289 * @param rName
290 * Event name
291 *
292 * @return
293 * True / false
294 */
295 bool Controllable(const std::string& rName) const;
296
297 /**
298 * Get EventSet with controllable events
299 *
300 * @return
301 * EventSet of controllable events
302 */
303 EventSet ControllableEvents(void) const;
304
305 /**
306 * Get EventSet with uncontrollable events
307 *
308 * @return
309 * EventSet of uncontrollable events
310 */
311 EventSet UncontrollableEvents(void) const;
312
313 /**
314 * Add an existing observable event to generator.
315 * An entry in the global eventtable will be made.
316 *
317 * @param index
318 * Event index
319 */
320 void InsObservableEvent(Idx index);
321
322 /**
323 * Add new named observable event to generator.
324 * An entry in the global eventtable will be made if event is new.
325 *
326 * @param rName
327 * Name of the event to add
328 *
329 * @return
330 * New global unique index
331 */
332 Idx InsObservableEvent(const std::string& rName);
333
334 /**
335 * Add an existing unobservable event to generator.
336 * An entry in the global eventtable will be made.
337 *
338 * @param index
339 * Event index
340 */
341 void InsUnobservableEvent(Idx index);
342
343 /**
344 * Add new named unobservable event to generator.
345 * An entry in the global eventtable will be made if event is new.
346 *
347 * @param rName
348 * Name of the event to add
349 *
350 * @return
351 * New global unique index
352 */
353 Idx InsUnobservableEvent(const std::string& rName);
354
355 /**
356 * Mark event observable (by index)
357 *
358 * @param index
359 * Event index
360 */
361 void SetObservable(Idx index);
362
363 /**
364 * Mark event observable (by name)
365 *
366 * @param rName
367 * Event name
368 */
369 void SetObservable(const std::string& rName);
370
371 /**
372 * Mark set of events observable
373 *
374 * @param rEvents
375 * EventSet
376 */
377 void SetObservable(const EventSet& rEvents);
378
379 /**
380 * Mark event unobservable (by index)
381 *
382 * @param index
383 * Event index
384 */
385 void ClrObservable(Idx index);
386
387 /**
388 * Mark event unobservable (by name)
389 *
390 * @param rName
391 * Event name
392 */
393 void ClrObservable(const std::string& rName);
394
395 /**
396 * Mark set of events unobservable
397 *
398 * @param rEvents
399 * EventSet
400 */
401 void ClrObservable(const EventSet& rEvents);
402
403 /**
404 * Is event observable (by index)
405 *
406 * @param index
407 * Event index
408 *
409 * @return
410 * True / false
411 */
412 bool Observable(Idx index) const;
413
414 /**
415 * Is event observable (by name)
416 *
417 * @param rName
418 * Event name
419 *
420 * @return
421 * True / false
422 */
423 bool Observable(const std::string& rName) const;
424
425 /**
426 * Get EventSet with observable events
427 *
428 * @return
429 * EventSet of controllable events
430 */
431 EventSet ObservableEvents(void) const;
432
433 /**
434 * Get EventSet with unobservable events
435 *
436 * @return
437 * EventSet of uncontrollable events
438 */
439 EventSet UnobservableEvents(void) const;
440
441 /**
442 * Add an existing forcible event to generator.
443 * An entry in the global eventtable will be made.
444 *
445 * @param index
446 * Event index
447 */
448 void InsForcibleEvent(Idx index);
449
450 /**
451 * Add new named forcible event to generator.
452 * An entry in the global eventtable will be made if event is new.
453 *
454 * @param rName
455 * Name of the event to add
456 *
457 * @return
458 * New global unique index
459 */
460 Idx InsForcibleEvent(const std::string& rName);
461
462 /**
463 * Add an existing unforcible event to generator.
464 * An entry in the global eventtable will be made.
465 *
466 * @param index
467 * Event index
468 */
469 void InsUnforcibleEvent(Idx index);
470
471 /**
472 * Add new named unforcible event to generator.
473 * An entry in the global eventtable will be made if event is new.
474 *
475 * @param rName
476 * Name of the event to add
477 *
478 * @return
479 * New global unique index
480 */
481 Idx InsUnforcibleEvent(const std::string& rName);
482
483 /**
484 * Mark event forcible (by index)
485 *
486 * @param index
487 * Event index
488 */
489 void SetForcible(Idx index);
490
491 /**
492 * Mark event forcible (by name)
493 *
494 * @param rName
495 * Event name
496 */
497 void SetForcible(const std::string& rName);
498
499 /**
500 * Mark set of events forcible
501 *
502 * @param rEvents
503 * EventSet
504 */
505 void SetForcible(const EventSet& rEvents);
506
507 /**
508 * Mark event unforcible (by index)
509 *
510 * @param index
511 * Event index
512 */
513 void ClrForcible(Idx index);
514
515 /**
516 * Mark event unforcible (by name)
517 *
518 * @param rName
519 * Event name
520 */
521 void ClrForcible(const std::string& rName);
522
523 /**
524 * Mark set of events unforcible
525 *
526 * @param rEvents
527 * EventSet
528 */
529 void ClrForcible(const EventSet& rEvents);
530
531 /**
532 * Is event forcible (by index)
533 *
534 * @param index
535 * Event index
536 *
537 * @return
538 * True / false
539 */
540 bool Forcible(Idx index) const;
541
542 /**
543 * Is event forcible (by name)
544 *
545 * @param rName
546 * Event name
547 *
548 * @return
549 * True / false
550 */
551 bool Forcible(const std::string& rName) const;
552
553 /**
554 * Get EventSet with forcible events
555 *
556 * @return
557 * EventSet of controllable events
558 */
559 EventSet ForcibleEvents(void) const;
560
561 /**
562 * Get EventSet with unforcible events
563 *
564 * @return
565 * EventSet of uncontrollable events
566 */
567 EventSet UnforcibleEvents(void) const;
568
569
570 /**
571 * Add an existing preemptible event to generator.
572 * An entry in the global eventtable will be made.
573 *
574 * @param index
575 * Event index
576 */
577 void InsPreemptibleEvent(Idx index);
578
579 /**
580 * Add new named preemptible event to generator.
581 * An entry in the global eventtable will be made if event is new.
582 *
583 * @param rName
584 * Name of the event to add
585 *
586 * @return
587 * New global unique index
588 */
589 Idx InsPreemptibleEvent(const std::string& rName);
590
591 /**
592 * Add an existing unpreemptible event to generator.
593 * An entry in the global eventtable will be made.
594 *
595 * @param index
596 * Event index
597 */
598 void InsUnpreemptibleEvent(Idx index);
599
600 /**
601 * Add new named unpreemptible event to generator.
602 * An entry in the global eventtable will be made if event is new.
603 *
604 * @param rName
605 * Name of the event to add
606 *
607 * @return
608 * New global unique index
609 */
610 Idx InsUnpreemptibleEvent(const std::string& rName);
611
612 /**
613 * Mark event preemptible (by index)
614 *
615 * @param index
616 * Event index
617 */
618 void SetPreemptible(Idx index);
619
620 /**
621 * Mark event preemptible (by name)
622 *
623 * @param rName
624 * Event name
625 */
626 void SetPreemptible(const std::string& rName);
627
628 /**
629 * Mark set of events preemptible
630 *
631 * @param rEvents
632 * EventSet
633 */
634 void SetPreemptible(const EventSet& rEvents);
635
636 /**
637 * Mark event unpreemptible (by index)
638 *
639 * @param index
640 * Event index
641 */
642 void ClrPreemptible(Idx index);
643
644 /**
645 * Mark event unpreemptible (by name)
646 *
647 * @param rName
648 * Event name
649 */
650 void ClrPreemptible(const std::string& rName);
651
652 /**
653 * Mark set of events unpreemptible
654 *
655 * @param rEvents
656 * EventSet
657 */
658 void ClrPreemptible(const EventSet& rEvents);
659
660 /**
661 * Is event preemptible (by index)
662 *
663 * @param index
664 * Event index
665 *
666 * @return
667 * True / false
668 */
669 bool Preemptible(Idx index) const;
670
671 /**
672 * Is event preemptible (by name)
673 *
674 * @param rName
675 * Event name
676 *
677 * @return
678 * True / false
679 */
680 bool Preemptible(const std::string& rName) const;
681
682 /**
683 * Get EventSet with preemptible events
684 *
685 * @return
686 * EventSet of preemptible events
687 */
688 EventSet PreemptibleEvents(void) const;
689
690 /**
691 * Get EventSet with unpreemptible events
692 *
693 * @return
694 * EventSet of unpreemptible events
695 */
696 EventSet UnpreemptibleEvents(void) const;
697
698
699
700 private:
701
702 protected:
703
704}; // end class TcGenerator
705
706
707/**
708 * Convenience typedef for std System.
709 *
710 * @ingroup GeneratorClasses
711 */
713
714/**
715 * Convenience typedef for vectors of systems
716 * \ingroup GeneratorClasses
717 */
719
720/** Compatibility: pre 2.20b used cGenerator as C++ class name*/
721#ifdef FAUDES_COMPATIBILITY
724#endif
725
726
727
728/*
729***************************************************************************
730***************************************************************************
731***************************************************************************
732
733Implementation cgenerator
734
735***************************************************************************
736***************************************************************************
737***************************************************************************
738*/
739
740/* convenience access to relevant scopes */
741#define THIS TcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
742#define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
743#define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
744
745
746// TcGenerator(void)
747TEMP THIS::TcGenerator(void) : BASE() {
748 FD_DG("TcGenerator(" << this << ")::TcGenerator()");
749}
750
751// TcGenerator(rOtherGen)
752TEMP THIS::TcGenerator(const TcGenerator& rOtherGen) : BASE(rOtherGen) {
753 FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
754}
755
756// TcGenerator(rOtherGen)
757TEMP THIS::TcGenerator(const vGenerator& rOtherGen) : BASE(rOtherGen) {
758 FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
759}
760
761// TcGenerator(rFilename)
762TEMP THIS::TcGenerator(const std::string& rFileName) : BASE(rFileName) {
763 FD_DG("TcGenerator(" << this << ")::TcGenerator(rFilename) : done");
764}
765
766// operator=
767TEMP THIS& THIS::operator= (const TcGenerator& rOtherGen) {
768 FD_DG("TcGenerator(" << this << ")::operator = [v]" << &rOtherGen);
769 return Copy(rOtherGen);
770}
771
772// operator=
773TEMP THIS& THIS::operator= (TcGenerator&& rOtherGen) {
774 FD_DG("TcGenerator(" << this << ")::operator = [v]" << &rOtherGen);
775 return Move(rOtherGen);
776}
777
778// copy from other faudes type
779TEMP THIS& THIS::Copy(const Type& rSrc) {
780 FD_DG("TcGenerator(" << this << ")::Copy([type] " << &rSrc << ")");
781 // bail out on match
782 if(&rSrc==static_cast<const Type*>(this)) return *this;
783
784 // cast tests (clang 8.0.0 issues, 2017)
785 /*
786 const THIS* cgen=dynamic_cast<const THIS*>(&rSrc);
787 FD_WARN("TcGenerator(" << this << ")::Copy(..): cgen " << cgen);
788 const BASE* agen=dynamic_cast<const BASE*>(&rSrc);
789 FD_WARN("TcGenerator(" << this << ")::Copy(..): agen " << agen);
790 const vGenerator* vgen=dynamic_cast<const vGenerator*>(&rSrc);
791 FD_WARN("TcGenerator(" << this << ")::Copy(..): vgen " << vgen);
792 const BASE* agen2=dynamic_cast<const BASE*>(cgen);
793 FD_WARN("TcGenerator(" << this << ")::Copy(..): agen2 " << agen);
794 */
795
796 // pass on to base
797 FD_DG("TcGenerator(" << this << ")::Copy([type] " << &rSrc << "): call base");
798 BASE::Copy(rSrc);
799 return *this;
800}
801
802// copy from other faudes type
803TEMP THIS& THIS::Move(Type& rSrc) {
804 FD_DG("TcGenerator(" << this << ")::Copy([type] " << &rSrc << ")");
805 // bail out on match
806 if(&rSrc==static_cast<Type*>(this)) return *this;
807 // pass on to base
808 FD_DG("TcGenerator(" << this << ")::Copy([type] " << &rSrc << "): call base");
809 BASE::Move(rSrc);
810 return *this;
811}
812
813// New
814TEMP THIS* THIS::New(void) const {
815 // allocate
816 THIS* res = new THIS;
817 // fix base data
818 res->EventSymbolTablep(BASE::mpEventSymbolTable);
819 res->mStateNamesEnabled=BASE::mStateNamesEnabled;
820 res->mReindexOnWrite=BASE::mReindexOnWrite;
821 return res;
822}
823
824// Copy
825TEMP THIS* THIS::NewCpy(void) const {
826 // allocate
827 THIS* res = new THIS(*this);
828 // done
829 return res;
830}
831
832
833
834 // Controllable(index)
835 TEMP bool THIS::Controllable(Idx index) const {
836 EventAttr attr=BASE::EventAttribute(index);
837 return attr.Controllable();
838 }
839
840 // Controllable(rName)
841 TEMP bool THIS::Controllable(const std::string& rName) const {
842 EventAttr attr=BASE::EventAttribute(rName);
843 return attr.Controllable();
844 }
845
846 // InsControllableEvent(index)
847 TEMP void THIS::InsControllableEvent(Idx index) {
848 FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << index << ")");
849 EventAttr attr;
850 attr.SetControllable();
851 BASE::InsEvent(index,attr);
852 }
853
854 // InsControllableEvent(rName)
855 TEMP Idx THIS::InsControllableEvent(const std::string& rName) {
856 FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << rName << ")");
857 EventAttr attr;
858 attr.SetControllable();
859 return BASE::InsEvent(rName,attr);
860 }
861
862 // InsUncontrollableEvent(index)
863 TEMP void THIS::InsUncontrollableEvent(Idx index) {
864 FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << index << ")");
865 EventAttr attr;
866 attr.ClrControllable();
867 BASE::InsEvent(index,attr);
868 }
869
870 // InsUncontrollableEvent(rName)
871 TEMP Idx THIS::InsUncontrollableEvent(const std::string& rName) {
872 FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << rName << ")");
873 EventAttr attr;
874 attr.ClrControllable();
875 return BASE::InsEvent(rName,attr);
876 }
877
878 // SetControllable(index)
879 TEMP void THIS::SetControllable(Idx index) {
880 FD_DG("TcGenerator(" << this << ")::SetControllable(" << index << ")");
881 EventAttr attr=BASE::EventAttribute(index);
882 attr.SetControllable();
883 BASE::pAlphabet->Attribute(index,attr);
884 }
885
886 // SetControllable(rName)
887 TEMP void THIS::SetControllable(const std::string& rName) {
888 FD_DG("TcGenerator(" << this << ")::SetControllable(" << rName << ")");
889 Idx index = BASE::EventIndex(rName);
890 SetControllable(index);
891 }
892
893 //SetControllable(rEvents)
894 TEMP void THIS::SetControllable(const EventSet& rEvents) {
895 FD_DG("TcGenerator(" << this << ")::SetControllable(rEvents)");
896 EventSet::Iterator it;
897 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
898 SetControllable(*it);
899 }
900 }
901
902 // ClrControllable(index)
903 TEMP void THIS::ClrControllable(Idx index) {
904 FD_DG("TcGenerator(" << this << ")::ClrControllable(" << index << ")");
905 EventAttr attr=BASE::EventAttribute(index);
906 attr.ClrControllable();
907 BASE::pAlphabet->Attribute(index,attr);
908 }
909
910 // ClrControllable(rName)
911 TEMP void THIS::ClrControllable(const std::string& rName) {
912 FD_DG("TcGenerator(" << this << ")::ClrControllable(" << rName << ")");
913 Idx index = BASE::EventIndex(rName);
914 ClrControllable(index);
915 }
916
917 //ClrControllable(rEvents)
918 TEMP void THIS::ClrControllable(const EventSet& rEvents) {
919 FD_DG("TcGenerator(" << this << ")::ClrControllable(rEvents)");
920 EventSet::Iterator it;
921 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
922 ClrControllable(*it);
923 }
924 }
925
926 //ControllableEvents()
927 TEMP EventSet THIS::ControllableEvents(void) const {
928 FD_DG("TcGenerator(" << this << ")::ControllableEvents()");
929 EventSet res;
930 EventSet::Iterator it;
931 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
932 if(Controllable(*it)) res.Insert(*it);
933 }
934 return res;
935 }
936
937 //UncontrollableEvents()
938 TEMP
939 EventSet THIS::UncontrollableEvents(void) const {
940 FD_DG("TcGenerator(" << this << ")::UncontrollableEvents()");
941 EventSet res;
942 EventSet::Iterator it;
943 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
944 if(!Controllable(*it)) res.Insert(*it);
945 }
946 return res;
947 }
948
949 // Observable(index)
950 TEMP bool THIS::Observable(Idx index) const {
951 EventAttr attr=BASE::EventAttribute(index);
952 return attr.Observable();
953 }
954
955 // Observable(rName)
956 TEMP bool THIS::Observable(const std::string& rName) const {
957 EventAttr attr=BASE::EventAttribute(rName);
958 return attr.Observable();
959 }
960
961 // InsObservableEvent(index)
962 TEMP void THIS::InsObservableEvent(Idx index) {
963 FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << index << ")");
964 EventAttr attr;
965 attr.SetObservable();
966 BASE::InsEvent(index,attr);
967 }
968
969 // InsObservableEvent(rName)
970 TEMP Idx THIS::InsObservableEvent(const std::string& rName) {
971 FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << rName << ")");
972 EventAttr attr;
973 attr.SetObservable();
974 return BASE::InsEvent(rName,attr);
975 }
976
977 // InsUnobservableEvent(index)
978 TEMP void THIS::InsUnobservableEvent(Idx index) {
979 FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << index << ")");
980 EventAttr attr;
981 attr.ClrObservable();
982 BASE::InsEvent(index,attr);
983 }
984
985 // InsUnobservableEvent(rName)
986 TEMP Idx THIS::InsUnobservableEvent(const std::string& rName) {
987 FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << rName << ")");
988 EventAttr attr;
989 attr.ClrObservable();
990 return BASE::InsEvent(rName,attr);
991 }
992
993 // SetObservable(index)
994 TEMP void THIS::SetObservable(Idx index) {
995 FD_DG("TcGenerator(" << this << ")::SetObservable(" << index << ")");
996 EventAttr attr=BASE::EventAttribute(index);
997 attr.SetObservable();
998 BASE::pAlphabet->Attribute(index,attr);
999 }
1000
1001 // SetObservable(rName)
1002 TEMP void THIS::SetObservable(const std::string& rName) {
1003 FD_DG("TcGenerator(" << this << ")::SetObservable(" << rName << ")");
1004 Idx index = BASE::EventIndex(rName);
1005 SetObservable(index);
1006 }
1007
1008 //SetObservable(rEvents)
1009 TEMP void THIS::SetObservable(const EventSet& rEvents) {
1010 FD_DG("TcGenerator(" << this << ")::SetObservable(rEvents)");
1011 EventSet::Iterator it;
1012 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1013 SetObservable(*it);
1014 }
1015 }
1016
1017 // ClrObservable(index)
1018 TEMP void THIS::ClrObservable(Idx index) {
1019 FD_DG("TcGenerator(" << this << ")::ClrObservable(" << index << ")");
1020 EventAttr attr=BASE::EventAttribute(index);
1021 attr.ClrObservable();
1022 BASE::pAlphabet->Attribute(index,attr);
1023 }
1024
1025 // ClrObservable(rName)
1026 TEMP void THIS::ClrObservable(const std::string& rName) {
1027 FD_DG("TcGenerator(" << this << ")::ClrObservable(" << rName << ")");
1028 Idx index = BASE::EventIndex(rName);
1029 ClrObservable(index);
1030 }
1031
1032 //ClrObservable(rEvents)
1033 TEMP void THIS::ClrObservable(const EventSet& rEvents) {
1034 FD_DG("TcGenerator(" << this << ")::ClrObservable(rEvents)");
1035 EventSet::Iterator it;
1036 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1037 ClrObservable(*it);
1038 }
1039 }
1040
1041 //ObservableEvents()
1042 TEMP EventSet THIS::ObservableEvents(void) const {
1043 FD_DG("TcGenerator(" << this << ")::ObservableEvents()");
1044 EventSet res;
1045 EventSet::Iterator it;
1046 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1047 if(Observable(*it)) res.Insert(*it);
1048 }
1049 return res;
1050 }
1051
1052 //UnobservableEvents()
1053 TEMP
1054 EventSet THIS::UnobservableEvents(void) const {
1055 FD_DG("TcGenerator(" << this << ")::UnobservableEvents()");
1056 EventSet res;
1057 EventSet::Iterator it;
1058 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1059 if(!Observable(*it)) res.Insert(*it);
1060 }
1061 return res;
1062 }
1063
1064
1065 //Forcible(index)
1066 TEMP bool THIS::Forcible(Idx index) const {
1067 EventAttr attr=BASE::EventAttribute(index);
1068 return attr.Forcible();
1069 }
1070
1071 // Forcible(rName)
1072 TEMP bool THIS::Forcible(const std::string& rName) const {
1073 EventAttr attr=BASE::EventAttribute(rName);
1074 return attr.Forcible();
1075 }
1076
1077 // InsForcibleEvent(index)
1078 TEMP void THIS::InsForcibleEvent(Idx index) {
1079 FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << index << ")");
1080 EventAttr attr;
1081 attr.SetForcible();
1082 BASE::InsEvent(index,attr);
1083 }
1084
1085 // InsForcibleEvent(rName)
1086 TEMP Idx THIS::InsForcibleEvent(const std::string& rName) {
1087 FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << rName << ")");
1088 EventAttr attr;
1089 attr.SetForcible();
1090 return BASE::InsEvent(rName,attr);
1091 }
1092
1093 // InsUnforcibleEvent(index)
1094 TEMP void THIS::InsUnforcibleEvent(Idx index) {
1095 FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << index << ")");
1096 EventAttr attr;
1097 attr.ClrForcible();
1098 BASE::InsEvent(index,attr);
1099 }
1100
1101 // InsUnforcibleEvent(rName)
1102 TEMP Idx THIS::InsUnforcibleEvent(const std::string& rName) {
1103 FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << rName << ")");
1104 EventAttr attr;
1105 attr.ClrForcible();
1106 return BASE::InsEvent(rName,attr);
1107 }
1108
1109 // SetForcible(index)
1110 TEMP void THIS::SetForcible(Idx index) {
1111 FD_DG("TcGenerator(" << this << ")::SetForcible(" << index << ")");
1112 EventAttr attr=BASE::EventAttribute(index);
1113 attr.SetForcible();
1114 BASE::pAlphabet->Attribute(index,attr);
1115 }
1116
1117 // SetForcible(rName)
1118 TEMP void THIS::SetForcible(const std::string& rName) {
1119 FD_DG("TcGenerator(" << this << ")::SetForcible(" << rName << ")");
1120 Idx index = BASE::EventIndex(rName);
1121 SetForcible(index);
1122 }
1123
1124 //SetForcible(rEvents)
1125 TEMP void THIS::SetForcible(const EventSet& rEvents) {
1126 FD_DG("TcGenerator(" << this << ")::SetForcible(rEvents)");
1127 EventSet::Iterator it;
1128 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1129 SetForcible(*it);
1130 }
1131 }
1132
1133 // ClrForcible(index)
1134 TEMP void THIS::ClrForcible(Idx index) {
1135 FD_DG("TcGenerator(" << this << ")::ClrForcible(" << index << ")");
1136 EventAttr attr=BASE::EventAttribute(index);
1137 attr.ClrForcible();
1138 BASE::pAlphabet->Attribute(index,attr);
1139 }
1140
1141 // ClrForcible(rName)
1142 TEMP void THIS::ClrForcible(const std::string& rName) {
1143 FD_DG("TcGenerator(" << this << ")::ClrForcible(" << rName << ")");
1144 Idx index = BASE::EventIndex(rName);
1145 ClrForcible(index);
1146 }
1147
1148 //ClrForcible(rEvents)
1149 TEMP void THIS::ClrForcible(const EventSet& rEvents) {
1150 FD_DG("TcGenerator(" << this << ")::ClrForcible(rEvents)");
1151 EventSet::Iterator it;
1152 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1153 ClrForcible(*it);
1154 }
1155 }
1156
1157 //ForcibleEvents()
1158 TEMP EventSet THIS::ForcibleEvents(void) const {
1159 FD_DG("TcGenerator(" << this << ")::ForcibleEvents()");
1160 EventSet res;
1161 EventSet::Iterator it;
1162 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1163 if(Forcible(*it)) res.Insert(*it);
1164 }
1165 return res;
1166 }
1167
1168 //UnforcibleEvents()
1169 TEMP
1170 EventSet THIS::UnforcibleEvents(void) const {
1171 FD_DG("TcGenerator(" << this << ")::UnforcibleEvents()");
1172 EventSet res;
1173 EventSet::Iterator it;
1174 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1175 if(!Forcible(*it)) res.Insert(*it);
1176 }
1177 return res;
1178 }
1179
1180
1181 //Preemptible(index)
1182 TEMP bool THIS::Preemptible(Idx index) const {
1183 EventAttr attr=BASE::EventAttribute(index);
1184 return attr.Preemptible();
1185 }
1186
1187 // Preemptible(rName)
1188 TEMP bool THIS::Preemptible(const std::string& rName) const {
1189 EventAttr attr=BASE::EventAttribute(rName);
1190 return attr.Preemptible();
1191 }
1192
1193 // InsPreemptibleEvent(index)
1194 TEMP void THIS::InsPreemptibleEvent(Idx index) {
1195 FD_DG("TcGenerator(" << this << ")::InsPreemptibleEvent(" << index << ")");
1196 EventAttr attr;
1197 attr.SetPreemptible();
1198 BASE::InsEvent(index,attr);
1199 }
1200
1201 // InsPreemptibleEvent(rName)
1202 TEMP Idx THIS::InsPreemptibleEvent(const std::string& rName) {
1203 FD_DG("TcGenerator(" << this << ")::InsPreemptibleEvent(" << rName << ")");
1204 EventAttr attr;
1205 attr.SetPreemptible();
1206 return BASE::InsEvent(rName,attr);
1207 }
1208
1209 // InsUnpreemptibleEvent(index)
1210 TEMP void THIS::InsUnpreemptibleEvent(Idx index) {
1211 FD_DG("TcGenerator(" << this << ")::InsUnpreemptibleEvent(" << index << ")");
1212 EventAttr attr;
1213 attr.ClrPreemptible();
1214 BASE::InsEvent(index,attr);
1215 }
1216
1217 // InsUnpreemptibleEvent(rName)
1218 TEMP Idx THIS::InsUnpreemptibleEvent(const std::string& rName) {
1219 FD_DG("TcGenerator(" << this << ")::InsUnpreemptibleEvent(" << rName << ")");
1220 EventAttr attr;
1221 attr.ClrPreemptible();
1222 return BASE::InsEvent(rName,attr);
1223 }
1224
1225 // SetPreemptible(index)
1226 TEMP void THIS::SetPreemptible(Idx index) {
1227 FD_DG("TcGenerator(" << this << ")::SetPreemptible(" << index << ")");
1228 EventAttr attr=BASE::EventAttribute(index);
1229 attr.SetPreemptible();
1230 BASE::pAlphabet->Attribute(index,attr);
1231 }
1232
1233 // SetPreemptible(rName)
1234 TEMP void THIS::SetPreemptible(const std::string& rName) {
1235 FD_DG("TcGenerator(" << this << ")::SetPreemptible(" << rName << ")");
1236 Idx index = BASE::EventIndex(rName);
1237 SetPreemptible(index);
1238 }
1239
1240 //SetPreemptible(rEvents)
1241 TEMP void THIS::SetPreemptible(const EventSet& rEvents) {
1242 FD_DG("TcGenerator(" << this << ")::SetPreemptible(rEvents)");
1243 EventSet::Iterator it;
1244 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1245 SetPreemptible(*it);
1246 }
1247 }
1248
1249 // ClrPreemptible(index)
1250 TEMP void THIS::ClrPreemptible(Idx index) {
1251 FD_DG("TcGenerator(" << this << ")::ClrPreemptible(" << index << ")");
1252 EventAttr attr=BASE::EventAttribute(index);
1253 attr.ClrPreemptible();
1254 BASE::pAlphabet->Attribute(index,attr);
1255 }
1256
1257 // ClrPreemptible(rName)
1258 TEMP void THIS::ClrPreemptible(const std::string& rName) {
1259 FD_DG("TcGenerator(" << this << ")::ClrPreemptible(" << rName << ")");
1260 Idx index = BASE::EventIndex(rName);
1261 ClrPreemptible(index);
1262 }
1263
1264 //ClrPreemptible(rEvents)
1265 TEMP void THIS::ClrPreemptible(const EventSet& rEvents) {
1266 FD_DG("TcGenerator(" << this << ")::ClrPreemptible(rEvents)");
1267 EventSet::Iterator it;
1268 for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1269 ClrPreemptible(*it);
1270 }
1271 }
1272
1273 //PreemptibleEvents()
1274 TEMP EventSet THIS::PreemptibleEvents(void) const {
1275 FD_DG("TcGenerator(" << this << ")::PreemptibleEvents()");
1276 EventSet res;
1277 EventSet::Iterator it;
1278 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1279 if(Preemptible(*it)) res.Insert(*it);
1280 }
1281 return res;
1282 }
1283
1284 //UnpreemptibleEvents()
1285 TEMP
1286 EventSet THIS::UnpreemptibleEvents(void) const {
1287 FD_DG("TcGenerator(" << this << ")::UnpreemptibleEvents()");
1288 EventSet res;
1289 EventSet::Iterator it;
1290 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1291 if(!Preemptible(*it)) res.Insert(*it);
1292 }
1293 return res;
1294 }
1295
1296
1297
1298
1299#undef TEMP
1300#undef BASE
1301#undef THIS
1302
1303// MSVC will remove registrars if we dont use them somehere else
1304// So we do so in cfl_generator.cpp
1309
1310
1311} // namespace faudes
1312
1313#endif
1314
#define TEMP
#define BASE
#define THIS
#define FD_DG(message)
#define FAUDES_API
#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
TcGenerator< AttributeVoid, AttributeVoid, AttributeCFlags, AttributeVoid > cGenerator
TBaseVector< Alphabet > AlphabetVector
AutoRegisterType< SystemVector > gRtiSystemVector("SystemVector")
AutoRegisterType< Alphabet > gRtiAlphabet("Alphabet")
AutoRegisterType< AlphabetVector > gRtiAlphabetVector("AlphabetVector")
AutoRegisterType< System > gRtiSystem("System")
TBaseVector< cGenerator > cGeneratorVector
TaNameSet< AttributeCFlags > cEventSet
TBaseVector< cEventSet > cEventSetVector

libFAUDES 2.34g --- 2026.04.09 --- c++ api documentaion by doxygen