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(Void,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   void 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    * Writes attribute to TokenWriter (XML format), see AttributeVoid for public wrappers.
00215    * Label and Context argument are ignored.  
00216    *
00217    * @param rTw
00218    *   TokenWriter to write to
00219    * @param rLabel
00220    *   Section to write
00221    * @param pContext
00222    *   Write context to provide contextual information
00223    *
00224    * @exception Exception
00225    *   - IO error (id 2)
00226    */
00227   virtual void DoXWrite(TokenWriter& rTw,const std::string& rLabel="", const Type* pContext=0) const;
00228 
00229 
00230 
00231 }; // class AttributeCFlags
00232 
00233 
00234 
00235 /** EventSet with controllablity properties */
00236 typedef TaNameSet<AttributeCFlags> cEventSet;
00237 
00238 
00239 
00240 
00241 /**
00242  * Generator with controllability attributes. 
00243  * 
00244  * @section Overview
00245  * 
00246  * The cGenerator is a variant of the 
00247  * aGenerator to add an interface for events with controllabilty attributes, ie
00248  * an event may be controllable, observable or forcible. 
00249  *
00250  * Technically, the construct is based on the specialized attribute class faudes::AttributeCFlags
00251  * that provides attributes with semantics for controllability properties. The TcGenerator
00252  * expects an event attribute template parameter with the minimum interface defined in AttribueCFlags.
00253  * Thus, you can add further semantics by deriving a class AttributeCFlagsAndMore  from
00254  * AttribueeCFlags and use this as event attribute parameter for TcGenerator. To model
00255  * a plain finite state machine plus controllability properties, use TcGenerator with
00256  * AttributeCFlags for the event attribute parameter and AttributeVoid for the other
00257  * parameters. For convenience, this has been typedefed as cGenerator.
00258  *
00259  * @ingroup GeneratorClasses
00260  */
00261 
00262 template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
00263     class TcGenerator : public TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr> {    
00264   public:
00265     /**
00266      * Creates an emtpy cGenerator object 
00267      */
00268     TcGenerator(void);
00269 
00270     /** 
00271      * cGenerator from a std Generator. Copy constructor 
00272      *
00273      * @param rOtherGen
00274      */
00275     TcGenerator(const vGenerator& rOtherGen);
00276         
00277     /** 
00278      * cGenerator from a cGenerator. Copy constructor 
00279      *
00280      * @param rOtherGen
00281      */
00282     TcGenerator(const TcGenerator& rOtherGen);
00283 
00284     /**
00285      * construct a cGenerator from file
00286      *
00287      * @param rFileName
00288      *   Filename
00289      *
00290      * @exception Exception
00291      *   If opening/reading fails an Exception object is thrown (id 1, 50, 51)
00292      */
00293     TcGenerator(const std::string& rFileName);
00294 
00295     /**
00296      * Construct on heap
00297      *
00298      * @return 
00299      *   new Generator 
00300      */
00301      TcGenerator* New(void) const;
00302 
00303     /**
00304      * Construct copy on heap
00305      *
00306      * @return 
00307      *   new Generator 
00308      */
00309      TcGenerator* Copy(void) const;
00310 
00311     /**
00312      * Construct on stack
00313      *
00314      * @return 
00315      *   new Generator 
00316      */
00317      TcGenerator NewCGen(void) const;
00318 
00319     /**
00320      * Assignment operator (uses copy )
00321      * Note: you must reimplement this operator in derived 
00322      * classes in order to handle internal pointers correctly
00323      *
00324      * @param rOtherGen
00325      *   Other generator
00326      */
00327      virtual TcGenerator& operator= (const TcGenerator& rOtherGen) { this->Assign(rOtherGen); return *this;};
00328 
00329     /**
00330      * Assignment operator (uses copy )
00331      *
00332      * @param rOtherGen
00333      *   Other generator
00334      */
00335      virtual TcGenerator& operator= (const vGenerator& rOtherGen) {this->Assign(rOtherGen); return *this;};
00336 
00337     /**
00338      * Add an existing controllable event to generator. 
00339      * An entry in the global eventtable will be made.
00340      *
00341      * @param index
00342      *   Event index
00343      */
00344     void InsControllableEvent(Idx index);
00345 
00346     /**
00347      * Add new named controllable event to generator. 
00348      * An entry in the global eventtable will be made if event is new.
00349      *
00350      * @param rName
00351      *   Name of the event to add
00352      *
00353      * @return 
00354      *   New global unique index
00355      */
00356     Idx InsControllableEvent(const std::string& rName);
00357     
00358     /**
00359      * Add an existing uncontrollable event to generator. 
00360      * An entry in the global eventtable will be made.
00361      *
00362      * @param index
00363      *   Event index
00364      */
00365     void InsUncontrollableEvent(Idx index);
00366 
00367     /**
00368      * Add new named uncontrollable event to generator. 
00369      * An entry in the global eventtable will be made if event is new.
00370      *
00371      * @param rName
00372      *   Name of the event to add
00373      *
00374      * @return 
00375      *   New global unique index
00376      */
00377     Idx InsUncontrollableEvent(const std::string& rName);
00378         
00379     /**
00380      * Mark event controllable (by index)
00381      *
00382      * @param index
00383      *   Event index
00384      */
00385     void SetControllable(Idx index);
00386 
00387     /** 
00388      * Mark event controllable (by name)
00389      *
00390      * @param rName
00391      *   Event name    
00392      */
00393     void SetControllable(const std::string& rName);
00394 
00395     /** 
00396      * Mark set of events controllable (by index)
00397      *
00398      * @param rEvents
00399      *   EventSet
00400      */
00401     void SetControllable(const EventSet& rEvents);
00402         
00403     /**
00404      * Mark event uncontrollable (by index)
00405      * 
00406      * @param index
00407      *   Event index
00408      */
00409     void ClrControllable(Idx index);
00410 
00411     /**
00412      * Mark event uncontrollable (by name)
00413      * 
00414      * @param rName
00415      *   Event name
00416      */
00417     void ClrControllable(const std::string& rName);
00418 
00419     /** 
00420      * Mark set of events uncontrollable (by index)
00421      *
00422      * @param rEvents
00423      *   EventSet
00424      */
00425     void ClrControllable(const EventSet& rEvents);
00426           
00427     /**
00428      * Is event controllable (by index)
00429      *
00430      * @param index
00431      *   Event index
00432      *
00433      * @return
00434      *   True / false
00435      */
00436     bool Controllable(Idx index) const;
00437 
00438     /**
00439      * Is event controllable (by name)
00440      *
00441      * @param rName
00442      *   Event name
00443      *
00444      * @return
00445      *   True / false
00446      */
00447     bool Controllable(const std::string& rName) const;
00448 
00449     /** 
00450      * Get EventSet with controllable events
00451      *
00452      * @return
00453      *   EventSet of controllable events
00454      */
00455     EventSet ControllableEvents(void) const;
00456 
00457     /**
00458      * Get EventSet with uncontrollable events
00459      *
00460      * @return 
00461      *   EventSet of uncontrollable events
00462      */
00463     EventSet UncontrollableEvents(void) const;
00464 
00465     /**
00466      * Add an existing observable event to generator. 
00467      * An entry in the global eventtable will be made.
00468      *
00469      * @param index
00470      *   Event index
00471      */
00472     void InsObservableEvent(Idx index);
00473 
00474     /**
00475      * Add new named observable event to generator. 
00476      * An entry in the global eventtable will be made if event is new.
00477      *
00478      * @param rName
00479      *   Name of the event to add
00480      *
00481      * @return 
00482      *   New global unique index
00483      */
00484     Idx InsObservableEvent(const std::string& rName);
00485     
00486     /**
00487      * Add an existing unobservable event to generator. 
00488      * An entry in the global eventtable will be made.
00489      *
00490      * @param index
00491      *   Event index
00492      */
00493     void InsUnobservableEvent(Idx index);
00494 
00495     /**
00496      * Add new named unobservable event to generator. 
00497      * An entry in the global eventtable will be made if event is new.
00498      *
00499      * @param rName
00500      *   Name of the event to add
00501      *
00502      * @return 
00503      *   New global unique index
00504      */
00505     Idx InsUnobservableEvent(const std::string& rName);
00506         
00507     /**
00508      * Mark event observable (by index)
00509      *
00510      * @param index
00511      *   Event index
00512      */
00513     void SetObservable(Idx index);
00514 
00515     /** 
00516      * Mark event observable (by name)
00517      *
00518      * @param rName
00519      *   Event name    
00520      */
00521     void SetObservable(const std::string& rName);
00522 
00523     /**
00524      * Mark set of events observable 
00525      *
00526      * @param rEvents
00527      *   EventSet
00528      */
00529     void SetObservable(const EventSet& rEvents);
00530         
00531     /**
00532      * Mark event unobservable (by index)
00533      * 
00534      * @param index
00535      *   Event index
00536      */
00537     void ClrObservable(Idx index);
00538 
00539     /**
00540      * Mark event unobservable (by name)
00541      * 
00542      * @param rName
00543      *   Event name
00544      */
00545     void ClrObservable(const std::string& rName);
00546 
00547     /**
00548      * Mark set of events unobservable 
00549      *
00550      * @param rEvents
00551      *   EventSet
00552      */
00553     void ClrObservable(const EventSet& rEvents);
00554           
00555     /**
00556      * Is event observable (by index)
00557      *
00558      * @param index
00559      *   Event index
00560      *
00561      * @return
00562      *   True / false
00563      */
00564     bool Observable(Idx index) const;
00565 
00566     /**
00567      * Is event observable (by name)
00568      *
00569      * @param rName
00570      *   Event name
00571      *
00572      * @return
00573      *   True / false
00574      */
00575     bool Observable(const std::string& rName) const;
00576 
00577     /** 
00578      * Get EventSet with observable events
00579      *
00580      * @return
00581      *   EventSet of controllable events
00582      */
00583     EventSet ObservableEvents(void) const;
00584 
00585     /**
00586      * Get EventSet with unobservable events
00587      *
00588      * @return 
00589      *   EventSet of uncontrollable events
00590      */
00591     EventSet UnobservableEvents(void) const;
00592 
00593     /**
00594      * Add an existing forcible event to generator. 
00595      * An entry in the global eventtable will be made.
00596      *
00597      * @param index
00598      *   Event index
00599      */
00600     void InsForcibleEvent(Idx index);
00601 
00602     /**
00603      * Add new named forcible event to generator. 
00604      * An entry in the global eventtable will be made if event is new.
00605      *
00606      * @param rName
00607      *   Name of the event to add
00608      *
00609      * @return 
00610      *   New global unique index
00611      */
00612     Idx InsForcibleEvent(const std::string& rName);
00613     
00614     /**
00615      * Add an existing unforcible event to generator. 
00616      * An entry in the global eventtable will be made.
00617      *
00618      * @param index
00619      *   Event index
00620      */
00621     void InsUnforcibleEvent(Idx index);
00622 
00623     /**
00624      * Add new named unforcible event to generator. 
00625      * An entry in the global eventtable will be made if event is new.
00626      *
00627      * @param rName
00628      *   Name of the event to add
00629      *
00630      * @return 
00631      *   New global unique index
00632      */
00633     Idx InsUnforcibleEvent(const std::string& rName);
00634         
00635     /**
00636      * Mark event forcible (by index)
00637      *
00638      * @param index
00639      *   Event index
00640      */
00641     void SetForcible(Idx index);
00642 
00643     /** 
00644      * Mark event forcible (by name)
00645      *
00646      * @param rName
00647      *   Event name    
00648      */
00649     void SetForcible(const std::string& rName);
00650 
00651     /**
00652      * Mark set of events forcible
00653      *
00654      * @param rEvents
00655      *   EventSet
00656      */
00657     void SetForcible(const EventSet& rEvents);
00658         
00659     /**
00660      * Mark event unforcible (by index)
00661      * 
00662      * @param index
00663      *   Event index
00664      */
00665     void ClrForcible(Idx index);
00666 
00667     /**
00668      * Mark event unforcible (by name)
00669      * 
00670      * @param rName
00671      *   Event name
00672      */
00673     void ClrForcible(const std::string& rName);
00674 
00675     /**
00676      * Mark set of events unforcible 
00677      *
00678      * @param rEvents
00679      *   EventSet
00680      */
00681     void ClrForcible(const EventSet& rEvents);
00682           
00683     /**
00684      * Is event forcible (by index)
00685      *
00686      * @param index
00687      *   Event index
00688      *
00689      * @return
00690      *   True / false
00691      */
00692     bool Forcible(Idx index) const;
00693 
00694     /**
00695      * Is event forcible (by name)
00696      *
00697      * @param rName
00698      *   Event name
00699      *
00700      * @return
00701      *   True / false
00702      */
00703     bool Forcible(const std::string& rName) const;
00704 
00705     /** 
00706      * Get EventSet with forcible events
00707      *
00708      * @return
00709      *   EventSet of controllable events
00710      */
00711     EventSet ForcibleEvents(void) const;
00712 
00713     /**
00714      * Get EventSet with unforcible events
00715      *
00716      * @return 
00717      *   EventSet of uncontrollable events
00718      */
00719     EventSet UnforcibleEvents(void) const;
00720 
00721     /**
00722      * Add an existing abstraction event to generator. 
00723      * An entry in the global eventtable will be made.
00724      *
00725      * @param index
00726      *   Event index
00727      */
00728     void InsHighlevelEvent(Idx index);
00729 
00730     /**
00731      * Add new named abstraction event to generator. 
00732      * An entry in the global eventtable will be made if event is new.
00733      *
00734      * @param rName
00735      *   Name of the event to add
00736      *
00737      * @return 
00738      *   New global unique index
00739      */
00740     Idx InsHighlevelEvent(const std::string& rName);
00741     
00742     /**
00743      * Add an existing low-level event to generator. 
00744      * An entry in the global eventtable will be made.
00745      *
00746      * @param index
00747      *   Event index
00748      */
00749     void InsLowlevelEvent(Idx index);
00750 
00751     /**
00752      * Add new named low-level event to generator. 
00753      * An entry in the global eventtable will be made if event is new.
00754      *
00755      * @param rName
00756      *   Name of the event to add
00757      *
00758      * @return 
00759      *   New global unique index
00760      */
00761     Idx InsLowlevelEvent(const std::string& rName);
00762         
00763     /**
00764      * Mark event as highlevel event (by index)
00765      *
00766      * @param index
00767      *   Event index
00768      */
00769     void SetHighlevel(Idx index);
00770 
00771     /** 
00772      * Mark event as highlevel event (by name)
00773      *
00774      * @param rName
00775      *   Event name    
00776      */
00777     void SetHighlevel(const std::string& rName);
00778 
00779     /**
00780      * Mark set of events as high-level events
00781      *
00782      * @param rEvents
00783      *   EventSet
00784      */
00785     void SetHighlevel(const EventSet& rEvents);
00786         
00787     /**
00788      * Mark event as low-level event (by index)
00789      * 
00790      * @param index
00791      *   Event index
00792      */
00793     void SetLowlevel(Idx index);
00794 
00795     /**
00796      * Mark event as low-level event (by name)
00797      * 
00798      * @param rName
00799      *   Event name
00800      */
00801     void SetLowlevel(const std::string& rName);
00802 
00803     /**
00804      * Mark set of events as low-level events.
00805      *
00806      * @param rEvents
00807      *   EventSet
00808      */
00809     void SetLowlevel(const EventSet& rEvents);
00810           
00811     /**
00812      * Test for high-level event  (by index)
00813      *
00814      * @param index
00815      *   Event index
00816      *
00817      * @return
00818      *   True / false
00819      */
00820     bool Highlevel(Idx index) const;
00821 
00822     /**
00823      * Test for high-level event  (by name)
00824      *
00825      * @param rName
00826      *   Event name
00827      *
00828      * @return
00829      *   True / false
00830      */
00831     bool Highlevel(const std::string& rName) const;
00832 
00833     /**
00834      * Test for low-level event  (by index)
00835      *
00836      * @param index
00837      *   Event index
00838      *
00839      * @return
00840      *   True / false
00841      */
00842     bool Lowlevel(Idx index) const;
00843 
00844     /**
00845      * Test for low-level event  (by name)
00846      *
00847      * @param rName
00848      *   Event name
00849      *
00850      * @return
00851      *   True / false
00852      */
00853     bool Lowlevel(const std::string& rName) const;
00854 
00855     /** 
00856      * Get EventSet of all high-level events
00857      *
00858      * @return
00859      *   EventSet of high-level events
00860      */
00861     EventSet HighlevelEvents(void) const;
00862 
00863     /**
00864      * Get EventSet of all low-level events
00865      *
00866      * @return 
00867      *   EventSet of low-level events
00868      */
00869     EventSet LowlevelEvents(void) const;
00870 
00871 
00872   private:
00873 
00874   protected:
00875 
00876 }; // end class TcGenerator
00877 
00878     
00879 /** Convenience typedef for std cGenerator */
00880 typedef TcGenerator<AttributeVoid, AttributeVoid, AttributeCFlags,AttributeVoid> cGenerator;
00881 
00882 /** Convenience typedef for generator vectors */
00883 typedef  TBaseVector<cGenerator> cGeneratorVector;  
00884 typedef  TBaseVector<cEventSet> cEventSetVector;  
00885 
00886 
00887 
00888 
00889 /*
00890 ***************************************************************************
00891 ***************************************************************************
00892 ***************************************************************************
00893 
00894 Implementation cgenerator
00895 
00896 ***************************************************************************
00897 ***************************************************************************
00898 ***************************************************************************
00899 */
00900 
00901 /* convenience access to relevant scopes */
00902 #define THIS TcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
00903 #define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
00904 #define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
00905 
00906 
00907 // TcGenerator(void)
00908 TEMP THIS::TcGenerator(void) : BASE() {
00909   FD_DG("TcGenerator(" << this << ")::TcGenerator()");
00910 }
00911 
00912 // TcGenerator(rOtherGen)
00913 TEMP THIS::TcGenerator(const TcGenerator& rOtherGen) : BASE(rOtherGen) {
00914   FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
00915 }
00916 
00917 // TcGenerator(rOtherGen)
00918 TEMP THIS::TcGenerator(const vGenerator& rOtherGen) : BASE(rOtherGen) {
00919   FD_DG("TcGenerator(" << this << ")::TcGenerator(rOtherGen)");
00920 }
00921 
00922 // TcGenerator(rFilename)
00923 TEMP THIS::TcGenerator(const std::string& rFileName) : BASE(rFileName) {
00924   FD_DG("TcGenerator(" << this << ")::TcGenerator(rFilename) : done");
00925 }
00926 
00927 
00928 // New
00929 TEMP THIS* THIS::New(void) const {
00930   // allocate
00931   THIS* res = new THIS;
00932   // fix base data
00933   res->EventSymbolTablep(BASE::mpEventSymbolTable);
00934   res->mStateNamesEnabled=BASE::mStateNamesEnabled;
00935   return res;
00936 }
00937 
00938 // Copy
00939 TEMP THIS* THIS::Copy(void) const {
00940   // allocate
00941   THIS* res = new THIS(*this);
00942   // done
00943   return res;
00944 }
00945 
00946 // NewCGen
00947 TEMP THIS THIS::NewCGen(void) const {
00948   // call base (fixes by assignment constructor)
00949   THIS res= BASE::NewAGen();
00950   return res;
00951 }
00952 
00953 
00954   // Controllable(index)
00955   TEMP bool THIS::Controllable(Idx index) const {
00956     EventAttr attr=BASE::EventAttribute(index);
00957     return attr.Controllable();
00958   } 
00959   
00960   // Controllable(rName)
00961   TEMP bool THIS::Controllable(const std::string& rName) const {
00962     EventAttr attr=BASE::EventAttribute(rName);
00963     return attr.Controllable();
00964   } 
00965   
00966   // InsControllableEvent(index)
00967   TEMP void THIS::InsControllableEvent(Idx index) {
00968     FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << index << ")");
00969     EventAttr attr;
00970     attr.SetControllable();
00971     BASE::InsEvent(index,attr);
00972   } 
00973 
00974   // InsControllableEvent(rName)
00975   TEMP Idx THIS::InsControllableEvent(const std::string& rName) {
00976     FD_DG("TcGenerator(" << this << ")::InsControllableEvent(" << rName << ")");
00977     EventAttr attr;
00978     attr.SetControllable();
00979     return BASE::InsEvent(rName,attr);
00980   } 
00981 
00982   // InsUncontrollableEvent(index)
00983   TEMP void THIS::InsUncontrollableEvent(Idx index) {
00984     FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << index << ")");
00985     EventAttr attr;
00986     attr.ClrControllable();
00987     BASE::InsEvent(index,attr);
00988   } 
00989 
00990   // InsUncontrollableEvent(rName)
00991   TEMP Idx THIS::InsUncontrollableEvent(const std::string& rName) {
00992     FD_DG("TcGenerator(" << this << ")::InsUncontrollableEvent(" << rName << ")");
00993     EventAttr attr;
00994     attr.ClrControllable();
00995     return BASE::InsEvent(rName,attr);
00996   } 
00997     
00998   // SetControllable(index)
00999   TEMP void THIS::SetControllable(Idx index) {
01000     FD_DG("TcGenerator(" << this << ")::SetControllable(" << index << ")");
01001     EventAttr attr=BASE::EventAttribute(index);
01002     attr.SetControllable();
01003     BASE::pAlphabet->Attribute(index,attr);
01004   } 
01005 
01006   // SetControllable(rName)
01007   TEMP void THIS::SetControllable(const std::string& rName) {
01008     FD_DG("TcGenerator(" << this << ")::SetControllable(" << rName << ")");
01009     Idx index = BASE::EventIndex(rName);
01010     SetControllable(index);
01011   }
01012 
01013   //SetControllable(rEvents)
01014   TEMP void THIS::SetControllable(const EventSet& rEvents) {
01015     FD_DG("TcGenerator(" << this << ")::SetControllable(rEvents)");
01016     EventSet::Iterator it;
01017     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01018       SetControllable(*it);
01019     }
01020   }
01021     
01022   // ClrControllable(index)
01023   TEMP void THIS::ClrControllable(Idx index) {
01024     FD_DG("TcGenerator(" << this << ")::ClrControllable(" << index << ")");
01025     EventAttr attr=BASE::EventAttribute(index);
01026     attr.ClrControllable();
01027     BASE::pAlphabet->Attribute(index,attr);
01028   } 
01029 
01030   // ClrControllable(rName)
01031   TEMP void THIS::ClrControllable(const std::string& rName) {
01032     FD_DG("TcGenerator(" << this << ")::ClrControllable(" << rName << ")");
01033     Idx index = BASE::EventIndex(rName);
01034     ClrControllable(index);
01035   }
01036 
01037   //ClrControllable(rEvents)
01038   TEMP void THIS::ClrControllable(const EventSet& rEvents) {
01039     FD_DG("TcGenerator(" << this << ")::ClrControllable(rEvents)");
01040     EventSet::Iterator it;
01041     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01042       ClrControllable(*it);
01043     }
01044   }
01045 
01046   //ControllableEvents()
01047   TEMP EventSet THIS::ControllableEvents(void) const {
01048     FD_DG("TcGenerator(" << this << ")::ControllableEvents()");
01049     EventSet res;
01050     EventSet::Iterator it;
01051     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01052       if(Controllable(*it)) res.Insert(*it);
01053     }
01054     return res;
01055   }
01056   
01057   //UncontrollableEvents()
01058   TEMP
01059     EventSet THIS::UncontrollableEvents(void) const {
01060     FD_DG("TcGenerator(" << this << ")::UncontrollableEvents()");
01061     EventSet res;
01062     EventSet::Iterator it;
01063     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01064       if(!Controllable(*it)) res.Insert(*it);
01065     }
01066     return res;
01067   }
01068   
01069   // Observable(index)
01070   TEMP bool THIS::Observable(Idx index) const {
01071     EventAttr attr=BASE::EventAttribute(index);
01072     return attr.Observable();
01073   } 
01074   
01075   // Observable(rName)
01076   TEMP bool THIS::Observable(const std::string& rName) const {
01077     EventAttr attr=BASE::EventAttribute(rName);
01078     return attr.Observable();
01079   } 
01080   
01081   // InsObservableEvent(index)
01082   TEMP void THIS::InsObservableEvent(Idx index) {
01083     FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << index << ")");
01084     EventAttr attr;
01085     attr.SetObservable();
01086     BASE::InsEvent(index,attr);
01087   } 
01088 
01089   // InsObservableEvent(rName)
01090   TEMP Idx THIS::InsObservableEvent(const std::string& rName) {
01091     FD_DG("TcGenerator(" << this << ")::InsObservableEvent(" << rName << ")");
01092     EventAttr attr;
01093     attr.SetObservable();
01094     return BASE::InsEvent(rName,attr);
01095   } 
01096 
01097   // InsUnobservableEvent(index)
01098   TEMP void THIS::InsUnobservableEvent(Idx index) {
01099     FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << index << ")");
01100     EventAttr attr;
01101     attr.ClrObservable();
01102     BASE::InsEvent(index,attr);
01103   } 
01104 
01105   // InsUnobservableEvent(rName)
01106   TEMP Idx THIS::InsUnobservableEvent(const std::string& rName) {
01107     FD_DG("TcGenerator(" << this << ")::InsUnobservableEvent(" << rName << ")");
01108     EventAttr attr;
01109     attr.ClrObservable();
01110     return BASE::InsEvent(rName,attr);
01111   } 
01112     
01113   // SetObservable(index)
01114   TEMP void THIS::SetObservable(Idx index) {
01115     FD_DG("TcGenerator(" << this << ")::SetObservable(" << index << ")");
01116     EventAttr attr=BASE::EventAttribute(index);
01117     attr.SetObservable();
01118     BASE::pAlphabet->Attribute(index,attr);
01119   } 
01120 
01121   // SetObservable(rName)
01122   TEMP void THIS::SetObservable(const std::string& rName) {
01123     FD_DG("TcGenerator(" << this << ")::SetObservable(" << rName << ")");
01124     Idx index = BASE::EventIndex(rName);
01125     SetObservable(index);
01126   }
01127 
01128   //SetObservable(rEvents)
01129   TEMP void THIS::SetObservable(const EventSet& rEvents) {
01130     FD_DG("TcGenerator(" << this << ")::SetObservable(rEvents)");
01131     EventSet::Iterator it;
01132     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01133       SetObservable(*it);
01134     }
01135   }
01136     
01137   // ClrObservable(index)
01138   TEMP void THIS::ClrObservable(Idx index) {
01139     FD_DG("TcGenerator(" << this << ")::ClrObservable(" << index << ")");
01140     EventAttr attr=BASE::EventAttribute(index);
01141     attr.ClrObservable();
01142     BASE::pAlphabet->Attribute(index,attr);
01143   } 
01144 
01145   // ClrObservable(rName)
01146   TEMP void THIS::ClrObservable(const std::string& rName) {
01147     FD_DG("TcGenerator(" << this << ")::ClrObservable(" << rName << ")");
01148     Idx index = BASE::EventIndex(rName);
01149     ClrObservable(index);
01150   }
01151 
01152   //ClrObservable(rEvents)
01153   TEMP void THIS::ClrObservable(const EventSet& rEvents) {
01154     FD_DG("TcGenerator(" << this << ")::ClrObservable(rEvents)");
01155     EventSet::Iterator it;
01156     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01157       ClrObservable(*it);
01158     }
01159   }
01160 
01161   //ObservableEvents()
01162   TEMP EventSet THIS::ObservableEvents(void) const {
01163     FD_DG("TcGenerator(" << this << ")::ObservableEvents()");
01164     EventSet res;
01165     EventSet::Iterator it;
01166     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01167       if(Observable(*it)) res.Insert(*it);
01168     }
01169     return res;
01170   }
01171   
01172   //UnobservableEvents()
01173   TEMP
01174     EventSet THIS::UnobservableEvents(void) const {
01175     FD_DG("TcGenerator(" << this << ")::UnobservableEvents()");
01176     EventSet res;
01177     EventSet::Iterator it;
01178     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01179       if(!Observable(*it)) res.Insert(*it);
01180     }
01181     return res;
01182   }
01183   
01184 
01185   //Forcible(index)
01186   TEMP bool THIS::Forcible(Idx index) const {
01187     EventAttr attr=BASE::EventAttribute(index);
01188     return attr.Forcible();
01189   } 
01190   
01191   // Forcible(rName)
01192   TEMP bool THIS::Forcible(const std::string& rName) const {
01193     EventAttr attr=BASE::EventAttribute(rName);
01194     return attr.Forcible();
01195   } 
01196   
01197   // InsForcibleEvent(index)
01198   TEMP void THIS::InsForcibleEvent(Idx index) {
01199     FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << index << ")");
01200     EventAttr attr;
01201     attr.SetForcible();
01202     BASE::InsEvent(index,attr);
01203   } 
01204 
01205   // InsForcibleEvent(rName)
01206   TEMP Idx THIS::InsForcibleEvent(const std::string& rName) {
01207     FD_DG("TcGenerator(" << this << ")::InsForcibleEvent(" << rName << ")");
01208     EventAttr attr;
01209     attr.SetForcible();
01210     return BASE::InsEvent(rName,attr);
01211   } 
01212 
01213   // InsUnforcibleEvent(index)
01214   TEMP void THIS::InsUnforcibleEvent(Idx index) {
01215     FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << index << ")");
01216     EventAttr attr;
01217     attr.ClrForcible();
01218     BASE::InsEvent(index,attr);
01219   } 
01220 
01221   // InsUnforcibleEvent(rName)
01222   TEMP Idx THIS::InsUnforcibleEvent(const std::string& rName) {
01223     FD_DG("TcGenerator(" << this << ")::InsUnforcibleEvent(" << rName << ")");
01224     EventAttr attr;
01225     attr.ClrForcible();
01226     return BASE::InsEvent(rName,attr);
01227   } 
01228     
01229   // SetForcible(index)
01230   TEMP void THIS::SetForcible(Idx index) {
01231     FD_DG("TcGenerator(" << this << ")::SetForcible(" << index << ")");
01232     EventAttr attr=BASE::EventAttribute(index);
01233     attr.SetForcible();
01234     BASE::pAlphabet->Attribute(index,attr);
01235   } 
01236 
01237   // SetForcible(rName)
01238   TEMP void THIS::SetForcible(const std::string& rName) {
01239     FD_DG("TcGenerator(" << this << ")::SetForcible(" << rName << ")");
01240     Idx index = BASE::EventIndex(rName);
01241     SetForcible(index);
01242   }
01243 
01244   //SetForcible(rEvents)
01245   TEMP void THIS::SetForcible(const EventSet& rEvents) {
01246     FD_DG("TcGenerator(" << this << ")::SetForcible(rEvents)");
01247     EventSet::Iterator it;
01248     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01249       SetForcible(*it);
01250     }
01251   }
01252     
01253   // ClrForcible(index)
01254   TEMP void THIS::ClrForcible(Idx index) {
01255     FD_DG("TcGenerator(" << this << ")::ClrForcible(" << index << ")");
01256     EventAttr attr=BASE::EventAttribute(index);
01257     attr.ClrForcible();
01258     BASE::pAlphabet->Attribute(index,attr);
01259   } 
01260 
01261   // ClrForcible(rName)
01262   TEMP void THIS::ClrForcible(const std::string& rName) {
01263     FD_DG("TcGenerator(" << this << ")::ClrForcible(" << rName << ")");
01264     Idx index = BASE::EventIndex(rName);
01265     ClrForcible(index);
01266   }
01267 
01268   //ClrForcible(rEvents)
01269   TEMP void THIS::ClrForcible(const EventSet& rEvents) {
01270     FD_DG("TcGenerator(" << this << ")::ClrForcible(rEvents)");
01271     EventSet::Iterator it;
01272     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01273       ClrForcible(*it);
01274     }
01275   }
01276 
01277   //ForcibleEvents()
01278   TEMP EventSet THIS::ForcibleEvents(void) const {
01279     FD_DG("TcGenerator(" << this << ")::ForcibleEvents()");
01280     EventSet res;
01281     EventSet::Iterator it;
01282     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01283       if(Forcible(*it)) res.Insert(*it);
01284     }
01285     return res;
01286   }
01287   
01288   //UnforcibleEvents()
01289   TEMP
01290     EventSet THIS::UnforcibleEvents(void) const {
01291     FD_DG("TcGenerator(" << this << ")::UnforcibleEvents()");
01292     EventSet res;
01293     EventSet::Iterator it;
01294     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01295       if(!Forcible(*it)) res.Insert(*it);
01296     }
01297     return res;
01298   }
01299   
01300 
01301   //Highlevel(index)
01302   TEMP bool THIS::Highlevel(Idx index) const {
01303     EventAttr attr=BASE::EventAttribute(index);
01304     return attr.Highlevel();
01305   } 
01306   
01307   // Highlevel(rName)
01308   TEMP bool THIS::Highlevel(const std::string& rName) const {
01309     EventAttr attr=BASE::EventAttribute(rName);
01310     return attr.Highlevel();
01311   } 
01312   
01313   //Lowlevel(index)
01314   TEMP bool THIS::Lowlevel(Idx index) const {
01315     EventAttr attr=BASE::EventAttribute(index);
01316     return attr.Lowlevel();
01317   } 
01318   
01319   // Lowlevel(rName)
01320   TEMP bool THIS::Lowlevel(const std::string& rName) const {
01321     EventAttr attr=BASE::EventAttribute(rName);
01322     return attr.Lowlevel();
01323   } 
01324   
01325   // InsHighlevelEvent(index)
01326   TEMP void THIS::InsHighlevelEvent(Idx index) {
01327     FD_DG("TcGenerator(" << this << ")::InsHighlevelEvent(" << index << ")");
01328     EventAttr attr;
01329     attr.SetHighlevel();
01330     BASE::InsEvent(index,attr);
01331   } 
01332 
01333   // InsHighlevelEvent(rName)
01334   TEMP Idx THIS::InsHighlevelEvent(const std::string& rName) {
01335     FD_DG("TcGenerator(" << this << ")::InsHighlevelEvent(" << rName << ")");
01336     EventAttr attr;
01337     attr.SetHighlevel();
01338     return BASE::InsEvent(rName,attr);
01339   } 
01340 
01341   // InsLowlevelEvent(index)
01342   TEMP void THIS::InsLowlevelEvent(Idx index) {
01343     FD_DG("TcGenerator(" << this << ")::InsLowlevelEvent(" << index << ")");
01344     EventAttr attr;
01345     attr.SetLowlevel();
01346     BASE::InsEvent(index,attr);
01347   } 
01348 
01349   // InsLowlevelEvent(rName)
01350   TEMP Idx THIS::InsLowlevelEvent(const std::string& rName) {
01351     FD_DG("TcGenerator(" << this << ")::InsLowlevelEvent(" << rName << ")");
01352     EventAttr attr;
01353     attr.SetLowlevel();
01354     return BASE::InsEvent(rName,attr);
01355   } 
01356     
01357   // SetHighlevel(index)
01358   TEMP void THIS::SetHighlevel(Idx index) {
01359     FD_DG("TcGenerator(" << this << ")::SetHighlevel(" << index << ")");
01360     EventAttr attr=BASE::EventAttribute(index);
01361     attr.SetHighlevel();
01362     BASE::pAlphabet->Attribute(index,attr);
01363   } 
01364 
01365   // SetHighlevel(rName)
01366   TEMP void THIS::SetHighlevel(const std::string& rName) {
01367     FD_DG("TcGenerator(" << this << ")::SetHighlevel(" << rName << ")");
01368     Idx index = BASE::EventIndex(rName);
01369     SetHighlevel(index);
01370   }
01371 
01372   //SetHighlevel(rEvents)
01373   TEMP void THIS::SetHighlevel(const EventSet& rEvents) {
01374     FD_DG("TcGenerator(" << this << ")::SetHighlevel(rEvents)");
01375     EventSet::Iterator it;
01376     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01377       SetHighlevel(*it);
01378     }
01379   }
01380     
01381   // SetLowlevel(index)
01382   TEMP void THIS::SetLowlevel(Idx index) {
01383     FD_DG("TcGenerator(" << this << ")::SetLowlevel(" << index << ")");
01384     EventAttr attr=BASE::EventAttribute(index);
01385     attr.SetLowlevel();
01386     BASE::pAlphabet->Attribute(index,attr);
01387   } 
01388 
01389   // SetLowlevel(rName)
01390   TEMP void THIS::SetLowlevel(const std::string& rName) {
01391     FD_DG("TcGenerator(" << this << ")::SetLowlevel(" << rName << ")");
01392     Idx index = BASE::EventIndex(rName);
01393     SetLowlevel(index);
01394   }
01395 
01396   //SetLowlevel(rEvents)
01397   TEMP void THIS::SetLowlevel(const EventSet& rEvents) {
01398     FD_DG("TcGenerator(" << this << ")::SetLowlevel(rEvents)");
01399     EventSet::Iterator it;
01400     for(it=rEvents.Begin(); it!=rEvents.End(); it++) {
01401       SetLowlevel(*it);
01402     }
01403   }
01404 
01405   //HighlevelEvents()
01406   TEMP EventSet THIS::HighlevelEvents(void) const {
01407     FD_DG("TcGenerator(" << this << ")::HighlevelEvents()");
01408     EventSet res;
01409     EventSet::Iterator it;
01410     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01411       if(Highlevel(*it)) res.Insert(*it);
01412     }
01413     return res;
01414   }
01415   
01416   //LowlevelEvents()
01417   TEMP
01418     EventSet THIS::LowlevelEvents(void) const {
01419     FD_DG("TcGenerator(" << this << ")::LowlevelEvents()");
01420     EventSet res;
01421     EventSet::Iterator it;
01422     for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
01423       if(Lowlevel(*it)) res.Insert(*it);
01424     }
01425     return res;
01426   }
01427   
01428 
01429 
01430 #undef TEMP
01431 #undef BASE
01432 #undef THIS
01433 
01434  
01435 } // namespace faudes
01436 
01437 #endif
01438 

libFAUDES 2.18b --- 2010-12-17 --- c++ source docu by doxygen 1.6.3