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

libFAUDES 2.28a --- 2016.09.13 --- c++ api documentaion by doxygen