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  */
65 
66  /** Destructor */
67  virtual ~AttributeCFlags(void) {};
68 
69  /**
70  * Set controllable flag
71  */
73 
74  /**
75  * Clear controllable flag
76  */
77 
79 
80  /**
81  * Query controllablility
82  */
83  bool Controllable(void) const {return ( (mFlags & mControllableFlag) != 0 ); }
84 
85 
86  /**
87  * Set observable flag
88  */
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  */
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  virtual 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
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 copy )
343  * Note: you must reimplement this operator in derived
344  * classes in order to handle internal pointers correctly
345  *
346  * @param rOtherGen
347  * Other generator
348  */
349  virtual TcGenerator& operator= (const TcGenerator& rOtherGen) { this->Assign(rOtherGen); return *this;};
350 
351  /**
352  * Assignment operator (uses copy )
353  *
354  * @param rOtherGen
355  * Other generator
356  */
357  virtual TcGenerator& operator= (const vGenerator& rOtherGen) {this->Assign(rOtherGen); return *this;};
358 
359  /**
360  * Add an existing controllable event to generator.
361  * An entry in the global eventtable will be made.
362  *
363  * @param index
364  * Event index
365  */
366  void InsControllableEvent(Idx index);
367 
368  /**
369  * Add new named controllable event to generator.
370  * An entry in the global eventtable will be made if event is new.
371  *
372  * @param rName
373  * Name of the event to add
374  *
375  * @return
376  * New global unique index
377  */
378  Idx InsControllableEvent(const std::string& rName);
379 
380  /**
381  * Add an existing uncontrollable event to generator.
382  * An entry in the global eventtable will be made.
383  *
384  * @param index
385  * Event index
386  */
387  void InsUncontrollableEvent(Idx index);
388 
389  /**
390  * Add new named uncontrollable event to generator.
391  * An entry in the global eventtable will be made if event is new.
392  *
393  * @param rName
394  * Name of the event to add
395  *
396  * @return
397  * New global unique index
398  */
399  Idx InsUncontrollableEvent(const std::string& rName);
400 
401  /**
402  * Mark event controllable (by index)
403  *
404  * @param index
405  * Event index
406  */
407  void SetControllable(Idx index);
408 
409  /**
410  * Mark event controllable (by name)
411  *
412  * @param rName
413  * Event name
414  */
415  void SetControllable(const std::string& rName);
416 
417  /**
418  * Mark set of events controllable (by index)
419  *
420  * @param rEvents
421  * EventSet
422  */
423  void SetControllable(const EventSet& rEvents);
424 
425  /**
426  * Mark event uncontrollable (by index)
427  *
428  * @param index
429  * Event index
430  */
431  void ClrControllable(Idx index);
432 
433  /**
434  * Mark event uncontrollable (by name)
435  *
436  * @param rName
437  * Event name
438  */
439  void ClrControllable(const std::string& rName);
440 
441  /**
442  * Mark set of events uncontrollable (by index)
443  *
444  * @param rEvents
445  * EventSet
446  */
447  void ClrControllable(const EventSet& rEvents);
448 
449  /**
450  * Is event controllable (by index)
451  *
452  * @param index
453  * Event index
454  *
455  * @return
456  * True / false
457  */
458  bool Controllable(Idx index) const;
459 
460  /**
461  * Is event controllable (by name)
462  *
463  * @param rName
464  * Event name
465  *
466  * @return
467  * True / false
468  */
469  bool Controllable(const std::string& rName) const;
470 
471  /**
472  * Get EventSet with controllable events
473  *
474  * @return
475  * EventSet of controllable events
476  */
477  EventSet ControllableEvents(void) const;
478 
479  /**
480  * Get EventSet with uncontrollable events
481  *
482  * @return
483  * EventSet of uncontrollable events
484  */
485  EventSet UncontrollableEvents(void) const;
486 
487  /**
488  * Add an existing observable event to generator.
489  * An entry in the global eventtable will be made.
490  *
491  * @param index
492  * Event index
493  */
494  void InsObservableEvent(Idx index);
495 
496  /**
497  * Add new named observable event to generator.
498  * An entry in the global eventtable will be made if event is new.
499  *
500  * @param rName
501  * Name of the event to add
502  *
503  * @return
504  * New global unique index
505  */
506  Idx InsObservableEvent(const std::string& rName);
507 
508  /**
509  * Add an existing unobservable event to generator.
510  * An entry in the global eventtable will be made.
511  *
512  * @param index
513  * Event index
514  */
515  void InsUnobservableEvent(Idx index);
516 
517  /**
518  * Add new named unobservable event to generator.
519  * An entry in the global eventtable will be made if event is new.
520  *
521  * @param rName
522  * Name of the event to add
523  *
524  * @return
525  * New global unique index
526  */
527  Idx InsUnobservableEvent(const std::string& rName);
528 
529  /**
530  * Mark event observable (by index)
531  *
532  * @param index
533  * Event index
534  */
535  void SetObservable(Idx index);
536 
537  /**
538  * Mark event observable (by name)
539  *
540  * @param rName
541  * Event name
542  */
543  void SetObservable(const std::string& rName);
544 
545  /**
546  * Mark set of events observable
547  *
548  * @param rEvents
549  * EventSet
550  */
551  void SetObservable(const EventSet& rEvents);
552 
553  /**
554  * Mark event unobservable (by index)
555  *
556  * @param index
557  * Event index
558  */
559  void ClrObservable(Idx index);
560 
561  /**
562  * Mark event unobservable (by name)
563  *
564  * @param rName
565  * Event name
566  */
567  void ClrObservable(const std::string& rName);
568 
569  /**
570  * Mark set of events unobservable
571  *
572  * @param rEvents
573  * EventSet
574  */
575  void ClrObservable(const EventSet& rEvents);
576 
577  /**
578  * Is event observable (by index)
579  *
580  * @param index
581  * Event index
582  *
583  * @return
584  * True / false
585  */
586  bool Observable(Idx index) const;
587 
588  /**
589  * Is event observable (by name)
590  *
591  * @param rName
592  * Event name
593  *
594  * @return
595  * True / false
596  */
597  bool Observable(const std::string& rName) const;
598 
599  /**
600  * Get EventSet with observable events
601  *
602  * @return
603  * EventSet of controllable events
604  */
605  EventSet ObservableEvents(void) const;
606 
607  /**
608  * Get EventSet with unobservable events
609  *
610  * @return
611  * EventSet of uncontrollable events
612  */
613  EventSet UnobservableEvents(void) const;
614 
615  /**
616  * Add an existing forcible event to generator.
617  * An entry in the global eventtable will be made.
618  *
619  * @param index
620  * Event index
621  */
622  void InsForcibleEvent(Idx index);
623 
624  /**
625  * Add new named forcible event to generator.
626  * An entry in the global eventtable will be made if event is new.
627  *
628  * @param rName
629  * Name of the event to add
630  *
631  * @return
632  * New global unique index
633  */
634  Idx InsForcibleEvent(const std::string& rName);
635 
636  /**
637  * Add an existing unforcible event to generator.
638  * An entry in the global eventtable will be made.
639  *
640  * @param index
641  * Event index
642  */
643  void InsUnforcibleEvent(Idx index);
644 
645  /**
646  * Add new named unforcible event to generator.
647  * An entry in the global eventtable will be made if event is new.
648  *
649  * @param rName
650  * Name of the event to add
651  *
652  * @return
653  * New global unique index
654  */
655  Idx InsUnforcibleEvent(const std::string& rName);
656 
657  /**
658  * Mark event forcible (by index)
659  *
660  * @param index
661  * Event index
662  */
663  void SetForcible(Idx index);
664 
665  /**
666  * Mark event forcible (by name)
667  *
668  * @param rName
669  * Event name
670  */
671  void SetForcible(const std::string& rName);
672 
673  /**
674  * Mark set of events forcible
675  *
676  * @param rEvents
677  * EventSet
678  */
679  void SetForcible(const EventSet& rEvents);
680 
681  /**
682  * Mark event unforcible (by index)
683  *
684  * @param index
685  * Event index
686  */
687  void ClrForcible(Idx index);
688 
689  /**
690  * Mark event unforcible (by name)
691  *
692  * @param rName
693  * Event name
694  */
695  void ClrForcible(const std::string& rName);
696 
697  /**
698  * Mark set of events unforcible
699  *
700  * @param rEvents
701  * EventSet
702  */
703  void ClrForcible(const EventSet& rEvents);
704 
705  /**
706  * Is event forcible (by index)
707  *
708  * @param index
709  * Event index
710  *
711  * @return
712  * True / false
713  */
714  bool Forcible(Idx index) const;
715 
716  /**
717  * Is event forcible (by name)
718  *
719  * @param rName
720  * Event name
721  *
722  * @return
723  * True / false
724  */
725  bool Forcible(const std::string& rName) const;
726 
727  /**
728  * Get EventSet with forcible events
729  *
730  * @return
731  * EventSet of controllable events
732  */
733  EventSet ForcibleEvents(void) const;
734 
735  /**
736  * Get EventSet with unforcible events
737  *
738  * @return
739  * EventSet of uncontrollable events
740  */
741  EventSet UnforcibleEvents(void) const;
742 
743  /**
744  * Add an existing abstraction event to generator.
745  * An entry in the global eventtable will be made.
746  *
747  * @param index
748  * Event index
749  */
750  void InsHighlevelEvent(Idx index);
751 
752  /**
753  * Add new named abstraction event to generator.
754  * An entry in the global eventtable will be made if event is new.
755  *
756  * @param rName
757  * Name of the event to add
758  *
759  * @return
760  * New global unique index
761  */
762  Idx InsHighlevelEvent(const std::string& rName);
763 
764  /**
765  * Add an existing low-level event to generator.
766  * An entry in the global eventtable will be made.
767  *
768  * @param index
769  * Event index
770  */
771  void InsLowlevelEvent(Idx index);
772 
773  /**
774  * Add new named low-level event to generator.
775  * An entry in the global eventtable will be made if event is new.
776  *
777  * @param rName
778  * Name of the event to add
779  *
780  * @return
781  * New global unique index
782  */
783  Idx InsLowlevelEvent(const std::string& rName);
784 
785  /**
786  * Mark event as highlevel event (by index)
787  *
788  * @param index
789  * Event index
790  */
791  void SetHighlevel(Idx index);
792 
793  /**
794  * Mark event as highlevel event (by name)
795  *
796  * @param rName
797  * Event name
798  */
799  void SetHighlevel(const std::string& rName);
800 
801  /**
802  * Mark set of events as high-level events
803  *
804  * @param rEvents
805  * EventSet
806  */
807  void SetHighlevel(const EventSet& rEvents);
808 
809  /**
810  * Mark event as low-level event (by index)
811  *
812  * @param index
813  * Event index
814  */
815  void SetLowlevel(Idx index);
816 
817  /**
818  * Mark event as low-level event (by name)
819  *
820  * @param rName
821  * Event name
822  */
823  void SetLowlevel(const std::string& rName);
824 
825  /**
826  * Mark set of events as low-level events.
827  *
828  * @param rEvents
829  * EventSet
830  */
831  void SetLowlevel(const EventSet& rEvents);
832 
833  /**
834  * Test for high-level event (by index)
835  *
836  * @param index
837  * Event index
838  *
839  * @return
840  * True / false
841  */
842  bool Highlevel(Idx index) const;
843 
844  /**
845  * Test for high-level event (by name)
846  *
847  * @param rName
848  * Event name
849  *
850  * @return
851  * True / false
852  */
853  bool Highlevel(const std::string& rName) const;
854 
855  /**
856  * Test for low-level event (by index)
857  *
858  * @param index
859  * Event index
860  *
861  * @return
862  * True / false
863  */
864  bool Lowlevel(Idx index) const;
865 
866  /**
867  * Test for low-level event (by name)
868  *
869  * @param rName
870  * Event name
871  *
872  * @return
873  * True / false
874  */
875  bool Lowlevel(const std::string& rName) const;
876 
877  /**
878  * Get EventSet of all high-level events
879  *
880  * @return
881  * EventSet of high-level events
882  */
883  EventSet HighlevelEvents(void) const;
884 
885  /**
886  * Get EventSet of all low-level events
887  *
888  * @return
889  * EventSet of low-level events
890  */
891  EventSet LowlevelEvents(void) const;
892 
893 
894  private:
895 
896  protected:
897 
898 }; // end class TcGenerator
899 
900 
901 /**
902  * Convenience typedef for std System.
903  *
904  * @ingroup GeneratorClasses
905  */
907 
908 /**
909  * Convenience typedef for vectors of systems
910  * \ingroup GeneratorClasses
911  */
913 
914 /** Compatibility: pre 2.20b used cGenerator as C++ class name*/
915 #ifdef FAUDES_COMPATIBILITY
918 #endif
919 
920 
921 
922 /*
923 ***************************************************************************
924 ***************************************************************************
925 ***************************************************************************
926 
927 Implementation cgenerator
928 
929 ***************************************************************************
930 ***************************************************************************
931 ***************************************************************************
932 */
933 
934 /* convenience access to relevant scopes */
935 #define THIS TcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
936 #define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
937 #define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
938 
939 
940 // TcGenerator(void)
941 TEMP THIS::TcGenerator(void) : BASE() {
942  FD_DG("TcGenerator(" << this << ")::TcGenerator()");
943 }
944 
945 // TcGenerator(rOtherGen)
946 TEMP THIS::TcGenerator(const TcGenerator& rOtherGen) : BASE(rOtherGen) {
947  FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
948 }
949 
950 // TcGenerator(rOtherGen)
951 TEMP THIS::TcGenerator(const vGenerator& rOtherGen) : BASE(rOtherGen) {
952  FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
953 }
954 
955 // TcGenerator(rFilename)
956 TEMP THIS::TcGenerator(const std::string& rFileName) : BASE(rFileName) {
957  FD_DG("TcGenerator(" << this << ")::TcGenerator(rFilename) : done");
958 }
959 
960 
961 // New
962 TEMP THIS* THIS::New(void) const {
963  // allocate
964  THIS* res = new THIS;
965  // fix base data
966  res->EventSymbolTablep(BASE::mpEventSymbolTable);
967  res->mStateNamesEnabled=BASE::mStateNamesEnabled;
968  res->mReindexOnWrite=BASE::mReindexOnWrite;
969  return res;
970 }
971 
972 // Copy
973 TEMP THIS* THIS::Copy(void) const {
974  // allocate
975  THIS* res = new THIS(*this);
976  // done
977  return res;
978 }
979 
980 // NewCGen
981 TEMP THIS THIS::NewCGen(void) const {
982  // call base (fixes by assignment constructor)
983  THIS res= BASE::NewAGen();
984  return res;
985 }
986 
987 
988 // CAST
989 //TEMP const Type* THIS::Cast(const Type* pOther) const {
990 // return dynamic_cast< const THIS* > (pOther);
991 //}
992 
993 
994 
995  // Controllable(index)
996  TEMP bool THIS::Controllable(Idx index) const {
997  EventAttr attr=BASE::EventAttribute(index);
998  return attr.Controllable();
999  }
1000 
1001  // Controllable(rName)
1002  TEMP bool THIS::Controllable(const std::string& rName) const {
1003  EventAttr attr=BASE::EventAttribute(rName);
1004  return attr.Controllable();
1005  }
1006 
1007  // InsControllableEvent(index)
1008  TEMP void THIS::InsControllableEvent(Idx index) {
1009  FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << index << ")");
1010  EventAttr attr;
1011  attr.SetControllable();
1012  BASE::InsEvent(index,attr);
1013  }
1014 
1015  // InsControllableEvent(rName)
1016  TEMP Idx THIS::InsControllableEvent(const std::string& rName) {
1017  FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << rName << ")");
1018  EventAttr attr;
1019  attr.SetControllable();
1020  return BASE::InsEvent(rName,attr);
1021  }
1022 
1023  // InsUncontrollableEvent(index)
1024  TEMP void THIS::InsUncontrollableEvent(Idx index) {
1025  FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << index << ")");
1026  EventAttr attr;
1027  attr.ClrControllable();
1028  BASE::InsEvent(index,attr);
1029  }
1030 
1031  // InsUncontrollableEvent(rName)
1032  TEMP Idx THIS::InsUncontrollableEvent(const std::string& rName) {
1033  FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << rName << ")");
1034  EventAttr attr;
1035  attr.ClrControllable();
1036  return BASE::InsEvent(rName,attr);
1037  }
1038 
1039  // SetControllable(index)
1040  TEMP void THIS::SetControllable(Idx index) {
1041  FD_DG("TcGenerator(" << this << ")::SetControllable(" << index << ")");
1042  EventAttr attr=BASE::EventAttribute(index);
1043  attr.SetControllable();
1044  BASE::pAlphabet->Attribute(index,attr);
1045  }
1046 
1047  // SetControllable(rName)
1048  TEMP void THIS::SetControllable(const std::string& rName) {
1049  FD_DG("TcGenerator(" << this << ")::SetControllable(" << rName << ")");
1050  Idx index = BASE::EventIndex(rName);
1051  SetControllable(index);
1052  }
1053 
1054  //SetControllable(rEvents)
1055  TEMP void THIS::SetControllable(const EventSet& rEvents) {
1056  FD_DG("TcGenerator(" << this << ")::SetControllable(rEvents)");
1057  EventSet::Iterator it;
1058  for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1059  SetControllable(*it);
1060  }
1061  }
1062 
1063  // ClrControllable(index)
1064  TEMP void THIS::ClrControllable(Idx index) {
1065  FD_DG("TcGenerator(" << this << ")::ClrControllable(" << index << ")");
1066  EventAttr attr=BASE::EventAttribute(index);
1067  attr.ClrControllable();
1068  BASE::pAlphabet->Attribute(index,attr);
1069  }
1070 
1071  // ClrControllable(rName)
1072  TEMP void THIS::ClrControllable(const std::string& rName) {
1073  FD_DG("TcGenerator(" << this << ")::ClrControllable(" << rName << ")");
1074  Idx index = BASE::EventIndex(rName);
1075  ClrControllable(index);
1076  }
1077 
1078  //ClrControllable(rEvents)
1079  TEMP void THIS::ClrControllable(const EventSet& rEvents) {
1080  FD_DG("TcGenerator(" << this << ")::ClrControllable(rEvents)");
1081  EventSet::Iterator it;
1082  for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1083  ClrControllable(*it);
1084  }
1085  }
1086 
1087  //ControllableEvents()
1088  TEMP EventSet THIS::ControllableEvents(void) const {
1089  FD_DG("TcGenerator(" << this << ")::ControllableEvents()");
1090  EventSet res;
1091  EventSet::Iterator it;
1092  for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1093  if(Controllable(*it)) res.Insert(*it);
1094  }
1095  return res;
1096  }
1097 
1098  //UncontrollableEvents()
1099  TEMP
1100  EventSet THIS::UncontrollableEvents(void) const {
1101  FD_DG("TcGenerator(" << this << ")::UncontrollableEvents()");
1102  EventSet res;
1103  EventSet::Iterator it;
1104  for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1105  if(!Controllable(*it)) res.Insert(*it);
1106  }
1107  return res;
1108  }
1109 
1110  // Observable(index)
1111  TEMP bool THIS::Observable(Idx index) const {
1112  EventAttr attr=BASE::EventAttribute(index);
1113  return attr.Observable();
1114  }
1115 
1116  // Observable(rName)
1117  TEMP bool THIS::Observable(const std::string& rName) const {
1118  EventAttr attr=BASE::EventAttribute(rName);
1119  return attr.Observable();
1120  }
1121 
1122  // InsObservableEvent(index)
1123  TEMP void THIS::InsObservableEvent(Idx index) {
1124  FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << index << ")");
1125  EventAttr attr;
1126  attr.SetObservable();
1127  BASE::InsEvent(index,attr);
1128  }
1129 
1130  // InsObservableEvent(rName)
1131  TEMP Idx THIS::InsObservableEvent(const std::string& rName) {
1132  FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << rName << ")");
1133  EventAttr attr;
1134  attr.SetObservable();
1135  return BASE::InsEvent(rName,attr);
1136  }
1137 
1138  // InsUnobservableEvent(index)
1139  TEMP void THIS::InsUnobservableEvent(Idx index) {
1140  FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << index << ")");
1141  EventAttr attr;
1142  attr.ClrObservable();
1143  BASE::InsEvent(index,attr);
1144  }
1145 
1146  // InsUnobservableEvent(rName)
1147  TEMP Idx THIS::InsUnobservableEvent(const std::string& rName) {
1148  FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << rName << ")");
1149  EventAttr attr;
1150  attr.ClrObservable();
1151  return BASE::InsEvent(rName,attr);
1152  }
1153 
1154  // SetObservable(index)
1155  TEMP void THIS::SetObservable(Idx index) {
1156  FD_DG("TcGenerator(" << this << ")::SetObservable(" << index << ")");
1157  EventAttr attr=BASE::EventAttribute(index);
1158  attr.SetObservable();
1159  BASE::pAlphabet->Attribute(index,attr);
1160  }
1161 
1162  // SetObservable(rName)
1163  TEMP void THIS::SetObservable(const std::string& rName) {
1164  FD_DG("TcGenerator(" << this << ")::SetObservable(" << rName << ")");
1165  Idx index = BASE::EventIndex(rName);
1166  SetObservable(index);
1167  }
1168 
1169  //SetObservable(rEvents)
1170  TEMP void THIS::SetObservable(const EventSet& rEvents) {
1171  FD_DG("TcGenerator(" << this << ")::SetObservable(rEvents)");
1172  EventSet::Iterator it;
1173  for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1174  SetObservable(*it);
1175  }
1176  }
1177 
1178  // ClrObservable(index)
1179  TEMP void THIS::ClrObservable(Idx index) {
1180  FD_DG("TcGenerator(" << this << ")::ClrObservable(" << index << ")");
1181  EventAttr attr=BASE::EventAttribute(index);
1182  attr.ClrObservable();
1183  BASE::pAlphabet->Attribute(index,attr);
1184  }
1185 
1186  // ClrObservable(rName)
1187  TEMP void THIS::ClrObservable(const std::string& rName) {
1188  FD_DG("TcGenerator(" << this << ")::ClrObservable(" << rName << ")");
1189  Idx index = BASE::EventIndex(rName);
1190  ClrObservable(index);
1191  }
1192 
1193  //ClrObservable(rEvents)
1194  TEMP void THIS::ClrObservable(const EventSet& rEvents) {
1195  FD_DG("TcGenerator(" << this << ")::ClrObservable(rEvents)");
1196  EventSet::Iterator it;
1197  for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1198  ClrObservable(*it);
1199  }
1200  }
1201 
1202  //ObservableEvents()
1203  TEMP EventSet THIS::ObservableEvents(void) const {
1204  FD_DG("TcGenerator(" << this << ")::ObservableEvents()");
1205  EventSet res;
1206  EventSet::Iterator it;
1207  for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1208  if(Observable(*it)) res.Insert(*it);
1209  }
1210  return res;
1211  }
1212 
1213  //UnobservableEvents()
1214  TEMP
1215  EventSet THIS::UnobservableEvents(void) const {
1216  FD_DG("TcGenerator(" << this << ")::UnobservableEvents()");
1217  EventSet res;
1218  EventSet::Iterator it;
1219  for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1220  if(!Observable(*it)) res.Insert(*it);
1221  }
1222  return res;
1223  }
1224 
1225 
1226  //Forcible(index)
1227  TEMP bool THIS::Forcible(Idx index) const {
1228  EventAttr attr=BASE::EventAttribute(index);
1229  return attr.Forcible();
1230  }
1231 
1232  // Forcible(rName)
1233  TEMP bool THIS::Forcible(const std::string& rName) const {
1234  EventAttr attr=BASE::EventAttribute(rName);
1235  return attr.Forcible();
1236  }
1237 
1238  // InsForcibleEvent(index)
1239  TEMP void THIS::InsForcibleEvent(Idx index) {
1240  FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << index << ")");
1241  EventAttr attr;
1242  attr.SetForcible();
1243  BASE::InsEvent(index,attr);
1244  }
1245 
1246  // InsForcibleEvent(rName)
1247  TEMP Idx THIS::InsForcibleEvent(const std::string& rName) {
1248  FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << rName << ")");
1249  EventAttr attr;
1250  attr.SetForcible();
1251  return BASE::InsEvent(rName,attr);
1252  }
1253 
1254  // InsUnforcibleEvent(index)
1255  TEMP void THIS::InsUnforcibleEvent(Idx index) {
1256  FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << index << ")");
1257  EventAttr attr;
1258  attr.ClrForcible();
1259  BASE::InsEvent(index,attr);
1260  }
1261 
1262  // InsUnforcibleEvent(rName)
1263  TEMP Idx THIS::InsUnforcibleEvent(const std::string& rName) {
1264  FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << rName << ")");
1265  EventAttr attr;
1266  attr.ClrForcible();
1267  return BASE::InsEvent(rName,attr);
1268  }
1269 
1270  // SetForcible(index)
1271  TEMP void THIS::SetForcible(Idx index) {
1272  FD_DG("TcGenerator(" << this << ")::SetForcible(" << index << ")");
1273  EventAttr attr=BASE::EventAttribute(index);
1274  attr.SetForcible();
1275  BASE::pAlphabet->Attribute(index,attr);
1276  }
1277 
1278  // SetForcible(rName)
1279  TEMP void THIS::SetForcible(const std::string& rName) {
1280  FD_DG("TcGenerator(" << this << ")::SetForcible(" << rName << ")");
1281  Idx index = BASE::EventIndex(rName);
1282  SetForcible(index);
1283  }
1284 
1285  //SetForcible(rEvents)
1286  TEMP void THIS::SetForcible(const EventSet& rEvents) {
1287  FD_DG("TcGenerator(" << this << ")::SetForcible(rEvents)");
1288  EventSet::Iterator it;
1289  for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1290  SetForcible(*it);
1291  }
1292  }
1293 
1294  // ClrForcible(index)
1295  TEMP void THIS::ClrForcible(Idx index) {
1296  FD_DG("TcGenerator(" << this << ")::ClrForcible(" << index << ")");
1297  EventAttr attr=BASE::EventAttribute(index);
1298  attr.ClrForcible();
1299  BASE::pAlphabet->Attribute(index,attr);
1300  }
1301 
1302  // ClrForcible(rName)
1303  TEMP void THIS::ClrForcible(const std::string& rName) {
1304  FD_DG("TcGenerator(" << this << ")::ClrForcible(" << rName << ")");
1305  Idx index = BASE::EventIndex(rName);
1306  ClrForcible(index);
1307  }
1308 
1309  //ClrForcible(rEvents)
1310  TEMP void THIS::ClrForcible(const EventSet& rEvents) {
1311  FD_DG("TcGenerator(" << this << ")::ClrForcible(rEvents)");
1312  EventSet::Iterator it;
1313  for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1314  ClrForcible(*it);
1315  }
1316  }
1317 
1318  //ForcibleEvents()
1319  TEMP EventSet THIS::ForcibleEvents(void) const {
1320  FD_DG("TcGenerator(" << this << ")::ForcibleEvents()");
1321  EventSet res;
1322  EventSet::Iterator it;
1323  for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1324  if(Forcible(*it)) res.Insert(*it);
1325  }
1326  return res;
1327  }
1328 
1329  //UnforcibleEvents()
1330  TEMP
1331  EventSet THIS::UnforcibleEvents(void) const {
1332  FD_DG("TcGenerator(" << this << ")::UnforcibleEvents()");
1333  EventSet res;
1334  EventSet::Iterator it;
1335  for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1336  if(!Forcible(*it)) res.Insert(*it);
1337  }
1338  return res;
1339  }
1340 
1341 
1342  //Highlevel(index)
1343  TEMP bool THIS::Highlevel(Idx index) const {
1344  EventAttr attr=BASE::EventAttribute(index);
1345  return attr.Highlevel();
1346  }
1347 
1348  // Highlevel(rName)
1349  TEMP bool THIS::Highlevel(const std::string& rName) const {
1350  EventAttr attr=BASE::EventAttribute(rName);
1351  return attr.Highlevel();
1352  }
1353 
1354  //Lowlevel(index)
1355  TEMP bool THIS::Lowlevel(Idx index) const {
1356  EventAttr attr=BASE::EventAttribute(index);
1357  return attr.Lowlevel();
1358  }
1359 
1360  // Lowlevel(rName)
1361  TEMP bool THIS::Lowlevel(const std::string& rName) const {
1362  EventAttr attr=BASE::EventAttribute(rName);
1363  return attr.Lowlevel();
1364  }
1365 
1366  // InsHighlevelEvent(index)
1367  TEMP void THIS::InsHighlevelEvent(Idx index) {
1368  FD_DG("TcGenerator(" << this << ")::InsHighlevelEvent(" << index << ")");
1369  EventAttr attr;
1370  attr.SetHighlevel();
1371  BASE::InsEvent(index,attr);
1372  }
1373 
1374  // InsHighlevelEvent(rName)
1375  TEMP Idx THIS::InsHighlevelEvent(const std::string& rName) {
1376  FD_DG("TcGenerator(" << this << ")::InsHighlevelEvent(" << rName << ")");
1377  EventAttr attr;
1378  attr.SetHighlevel();
1379  return BASE::InsEvent(rName,attr);
1380  }
1381 
1382  // InsLowlevelEvent(index)
1383  TEMP void THIS::InsLowlevelEvent(Idx index) {
1384  FD_DG("TcGenerator(" << this << ")::InsLowlevelEvent(" << index << ")");
1385  EventAttr attr;
1386  attr.SetLowlevel();
1387  BASE::InsEvent(index,attr);
1388  }
1389 
1390  // InsLowlevelEvent(rName)
1391  TEMP Idx THIS::InsLowlevelEvent(const std::string& rName) {
1392  FD_DG("TcGenerator(" << this << ")::InsLowlevelEvent(" << rName << ")");
1393  EventAttr attr;
1394  attr.SetLowlevel();
1395  return BASE::InsEvent(rName,attr);
1396  }
1397 
1398  // SetHighlevel(index)
1399  TEMP void THIS::SetHighlevel(Idx index) {
1400  FD_DG("TcGenerator(" << this << ")::SetHighlevel(" << index << ")");
1401  EventAttr attr=BASE::EventAttribute(index);
1402  attr.SetHighlevel();
1403  BASE::pAlphabet->Attribute(index,attr);
1404  }
1405 
1406  // SetHighlevel(rName)
1407  TEMP void THIS::SetHighlevel(const std::string& rName) {
1408  FD_DG("TcGenerator(" << this << ")::SetHighlevel(" << rName << ")");
1409  Idx index = BASE::EventIndex(rName);
1410  SetHighlevel(index);
1411  }
1412 
1413  //SetHighlevel(rEvents)
1414  TEMP void THIS::SetHighlevel(const EventSet& rEvents) {
1415  FD_DG("TcGenerator(" << this << ")::SetHighlevel(rEvents)");
1416  EventSet::Iterator it;
1417  for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1418  SetHighlevel(*it);
1419  }
1420  }
1421 
1422  // SetLowlevel(index)
1423  TEMP void THIS::SetLowlevel(Idx index) {
1424  FD_DG("TcGenerator(" << this << ")::SetLowlevel(" << index << ")");
1425  EventAttr attr=BASE::EventAttribute(index);
1426  attr.SetLowlevel();
1427  BASE::pAlphabet->Attribute(index,attr);
1428  }
1429 
1430  // SetLowlevel(rName)
1431  TEMP void THIS::SetLowlevel(const std::string& rName) {
1432  FD_DG("TcGenerator(" << this << ")::SetLowlevel(" << rName << ")");
1433  Idx index = BASE::EventIndex(rName);
1434  SetLowlevel(index);
1435  }
1436 
1437  //SetLowlevel(rEvents)
1438  TEMP void THIS::SetLowlevel(const EventSet& rEvents) {
1439  FD_DG("TcGenerator(" << this << ")::SetLowlevel(rEvents)");
1440  EventSet::Iterator it;
1441  for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
1442  SetLowlevel(*it);
1443  }
1444  }
1445 
1446  //HighlevelEvents()
1447  TEMP EventSet THIS::HighlevelEvents(void) const {
1448  FD_DG("TcGenerator(" << this << ")::HighlevelEvents()");
1449  EventSet res;
1450  EventSet::Iterator it;
1451  for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1452  if(Highlevel(*it)) res.Insert(*it);
1453  }
1454  return res;
1455  }
1456 
1457  //LowlevelEvents()
1458  TEMP
1459  EventSet THIS::LowlevelEvents(void) const {
1460  FD_DG("TcGenerator(" << this << ")::LowlevelEvents()");
1461  EventSet res;
1462  EventSet::Iterator it;
1463  for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1464  if(Lowlevel(*it)) res.Insert(*it);
1465  }
1466  return res;
1467  }
1468 
1469 
1470 
1471 #undef TEMP
1472 #undef BASE
1473 #undef THIS
1474 
1475 
1476 } // namespace faudes
1477 
1478 #endif
1479 

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