libFAUDES

Sections

Index

cfl_cgenerator.h

Go to the documentation of this file.
00001 /** @file cfl_cgenerator.h Classes TcGenerator, cGenerator and AttributeCFlags */
00002 
00003 /* FAU Discrete Event Systems Library (libfaudes)
00004 
00005 Copyright (C) 2006  Bernd Opitz
00006 Copyright (C) 2007  Thomas Moor
00007 Exclusive copyright is granted to Klaus Schmidt
00008 
00009 This library is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU Lesser General Public
00011 License as published by the Free Software Foundation; either
00012 version 2.1 of the License, or (at your option) any later version.
00013 
00014 This library is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public
00020 License along with this library; if not, write to the Free Software
00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00022 
00023 
00024 #ifndef FAUDES_CGENERATOR_H
00025 #define FAUDES_CGENERATOR_H
00026 
00027 #include "cfl_definitions.h"
00028 #include "cfl_agenerator.h"
00029 #include "cfl_parallel.h"
00030 #include "cfl_project.h"
00031 
00032 
00033 namespace faudes {
00034 
00035 
00036 /**
00037  * Attribute class to model event controllability properties.
00038  *
00039  * This attribute is meant to be an event attribute and can distinguish between
00040  * controllable, observable, forcible and abstraction events. It is based on faudes::AttributeFlags
00041  * and uses the lower four bits in the flag word to store the respective boolean values.
00042  * The AttributeCFlags class adds convenience functions to access these bits and a default-value 
00043  * that corresponds to observable and neiter controllable nor forcible.
00044  *
00045  * Presuming that only controllability flags are uses (different from default), the
00046  * token representation is by an Option String consisting of the initials <tt>c</tt>,<tt>o</tt>,<tt>f</tt> 
00047  * and <tt>a</tt>, where initials are capitatised for set flags and default values 
00048  * are not written; eg <tt>+C+</tt> 
00049  * for a controllable event that is observable (default),  not forcible (default) and  
00050  * an abstraction event (default).
00051  * If other than the four controllability bits are used, std. hex format is used.
00052  * 
00053  */
00054 
00055 
00056 class AttributeCFlags : public AttributeFlags {
00057 
00058 FAUDES_TYPE_DECLARATION(AttributeCFlags,AttributeFlags)
00059 
00060  public:
00061   /**
00062    * Default constructor 
00063    */
00064   AttributeCFlags(void) : AttributeFlags() { mFlags=mDefCFlags; };
00065 
00066   /** Destructor */
00067   virtual ~AttributeCFlags(void) {};
00068 
00069   /**
00070    * Set controllable flag 
00071    */
00072   void SetControllable(void) { mFlags |= mControllableFlag; }
00073 
00074   /**
00075    * Clear controllable flag 
00076    */
00077 
00078   void ClrControllable(void) { mFlags &= ~mControllableFlag; };
00079      
00080   /**
00081    * Query controllablility 
00082    */
00083   bool Controllable(void) const {return ( (mFlags & mControllableFlag) != 0 ); }
00084 
00085 
00086   /**
00087    * Set observable flag 
00088    */
00089   void SetObservable(void) { mFlags |= mObservableFlag; }
00090 
00091   /**
00092    * Clear observable flag 
00093    */
00094   void ClrObservable(void) { mFlags &= ~mObservableFlag; };
00095      
00096   /**
00097    * Query observablility 
00098    */
00099   bool Observable(void) const {return ( (mFlags & mObservableFlag) != 0 ); }
00100 
00101 
00102   /**
00103    * Set forcible flag 
00104    */
00105   void SetForcible(void) { mFlags |= mForcibleFlag; }
00106 
00107   /**
00108    * Clear forcible flag 
00109    */
00110 
00111   void ClrForcible(void) { mFlags &= ~mForcibleFlag; };
00112      
00113   /**
00114    * Query forcibility 
00115    */
00116   bool Forcible(void) const {return ( (mFlags & mForcibleFlag) != 0 ); }
00117 
00118 
00119   /**
00120    * Set abstraction flag 
00121    */
00122   void SetHighlevel(void) { mFlags |= mAbstractionFlag; }
00123 
00124   /**
00125    * Clear abstraction flag 
00126    */
00127   void SetLowlevel(void) { mFlags &= ~mAbstractionFlag; };
00128      
00129   /**
00130    * Query abstaction flag
00131    */
00132   bool Highlevel(void) const {return ( (mFlags & mAbstractionFlag) != 0 ); }
00133 
00134   /**
00135    * Query abstaction flag
00136    */
00137   bool Lowlevel(void) const {return ( (mFlags & mAbstractionFlag) == 0 ); }
00138 
00139 
00140   /** 
00141    * Test for default value
00142    */
00143   virtual bool  IsDefault(void) const {return mFlags==mDefCFlags;};
00144 
00145   // flag masks for the three properties
00146   const static fType mControllableFlag =0x01;
00147   const static fType mObservableFlag   =0x02;
00148   const static fType mForcibleFlag     =0x04;
00149   const static fType mAbstractionFlag  =0x08;
00150 
00151  private:
00152   /** Overall default value */
00153   const static fType mDefCFlags         =0x0a;
00154 
00155   /** All flags used by CFlags */
00156   const static fType mAllCFlags         =0x0f;
00157 
00158  protected:
00159 
00160   /**
00161    * Assignment method. 
00162    *
00163    * @param rSrcAttr
00164    *    Source to assign from
00165    */
00166   AttributeCFlags& DoAssign(const AttributeCFlags& rSrcAttr);
00167 
00168   /**
00169    * Test equality of configuration data.
00170    *
00171    * @param rOther 
00172    *    Other attribute to compare with.
00173    * @return 
00174    *   True on match.
00175    */
00176   virtual bool DoEqual(const AttributeCFlags& rOther) const;
00177 
00178   /**
00179    * Reads attribute from TokenReader, see AttributeVoid for public wrappers.
00180    * Reads a single token if it can be interpreted as AttributeCFlag, that is, if
00181    * it is a respective option string or hex number. Label and Context
00182    * argument are ignored. No token mismatch exceptions are thrown on error.
00183    *
00184    * @param rTr
00185    *   TokenReader to read from
00186    * @param rLabel
00187    *   Section to read
00188    * @param pContext
00189    *   Read context to provide contextual information
00190    *
00191    * @exception Exception
00192    *   - IO error (id 1)
00193    */
00194   virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=0);
00195  
00196   /**
00197    * Writes attribute to TokenWriter, see AttributeVoid for public wrappers.
00198    * Label and Context argument are ignored.  
00199    *
00200    * @param rTw
00201    *   TokenWriter to write to
00202    * @param rLabel
00203    *   Section to write
00204    * @param pContext
00205    *   Write context to provide contextual information
00206    *
00207    * @exception Exception
00208    *   - IO error (id 2)
00209    */
00210   virtual void DoWrite(TokenWriter& rTw,const std::string& rLabel="", const Type* pContext=0) const;
00211 
00212 
00213 
00214 }; // class AttributeCFlags
00215 
00216 
00217 /**
00218  * Generator with controllability attributes. 
00219  * 
00220  * @section Overview
00221  * 
00222  * The cGenerator is a variant of the 
00223  * aGenerator to add an interface for events with controllabilty attributes, ie
00224  * an event may be controllable, observable or forcible. 
00225  *
00226  * Technically, the construct is based on the specialized attribute class faudes::AttributeCFlags
00227  * that provides attributes with semantics for controllability properties. The TcGenerator
00228  * expects an event attribute template parameter with the minimum interface defined in AttribueCFlags.
00229  * Thus, you can add further semantics by deriving a class AttributeCFlagsAndMore  from
00230  * AttribueeCFlags and use this as event attribute parameter for TcGenerator. To model
00231  * a plain finite state machine plus controllability properties, use TcGenerator with
00232  * AttributeCFlags for the event attribute parameter and AttributeVoid for the other
00233  * parameters. For convenience, this has been typedefed as cGenerator.
00234  *
00235  * @ingroup GeneratorClasses
00236  */
00237 
00238 template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
00239     class TcGenerator : public TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr> {    
00240   public:
00241     /**
00242      * Creates an emtpy cGenerator object 
00243      */
00244     TcGenerator(void);
00245 
00246     /** 
00247      * cGenerator from a std Generator. Copy constructor 
00248      *
00249      * @param rOtherGen
00250      */
00251     TcGenerator(const vGenerator& rOtherGen);
00252         
00253     /** 
00254      * cGenerator from a cGenerator. Copy constructor 
00255      *
00256      * @param rOtherGen
00257      */
00258     TcGenerator(const TcGenerator& rOtherGen);
00259 
00260     /**
00261      * construct a cGenerator from file
00262      *
00263      * @param rFileName
00264      *   Filename
00265      *
00266      * @exception Exception
00267      *   If opening/reading fails an Exception object is thrown (id 1, 50, 51)
00268      */
00269     TcGenerator(const std::string& rFileName);
00270 
00271     /**
00272      * Construct on heap
00273      *
00274      * @return 
00275      *   new Generator 
00276      */
00277      TcGenerator* New(void) const;
00278 
00279     /**
00280      * Construct copy on heap
00281      *
00282      * @return 
00283      *   new Generator 
00284      */
00285      TcGenerator* Copy(void) const;
00286 
00287     /**
00288      * Construct on stack
00289      *
00290      * @return 
00291      *   new Generator 
00292      */
00293      TcGenerator NewCGen(void) const;
00294 
00295     /**
00296      * Assignment operator (uses copy )
00297      * Note: you must reimplement this operator in derived 
00298      * classes in order to handle internal pointers correctly
00299      *
00300      * @param rOtherGen
00301      *   Other generator
00302      */
00303      virtual TcGenerator& operator= (const TcGenerator& rOtherGen) { this->Assign(rOtherGen); return *this;};
00304 
00305     /**
00306      * Assignment operator (uses copy )
00307      *
00308      * @param rOtherGen
00309      *   Other generator
00310      */
00311      virtual TcGenerator& operator= (const vGenerator& rOtherGen) {this->Assign(rOtherGen); return *this;};
00312 
00313     /**
00314      * Add an existing controllable event to generator. 
00315      * An entry in the global eventtable will be made.
00316      *
00317      * @param index
00318      *   Event index
00319      */
00320     void InsControllableEvent(Idx index);
00321 
00322     /**
00323      * Add new named controllable event to generator. 
00324      * An entry in the global eventtable will be made if event is new.
00325      *
00326      * @param rName
00327      *   Name of the event to add
00328      *
00329      * @return 
00330      *   New global unique index
00331      */
00332     Idx InsControllableEvent(const std::string& rName);
00333     
00334     /**
00335      * Add an existing uncontrollable event to generator. 
00336      * An entry in the global eventtable will be made.
00337      *
00338      * @param index
00339      *   Event index
00340      */
00341     void InsUncontrollableEvent(Idx index);
00342 
00343     /**
00344      * Add new named uncontrollable event to generator. 
00345      * An entry in the global eventtable will be made if event is new.
00346      *
00347      * @param rName
00348      *   Name of the event to add
00349      *
00350      * @return 
00351      *   New global unique index
00352      */
00353     Idx InsUncontrollableEvent(const std::string& rName);
00354         
00355     /**
00356      * Mark event controllable (by index)
00357      *
00358      * @param index
00359      *   Event index
00360      */
00361     void SetControllable(Idx index);
00362 
00363     /** 
00364      * Mark event controllable (by name)
00365      *
00366      * @param rName
00367      *   Event name    
00368      */
00369     void SetControllable(const std::string& rName);
00370 
00371     /** 
00372      * Mark set of events controllable (by index)
00373      *
00374      * @param rEvents
00375      *   EventSet
00376      */
00377     void SetControllable(const EventSet& rEvents);
00378         
00379     /**
00380      * Mark event uncontrollable (by index)
00381      * 
00382      * @param index
00383      *   Event index
00384      */
00385     void ClrControllable(Idx index);
00386 
00387     /**
00388      * Mark event uncontrollable (by name)
00389      * 
00390      * @param rName
00391      *   Event name
00392      */
00393     void ClrControllable(const std::string& rName);
00394 
00395     /** 
00396      * Mark set of events uncontrollable (by index)
00397      *
00398      * @param rEvents
00399      *   EventSet
00400      */
00401     void ClrControllable(const EventSet& rEvents);
00402           
00403     /**
00404      * Is event controllable (by index)
00405      *
00406      * @param index
00407      *   Event index
00408      *
00409      * @return
00410      *   True / false
00411      */
00412     bool Controllable(Idx index) const;
00413 
00414     /**
00415      * Is event controllable (by name)
00416      *
00417      * @param rName
00418      *   Event name
00419      *
00420      * @return
00421      *   True / false
00422      */
00423     bool Controllable(const std::string& rName) const;
00424 
00425     /** 
00426      * Get EventSet with controllable events
00427      *
00428      * @return
00429      *   EventSet of controllable events
00430      */
00431     EventSet ControllableEvents(void) const;
00432 
00433     /**
00434      * Get EventSet with uncontrollable events
00435      *
00436      * @return 
00437      *   EventSet of uncontrollable events
00438      */
00439     EventSet UncontrollableEvents(void) const;
00440 
00441     /**
00442      * Add an existing observable event to generator. 
00443      * An entry in the global eventtable will be made.
00444      *
00445      * @param index
00446      *   Event index
00447      */
00448     void InsObservableEvent(Idx index);
00449 
00450     /**
00451      * Add new named observable event to generator. 
00452      * An entry in the global eventtable will be made if event is new.
00453      *
00454      * @param rName
00455      *   Name of the event to add
00456      *
00457      * @return 
00458      *   New global unique index
00459      */
00460     Idx InsObservableEvent(const std::string& rName);
00461     
00462     /**
00463      * Add an existing unobservable event to generator. 
00464      * An entry in the global eventtable will be made.
00465      *
00466      * @param index
00467      *   Event index
00468      */
00469     void InsUnobservableEvent(Idx index);
00470 
00471     /**
00472      * Add new named unobservable event to generator. 
00473      * An entry in the global eventtable will be made if event is new.
00474      *
00475      * @param rName
00476      *   Name of the event to add
00477      *
00478      * @return 
00479      *   New global unique index
00480      */
00481     Idx InsUnobservableEvent(const std::string& rName);
00482         
00483     /**
00484      * Mark event observable (by index)
00485      *
00486      * @param index
00487      *   Event index
00488      */
00489     void SetObservable(Idx index);
00490 
00491     /** 
00492      * Mark event observable (by name)
00493      *
00494      * @param rName
00495      *   Event name    
00496      */
00497     void SetObservable(const std::string& rName);
00498 
00499     /**
00500      * Mark set of events observable 
00501      *
00502      * @param rEvents
00503      *   EventSet
00504      */
00505     void SetObservable(const EventSet& rEvents);
00506         
00507     /**
00508      * Mark event unobservable (by index)
00509      * 
00510      * @param index
00511      *   Event index
00512      */
00513     void ClrObservable(Idx index);
00514 
00515     /**
00516      * Mark event unobservable (by name)
00517      * 
00518      * @param rName
00519      *   Event name
00520      */
00521     void ClrObservable(const std::string& rName);
00522 
00523     /**
00524      * Mark set of events unobservable 
00525      *
00526      * @param rEvents
00527      *   EventSet
00528      */
00529     void ClrObservable(const EventSet& rEvents);
00530           
00531     /**
00532      * Is event observable (by index)
00533      *
00534      * @param index
00535      *   Event index
00536      *
00537      * @return
00538      *   True / false
00539      */
00540     bool Observable(Idx index) const;
00541 
00542     /**
00543      * Is event observable (by name)
00544      *
00545      * @param rName
00546      *   Event name
00547      *
00548      * @return
00549      *   True / false
00550      */
00551     bool Observable(const std::string& rName) const;
00552 
00553     /** 
00554      * Get EventSet with observable events
00555      *
00556      * @return
00557      *   EventSet of controllable events
00558      */
00559     EventSet ObservableEvents(void) const;
00560 
00561     /**
00562      * Get EventSet with unobservable events
00563      *
00564      * @return 
00565      *   EventSet of uncontrollable events
00566      */
00567     EventSet UnobservableEvents(void) const;
00568 
00569     /**
00570      * Add an existing forcible event to generator. 
00571      * An entry in the global eventtable will be made.
00572      *
00573      * @param index
00574      *   Event index
00575      */
00576     void InsForcibleEvent(Idx index);
00577 
00578     /**
00579      * Add new named forcible event to generator. 
00580      * An entry in the global eventtable will be made if event is new.
00581      *
00582      * @param rName
00583      *   Name of the event to add
00584      *
00585      * @return 
00586      *   New global unique index
00587      */
00588     Idx InsForcibleEvent(const std::string& rName);
00589     
00590     /**
00591      * Add an existing unforcible event to generator. 
00592      * An entry in the global eventtable will be made.
00593      *
00594      * @param index
00595      *   Event index
00596      */
00597     void InsUnforcibleEvent(Idx index);
00598 
00599     /**
00600      * Add new named unforcible event to generator. 
00601      * An entry in the global eventtable will be made if event is new.
00602      *
00603      * @param rName
00604      *   Name of the event to add
00605      *
00606      * @return 
00607      *   New global unique index
00608      */
00609     Idx InsUnforcibleEvent(const std::string& rName);
00610         
00611     /**
00612      * Mark event forcible (by index)
00613      *
00614      * @param index
00615      *   Event index
00616      */
00617     void SetForcible(Idx index);
00618 
00619     /** 
00620      * Mark event forcible (by name)
00621      *
00622      * @param rName
00623      *   Event name    
00624      */
00625     void SetForcible(const std::string& rName);
00626 
00627     /**
00628      * Mark set of events forcible
00629      *
00630      * @param rEvents
00631      *   EventSet
00632      */
00633     void SetForcible(const EventSet& rEvents);
00634         
00635     /**
00636      * Mark event unforcible (by index)
00637      * 
00638      * @param index
00639      *   Event index
00640      */
00641     void ClrForcible(Idx index);
00642 
00643     /**
00644      * Mark event unforcible (by name)
00645      * 
00646      * @param rName
00647      *   Event name
00648      */
00649     void ClrForcible(const std::string& rName);
00650 
00651     /**
00652      * Mark set of events unforcible 
00653      *
00654      * @param rEvents
00655      *   EventSet
00656      */
00657     void ClrForcible(const EventSet& rEvents);
00658           
00659     /**
00660      * Is event forcible (by index)
00661      *
00662      * @param index
00663      *   Event index
00664      *
00665      * @return
00666      *   True / false
00667      */
00668     bool Forcible(Idx index) const;
00669 
00670     /**
00671      * Is event forcible (by name)
00672      *
00673      * @param rName
00674      *   Event name
00675      *
00676      * @return
00677      *   True / false
00678      */
00679     bool Forcible(const std::string& rName) const;
00680 
00681     /** 
00682      * Get EventSet with forcible events
00683      *
00684      * @return
00685      *   EventSet of controllable events
00686      */
00687     EventSet ForcibleEvents(void) const;
00688 
00689     /**
00690      * Get EventSet with unforcible events
00691      *
00692      * @return 
00693      *   EventSet of uncontrollable events
00694      */
00695     EventSet UnforcibleEvents(void) const;
00696 
00697     /**
00698      * Add an existing abstraction event to generator. 
00699      * An entry in the global eventtable will be made.
00700      *
00701      * @param index
00702      *   Event index
00703      */
00704     void InsHighlevelEvent(Idx index);
00705 
00706     /**
00707      * Add new named abstraction event to generator. 
00708      * An entry in the global eventtable will be made if event is new.
00709      *
00710      * @param rName
00711      *   Name of the event to add
00712      *
00713      * @return 
00714      *   New global unique index
00715      */
00716     Idx InsHighlevelEvent(const std::string& rName);
00717     
00718     /**
00719      * Add an existing low-level event to generator. 
00720      * An entry in the global eventtable will be made.
00721      *
00722      * @param index
00723      *   Event index
00724      */
00725     void InsLowlevelEvent(Idx index);
00726 
00727     /**
00728      * Add new named low-level event to generator. 
00729      * An entry in the global eventtable will be made if event is new.
00730      *
00731      * @param rName
00732      *   Name of the event to add
00733      *
00734      * @return 
00735      *   New global unique index
00736      */
00737     Idx InsLowlevelEvent(const std::string& rName);
00738         
00739     /**
00740      * Mark event as highlevel event (by index)
00741      *
00742      * @param index
00743      *   Event index
00744      */
00745     void SetHighlevel(Idx index);
00746 
00747     /** 
00748      * Mark event as highlevel event (by name)
00749      *
00750      * @param rName
00751      *   Event name    
00752      */
00753     void SetHighlevel(const std::string& rName);
00754 
00755     /**
00756      * Mark set of events as high-level events
00757      *
00758      * @param rEvents
00759      *   EventSet
00760      */
00761     void SetHighlevel(const EventSet& rEvents);
00762         
00763     /**
00764      * Mark event as low-level event (by index)
00765      * 
00766      * @param index
00767      *   Event index
00768      */
00769     void SetLowlevel(Idx index);
00770 
00771     /**
00772      * Mark event as low-level event (by name)
00773      * 
00774      * @param rName
00775      *   Event name
00776      */
00777     void SetLowlevel(const std::string& rName);
00778 
00779     /**
00780      * Mark set of events as low-level events.
00781      *
00782      * @param rEvents
00783      *   EventSet
00784      */
00785     void SetLowlevel(const EventSet& rEvents);
00786           
00787     /**
00788      * Test for high-level event  (by index)
00789      *
00790      * @param index
00791      *   Event index
00792      *
00793      * @return
00794      *   True / false
00795      */
00796     bool Highlevel(Idx index) const;
00797 
00798     /**
00799      * Test for high-level event  (by name)
00800      *
00801      * @param rName
00802      *   Event name
00803      *
00804      * @return
00805      *   True / false
00806      */
00807     bool Highlevel(const std::string& rName) const;
00808 
00809     /**
00810      * Test for low-level event  (by index)
00811      *
00812      * @param index
00813      *   Event index
00814      *
00815      * @return
00816      *   True / false
00817      */
00818     bool Lowlevel(Idx index) const;
00819 
00820     /**
00821      * Test for low-level event  (by name)
00822      *
00823      * @param rName
00824      *   Event name
00825      *
00826      * @return
00827      *   True / false
00828      */
00829     bool Lowlevel(const std::string& rName) const;
00830 
00831     /** 
00832      * Get EventSet of all high-level events
00833      *
00834      * @return
00835      *   EventSet of high-level events
00836      */
00837     EventSet HighlevelEvents(void) const;
00838 
00839     /**
00840      * Get EventSet of all low-level events
00841      *
00842      * @return 
00843      *   EventSet of low-level events
00844      */
00845     EventSet LowlevelEvents(void) const;
00846 
00847 
00848   private:
00849 
00850   protected:
00851 
00852 }; // end class TcGenerator
00853 
00854     
00855 /** Convenience typedef for std cGenerator */
00856 typedef TcGenerator<AttributeVoid, AttributeVoid, AttributeCFlags,AttributeVoid> cGenerator;
00857 
00858 /** EventSet with controllablity properties */
00859 typedef TaNameSet<AttributeCFlags> cEventSet;
00860 
00861 /** Convenience typedef for generator vectors */
00862 typedef  TBaseVector<cGenerator> cGeneratorVector;  
00863 typedef  TBaseVector<cEventSet> cEventSetVector;  
00864 
00865 
00866 
00867 
00868 /*
00869 ***************************************************************************
00870 ***************************************************************************
00871 ***************************************************************************
00872 
00873 Implementation cgenerator
00874 
00875 ***************************************************************************
00876 ***************************************************************************
00877 ***************************************************************************
00878 */
00879 
00880 /* convenience access to relevant scopes */
00881 #define THIS TcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
00882 #define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
00883 #define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
00884 
00885 
00886 // TcGenerator(void)
00887 TEMP THIS::TcGenerator(void) : BASE() {
00888   FD_DG("TcGenerator(" << this << ")::TcGenerator()");
00889 }
00890 
00891 // TcGenerator(rOtherGen)
00892 TEMP THIS::TcGenerator(const TcGenerator& rOtherGen) : BASE(rOtherGen) {
00893   FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
00894 }
00895 
00896 // TcGenerator(rOtherGen)
00897 TEMP THIS::TcGenerator(const vGenerator& rOtherGen) : BASE(rOtherGen) {
00898   FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
00899 }
00900 
00901 // TcGenerator(rFilename)
00902 TEMP THIS::TcGenerator(const std::string& rFileName) : BASE(rFileName) {
00903   FD_DG("TcGenerator(" << this << ")::TcGenerator(rFilename) : done");
00904 }
00905 
00906 
00907 // New
00908 TEMP THIS* THIS::New(void) const {
00909   // allocate
00910   THIS* res = new THIS;
00911   // fix base data
00912   res->EventSymbolTablep(BASE::mpEventSymbolTable);
00913   res->mStateNamesEnabled=BASE::mStateNamesEnabled;
00914   return res;
00915 }
00916 
00917 // Copy
00918 TEMP THIS* THIS::Copy(void) const {
00919   // allocate
00920   THIS* res = new THIS(*this);
00921   // done
00922   return res;
00923 }
00924 
00925 // NewCGen
00926 TEMP THIS THIS::NewCGen(void) const {
00927   // call base (fixes by assignment constructor)
00928   THIS res= BASE::NewAGen();
00929   return res;
00930 }
00931 
00932 
00933   // Controllable(index)
00934   TEMP bool THIS::Controllable(Idx index) const {
00935     EventAttr attr=BASE::EventAttribute(index);
00936     return attr.Controllable();
00937   } 
00938   
00939   // Controllable(rName)
00940   TEMP bool THIS::Controllable(const std::string& rName) const {
00941     EventAttr attr=BASE::EventAttribute(rName);
00942     return attr.Controllable();
00943   } 
00944   
00945   // InsControllableEvent(index)
00946   TEMP void THIS::InsControllableEvent(Idx index) {
00947     FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << index << ")");
00948     EventAttr attr;
00949     attr.SetControllable();
00950     BASE::InsEvent(index,attr);
00951   } 
00952 
00953   // InsControllableEvent(rName)
00954   TEMP Idx THIS::InsControllableEvent(const std::string& rName) {
00955     FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << rName << ")");
00956     EventAttr attr;
00957     attr.SetControllable();
00958     return BASE::InsEvent(rName,attr);
00959   } 
00960 
00961   // InsUncontrollableEvent(index)
00962   TEMP void THIS::InsUncontrollableEvent(Idx index) {
00963     FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << index << ")");
00964     EventAttr attr;
00965     attr.ClrControllable();
00966     BASE::InsEvent(index,attr);
00967   } 
00968 
00969   // InsUncontrollableEvent(rName)
00970   TEMP Idx THIS::InsUncontrollableEvent(const std::string& rName) {
00971     FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << rName << ")");
00972     EventAttr attr;
00973     attr.ClrControllable();
00974     return BASE::InsEvent(rName,attr);
00975   } 
00976     
00977   // SetControllable(index)
00978   TEMP void THIS::SetControllable(Idx index) {
00979     FD_DG("TcGenerator(" << this << ")::SetControllable(" << index << ")");
00980     EventAttr attr=BASE::EventAttribute(index);
00981     attr.SetControllable();
00982     BASE::pAlphabet->Attribute(index,attr);
00983   } 
00984 
00985   // SetControllable(rName)
00986   TEMP void THIS::SetControllable(const std::string& rName) {
00987     FD_DG("TcGenerator(" << this << ")::SetControllable(" << rName << ")");
00988     Idx index = BASE::EventIndex(rName);
00989     SetControllable(index);
00990   }
00991 
00992   //SetControllable(rEvents)
00993   TEMP void THIS::SetControllable(const EventSet& rEvents) {
00994     FD_DG("TcGenerator(" << this << ")::SetControllable(rEvents)");
00995     EventSet::Iterator it;
00996     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
00997       SetControllable(*it);
00998     }
00999   }
01000     
01001   // ClrControllable(index)
01002   TEMP void THIS::ClrControllable(Idx index) {
01003     FD_DG("TcGenerator(" << this << ")::ClrControllable(" << index << ")");
01004     EventAttr attr=BASE::EventAttribute(index);
01005     attr.ClrControllable();
01006     BASE::pAlphabet->Attribute(index,attr);
01007   } 
01008 
01009   // ClrControllable(rName)
01010   TEMP void THIS::ClrControllable(const std::string& rName) {
01011     FD_DG("TcGenerator(" << this << ")::ClrControllable(" << rName << ")");
01012     Idx index = BASE::EventIndex(rName);
01013     ClrControllable(index);
01014   }
01015 
01016   //ClrControllable(rEvents)
01017   TEMP void THIS::ClrControllable(const EventSet& rEvents) {
01018     FD_DG("TcGenerator(" << this << ")::ClrControllable(rEvents)");
01019     EventSet::Iterator it;
01020     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01021       ClrControllable(*it);
01022     }
01023   }
01024 
01025   //ControllableEvents()
01026   TEMP EventSet THIS::ControllableEvents(void) const {
01027     FD_DG("TcGenerator(" << this << ")::ControllableEvents()");
01028     EventSet res;
01029     EventSet::Iterator it;
01030     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01031       if(Controllable(*it)) res.Insert(*it);
01032     }
01033     return res;
01034   }
01035   
01036   //UncontrollableEvents()
01037   TEMP
01038     EventSet THIS::UncontrollableEvents(void) const {
01039     FD_DG("TcGenerator(" << this << ")::UncontrollableEvents()");
01040     EventSet res;
01041     EventSet::Iterator it;
01042     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01043       if(!Controllable(*it)) res.Insert(*it);
01044     }
01045     return res;
01046   }
01047   
01048   // Observable(index)
01049   TEMP bool THIS::Observable(Idx index) const {
01050     EventAttr attr=BASE::EventAttribute(index);
01051     return attr.Observable();
01052   } 
01053   
01054   // Observable(rName)
01055   TEMP bool THIS::Observable(const std::string& rName) const {
01056     EventAttr attr=BASE::EventAttribute(rName);
01057     return attr.Observable();
01058   } 
01059   
01060   // InsObservableEvent(index)
01061   TEMP void THIS::InsObservableEvent(Idx index) {
01062     FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << index << ")");
01063     EventAttr attr;
01064     attr.SetObservable();
01065     BASE::InsEvent(index,attr);
01066   } 
01067 
01068   // InsObservableEvent(rName)
01069   TEMP Idx THIS::InsObservableEvent(const std::string& rName) {
01070     FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << rName << ")");
01071     EventAttr attr;
01072     attr.SetObservable();
01073     return BASE::InsEvent(rName,attr);
01074   } 
01075 
01076   // InsUnobservableEvent(index)
01077   TEMP void THIS::InsUnobservableEvent(Idx index) {
01078     FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << index << ")");
01079     EventAttr attr;
01080     attr.ClrObservable();
01081     BASE::InsEvent(index,attr);
01082   } 
01083 
01084   // InsUnobservableEvent(rName)
01085   TEMP Idx THIS::InsUnobservableEvent(const std::string& rName) {
01086     FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << rName << ")");
01087     EventAttr attr;
01088     attr.ClrObservable();
01089     return BASE::InsEvent(rName,attr);
01090   } 
01091     
01092   // SetObservable(index)
01093   TEMP void THIS::SetObservable(Idx index) {
01094     FD_DG("TcGenerator(" << this << ")::SetObservable(" << index << ")");
01095     EventAttr attr=BASE::EventAttribute(index);
01096     attr.SetObservable();
01097     BASE::pAlphabet->Attribute(index,attr);
01098   } 
01099 
01100   // SetObservable(rName)
01101   TEMP void THIS::SetObservable(const std::string& rName) {
01102     FD_DG("TcGenerator(" << this << ")::SetObservable(" << rName << ")");
01103     Idx index = BASE::EventIndex(rName);
01104     SetObservable(index);
01105   }
01106 
01107   //SetObservable(rEvents)
01108   TEMP void THIS::SetObservable(const EventSet& rEvents) {
01109     FD_DG("TcGenerator(" << this << ")::SetObservable(rEvents)");
01110     EventSet::Iterator it;
01111     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01112       SetObservable(*it);
01113     }
01114   }
01115     
01116   // ClrObservable(index)
01117   TEMP void THIS::ClrObservable(Idx index) {
01118     FD_DG("TcGenerator(" << this << ")::ClrObservable(" << index << ")");
01119     EventAttr attr=BASE::EventAttribute(index);
01120     attr.ClrObservable();
01121     BASE::pAlphabet->Attribute(index,attr);
01122   } 
01123 
01124   // ClrObservable(rName)
01125   TEMP void THIS::ClrObservable(const std::string& rName) {
01126     FD_DG("TcGenerator(" << this << ")::ClrObservable(" << rName << ")");
01127     Idx index = BASE::EventIndex(rName);
01128     ClrObservable(index);
01129   }
01130 
01131   //ClrObservable(rEvents)
01132   TEMP void THIS::ClrObservable(const EventSet& rEvents) {
01133     FD_DG("TcGenerator(" << this << ")::ClrObservable(rEvents)");
01134     EventSet::Iterator it;
01135     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01136       ClrObservable(*it);
01137     }
01138   }
01139 
01140   //ObservableEvents()
01141   TEMP EventSet THIS::ObservableEvents(void) const {
01142     FD_DG("TcGenerator(" << this << ")::ObservableEvents()");
01143     EventSet res;
01144     EventSet::Iterator it;
01145     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01146       if(Observable(*it)) res.Insert(*it);
01147     }
01148     return res;
01149   }
01150   
01151   //UnobservableEvents()
01152   TEMP
01153     EventSet THIS::UnobservableEvents(void) const {
01154     FD_DG("TcGenerator(" << this << ")::UnobservableEvents()");
01155     EventSet res;
01156     EventSet::Iterator it;
01157     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01158       if(!Observable(*it)) res.Insert(*it);
01159     }
01160     return res;
01161   }
01162   
01163 
01164   //Forcible(index)
01165   TEMP bool THIS::Forcible(Idx index) const {
01166     EventAttr attr=BASE::EventAttribute(index);
01167     return attr.Forcible();
01168   } 
01169   
01170   // Forcible(rName)
01171   TEMP bool THIS::Forcible(const std::string& rName) const {
01172     EventAttr attr=BASE::EventAttribute(rName);
01173     return attr.Forcible();
01174   } 
01175   
01176   // InsForcibleEvent(index)
01177   TEMP void THIS::InsForcibleEvent(Idx index) {
01178     FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << index << ")");
01179     EventAttr attr;
01180     attr.SetForcible();
01181     BASE::InsEvent(index,attr);
01182   } 
01183 
01184   // InsForcibleEvent(rName)
01185   TEMP Idx THIS::InsForcibleEvent(const std::string& rName) {
01186     FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << rName << ")");
01187     EventAttr attr;
01188     attr.SetForcible();
01189     return BASE::InsEvent(rName,attr);
01190   } 
01191 
01192   // InsUnforcibleEvent(index)
01193   TEMP void THIS::InsUnforcibleEvent(Idx index) {
01194     FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << index << ")");
01195     EventAttr attr;
01196     attr.ClrForcible();
01197     BASE::InsEvent(index,attr);
01198   } 
01199 
01200   // InsUnforcibleEvent(rName)
01201   TEMP Idx THIS::InsUnforcibleEvent(const std::string& rName) {
01202     FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << rName << ")");
01203     EventAttr attr;
01204     attr.ClrForcible();
01205     return BASE::InsEvent(rName,attr);
01206   } 
01207     
01208   // SetForcible(index)
01209   TEMP void THIS::SetForcible(Idx index) {
01210     FD_DG("TcGenerator(" << this << ")::SetForcible(" << index << ")");
01211     EventAttr attr=BASE::EventAttribute(index);
01212     attr.SetForcible();
01213     BASE::pAlphabet->Attribute(index,attr);
01214   } 
01215 
01216   // SetForcible(rName)
01217   TEMP void THIS::SetForcible(const std::string& rName) {
01218     FD_DG("TcGenerator(" << this << ")::SetForcible(" << rName << ")");
01219     Idx index = BASE::EventIndex(rName);
01220     SetForcible(index);
01221   }
01222 
01223   //SetForcible(rEvents)
01224   TEMP void THIS::SetForcible(const EventSet& rEvents) {
01225     FD_DG("TcGenerator(" << this << ")::SetForcible(rEvents)");
01226     EventSet::Iterator it;
01227     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01228       SetForcible(*it);
01229     }
01230   }
01231     
01232   // ClrForcible(index)
01233   TEMP void THIS::ClrForcible(Idx index) {
01234     FD_DG("TcGenerator(" << this << ")::ClrForcible(" << index << ")");
01235     EventAttr attr=BASE::EventAttribute(index);
01236     attr.ClrForcible();
01237     BASE::pAlphabet->Attribute(index,attr);
01238   } 
01239 
01240   // ClrForcible(rName)
01241   TEMP void THIS::ClrForcible(const std::string& rName) {
01242     FD_DG("TcGenerator(" << this << ")::ClrForcible(" << rName << ")");
01243     Idx index = BASE::EventIndex(rName);
01244     ClrForcible(index);
01245   }
01246 
01247   //ClrForcible(rEvents)
01248   TEMP void THIS::ClrForcible(const EventSet& rEvents) {
01249     FD_DG("TcGenerator(" << this << ")::ClrForcible(rEvents)");
01250     EventSet::Iterator it;
01251     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01252       ClrForcible(*it);
01253     }
01254   }
01255 
01256   //ForcibleEvents()
01257   TEMP EventSet THIS::ForcibleEvents(void) const {
01258     FD_DG("TcGenerator(" << this << ")::ForcibleEvents()");
01259     EventSet res;
01260     EventSet::Iterator it;
01261     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01262       if(Forcible(*it)) res.Insert(*it);
01263     }
01264     return res;
01265   }
01266   
01267   //UnforcibleEvents()
01268   TEMP
01269     EventSet THIS::UnforcibleEvents(void) const {
01270     FD_DG("TcGenerator(" << this << ")::UnforcibleEvents()");
01271     EventSet res;
01272     EventSet::Iterator it;
01273     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01274       if(!Forcible(*it)) res.Insert(*it);
01275     }
01276     return res;
01277   }
01278   
01279 
01280   //Highlevel(index)
01281   TEMP bool THIS::Highlevel(Idx index) const {
01282     EventAttr attr=BASE::EventAttribute(index);
01283     return attr.Highlevel();
01284   } 
01285   
01286   // Highlevel(rName)
01287   TEMP bool THIS::Highlevel(const std::string& rName) const {
01288     EventAttr attr=BASE::EventAttribute(rName);
01289     return attr.Highlevel();
01290   } 
01291   
01292   //Lowlevel(index)
01293   TEMP bool THIS::Lowlevel(Idx index) const {
01294     EventAttr attr=BASE::EventAttribute(index);
01295     return attr.Lowlevel();
01296   } 
01297   
01298   // Lowlevel(rName)
01299   TEMP bool THIS::Lowlevel(const std::string& rName) const {
01300     EventAttr attr=BASE::EventAttribute(rName);
01301     return attr.Lowlevel();
01302   } 
01303   
01304   // InsHighlevelEvent(index)
01305   TEMP void THIS::InsHighlevelEvent(Idx index) {
01306     FD_DG("TcGenerator(" << this << ")::InsHighlevelEvent(" << index << ")");
01307     EventAttr attr;
01308     attr.SetHighlevel();
01309     BASE::InsEvent(index,attr);
01310   } 
01311 
01312   // InsHighlevelEvent(rName)
01313   TEMP Idx THIS::InsHighlevelEvent(const std::string& rName) {
01314     FD_DG("TcGenerator(" << this << ")::InsHighlevelEvent(" << rName << ")");
01315     EventAttr attr;
01316     attr.SetHighlevel();
01317     return BASE::InsEvent(rName,attr);
01318   } 
01319 
01320   // InsLowlevelEvent(index)
01321   TEMP void THIS::InsLowlevelEvent(Idx index) {
01322     FD_DG("TcGenerator(" << this << ")::InsLowlevelEvent(" << index << ")");
01323     EventAttr attr;
01324     attr.SetLowlevel();
01325     BASE::InsEvent(index,attr);
01326   } 
01327 
01328   // InsLowlevelEvent(rName)
01329   TEMP Idx THIS::InsLowlevelEvent(const std::string& rName) {
01330     FD_DG("TcGenerator(" << this << ")::InsLowlevelEvent(" << rName << ")");
01331     EventAttr attr;
01332     attr.SetLowlevel();
01333     return BASE::InsEvent(rName,attr);
01334   } 
01335     
01336   // SetHighlevel(index)
01337   TEMP void THIS::SetHighlevel(Idx index) {
01338     FD_DG("TcGenerator(" << this << ")::SetHighlevel(" << index << ")");
01339     EventAttr attr=BASE::EventAttribute(index);
01340     attr.SetHighlevel();
01341     BASE::pAlphabet->Attribute(index,attr);
01342   } 
01343 
01344   // SetHighlevel(rName)
01345   TEMP void THIS::SetHighlevel(const std::string& rName) {
01346     FD_DG("TcGenerator(" << this << ")::SetHighlevel(" << rName << ")");
01347     Idx index = BASE::EventIndex(rName);
01348     SetHighlevel(index);
01349   }
01350 
01351   //SetHighlevel(rEvents)
01352   TEMP void THIS::SetHighlevel(const EventSet& rEvents) {
01353     FD_DG("TcGenerator(" << this << ")::SetHighlevel(rEvents)");
01354     EventSet::Iterator it;
01355     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01356       SetHighlevel(*it);
01357     }
01358   }
01359     
01360   // SetLowlevel(index)
01361   TEMP void THIS::SetLowlevel(Idx index) {
01362     FD_DG("TcGenerator(" << this << ")::SetLowlevel(" << index << ")");
01363     EventAttr attr=BASE::EventAttribute(index);
01364     attr.SetLowlevel();
01365     BASE::pAlphabet->Attribute(index,attr);
01366   } 
01367 
01368   // SetLowlevel(rName)
01369   TEMP void THIS::SetLowlevel(const std::string& rName) {
01370     FD_DG("TcGenerator(" << this << ")::SetLowlevel(" << rName << ")");
01371     Idx index = BASE::EventIndex(rName);
01372     SetLowlevel(index);
01373   }
01374 
01375   //SetLowlevel(rEvents)
01376   TEMP void THIS::SetLowlevel(const EventSet& rEvents) {
01377     FD_DG("TcGenerator(" << this << ")::SetLowlevel(rEvents)");
01378     EventSet::Iterator it;
01379     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01380       SetLowlevel(*it);
01381     }
01382   }
01383 
01384   //HighlevelEvents()
01385   TEMP EventSet THIS::HighlevelEvents(void) const {
01386     FD_DG("TcGenerator(" << this << ")::HighlevelEvents()");
01387     EventSet res;
01388     EventSet::Iterator it;
01389     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01390       if(Highlevel(*it)) res.Insert(*it);
01391     }
01392     return res;
01393   }
01394   
01395   //LowlevelEvents()
01396   TEMP
01397     EventSet THIS::LowlevelEvents(void) const {
01398     FD_DG("TcGenerator(" << this << ")::LowlevelEvents()");
01399     EventSet res;
01400     EventSet::Iterator it;
01401     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01402       if(Lowlevel(*it)) res.Insert(*it);
01403     }
01404     return res;
01405   }
01406   
01407 
01408 
01409 #undef TEMP
01410 #undef BASE
01411 #undef THIS
01412 
01413  
01414 } // namespace faudes
01415 
01416 #endif
01417 

libFAUDES 2.16b --- 2010-9-8 --- c++ source docu by doxygen 1.6.3