cfl_generator.h

Go to the documentation of this file.
00001 /** @file cfl_generator.h Class vGenerator */
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 MERCANTABILITY or FITNES 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_VGENERATOR_H
00025 #define FAUDES_VGENERATOR_H
00026 
00027 #include "cfl_definitions.h"
00028 #include "cfl_exception.h"
00029 #include "cfl_types.h"
00030 #include "cfl_symboltable.h"
00031 #include "cfl_indexset.h"
00032 #include "cfl_nameset.h"
00033 #include "cfl_transset.h"
00034 #include "cfl_token.h"
00035 #include "cfl_tokenreader.h"
00036 #include "cfl_tokenwriter.h"
00037 
00038 #include <map>
00039 #include <set>
00040 #include <sstream>
00041 #include <cstdlib>
00042 #include <cassert>
00043 
00044 namespace faudes {
00045 
00046 /**
00047  * Base class of all FAUDES generators.
00048  * 
00049  * \section GeneratorMembers Overview
00050  *
00051  * The faudes::vGenerator models the plain five-tupel G = (X, Sigma, Delta, X_0, X_m) to represent
00052  * the marked language L(G) and closed language L_m(G), respectively. It provides read and write
00053  * access to core menbers, e.g. methods for inserting/deleting events, states 
00054  * and transitions. 
00055  *
00056  *
00057  * States, events and transitions in a generator can be addressed in three alternative methods:
00058  *
00059  * - by index, involves a search on a sorted set (efficient)
00060  * - by name, involves two searches on sorted sets (not quite so efficient)
00061  * - by iterator, involves pointer dereferencing  (very efficient)
00062  *
00063  * For read access, const refererences to sets are provided. In order to allow for consistency checks,
00064  * write access is via generator methods only. When the compiletime option FAUDES_CHECKED is 
00065  * defined, write methods throw an exception on inconsistent data, eg. setting an initial state
00066  * that is not an element of the state set, or introducing a transition with an event label that
00067  * is not in the alphabet. 
00068  *
00069  *
00070  * \section SecEventsVersusStates Events Versus States
00071  *
00072  * While both, events and states, are represented by the integer type faudes::Idx, there
00073  * is a fundamental distinction between both, which stems from the design choice to use generators
00074  * as a tool to represent formal languages. From this perspective, events are global enteties while states
00075  * are local to the respective generator. Any two events within libFAUDES are related while states only 
00076  * compare within a generator. 
00077  *
00078  * In consequence, there is global sybmoltable for event name resolution, 
00079  * while there is one local state symboltable for 
00080  * each generator. Furthermore, state names are considered cosmetic and hence are optional, while
00081  * event names are mandatory. 
00082  *
00083  * Example: two machines both refer to the event name "alpha" that models the process of passing 
00084  * a workpiece from one machine to the other. In libFAUDES this is indeed modelled as one event 
00085  * which is represented by one index. However, both machines may have a state "Idle" which indicates
00086  * that the respective machine is idle. In libFAUDES the two states are treated locally to the
00087  * generators and whether or not they have the same index is regarded irrelevant.
00088  * 
00089  * The generator class carries a flag to indicate that functions with result type
00090  * generator shall attach names to the newly created states, based on the state names
00091  * of the respective arguments. Turning of this feature and avoiding state names alltogether
00092  * considerably increases libFAUDES performance.
00093  *
00094  * \section GeneratorFileFormat File I/O (default format)
00095  *
00096  * Generators inherit the standard token IO interface from the libFAUDES general purpose base Type, 
00097  * so you may use Read and Write functions for generators. The file-format consists of a generator 
00098  * section that includes one subsection for each core member. It is illustrated by the below example
00099  * 
00100  * @code
00101  * <Generator>
00102  * % libFAUDES Generator for the simple machine
00103  * "simple machine"                   
00104  *
00105  * <Alphabet>                         
00106  * "alpha" "beta" "mue" "lambda"      
00107  * </Alphabet>
00108  *
00109  * <States>                           
00110  * "idle" "busy" "down"
00111  * </States>
00112  *
00113  * <TransRel>
00114  * "idle" "alpha" "busy"
00115  * "busy" "beta" "idle"
00116  * "busy" "mue" "down"
00117  * "down" "lambda" "idle"
00118  * </TransRel>
00119  * 
00120  * <InitStates>
00121  * "idle"
00122  * </InitStates>
00123  * 
00124  * <MarkedStates>
00125  * "idle"
00126  * </MarkedStates>
00127  * </Generator>
00128  * @endcode
00129  *
00130  * Technical Detail: Since symbolic state names are optional, states may alternatively be represented
00131  * by their index. In order to consitently read a generator from a token stream, the convention
00132  * was introduced that states are indexed consecutively starting from 1. This convention
00133  * produces nice and human-readable output. However, it requires a re-indexing when writing 
00134  * the generator. As of libFAUDES 2.20j, the token format was extended to allow for explicit 
00135  * symbol table entries in the format "symbolic_state_name#index". Whether or not re-indexing
00136  * is applied can be configured via ReindexOnWrite(bool). The default is not to re-index.
00137  * If you want to read your token stream with libFAUDES pre 2.20j, you must turn
00138  * re-index on.
00139  * 
00140  * \section GeneratorFileFormat File I/O (XML file-format)
00141  *
00142  * The alternative file file format prodiced by XWrite() is meant to accomodate
00143  * for additional attributes attached to states, events and transitions, including e.g.
00144  * graph data for a graphical representation. It starts with the outer element "Generator" which optionally
00145  * has a name and a type attribute. 
00146  *
00147  *
00148  * @code
00149  * <Generator name="simpla machine>
00150  * <Alphabet>                         
00151  * <Event name="alpha"/>
00152  * <Event name="beta"/>
00153  * <Event name="mue"/>
00154  * <Event name="lambda"/>
00155  * </Alphabet>
00156  *
00157  * <StateSet>                           
00158  * <State name="idle" id="1">
00159      <Marked/><Initial/>
00160    <State/>
00161  * <State name="busy" id="2"/>
00162  * <State name="down" id="3"/>
00163  * </StateSet>
00164  *
00165  * <TransitionRelation>
00166  * <Transition x1="1" event="alphs" x2="2"/>
00167  * <Transition x1="2" event="beta" x2="2"/>
00168  * <Transition x1="2" event="mue" x2="3"/>
00169  * <Transition x1="3" event="lambda" x2="1"/>
00170  * <TransitionRelation/>
00171  *
00172  * </Generator>
00173  * @endcode
00174  *
00175  *
00176  * \section GeneratorAttributes Attributes
00177  *
00178  * libFAUDES generators provide an interface to access so called attributes, ie data that 
00179  * is optionally attached to individual states, events, transitions, or globally to the generator.
00180  *
00181  * The faudes::Generator's interface to attributes is abstract in the sense that a generator 
00182  * is not aware of the actual type of its attributes. 
00183  * Instances of the class Generator indeed have trivial attributes that hold no data at all. 
00184  * To use attributes, you are meant to instantiate objects of the derived class TaGenerator 
00185  * with template parameters to specify attribute types. Basic algorithms 
00186  * implemented for plain generators will accept attributed generators as arguments. Such algorithms may 
00187  * occasionally inspect or set attributes using the abstract interface and C++ dynamic casts. For
00188  * specialised algorithms that refer to extended generator semantics, we recommend derived 
00189  * generator classes as argument type.
00190  *
00191  *
00192  * @ingroup GeneratorClasses
00193  */
00194 
00195 
00196 class vGenerator : public Type  {
00197 
00198  public:
00199     
00200   /** @name Constructors & Destructor */
00201   /** @{ doxygen group */
00202 
00203   /**
00204    * Default constructor
00205    */
00206   vGenerator(void);
00207 
00208   /**
00209    * Copy-constructror
00210    */
00211   vGenerator(const vGenerator& rOtherGen);
00212 
00213   /**
00214    * Construct from file. This constructor
00215    * effectively uses the DoRead(TokenReader&) function to read.
00216    *
00217    * @param rFileName
00218    *   Name of file
00219    *
00220    * @exception Exception
00221    *   - IO errors (id 1)
00222    *   - Token mismatch (id 50, 51, 52, 80, 85)
00223    */
00224   vGenerator(const std::string& rFileName);
00225 
00226   /**
00227    * Construct on heap. 
00228    * Technically not a constructor, this function creates a vGenerator with the
00229    * same event symboltable. It is the callers responsebilty to delete the object 
00230    * when no longer needed. Derived classes must reimplement
00231    * this function to create an object of the same class and the same event 
00232    * symboltable. 
00233    *
00234    * @return 
00235    *   New vGenerator 
00236    */
00237   virtual vGenerator* New(void) const;
00238 
00239   /**
00240    * Construct copy on heap. 
00241    * Technically not a constructor, this function creates a vGenerator with the
00242    * same event symboltable. It is the callers responsebilty to delete the object 
00243    * when no longer needed. Derived classes must reimplement
00244    * this function to create an object of the same class and the same event 
00245    * symboltable. 
00246    *
00247    * @return 
00248    *   New vGenerator 
00249    */
00250   virtual vGenerator* Copy(void) const;
00251 
00252   /**
00253    * Type test.
00254    * Uses C++ dynamic cast to test whether the specified object
00255    * casts to a vGenerator.
00256    *
00257    * @return 
00258    *   vGenerator reference if dynamic cast succeeds, else NULL 
00259    */
00260   virtual const Type* Cast(const Type* pOther) const;
00261 
00262   /**
00263    * Destructor 
00264    */
00265   virtual ~vGenerator(void);
00266 
00267   /** @} doxygen group */
00268 
00269   /*****************************************
00270    *****************************************
00271    *****************************************
00272    *****************************************/
00273 
00274   /** @name Copy and Assignment */
00275   /** @{ doxygen group */
00276 
00277 
00278   /**
00279    * Copy from other vGenerator. 
00280    * The current implementation tries to be smart and copies attributes
00281    * if types can be casted. Use AssignWithoutAttributes to 
00282    * explicitely ignore attributes.
00283    *
00284    * @param rSrc
00285    *   Source to copy from.
00286    */
00287   virtual vGenerator& Assign(const vGenerator& rSrc); 
00288 
00289   /**
00290    * Copy from other faudes type.
00291    * The current implementation tests whether the source
00292    * object can be casted to a generator and then performs
00293    * the according assignment. 
00294    *
00295    * @param rSrc
00296    *   Source to copy from.
00297    */
00298   virtual vGenerator& Assign(const Type& rSrc); 
00299 
00300   /**
00301    * Copy from other vGenerator, ignore attributes. 
00302    *
00303    * @param rGen
00304    *   Source to copy from.
00305    */
00306   virtual vGenerator& AssignWithoutAttributes(const vGenerator& rGen); 
00307 
00308   /**
00309    * Destructive copy to other vGenerator. 
00310    * Copy method with increased performance at the cost of invalidating
00311    * the source data. If attribute types of source and destination differ,
00312    * a std copy is invoked.
00313    * 
00314    *
00315    * @param rGen
00316    *   Destination for copy operation.
00317    */
00318   virtual void Move(vGenerator& rGen); 
00319 
00320   /**
00321    * Assignment operator (uses Assign method)
00322    * Note: you must reimplement this operator in derived 
00323    * classes in order to handle internal pointers correctly.
00324    *
00325    * @param rOtherGen
00326    *   Other generator
00327    */
00328   virtual vGenerator& operator= (const vGenerator& rOtherGen);
00329 
00330   /**
00331    * Create another version of this generator.
00332    * Assembles a copy of this generator, however, with versioned events.
00333    * The new event names are created by appending an underscore and a specified string.
00334    * State names and indices as well as any attributes are maintained.
00335    *
00336    * @param rVersion
00337    *   String value to be appended to event names
00338    * @param rResGen
00339    *   Resulting versioned generator
00340    *
00341    * @exception Exception
00342    *   - Source must not match destination (id 96)
00343    */
00344   virtual void Version(const std::string& rVersion, vGenerator& rResGen) const;
00345 
00346   /**
00347    * Create another version of this generator.
00348    * Assembles a copy of this generator, however, with versioned events.
00349    * The new event names are created by appending an underscore and a numeric index.
00350    * State names and indices as well as any attributes are maintained.
00351    *
00352    * @param version
00353    *   Numeric value to be appended to event names
00354    * @param rResGen
00355    *   Resulting versioned generator
00356    * @exception Exception
00357    *   - Source must not match destination (id 96)
00358    */
00359   virtual void Version(Idx version, vGenerator& rResGen) const;
00360 
00361   /**
00362    * Create another version of this generator.
00363    * Assembles a copy of this generator, however, with versioned events.
00364    * The new event names are created by replacing all substrings matching
00365    * a specified string pattern by a replacement string.
00366    * State names and indices as well as any attributes are maintained.
00367    *
00368    * @param rPattern
00369    *   String value to be replaced in event names
00370    * @param rReplacement
00371    *   String value to be inserted in event names in place of rPattern
00372    * @param rResGen
00373    *   Resulting versioned generator
00374    * @exception Exception
00375    *   - Source must not match destination (id 96)
00376    */
00377   virtual void Version(const std::string& rPattern,const std::string& rReplacement, vGenerator& rResGen) const;
00378 
00379 
00380 
00381   /** @} doxygen group */
00382 
00383 
00384   /*****************************************
00385    *****************************************
00386    *****************************************
00387    *****************************************/
00388 
00389   /** @name Basic Maintenance */
00390   /** @{ doxygen group */
00391 
00392 
00393   /** 
00394    * Set the generator's name 
00395    *
00396    * @param rName
00397    *   Generator name
00398    */
00399   void Name(const std::string& rName);
00400 
00401   /** 
00402    * Get generator's name 
00403    *
00404    * @return 
00405    *   Name of generator
00406    */
00407   const std::string& Name(void) const;
00408 
00409  /** 
00410    * Check if generator is valid. 
00411    * Performs internal consistency tests, This method is intendend
00412    * to test generators that have been manipulated by methods without
00413    * consistency tests, eg InjectAlphabet.
00414    *
00415    * @return 
00416    *   True for success
00417    */
00418   virtual bool Valid(void);
00419 
00420   /**
00421    * Clear generator data. 
00422    * Clears state set, alphabet and transitionrealtion. Behavioural flags
00423    * eg StateNamesEnabled are maintained.
00424    */
00425   virtual void Clear(void);
00426 
00427 
00428   /**
00429    * Clear all states and transitions, maintain alphabet.
00430    */
00431   void ClearStates(void);
00432 
00433   /**
00434    * Get number of events in alphabet
00435    *
00436    * @return
00437    *   Number of events
00438    */
00439   Idx AlphabetSize(void) const;
00440 
00441   /** 
00442    * Get generator size (number of states) 
00443    * 
00444    * @return 
00445    *   Number of states
00446    */
00447   Idx Size(void) const;
00448 
00449   /**
00450    * Get number of transitions
00451    *
00452    * @return
00453    *   Number of transitions
00454    */
00455   Idx TransRelSize(void) const;
00456 
00457   /**
00458    * Get number of initial states
00459    *
00460    * @return
00461    *   Number of initial states
00462    */
00463   Idx InitStatesSize(void) const;
00464 
00465   /**
00466    * Get number of marked states
00467    *
00468    * @return
00469    *   Number of marked states
00470    */
00471   Idx MarkedStatesSize(void) const;
00472 
00473   /** 
00474    * Check if generator is empty (no states)
00475    *
00476    * @return 
00477    *   True if state set is empty
00478    */
00479   bool Empty(void) const;
00480 
00481   /**
00482    * Check if alphabet is Empty
00483    *
00484    * @return
00485    *   True if mpAlphabet is empty
00486    */
00487   bool AlphabetEmpty(void) const;
00488 
00489   /**
00490    * Check if transition relation is empty
00491    *
00492    * @return
00493    *   True if transition relation is empty
00494    */
00495   bool TransRelEmpty(void) const;
00496 
00497   /**
00498    * Check if set of initial states are empty
00499    *
00500    * @return
00501    *   True if mInitStates is empty
00502    */
00503   bool InitStatesEmpty(void) const;
00504 
00505   /**
00506    * Check if set of marked states are empty
00507    *
00508    * @return
00509    *   True if mMarkedStates is empty
00510    */
00511   bool MarkedStatesEmpty(void) const;
00512 
00513 
00514   /** @} doxygen group */
00515 
00516   /*****************************************
00517    *****************************************
00518    *****************************************
00519    *****************************************/
00520 
00521   /** @name Event Symboltable */
00522   /** @{ doxygen group */
00523 
00524   /**
00525    * Get Pointer to EventSymbolTable currently used
00526    * by this vGenerator. 
00527    *
00528    * @return
00529    *   Pointer to EventSymbolTable
00530    */
00531   SymbolTable* EventSymbolTablep(void) const;
00532 
00533   /**
00534    * Set EventSymbolTable to be used by this vGenerator. 
00535    * This function sets the reference to the event symboltable. The current implementation
00536    * in derived classes clears the generator, future versions may implement a re-indexing.
00537    *
00538    * @param pSymTab
00539    *   Pointer to SymbolTable
00540    */
00541   virtual void EventSymbolTablep(SymbolTable* pSymTab);
00542 
00543   /**
00544    * Set EventSymbolTable as given by rOtherGen. 
00545    * This function sets the reference to the event symboltable. The current implementation
00546    * clears the generator, future versions may implement a re-indexing.
00547    *
00548    * @param rOtherGen
00549    *   Other generator 
00550    *   
00551    */
00552   virtual void EventSymbolTablep(const vGenerator& rOtherGen);
00553 
00554   /**
00555    * Create EventSet with generator's EventSymbolTable (on stack).
00556    *
00557    * @return
00558    *   New empty EventSet on stack
00559    */
00560   EventSet NewEventSet(void) const;
00561 
00562   /**
00563    * Create EventSet with generator's EventSymbolTable (on heap). 
00564    *
00565    * @return
00566    *   Pointer to new empty EventSet on heap
00567    */
00568   EventSet* NewEventSetp(void) const;
00569 
00570   /**
00571    * Event index lookup 
00572    * 
00573    * @param rName
00574    *    Name of event to lookup
00575    *
00576    * @return 
00577    *   Valid index or 0 if name unknown to symboltable
00578    */
00579   Idx EventIndex(const std::string& rName) const;
00580 
00581   /** 
00582    * Event name lookup 
00583    *
00584    * @param index
00585    *   Index of event to look up
00586    *
00587    * @return 
00588    *   Name or empty std::string if non-existent
00589    */
00590   std::string EventName(Idx index) const;
00591 
00592   /**
00593    * Set name for existing event
00594    *
00595    * Note: since the event symboltable is global, this affect all
00596    * generators that refer to the specified event.
00597    *
00598    * @param index
00599    *   Event index
00600    * @param rName
00601    *   New name
00602    *
00603    * @exception Exception
00604    *   - index not found in EventSymbolMap (id 42)
00605    *   - name already associated with another index (id 44)
00606    *   - event does not exist in generator (id 89)
00607    */
00608   void EventName(Idx index, const std::string& rName);
00609 
00610   /** 
00611    * Create a new unique symbolic event name.
00612    * See also SymbolTable::UniqueSymbol().
00613    *
00614    * @param rName
00615    *   suggestion for new state name
00616    */
00617   std::string UniqueEventName(const std::string& rName) const;
00618 
00619 
00620   /** 
00621    * Rename event in this generator.
00622    * This method renames the specified event. It does so by
00623    * removing and adding transitions. This does not
00624    * effect other generators. 
00625    *
00626    * @param event
00627    *   Event to rename
00628    * @param rNewName
00629    *   New name
00630    * @return
00631    *   True, if the new name did already exist
00632    *
00633    * @exception Exception
00634    *   - specified event does not exist (id 89)
00635    */
00636   bool EventRename(Idx event, const std::string& rNewName);
00637 
00638 
00639   /** 
00640    * Rename event in this generator.
00641    * Convenience wrapper for EventRename(Idx, const std::string&).
00642    *
00643    * @param event
00644    *   Event to rename
00645    * @param rNewName
00646    *   New name
00647    * @return
00648    *   True, if the new name did already exist
00649    *
00650    * @exception Exception
00651    *   - specified event does not exist (id 89)
00652    */
00653   bool EventRename(const std::string& rOldName, const std::string& rNewName);
00654 
00655 
00656   /** @} doxygen group */
00657 
00658   /* statics outside doxygen group */
00659 
00660   /**
00661    * Get Pointer to global EventSymbolTable. This is
00662    * a static member of SymbolTable and used as default
00663    * for all derived generator classes and instantiated objects.
00664    *
00665    * @return
00666    *   Pointer to global EventSymbolTable
00667    */
00668   static SymbolTable* GlobalEventSymbolTablep(void);
00669 
00670 
00671   /*****************************************
00672    *****************************************
00673    *****************************************
00674    *****************************************/
00675 
00676   /** @name State Symboltable */
00677   /** @{ doxygen group */
00678 
00679 
00680   /**
00681    * Get StateSymbolTable. 
00682    *
00683    * @return
00684    *   ref to state-symboltable
00685    */
00686   const SymbolTable& StateSymbolTable(void) const;
00687 
00688   /**
00689    * Set StateSymbolTable.
00690    *
00691    * By convention, state names and indices are local to the
00692    * respective generator. It is most unlikely that you want to use
00693    * this function.
00694    *
00695    * @return
00696    *   Pointer to mpStateSymbolTable
00697    */
00698   void StateSymbolTable(const SymbolTable& rSymTab);
00699 
00700   /**
00701    * State index lookup. 
00702    *
00703    * @param rName
00704    *
00705    * @return
00706    *  Valid index (or 0 for non-existent)
00707    */
00708   Idx StateIndex(const std::string& rName) const;
00709 
00710   /** 
00711    * State name lookup 
00712    *
00713    * @param index
00714    *
00715    * @return name (or empty string if no such exists) 
00716    */
00717   std::string StateName(Idx index) const;
00718 
00719   /** 
00720    * Set name of state
00721    *
00722    * @param index
00723    *   Index
00724    * @param rName
00725    *   Name
00726    *
00727    * @exception Exception
00728    *   - name already associated with another index (id 44)
00729    *   - state does not exist in generator (id 90)
00730    */
00731   void StateName(Idx index, const std::string& rName);
00732 
00733   /**
00734    * Remove all names from generator's StateSymbolTable
00735    */
00736   void ClearStateNames(void);
00737 
00738   /**
00739    * Clear name for individual state
00740    *
00741    * @param index
00742    *   State index
00743    * @exception Exception
00744    *   - state does not exist in generator (id 90)
00745    */
00746   void ClrStateName(Idx index);
00747 
00748   /**
00749    * Clear name for individual  state
00750    *
00751    * @param rName
00752    *   State name
00753    */
00754   void ClrStateName(const std::string& rName);
00755 
00756   /**
00757    * Whether libFAUEDS functions are requested to generate state names.
00758    * Most libFAUDES functions that introduce new states to a generator can be enabled
00759    * to also assign (more or less sensible) names to those states. This feature is
00760    * purely cosmetic and may be disabled for performance reasons. 
00761    * 
00762    *
00763    * @return
00764    *   True, if generation of statenames is enabled.
00765    */
00766   bool StateNamesEnabled(void) const;
00767 
00768   /**
00769    * Enable/disable libFAUEDS functions to automatically generate state names.
00770    * Disabling state name generation implies ClearStateNames().
00771    *
00772    * @param flag
00773    *   True enables statenames / false disables them
00774    */
00775   void StateNamesEnabled(bool flag);
00776 
00777   /**
00778    * Assign each state a default name based on its index.
00779    */
00780   void SetDefaultStateNames(void);
00781 
00782   /**
00783    * For all states without a symbolic name, assign a name 
00784    * based on suggested template and the index.
00785    *
00786    * @param rTemplate
00787    *   Basis for name generation
00788    */
00789   void EnforceStateNames(const std::string& rTemplate);
00790 
00791   /** 
00792    * Create a new unique symbolic state name.
00793    * See also SymbolTable::UniqueSymbol().
00794    *
00795    * @param rName
00796    *   suggestion for new state name
00797    */
00798   std::string UniqueStateName(const std::string& rName) const;
00799 
00800 
00801   /** @} doxygen group */
00802 
00803   /* statics outside doxygen group */
00804 
00805   /**
00806    * Sets the default for automatic state name generation.
00807    * This flag takes effect only on generators newly created by the default
00808    * constructor. The copy constructor copies the state name flag from the 
00809    * source generator. See also StateNamesEnabled(bool).
00810    *
00811    * @param flag
00812    *   True enables statenames / false disables them
00813    */
00814   static void StateNamesEnabledDefault(bool flag);
00815 
00816 
00817   /*****************************************
00818    *****************************************
00819    *****************************************
00820    *****************************************
00821    *****************************************/
00822 
00823   /** @name Read Access to Core Members */
00824   /** @{ doxygen group */
00825 
00826   /**
00827    * Iterator to Begin() of alphabet
00828    *
00829    * @return
00830    *   Iterator to begin of mpAlphabet
00831    */
00832   EventSet::Iterator AlphabetBegin(void) const;
00833 
00834   /**
00835    * Iterator to End() of alphabet
00836    *
00837    * @return
00838    *   Iterator to end of mpAlphabet
00839    */
00840   EventSet::Iterator AlphabetEnd(void) const;
00841 
00842   /** 
00843    * Test existence of event in alphabet
00844    *
00845    * @param index
00846    *   Event index
00847    *
00848    * @return
00849    *   True / false
00850    */
00851   bool ExistsEvent(Idx index) const;
00852 
00853   /** 
00854    * Test existence of event in alphabet
00855    *
00856    * @param rName
00857    *   Event name
00858    *
00859    * @return
00860    *   True / false
00861    */
00862   bool ExistsEvent(const std::string& rName) const;
00863 
00864   /**
00865    * Returns a iterator to event index in alphabet
00866    *
00867    * @param index
00868    *   Index to find
00869    *
00870    * @return
00871    *   Iterator to event index
00872    */
00873   EventSet::Iterator FindEvent(Idx index) const;
00874 
00875   /**
00876    * Returns a iterator to event index in alphabet
00877    *
00878    * @param rName
00879    *   Event name of index to find
00880    *
00881    * @return
00882    *   Iterator to event index
00883    */
00884   EventSet::Iterator FindEvent(const std::string& rName) const;
00885 
00886   /**
00887    * Return const reference to alphabet 
00888    *
00889    * @return EventSet
00890    *   Reference to mpAlphabet
00891    */
00892   const EventSet& Alphabet(void) const;
00893 
00894   /**
00895    * Iterator to Begin() of state set
00896    *
00897    * @return
00898    *   Iterator to begin of state set
00899    */
00900   StateSet::Iterator StatesBegin(void) const;
00901 
00902   /**
00903    * Iterator to End() of state set
00904    *
00905    * @return
00906    *   Iterator to end of state set
00907    */
00908   StateSet::Iterator StatesEnd(void) const;
00909 
00910   /**
00911    * Test existence of state in state set
00912    * 
00913    * @param index
00914    *   State index
00915    *
00916    * @return
00917    *   true / false
00918    */
00919   bool ExistsState(Idx index) const;
00920 
00921   /**
00922    * Test existence of state in state set
00923    * 
00924    * @param name
00925    *   State name
00926    *
00927    * @return
00928    *   true / false
00929    */
00930   bool ExistsState(const std::string& name) const;
00931 
00932   /**
00933    * Returns a iterator to state index in state set 
00934    *
00935    * @param index
00936    *   Index to find
00937    *
00938    * @return
00939    *   StateSet::Iterator to state index
00940    */
00941   StateSet::Iterator FindState(Idx index) const;
00942 
00943   /**
00944    * Returns a iterator to state with specified name
00945    *
00946    * @param rName
00947    *   name of state to find
00948    *
00949    * @return
00950    *   StateSet::Iterator to state 
00951    */
00952   StateSet::Iterator FindState(const std::string& rName) const;
00953 
00954 
00955   /**
00956    * Return reference to state set
00957    *
00958    * @return 
00959    *   StateSet reference incl actual attribute type
00960    */
00961   const StateSet& States(void) const;
00962 
00963   /**
00964    * Return initial state 
00965    * 
00966    * If the initial state is not unique, this function
00967    * returns 0.
00968    *
00969    * @return
00970    *   Index of initial state
00971    *
00972    */
00973   Idx InitState(void) const;
00974 
00975   /**
00976    * Iterator to Begin() of mInitStates
00977    *
00978    * @return
00979    *   Iterator to begin of mInitStates
00980    */
00981   StateSet::Iterator InitStatesBegin(void) const;
00982 
00983   /**
00984    * Iterator to End() of mInitStates
00985    * 
00986    * @returns
00987    *   Iterator to end of mInitStates
00988    */
00989   StateSet::Iterator InitStatesEnd(void) const;
00990 
00991   /**
00992    * Test existence of state in mInitStates
00993    * 
00994    * @param index
00995    *   State index
00996    *
00997    * @return
00998    *   true / false
00999    */
01000   bool ExistsInitState(Idx index) const;
01001 
01002   /**
01003    * Iterator to state index in mInitStates 
01004    *
01005    * @param index
01006    *   Index to find
01007    *
01008    * @return
01009    *   StateSet::Iterator to state index
01010    */
01011   StateSet::Iterator FindInitState(Idx index) const;
01012 
01013   /**
01014    * Const ref to initial states
01015    *
01016    * @return StateSet
01017    */
01018   const StateSet& InitStates(void) const;
01019 
01020   /**
01021    * Iterator to Begin() of mMarkedStates
01022    *
01023    * @returns
01024    *   iterator to Begin of mMarkedStates
01025    */
01026   StateSet::Iterator MarkedStatesBegin(void) const;
01027 
01028   /**
01029    * Iterator to End() of mMarkedStates
01030    * 
01031    * @returns
01032    *   iterator to End of mMarkedStates
01033    */
01034   StateSet::Iterator MarkedStatesEnd(void) const;
01035 
01036   /**
01037    * Test existence of state in mMarkedStates
01038    * 
01039    * @param index
01040    *   State index
01041    *
01042    * @return
01043    *   true / false
01044    */
01045   bool ExistsMarkedState(Idx index) const;
01046 
01047   /**
01048    * Returns a iterator to state index in mMarkedStates
01049    *
01050    * @param index
01051    *   Index to find
01052    *
01053    * @return
01054    *   StateSet::Iterator to state index
01055    */
01056   StateSet::Iterator FindMarkedState(Idx index) const;
01057 
01058   /**
01059    * Return const ref of marked states
01060    *
01061    * @return StateSet
01062    */
01063   const StateSet& MarkedStates(void) const;
01064 
01065   /**
01066    * Iterator to Begin() of transition relation
01067    *
01068    * @return
01069    *   Iterator to Begin of mpTransRel
01070    */
01071   TransSet::Iterator TransRelBegin(void) const;
01072 
01073   /**
01074    * Iterator to End() of transition relation
01075    * 
01076    * @return
01077    *   Iterator to End of mpTransRel
01078    */
01079   TransSet::Iterator TransRelEnd(void) const;
01080 
01081   /**
01082    * Iterator to begin of transitions with x1 as predecessor state.
01083    *
01084    * @param x1
01085    *   Predecessor state
01086    *
01087    * @return
01088    *   iterator to begin of transitions with x1
01089    */
01090   TransSet::Iterator TransRelBegin(Idx x1) const;
01091 
01092   /**
01093    * iterator to end of transitions with x1 as predecessor state. 
01094    *
01095    * Note: Set the End(x1) iterator to a variable, so it won't be 
01096    * recalculated every iteration.
01097    *
01098    * @param x1
01099    *   Predecessor state
01100    *
01101    * @return 
01102    *   iterator to end of transitions with x1 
01103    *   (one after last matching transition)
01104    */
01105   TransSet::Iterator TransRelEnd(Idx x1) const;
01106 
01107   /**
01108    * iterator to begin of transitions with x1 as predecessor state and
01109    * event ev. 
01110    *
01111    * @param x1
01112    *   Predecessor state
01113    * @param ev
01114    *   Event
01115    *
01116    * @return
01117    *   iterator to begin of transitions with x1 and ev
01118    */
01119   TransSet::Iterator TransRelBegin(Idx x1, Idx ev) const;
01120 
01121   /**
01122    * Iterator to end of transitions with x1 as predecessor state and
01123    * event ev.
01124    *
01125    * Note: Set the End(x1,ev) iterator to a variable, so it won't be 
01126    * recalculated every iteration.
01127    * 
01128    * @param x1
01129    *   Predecessor state
01130    * @param ev
01131    *   Event
01132    *
01133    * @return
01134    *   iterator to end of transitions with x1 and ev 
01135    *   (one after last matching transition)
01136    */
01137   TransSet::Iterator TransRelEnd(Idx x1, Idx ev) const;
01138 
01139   /**
01140    * iterator to transition given by x1, ev, x2
01141    *
01142    * 
01143    * @param rX1
01144    *   name of Predecessor state
01145    * @param rEv
01146    *   name of Event
01147    * @param rX2
01148    *   name of Successor state
01149    *
01150    * @return
01151    *   iterator to transition or end() if not exists
01152    */
01153   TransSet::Iterator FindTransition(
01154     const std::string& rX1, const std::string& rEv, const std::string& rX2) const;
01155 
01156   /**
01157    * Iterator to transition given by x1, ev, x2
01158    *
01159    * 
01160    * @param x1
01161    *   Predecessor state
01162    * @param ev
01163    *   Event
01164    * @param x2
01165    *   Successor state
01166    *
01167    * @return
01168    *   iterator to transition or End() if not exists
01169    */
01170   TransSet::Iterator FindTransition(Idx x1, Idx ev, Idx x2) const;
01171 
01172   /**
01173    * Iterator to transition 
01174    *
01175    * 
01176    * @param rTrans
01177    *   transition
01178    *
01179    * @return
01180    *   iterator to transition or end() if not exists
01181    */
01182   TransSet::Iterator FindTransition(const Transition& rTrans) const;
01183 
01184   /**
01185    * Test for transition given by x1, ev, x2
01186    *
01187    * 
01188    * @param rX1
01189    *   name of Predecessor state
01190    * @param rEv
01191    *   name of Event
01192    * @param rX2
01193    *   name of Successor state
01194    *
01195    * @return
01196    *   true / false
01197    */
01198   bool ExistsTransition(
01199     const std::string& rX1, const std::string& rEv, const std::string& rX2) const;
01200 
01201   /**
01202    * Test for transition given by x1, ev, x2
01203    * 
01204    * @param x1
01205    *   Predecessor state
01206    * @param ev
01207    *   Event
01208    * @param x2
01209    *   Successor state
01210    *
01211    * @return
01212    *   true / false
01213    */
01214   bool ExistsTransition(Idx x1, Idx ev, Idx x2) const;
01215 
01216   /**
01217    * test for transition 
01218    *
01219    * 
01220    * @param rTrans
01221    *   transition
01222    *
01223    * @return
01224    *   true / false
01225    */
01226   bool ExistsTransition(const Transition& rTrans) const;
01227 
01228   /**
01229    * Test for transition given by x1, ev
01230    * 
01231    * @param x1
01232    *   Predecessor state
01233    * @param ev
01234    *   Event
01235    *
01236    * @return
01237    *   true / false
01238    */
01239   bool ExistsTransition(Idx x1, Idx ev) const;
01240 
01241   /**
01242    * Test for transition given by x1
01243    * 
01244    * @param x1
01245    *   Predecessor state
01246    *
01247    * @return
01248    *   true / false
01249    */
01250   bool ExistsTransition(Idx x1) const;
01251 
01252   /**
01253    * Return reference to transition relation
01254    *
01255    * @return TransRel
01256    */
01257   const TransSet& TransRel(void) const;
01258 
01259   /**
01260    * Get copy of trantision relation  sorted by other compare 
01261    * operator, e.g. "x2,ev,x1"
01262    * 
01263    * @param res
01264    *   resulting transition relation 
01265    */
01266   void TransRel(TransSetX1EvX2& res) const;
01267   void TransRel(TransSetEvX1X2& res) const;
01268   void TransRel(TransSetEvX2X1& res) const;
01269   void TransRel(TransSetX2EvX1& res) const;
01270   void TransRel(TransSetX2X1Ev& res) const;
01271   void TransRel(TransSetX1X2Ev& res) const;
01272 
01273   /**
01274    * Convebience function.
01275    * 
01276    * @param rX1
01277    *   Name of Predecessor state
01278    * @param rEv
01279    *   Name of Event
01280    * @param rX2
01281    *   Name of Successor state
01282    *
01283    * @return
01284    *   Transition as specified.
01285    */
01286   Transition TransitionByNames(
01287     const std::string& rX1, const std::string& rEv, const std::string& rX2) const;
01288 
01289   /** @} doxygen group */
01290 
01291 
01292 
01293   /*****************************************
01294    *****************************************
01295    *****************************************
01296    *****************************************/
01297 
01298   /** @name Write Access to Core Members */
01299   /** @{ doxygen group */
01300 
01301 
01302   /**
01303    * Add an existing event to alphabet by index. It is an error to insert
01304    * an event index that is not known to the mpEventSymbolTable.
01305    *
01306    * @param index
01307    *   Event index
01308    * @return
01309    *   True, if event was new to alphabet
01310    */
01311   bool InsEvent(Idx index);
01312 
01313   /**
01314    * Add named event to generator. An entry in the mpEventSymbolTable will
01315    * be made if event name is not known so far.
01316    *
01317    * @param rName
01318    *   Name of the event to add
01319    *
01320    * @return 
01321    *   New unique index
01322    */
01323   Idx InsEvent(const std::string& rName);
01324 
01325   /**
01326    * Add new named events to generator.
01327    * If the event allready exists, the attribute is maintained.
01328    *
01329    * @param events
01330    *   EventSet
01331    */
01332   void InsEvents(const EventSet& events);
01333 
01334   /**
01335    * Delete event from generator by index. mpEventSymbolTable stays untouched.
01336    * Transitions containing event will be removed too.
01337    *
01338    * @param index
01339    *   Index of event
01340    * @return
01341    *   True, if event was in alphabet
01342    *
01343    */
01344   bool DelEvent(Idx index);
01345 
01346   /**
01347    * Delete event from generator by name. mpEventSymbolTable stays untouched.
01348    * Transitions containing event will be removed too.
01349    *
01350    * @param rName
01351    *    Name of event
01352    * @return
01353    *   True, if event was in alphabet
01354    *
01355    */
01356   bool DelEvent(const std::string& rName);
01357 
01358   /** 
01359    * Delete a set of events from generator. mpEventSymbolTable stays untouched.
01360    * Transitions containing events will be removed too.
01361    * 
01362    * @param rEvents
01363    *   EventSet containing events to remove
01364    */
01365   void DelEvents(const EventSet& rEvents);
01366 
01367   /** 
01368    * Delete event from alphabet without consistency check. The event is only
01369    * deleted from mpAlphabet but not from transition relation.
01370    *
01371    * @param index
01372    *   Index of event
01373    * @return
01374    *   True, if event was in alphabet
01375    *
01376    */
01377   bool DelEventFromAlphabet(Idx index);
01378 
01379   /**
01380    * Set mpAlphabet without consistency check.
01381    * Sets the alphabet incl attributes, if provided.
01382    *
01383    * @param rNewalphabet
01384    *   EventSet with new alphabet
01385    */
01386   void InjectAlphabet(const EventSet& rNewalphabet);
01387 
01388   /**
01389    * Restricts mpAlphabet incl removing resp. transition.
01390    * Maintains attributes if any.
01391    *
01392    * Note: before libFAUDES 2.23, this method did not remove
01393    * transitions. Use InjectAlphabet(const EventSet&) for direct
01394    * write acces to the alphabet.
01395    *
01396    * @param rNewalphabet
01397    *   EventSet with alphabet
01398    */
01399   void RestrictAlphabet(const EventSet& rNewalphabet);
01400 
01401   /** 
01402    * Add new anonymous state to generator 
01403    * 
01404    * @return 
01405    *   Index of new unique state
01406    */
01407   Idx InsState(void);
01408 
01409   /** 
01410    * Add (perhaps new) state to generator 
01411    * 
01412    * @return 
01413    *   True to indicate that state was new to generator
01414    */
01415   bool InsState(Idx index);
01416 
01417   /** 
01418    * Add new named state to generator. 
01419    *
01420    * @param rName
01421    *   Name of the state to add
01422    *
01423    * @return 
01424    *   Index of new unique state
01425    *
01426    * @exception Exception
01427    *   Name already exists (id 44)
01428    */
01429   Idx InsState(const std::string& rName);
01430 
01431   /** 
01432    * Add anonymous states to generator 
01433    * 
01434    * @param rStates
01435    *   Set of states to add
01436    */
01437   void InsStates(const StateSet& rStates);
01438 
01439   /** 
01440    * Delete a state from generator by index. 
01441    * Cleans mpStates, mInitStates, mMarkedStates, mpTransRel and mpStateSymbolTable.
01442    *
01443    * @param index
01444    *   Index of state to delete. 
01445    * @return
01446    *   True, if state was in stateset
01447    */
01448   bool DelState(Idx index);
01449 
01450   /** 
01451    * Delete a state from generator by name.
01452    * Cleans mpStates, mInitStates, mMarkedStates, mpTransRel and mpStateSymbolTable.
01453    *
01454    * @param rName
01455    *   Name of state to delete. Will be erased in mpStateSymbolTable too
01456    * @return
01457    *   True, if state was in stateset
01458    *
01459    * @exception Exception
01460    *   - Symbolic name not known (id 90)
01461    */
01462   bool DelState(const std::string& rName);
01463 
01464   /**
01465    * Delete a set of states 
01466    * Cleans mpStates, mInitStates, mMarkedStates, mpTransrel, and mpStateSymboltable
01467    *
01468    * @param rDelStates
01469    *   StateSet containing states aka indicees to delete
01470    */
01471   void DelStates(const StateSet& rDelStates);
01472 
01473 
01474   /**
01475    * Delete a state from generator without consistency check. This removes the
01476    * state from mpStates and mpStateSymbolTable but doesn't touch mpTransRel,
01477    * mInitStates and mMarkedStates.
01478    *
01479    * @param index
01480    *   Index of state to delete. 
01481    * @return
01482    *   True, if state was in stateset
01483    *
01484    */
01485   bool DelStateFromStates(Idx index);
01486 
01487   /**
01488    * Delete a state from generator without consistency check. This removes the
01489    * state from mpStates and mpStateSymbolTable but doesn't touch mpTransRel,
01490    * mInitStates and mMarkedStates.
01491    * Index to delete is given by iterator. 
01492    *
01493    * @param pos
01494    *   StateSet::Iterator
01495    * @return
01496    *   Iteraror to next state
01497    */
01498   StateSet::Iterator DelStateFromStates(StateSet::Iterator pos);
01499 
01500   /**
01501    * Restrict states 
01502    * Cleans mpStates, mInitStates, mMarkedStates, mpTransrel, and mpStateSymboltable
01503    *
01504    * @param rStates
01505    *   StateSet containing valid states
01506    */
01507   void RestrictStates(const StateSet& rStates);
01508 
01509 
01510   /** 
01511    * Inject an existing state index into generators mStates
01512    * Use with care! For use in performance optimized functions.
01513    *
01514    * @param index
01515    *   State index to inject
01516    */
01517   void InjectState(Idx index);
01518 
01519   /**
01520    * Inject a complete state set without consistency checks (without attributes)
01521    *
01522    * @param rNewStates
01523    *    StateSet
01524    */
01525   void InjectStates(const StateSet& rNewStates);
01526 
01527 
01528   /**
01529    * Create new anonymous state and set as initial state
01530    *
01531    * @return 
01532    *   Index of new unique
01533    */
01534   Idx InsInitState(void);
01535 
01536   /** 
01537    * Add (perhaps new) state to generator and turn it
01538    * into a initial state. 
01539    * 
01540    * @param index
01541    *   State to insert
01542    * @return 
01543    *   True to indicate that state was new to generator
01544    */
01545   bool InsInitState(Idx index);
01546 
01547   /**
01548    * Create a new named state and set as initial state
01549    *
01550    * @param rName
01551    *   Name of the state to add
01552    *
01553    * @return 
01554    *   Index of new unique state
01555    */
01556   Idx InsInitState(const std::string& rName);
01557 
01558   /** 
01559    * Add (perhaps new) anonymous initial states to generator  
01560    * 
01561    * @param rStates
01562    *   Set of states to add
01563    */
01564   void InsInitStates(const StateSet& rStates);
01565 
01566   /**
01567    * Create new anonymous state and set as marked state
01568    *
01569    * @return 
01570    *   Index of new unique state
01571    */
01572   Idx InsMarkedState(void);
01573 
01574   /** 
01575    * Add (perhaps new) state to generator and turn it
01576    * into a marked state. 
01577    * 
01578    * @param index
01579    *   State to insert
01580    * @return 
01581    *   True to indicate that state was new to generator
01582    */
01583   bool InsMarkedState(Idx index);
01584 
01585   /**
01586    * Create a new named state and set as marked state
01587    *
01588    * @param rName
01589    *   Name of the state to add
01590    *
01591    * @return 
01592    *   Index of new unique state
01593    */
01594   Idx InsMarkedState(const std::string& rName);
01595 
01596   /** 
01597    * Add (perhaps new) anonymous initial states to generator  
01598    * 
01599    * @param rStates
01600    *   Set of states to add
01601    */
01602   void InsMarkedStates(const StateSet& rStates);
01603 
01604   /**
01605    * Set an existing state as initial state by index.
01606    *
01607    * @param index
01608    *   Index of state to set as initial state
01609    * @exception Exception
01610    *   - State index not found in generator (id 91)
01611    */
01612   void SetInitState(Idx index);
01613 
01614   /**
01615    * Set an existing state as initial state by name. 
01616    *
01617    * @param rName
01618    *   Name of state to set as initial state
01619    *
01620    * @exception Exception
01621    *   - State name not known in generator (id 90)
01622    */
01623   void SetInitState(const std::string& rName);
01624 
01625   /**
01626    * Replace mInitStates with StateSet given as parameter without consistency checks.
01627    *
01628    * @param rNewInitStates
01629    *   StateSet containing new mInitStates
01630    */
01631   void InjectInitStates(const StateSet& rNewInitStates);
01632 
01633   /**
01634    * Unset an existing state as initial state by index
01635    *
01636    * Define FAUDES_CHECKED for consistency checks.
01637    *
01638    * @param index
01639    *   State index
01640    *
01641    * @exception Exception
01642    *   - State index not found in generator (id 91)
01643    */
01644   void ClrInitState(Idx index);
01645 
01646   /**
01647    * Unset an existing state as initial state by name 
01648    *
01649    * @param rName
01650    *   State name
01651    *
01652    * @exception Exception
01653    *   - State name not known in generator (id 90)
01654    */
01655   void ClrInitState(const std::string& rName);
01656 
01657   /**
01658    * Unset an existing state as initial state by iterator
01659    *
01660    * @param pos
01661    *   StateSet::iterator
01662    * @return 
01663    *   Iterator to next init state
01664    */
01665   StateSet::Iterator ClrInitState(StateSet::Iterator pos);
01666 
01667   /**
01668    * Clear all mInitStates
01669    */
01670   void ClearInitStates(void); 
01671 
01672   /**
01673    * Set an existing state as marked state by index
01674    *
01675    * @param index
01676    *   Index of state to set as initial state
01677    * @exception Exception
01678    *   - State index not found in generator (id 91)
01679    */
01680   void SetMarkedState(Idx index);
01681 
01682   /**
01683    * Set an existing state as marked state by name. 
01684    *
01685    * @param rName
01686    *   Name of state to set as marked state
01687    *
01688    * @exception Exception
01689    *   - State name not known in generator (id 90)
01690    */
01691   void SetMarkedState(const std::string& rName);
01692 
01693   /**
01694    * Unset an existing state as marked state by index
01695    *
01696    * @param index
01697    *   State index
01698    *
01699    * @exception Exception
01700    *   - State index not found in generator (id 91)
01701    */
01702   void ClrMarkedState(Idx index);
01703 
01704   /**
01705    * Unset an existing state as marked state by name
01706    *
01707    * @param rName
01708    *   State name
01709    *
01710    * @exception Exception
01711    *   - State index not found in generator (id 91)
01712    */
01713    void ClrMarkedState(const std::string& rName);
01714 
01715   /**
01716    * Unset an existing state as marked state by iterator
01717    *
01718    * @param pos
01719    *   StateSet::iterator
01720    * @return 
01721    *   Iterator to next marked state
01722    */
01723   StateSet::Iterator ClrMarkedState(StateSet::Iterator pos);
01724 
01725   /**
01726    * Clear all marked states
01727    */
01728   void ClearMarkedStates(void);
01729 
01730   /**
01731    * Replace mMarkedStates with StateSet given as parameter without consistency checks.
01732    *
01733    * @param rNewMarkedStates
01734    *   StateSet containing new marked states
01735    */
01736   void InjectMarkedStates(const StateSet& rNewMarkedStates);
01737 
01738   /** 
01739    * Add a transition to generator by indices. States and event
01740    * must already exist.
01741    *
01742    * @param x1 
01743    *   Predecessor state index 
01744    * @param ev 
01745    *   Event index 
01746    * @param x2
01747    *   Successor state index
01748    *
01749    * @return
01750    *   True, if the transition was new the generator
01751    *
01752    * @exception Exception
01753    *   - state or event not in generator (id 95)
01754    */
01755   bool SetTransition(Idx x1, Idx ev, Idx x2);
01756 
01757   /** 
01758    * Add a transition to generator by names. Statename and eventname
01759    * must already exist.
01760    *
01761    * @param rX1
01762    *   Predecessor state name
01763    * @param rEv
01764    *   Event name
01765    * @param rX2
01766    *   Successor state name
01767    *
01768    * @return
01769    *   True, if the transition was new the generator
01770    *
01771    * @exception Exception
01772    *   - state or event not in generator (id 95)
01773    *   - state name not known (id 90)
01774    *   - event name not known (id 66)
01775    */
01776   bool SetTransition(const std::string& rX1, const std::string& rEv, 
01777            const std::string& rX2);
01778 
01779   /** 
01780    * Add a transition to generator. States and event
01781    * must already exist.
01782    *
01783    *
01784    * @param rTransition
01785    *   Transition
01786    *
01787    * @return
01788    *   True, if the transition was new the generator
01789    * @exception Exception
01790    *   - state or event not in generator (id 95)
01791    */
01792   bool SetTransition(const Transition& rTransition);
01793 
01794   /**
01795    * Remove a transition by indices
01796    *
01797    * @param x1
01798    *   Predecessor state index
01799    * @param ev
01800    *   Event index
01801    * @param x2
01802    *   Successor state index
01803    */
01804   void ClrTransition(Idx x1, Idx ev, Idx x2);
01805 
01806   /**
01807    * Remove a transition by transition object
01808    *
01809    * @param rTrans
01810    *   Transition object
01811    */
01812   void ClrTransition(const Transition& rTrans);
01813 
01814   /**
01815    * Remove a transition by iterator
01816    *
01817    * @param it
01818    *   TransSet::iterator 
01819    * @return
01820    *   Iterator to next transition
01821    */
01822   TransSet::Iterator ClrTransition(TransSet::Iterator it);
01823 
01824   /**
01825    * Remove a transitions by state and event
01826    *
01827    * @param x1
01828    *   Predecessor state index
01829    * @param ev
01830    *   Event index
01831    */
01832   void ClrTransitions(Idx x1, Idx ev);
01833 
01834   /**
01835    * Remove a transitions by state
01836    *
01837    * @param x1
01838    *   Predecessor state index
01839    */
01840   void ClrTransitions(Idx x1);
01841 
01842   /**
01843    * Clear all transitions
01844    */
01845   void ClearTransRel(void);
01846 
01847   /**
01848    * Set transition without consistency check.
01849    *
01850    * @param rTrans
01851    *   Transition to insert
01852    */
01853   void InjectTransition(const Transition& rTrans);
01854 
01855   /**
01856    * Set transition relation without consistency check (no attributes)
01857    *
01858    * @param rNewtransrel
01859    *   TransRel to insert
01860    */
01861   void InjectTransRel(const TransSet& rNewtransrel);
01862 
01863   /** @} doxygen group */
01864 
01865 
01866 
01867   /*****************************************
01868    *****************************************
01869    *****************************************
01870    *****************************************/
01871 
01872   /** @name Attributes */
01873   /** @{ doxygen group */
01874 
01875 
01876   /**
01877    * Clear Attributes
01878    */
01879   virtual void ClearAttributes(void);
01880 
01881   /**
01882    * Updates internal attributes. 
01883    * This method does nothing and may be reimplemented 
01884    * by a any class that adds semantics to attributes
01885    * Eg. you may set a particular state flag, if this state 
01886    * is reachable.
01887    * 
01888    * @return True if value changed
01889    */
01890   virtual bool UpdateAttributes(void) {return false;};
01891 
01892   /**
01893    * Clear event attributes
01894    */
01895   virtual void ClearEventAttributes(void);
01896 
01897   /**
01898    * Clear attribute for existing event
01899    *
01900    * @param index
01901    *   Event index
01902    */
01903   virtual void ClrEventAttribute(Idx index);
01904 
01905   /**
01906    * Set attribute for existing event. 
01907    * This version uses a dynamic cast
01908    * to test the actual type of the provided attribute. An exception is
01909    * thrown for an invalid attribute type. 
01910    * In a context where
01911    * the attribute type is known, you may prefer the TaGenerator method.
01912    *
01913    * @param index
01914    *   Event index
01915    * @param rAttr
01916    *   New attribute
01917    *
01918    * @exception Exception
01919    *   - Index not found in alphabet (id 60)
01920    *   - Cannot cast attribute (id 63)
01921    */
01922    virtual void EventAttribute(Idx index, const Type& rAttr);
01923 
01924   /**
01925    * Set attributes for existing events. 
01926    * This version uses a dynamic cast
01927    * to test the actual type of the provided attributes. An exception is
01928    * thrown for an invalid attribute type. 
01929    *
01930    * @param rEventSet
01931    *   Set of attributed events
01932    * @exception Exception
01933    *   - Element not found in alphabet (id 60)
01934    *   - Cannot cast attribute (id 63)
01935    */
01936    virtual void EventAttributes(const EventSet& rEventSet);
01937 
01938   /** 
01939    * Event attribute lookup. 
01940    * In a context where
01941    * the attribute type is known, you may prefer the TaGenerator method.
01942    *
01943    * @param index
01944    *
01945    * @return 
01946    *   reference to attribute
01947    */
01948   virtual const AttributeVoid& EventAttribute(Idx index) const;
01949 
01950   /** 
01951    * Event attribute lookup. 
01952    * In a context where the attribute type is known, 
01953    * you may prefer the TaGenerator method.
01954    *
01955    * @param rName
01956    *
01957    * @return 
01958    *   reference to attribute
01959    */
01960   virtual const AttributeVoid& EventAttribute(const std::string& rName) const;
01961 
01962   /** 
01963    * Event attribute pointer to access Attribute methods.
01964    * If there are no attributes (plain vGenerator) this method
01965    * returs 0. If there are attributes, an explicit default value
01966    * may be inserted. 
01967    * In a context where the attribute type is known, 
01968    * you may prefer the TaGenerator method.
01969    *
01970    * @param index
01971    *
01972    * @return 
01973    *   pointer to attribute
01974    */
01975   virtual AttributeVoid* EventAttributep(Idx index);
01976 
01977   /** 
01978    * Event attribute pointer to access Attribute methods.
01979    * If there are no attributes (plain vGenerator) this method
01980    * returs 0. If there are attributes, an explicit default value
01981    * may be inserted. 
01982    * In a context where the attribute type is known, 
01983    * you may prefer the TaGenerator method.
01984    *
01985    * @param rName
01986    *
01987    * @return 
01988    *   pointer to attribute
01989    */
01990   virtual AttributeVoid* EventAttributep(const std::string& rName);
01991 
01992 
01993   /**
01994    * Clear state attributes
01995    */
01996   virtual void ClearStateAttributes(void);
01997 
01998   /**
01999    * Clear attribute for existing state
02000    *
02001    * @param index
02002    *   State index
02003    */
02004   virtual void ClrStateAttribute(Idx index);
02005 
02006   /**
02007    * Set attribute for existing state. 
02008    * This version uses a dynamic cast
02009    * to test the actual type of the provided attribute. An exception is
02010    * thrown for an invalid attribute type. 
02011    * In a context where
02012    * the attribute type is known, you may prefer the TaGenerator method.
02013    *
02014    * @param index
02015    *   State index
02016    * @param rAttr
02017    *   New attribute
02018    *
02019    * @exception Exception
02020    *   - Index not found in Stateset (id 60)
02021    *   - Cannot cast attribute (id 63)
02022    */
02023   virtual void StateAttribute(Idx index, const Type& rAttr);
02024 
02025   /** 
02026    * State attribute lookup. 
02027    * In a context where the attribute type is known, 
02028    * you may prefer the TaGenerator method.
02029    *
02030    * @param index
02031    *   State index
02032    *
02033    * @return Ref to attribute of state
02034    */
02035   virtual const AttributeVoid& StateAttribute(Idx index) const;
02036 
02037   /** 
02038    * State attribute pointer to access Attribute methods.
02039    * If there are no attributes (plain vGenerator) this method
02040    * returns 0. If there are attributes, an explicit default value
02041    * may be inserted. 
02042    * In a context where the attribute type is known, 
02043    * you may prefer the TaGenerator method.
02044    *
02045    * @param index
02046    *   State index
02047    *
02048    * @return Pointer to attribute of state
02049    */
02050   virtual AttributeVoid* StateAttributep(Idx index);
02051 
02052   /**
02053    * Clear transition attributes
02054    */
02055   virtual void ClearTransAttributes(void);
02056 
02057   /**
02058    * Set attribute for existing transition.
02059    * This version uses a dynamic cast
02060    * to test the actual type of the provided attribute. An exception is
02061    * thrown for an invalid attribute type. 
02062    * In a context where
02063    * the attribute type is known, you may prefer the TaGenerator method.
02064    *
02065    * @param rTrans
02066    *   Transition
02067    * @param rAttr
02068    *   New attribute
02069    *
02070    * @exception Exception
02071    *   - Transition not found in transition relation(id 60)
02072    *   - Cannot cast attribute (id 63)
02073    */
02074    virtual void TransAttribute(const Transition& rTrans, const Type& rAttr);
02075 
02076 
02077   /**
02078    * Clear attribute for existing transition
02079    *
02080    * @param rTrans
02081    *   transition
02082    */
02083   virtual void ClrTransAttribute(const Transition& rTrans);
02084 
02085   /**
02086    * Transition attribute lookup.
02087    * In a context where the attribute type is known, 
02088    * you may prefer the TaGenerator method.
02089    *
02090    * @return 
02091    *   Attribute
02092    *
02093    */
02094   virtual const AttributeVoid& TransAttribute(const Transition& rTrans) const;
02095 
02096   /**
02097    * Transition attribute pointer to access Attribute methods.
02098    * If there are no attributes (plain vGenerator) this method
02099    * returns 0. If there are attributes, an explicit default value
02100    * may be inserted. 
02101    * In a context where the attribute type is known, 
02102    * you may prefer the TaGenerator method.
02103    *
02104    * @return 
02105    *   Attribute pointer
02106    *
02107    */
02108   virtual AttributeVoid* TransAttributep(const Transition& rTrans);
02109 
02110   /**
02111    * Clear global attribute
02112    */
02113   virtual void ClearGlobalAttribute(void);
02114 
02115   /** 
02116    * Set global attribute. 
02117    * The vGenerator does not have attributes, so this function throws an exception for
02118    * any specified attribute different to AttributeVoid.
02119    * The TaGenarator provides a re-implementation to actually set the global attribute.
02120    *
02121    * @param rAttr
02122    *   Attribute
02123    * @exception Exception
02124    *   - Cannot cast attribute (id 63)
02125    */
02126   virtual void GlobalAttribute(const Type& rAttr);
02127 
02128   /** 
02129    * Set global attribute. 
02130    * The vGenerator does not have attributes, so this function does nothing.
02131    * The TaGenarator provides a re-implementation to actually set the global attribute.
02132    *
02133    * @param rAttr
02134    *   Attribute
02135    */
02136   virtual void GlobalAttributeTry(const Type& rAttr);
02137 
02138   /** 
02139    * Global attribute lookup.
02140    * In a context where the attribute type is known, 
02141    * you may prefer the TaGenerator method.
02142    */
02143   virtual const AttributeVoid& GlobalAttribute(void) const;
02144 
02145 
02146   /** 
02147    * Get attribute pointer 
02148    * The global attribute allways exits. For the vGenerator its of
02149    * type AttributeVoid, the TaGenerator sets a nontrivial type.
02150    * In a context where the attribute type is known, 
02151    * you may prefer the TaGenerator method.
02152    */
02153   virtual AttributeVoid* GlobalAttributep(void);
02154 
02155 
02156   /** @} doxygen group */
02157 
02158 
02159 
02160   /*****************************************
02161    *****************************************
02162    *****************************************
02163    *****************************************/
02164 
02165   /** @name Reachability */
02166   /** @{ doxygen group */
02167 
02168 
02169   /**
02170    * Compute set of accessible states
02171    */
02172   StateSet AccessibleSet(void) const;
02173 
02174   /**
02175    * Make generator accessible.
02176    *
02177    * @return
02178    *   True if generator contains at least one initial state
02179    */
02180   bool Accessible(void);
02181 
02182   /**
02183    * Check if generator is accessible
02184    *
02185    * @return
02186    *   True if generator is accesssible
02187    */
02188   bool IsAccessible(void) const;
02189 
02190   /**
02191    * Compute set of Coaccessible states
02192    */
02193   StateSet CoaccessibleSet(void) const;
02194 
02195   /**
02196    * Make generator Coaccessible
02197    *
02198    * @return
02199    *   True if generator contains at least one marked state
02200    */
02201   bool Coaccessible(void);
02202 
02203   /**
02204    * Check if generator is Coaccessible
02205    *
02206    * @return
02207    *   True if generator is coaccessible
02208    */
02209   bool IsCoaccessible(void) const;
02210 
02211   /**
02212    * Compute set of blocking states.
02213    *
02214    * A state is considered blocking it is accessible but not coaccessible.
02215    */
02216   StateSet BlockingStates(void) const;
02217 
02218 
02219   /**
02220    * Compute set of terminal states.
02221    *
02222    * A terminal state is a state with no successor state.
02223    * If and only if the set of terminal states is empty, the generator is complete.
02224    * @return
02225    *   Set of terminal states.
02226    */
02227   StateSet TerminalStates(void) const;
02228 
02229 
02230   /**
02231    * Compute set of terminal states.
02232    *
02233    * A terminal state is a state with no successor state.
02234    * This function returns the the set terminal states contained
02235    * in the specified state ste.
02236    *
02237    * @param rStates
02238    *   Set of state indices to restrict the search
02239    * @return
02240    *   Set of terminal states.
02241    */
02242   StateSet TerminalStates(const StateSet& rStates) const;
02243 
02244   /**
02245    * Check if generator is complete.
02246    *
02247    * A generator is considered complete, if each state has at least
02248    * one successor state. 
02249    *
02250    * If the generator is accessible, completeness
02251    * is equivalent to completeness of the generated language, ie 
02252    * forall s in L(G) there exists r>s such that r in L(G)
02253    *
02254    * If the generator is trim, completeness is equivalent to 
02255    * completeness of the markede language, ie forall s in Lm(G) there exists 
02256    * r>s such that r in Lm(G)
02257    *
02258    * @return
02259    *   True if generator is complete
02260    */
02261   bool IsComplete(void) const;
02262 
02263   /**
02264    * Check if generator is complete.
02265    *
02266    * Same as IsComplete(void), however, only the specified
02267    * states are considered. The rational is to e.g. apply the test
02268    * to accessible (resp. trim) states only. Then, test is equivalent
02269    * to completeness of the generated (resp. marked) language.
02270    *
02271    * @param rStates
02272    *   Set of state indices to restrict the completeness test
02273    * @return
02274    *   True if generator is relatively complete
02275    */
02276   bool IsComplete(const StateSet& rStates) const;
02277 
02278 
02279   /**
02280    * Check if generator is complete w.r.t. an alphabet
02281    *
02282    * A generator is considered complete w.r.t. an alphabet Sigma_o, 
02283    * if each state can be continued to a state in which a symbol
02284    * of Sigma_c is enabled.
02285    *
02286    * If the generator is accessible, completeness w.r.t. Sigma_o
02287    * is equivalent to:
02288    *
02289    * forall s in L(G) there exists t in (Sigma*)Sigma_u such that st in L(G)
02290    *
02291    * @param rSigmaO
02292    *   Specified alphabet Sigma_o
02293    *
02294    * @return
02295    *   True if generator is complete
02296    */
02297    bool IsComplete(const EventSet& rSigmaO) const;
02298 
02299 
02300   /**
02301    * Make generator Complete.
02302    *
02303    * This procedure removes all states that are guaranteed to evolve
02304    * into a terminal state within a finite number of transitios. 
02305    * The current implementations is initialized by
02306    * the set of terminal states and then performs a backward 
02307    * reachability analysis.
02308    *
02309    * @return
02310    *   True if generator contains at least one initial state
02311    */
02312    bool Complete(void);
02313 
02314   /**
02315    * Make generator Complete w.r.t. an alphabet
02316    *
02317    * This procedure removes all states that conflict with
02318    * completes w.r.t. the specified alphabet Sigma_o until 
02319    * a fixpoint is reached. The current implementation consists of
02320    * an outer iteration to restrict a domain of states and an inner iteration
02321    * for abcakwar reachability analyis.
02322    *
02323    * THIS IS EXPERIMENTAL / NEEDS TESTING
02324    *
02325    * @param rSigmaHi
02326    *   Specified alphabet Sigma_o
02327    *
02328    * @return
02329    *   True if generator contains at least one initial state
02330    */
02331    bool Complete(const EventSet& rSigmaO);
02332 
02333 
02334 
02335 
02336   /**
02337    * Compute set of trim states
02338    */
02339   StateSet TrimSet(void) const;
02340 
02341   /**
02342    * Make generator trim
02343    *
02344    * This function removes all states are not accessible or not
02345    * coaccessible. In other words: only those states are kept, that
02346    * contribute to that marked language.
02347    *
02348    * @return 
02349    *   True if resulting generator contains at least one initial state and at least one marked state.
02350    */
02351   bool Trim(void);
02352 
02353   /**
02354    * Check if generator is trim.
02355    *
02356    * Returns true if all states are rechable and coreachale.
02357    *
02358    * @return
02359    *   True if generator is trim
02360    */
02361   bool IsTrim(void) const;
02362 
02363 
02364   /**
02365    * Make generator omega-trim
02366    *
02367    * This function removes states such that the generator becomes
02368    * omega trim while not affecting the induced omega language. 
02369    *
02370    * The implementation first makes the generator accessible
02371    * and then iteratively removes state that either 
02372    * never reach a marked state or that are guaranteed to eventually
02373    * reach a terminal state. There might be a more efficient 
02374    * approach.
02375    *
02376    * @return 
02377    *   True if resulting generator contains at least one initial state and at least one marked state.
02378    */
02379   bool OmegaTrim(void);
02380 
02381 
02382   /**
02383    * Check if generator is omega-trim.
02384    *
02385    * Returns true if all states are accessible, coacessible, and
02386    * have a successor state.
02387    *
02388    * @return
02389    *   True if generator is omega-trim
02390    */
02391   bool IsOmegaTrim(void) const;
02392 
02393 
02394 
02395   /** @} doxygen group */
02396 
02397   /*****************************************
02398    *****************************************
02399    *****************************************
02400    *****************************************/
02401 
02402   /** @name File IO */
02403   /** @{ doxygen group */
02404  
02405   /**
02406    * Write generators alphabet to console
02407    */
02408   void WriteAlphabet(void) const;
02409 
02410   /**
02411    * Write generators alphabet to string
02412    *
02413    * @return
02414    *   std::string
02415    * @exception Exception
02416    *   - IO errors (id 2)
02417    */
02418   std::string AlphabetToString(void) const;
02419 
02420   /**
02421    * Write generators alphabet to tokenwriter
02422    *
02423    * @param rTw
02424    *   Reference to TokenWriter
02425    *
02426    * @exception Exception
02427    *   - IO errors (id 2)
02428    */
02429   void WriteAlphabet(TokenWriter& rTw) const;
02430 
02431   /**
02432    * Write a stateset to console (no re-indexing).
02433    * Uses WriteStateSet(TokenWriter& rTw, const StateSet&) const to write
02434    * the specified state set to console  referring to this generators state names.
02435    *
02436    * @param rStateSet
02437    *   Reference to stateset
02438    */
02439   void WriteStateSet(const StateSet& rStateSet) const;
02440 
02441   /**
02442    * Write a stateset to string (no re-indexing). 
02443    * Uses WriteStateSet(TokenWriter& rTw, const StateSet&) const to write
02444    * the specified state set to a string  referring to this generators state names.
02445    *
02446    * @param rStateSet
02447    *   Reference to stateset
02448    * @return
02449    *   std::string
02450    * @exception Exception
02451    *   - IO errors (id 2)
02452    */
02453   std::string StateSetToString(const StateSet& rStateSet) const;
02454 
02455   /**
02456    * Write a stateset to formated text (no re-indexing). 
02457    * Uses WriteStateSet(TokenWriter& rTw, const StateSet&) const to write
02458    * the specified state set to a string  referring to this generators state names.
02459    *
02460    * @param rStateSet
02461    *   Reference to stateset
02462    * @return
02463    *   std::string
02464    * @exception Exception
02465    *   - IO errors (id 2)
02466    */
02467   std::string StateSetToText(const StateSet& rStateSet) const;
02468 
02469   /**
02470    * Write a stateset to TokenWriter. 
02471    * All native output of external state sets done with this function.
02472    * Technically, a StateSet is a set of plain indices with no references 
02473    * to symbolic names. Thus, it is only the context of a Generator that provides
02474    * the symbolic names for file output. 
02475    * 
02476    * Output of state sets always uses the mMinStateIndexMap to re-index states. 
02477    * However, this map is only set up automatically for file output. If You require
02478    * re-indexed output to e.g. a string, you must set up the map by calling SetMinStateIndexMap().
02479    * To ensure that no re-indexing takes place, call ClearMinStateIndexMap().
02480    *
02481    * @param rTw
02482    *   Reference to TokenWriter
02483    * @param rStateSet
02484    *   Reference to stateset
02485    *
02486    * @exception Exception
02487    *   - IO errors (id 2)
02488    */
02489   void WriteStateSet(TokenWriter& rTw, const StateSet& rStateSet) const;
02490 
02491   /**
02492    * Write a stateset to TokenWriter (debug version, no re-indexing)
02493    * 
02494    * @param rTw
02495    *   Reference to TokenWriter
02496    * @param rStateSet
02497    *   Reference to stateset
02498    *
02499    * @exception Exception
02500    *   - IO errors (id 2)
02501    */
02502    void DWriteStateSet(TokenWriter& rTw, const StateSet& rStateSet) const;
02503 
02504   /**
02505    * Write stateset of this generator to a string (no  re-indexing)
02506    *
02507    * @return
02508    *   std::string
02509    * @exception Exception
02510    *   - IO errors (id 2)
02511    */
02512   std::string StatesToString(void) const;
02513 
02514   /**
02515    * Write stateset of this generator to formated text (no  re-indexing)
02516    *
02517    * @return
02518    *   std::string
02519    * @exception Exception
02520    *   - IO errors (id 2)
02521    */
02522   std::string StatesToText(void) const;
02523 
02524   /**
02525    * Write set of marked states to a string (no  re-indexing)
02526    *
02527    * @return
02528    *   std::string
02529    * @exception Exception
02530    *   - IO errors (id 2)
02531    */
02532   std::string MarkedStatesToString(void) const;
02533 
02534   /**
02535    * Write set of initial states to a string (no  re-indexing)
02536    *
02537    * @return
02538    *   std::string
02539    * @exception Exception
02540    *   - IO errors (id 2)
02541    */
02542   std::string InitStatesToString(void) const;
02543 
02544   /**
02545    * Write transition relation to console (no re-indexing)
02546    */
02547   void WriteTransRel(void) const;
02548 
02549   /**
02550    * Write transition relation to string (no re-indexing)
02551    */
02552   std::string TransRelToString(void) const;
02553 
02554   /**
02555    * Write transition relation to formated text (no re-indexing)
02556    */
02557   std::string TransRelToText(void) const;
02558 
02559   /**
02560    * Write transition relation to tokenwriter.
02561    * Re-indexing and symbolic state names are handled in the same way
02562    * as with state sets: this function refers to the generators state symboltable to
02563    * obtain state names and  uses the mMinStateIndexMap to re-index the output.
02564    *
02565    * @param rTw
02566    *   Reference to TokenWriter
02567    *
02568    * @exception Exception
02569    *   - IO errors (id 2)
02570    */
02571   void WriteTransRel(TokenWriter& rTw) const;
02572 
02573   /**
02574    * Write transition relation to tokenwriter (debug version)
02575    * @param rTw
02576    *   Reference to TokenWriter
02577    *
02578    * @exception Exception
02579    *   - IO errors (id 2)
02580    */
02581   void DWriteTransRel(TokenWriter& rTw) const;
02582 
02583  
02584   /**
02585    * Writes generator to dot input format.
02586    * The dot file format is specified by the graphiz package; see http://www.graphviz.org.
02587    * The package includes the dot command line tool to generate a graphical 
02588    * representation of the generators graph. See also GraphWrite().
02589    * This functions sets the re-indexing to minimal indices.
02590    *
02591    * @param rFileName
02592    *   File to write
02593    *
02594    * @exception Exception
02595    *   - IO errors (id 2)
02596    */
02597   virtual void DotWrite(const std::string& rFileName) const;
02598 
02599   /**
02600    * Writes generator to dot input format (no re-indexing).
02601    * Variant of DotWrite() without re-indexing.
02602    *
02603    * @param rFileName
02604    *   File to write
02605    *
02606    * @exception Exception
02607    *   - IO errors (id 2)
02608    */
02609   virtual void DDotWrite(const std::string& rFileName) const;
02610 
02611   /**
02612    * Writes generator to dot input format for export to VioLib.
02613    * Variant of DotWrite() using strategic state and event names
02614    * to simplify import to VioLib (qt widget for graphical representation
02615    * of FAUDES generators).
02616    *
02617    * @param rFileName
02618    *   File to write
02619    * @exception Exception
02620    *   - IO errors (id 2)
02621    */
02622   virtual void XDotWrite(const std::string& rFileName) const;
02623 
02624   /**
02625    * Read a state set.
02626    * Refer to the generators state symboltable while reading a state set.
02627    * Ignore any attributes.
02628    *
02629    * @param rTr
02630    *   Reference to TokenReader
02631    * @param rLabel
02632    *   Label of set in source
02633    * @param rStateSet
02634    *   Destination state set 
02635    *
02636    * @exception Exception
02637    *   - IO errors (id 1)
02638    *   - token mismatch (id 50, 51, 52, 80, 85)
02639    */
02640   void ReadStateSet(TokenReader& rTr, const std::string& rLabel, StateSet& rStateSet) const;
02641 
02642 
02643   /**
02644    * Test whether file-i/o uses minimal state indicees.
02645    * 
02646    * @return
02647    *   True when minimal state indicees are enabled
02648    */
02649   bool ReindexOnWrite(void) const;
02650 
02651   /**
02652    * Enable/disable minimal state indicees for file-i/o.
02653    *
02654    * @param flag
02655    *   True enables reindexing.
02656    */
02657   void ReindexOnWrite(bool flag);
02658 
02659 
02660   /**
02661    * Enable/disable reindexing states for file-i/o.
02662    *
02663    * Set default value for re-indexing. Initially, the default
02664    * is set to "false".
02665    *
02666    * @param flag
02667    *   True enables reindexing.
02668    */
02669   static void ReindexOnWriteDefault(bool flag);
02670 
02671 
02672   /**
02673    * Enable/disable reindexing states for file-i/o.
02674    *
02675    * Set default value for re-indexing.
02676    *
02677    * @return
02678    *   True for reindexing enabled.
02679    */
02680   static bool ReindexOnWriteDefault(void);
02681 
02682 
02683   /** @} doxygen group */
02684 
02685 
02686   /*****************************************
02687    *****************************************
02688    *****************************************
02689    *****************************************/
02690 
02691   /** @name Misc */
02692   /** @{ doxygen group */
02693 
02694   /**
02695    * Return used events (executed in transitions)
02696    *
02697    * @return EventSet
02698    */
02699   EventSet UsedEvents(void) const;
02700 
02701   /**
02702    * Return unused events
02703    *
02704    * @return EventSet
02705    */
02706   EventSet UnusedEvents(void) const;
02707 
02708   /**
02709    * Set the alphabet to used events
02710    */
02711   void MinimizeAlphabet(void);
02712 
02713   /**
02714    * Return active event set at state x1
02715    *
02716    * @param x1
02717    *   Index of x1
02718    *
02719    * @return EventSet
02720    */
02721   EventSet ActiveEventSet(Idx x1) const;
02722 
02723   /**
02724    * Return active transition set at state x1
02725    *
02726    * @param x1
02727    *   Index of x1
02728    *
02729    * @return EventSet
02730    */
02731   TransSet ActiveTransSet(Idx x1) const;
02732 
02733   /**
02734    * Return the states covered by transitions
02735    *
02736    * @return StateSet
02737    */
02738   StateSet TransRelStates(void) const;
02739 
02740   /**
02741    * Return the successor state of state x1 with event ev.
02742    * If no such transition exists, return 0.
02743    * If multiple such transitions exit, through expection.
02744    *
02745    * A more egeneral set valued interface is provided by TransSet
02746    *
02747    * @return next state
02748    * @exception Exception
02749    *  - Successor state does not exist uniquely (id 92)
02750    */
02751    Idx SuccessorState(Idx x1, Idx ev) const;
02752 
02753   /**
02754    * Return the successor states of state x1
02755    *
02756    * @return StateSet
02757    */
02758   StateSet SuccessorStates(Idx x1) const;
02759 
02760   /**
02761    * Return the successor states of state x1 with event ev
02762    *
02763    * @return StateSet
02764    */
02765   StateSet SuccessorStates(Idx x1, Idx ev) const;
02766 
02767   /**
02768    * Check if generator is deterministic.
02769    *
02770    * We require the transition relation to be a partial function
02771    * and at most one initial state.
02772    * 
02773    * Note: pre 2.19 libFAUDES also insisted in exactly one initial state.
02774    * 
02775    *
02776    * @return
02777    *   True if generator is deterministic
02778    */
02779   bool IsDeterministic(void) const;
02780 
02781   /**
02782    * Set minimal index map for file io of generator states
02783    *
02784    * This function is implemented as fake-const to allow for
02785    * const Write function.
02786    *
02787    */
02788   void SetMinStateIndexMap(void) const;
02789 
02790   /**
02791    * Clear minimal index map for 1:1 file io 
02792    *
02793    */
02794   void ClearMinStateIndexMap(void) const;
02795 
02796   /**
02797    * Get state index as is it will be written to file.
02798    *
02799    * @param index
02800    *   state index
02801    * @return
02802    *   minimal index
02803    */
02804   Idx MinStateIndex(Idx index) const;
02805 
02806 
02807   /**
02808    * Re-enumerate states.
02809    *
02810    * This method re-enumerates states such that the resulting
02811    * state set consist of consecutive indexes; i.e. Size()=MaxStateIndex().
02812    * The current implementation sets up the minimal-state-index map used for
02813    * file i/o and applies it to the state set and the transition relation.
02814    *
02815    * Note: libFAUDES does not maintain consecutive state indices.
02816    * This was a design decision and it comes pros and cons. The method MinStateIndex()
02817    * was implemented to provide some limited support for the implementation of algorithms in a 
02818    * consecutive state enumeration paradigm. However, mixing both paradigms most likely
02819    * involves an overall performace penalty.
02820    */
02821   void MinStateIndex(void);
02822 
02823 
02824   /**
02825    * Get maximum state index used in this generator.
02826    * Returns 0 if no states at all.
02827    * @return
02828    *   maximal index
02829    */
02830   Idx MaxStateIndex(void) const;
02831 
02832 
02833   /**
02834    * Get state index translation map
02835    *
02836    * @return
02837    *   minimal index map
02838    */
02839   const std::map<Idx,Idx>& MinStateIndexMap(void) const;
02840 
02841 
02842   /**
02843    * Pretty printable event name for index (eg for debugging).
02844    *
02845    * @param index
02846    *   Event index
02847    *
02848    * @return
02849    *   std::string
02850    */
02851   std::string EStr(Idx index) const;
02852 
02853   /**
02854    * Return pretty printable state name for index (eg for debugging)
02855    *
02856    * @param index
02857    *   State index
02858    *
02859    * @return
02860    *   std::string
02861    */
02862   std::string SStr(Idx index) const;
02863 
02864   
02865   /**
02866    * Return pretty printable transition (eg for debugging)
02867    *
02868    * @param rTrans
02869    *   Transition
02870    *
02871    * @return
02872    *   std::string
02873    */
02874   std::string TStr(const Transition& rTrans) const;
02875 
02876   
02877   /**
02878    * Produce graphical representation of this generator.
02879    * This method calls the generator's DotWrite function and then processes the output
02880    * with the dot tool from graphiz package.  If no output format is given,
02881    * try to guess from filename extension.  See also ProcessDot().
02882    *
02883    * @param rFileName
02884    *   Name of output file
02885    * @param rOutFormat
02886    *   Graphics file format, eg "png", "jpg", "svg"
02887    * @param rDotExec
02888    *   path/name of executable
02889    * @exception Exception
02890    *   - IO errors (id 2)
02891    *   - error during systemcall for dot (id 3)
02892    */
02893   void GraphWrite(const std::string& rFileName, const std::string& rOutFormat="", 
02894     const std::string& rDotExec="dot") const;
02895 
02896   /** 
02897    * Order for sorting containers of generators 
02898    */
02899   bool operator < (const vGenerator& rOtherGen) const {
02900     return (mId < rOtherGen.mId);
02901   }
02902 
02903  
02904   /** @} doxygen group */
02905 
02906 
02907  protected:
02908 
02909   /** Name of generator */
02910   std::string mMyName;
02911 
02912   /** Number of generator */
02913   Idx mId;
02914 
02915   /** Number of generator objects */
02916   static Idx msObjectCount;
02917 
02918   /** State symbol table (local per Generator)*/
02919   SymbolTable mStateSymbolTable;
02920 
02921   /** Pointer to State symbol table */
02922   SymbolTable* mpStateSymbolTable;
02923 
02924   /** Pointer to Event symbol table */
02925   SymbolTable* mpEventSymbolTable;
02926 
02927   /** Automatic state names */
02928   bool mStateNamesEnabled;
02929   
02930   /** Default for automatic statenames */
02931   static bool msStateNamesEnabledDefault;
02932 
02933   /** Reindex states on file-i/o */
02934   bool mReindexOnWrite;
02935 
02936   /** Default for automatic statenames */
02937   static bool msReindexOnWriteDefault;
02938 
02939   /** Pointer to alphabet (actual type depends on attributes) */
02940   EventSet* mpAlphabet;
02941 
02942   /** Pointer to state set (actual type depends on attributes) */
02943   StateSet* mpStates;
02944 
02945   /** Pointer to ransition relation (actual type depends on attributes) */
02946   TransSet* mpTransRel;
02947 
02948   /** Pointer to lobal attribute (actual type depends on attributes) */
02949   AttributeVoid* mpGlobalAttribute;
02950 
02951   /** Pointer to alphabet prototype (incl. attribute type) */
02952   const EventSet* pAlphabetPrototype;
02953 
02954   /** Pointer to state set prototype (incl. attribute type) */
02955   const StateSet* pStatesPrototype;
02956 
02957   /** Pointer to transition relation prototype (incl. attribute type) */
02958   const TransSet* pTransRelPrototype;
02959 
02960   /** Pointer to global attribute prototype (configures global attribute type) */
02961   const AttributeVoid* pGlobalPrototype;
02962 
02963   /** Static default alphabet prototype (incl. attribute type) */
02964   static const EventSet& AlphabetVoid(void);
02965 
02966   /** Static default state set prototype (incl. attribute type) */
02967   static const StateSet& StatesVoid(void);
02968 
02969   /** Static default transition relation prototype (incl. attribute type) */
02970   static const TransSet& TransRelVoid(void);
02971 
02972   /** Static default global attribute prototype (configures global attribute type) */
02973   static const AttributeVoid& GlobalVoid(void);
02974 
02975   /** Initial states */
02976   StateSet mInitStates;
02977 
02978   /** Marked states */
02979   StateSet mMarkedStates;
02980 
02981   /** Map State indices to consecutive indices */
02982   std::map<Idx,Idx> mMinStateIndexMap;
02983 
02984   /** Allocate my heap members (attribute dependent types) */
02985   virtual void NewCore(void);
02986   
02987   /** Free my heap members (attribute dependent types) */
02988   virtual void DeleteCore(void);
02989 
02990   /** Callback for core update */
02991   virtual void UpdateCore(void);
02992 
02993   /** Configure attribute types */
02994   void ConfigureAttributeTypes(const AttributeVoid* pNewGlobalPrototype, 
02995     const StateSet* pNewStatesPrototype, const EventSet* pNewAlphabetPrototype, 
02996     const TransSet* pNewTransRelPrototype);
02997 
02998   /**
02999    * Read generator object from TokenReader, see Type::Read for public wrappers.
03000    *
03001    * Virtual function for std token io interface. Context is ignored,
03002    * label defaults to "Generator".
03003    *
03004    * @param rTr
03005    *   TokenReader to read from
03006    * @param rLabel
03007    *   Section to read
03008    * @param pContext
03009    *   Read context to provide contextual information (ignored)
03010    *
03011    * @exception Exception
03012    *   - token mismatch (id 50, 51, 52, 80, 85)
03013    *   - IO error (id 1)
03014    */
03015   virtual void DoRead(TokenReader& rTr,  const std::string& rLabel = "", const Type* pContext=0);
03016  
03017   /**
03018    * Write generator to TokenWriter, see Type::Write for public wrappers.
03019    *
03020    * Virtual function for std token io interface. Context is ignored,
03021    * label defaults to "Generator". If the tokenwriter writes to a file,
03022    * state indices will be re-indext to start from 1.
03023    *
03024    * @param rTw
03025    *   Reference to TokenWriter
03026    * @param rLabel
03027    *   Label of section to write
03028    * @param pContext
03029    *   Write context to provide contextual information (ignored)
03030    *
03031    * @exception Exception 
03032    *   - IO errors (id 2)
03033    */
03034   virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
03035 
03036   /**
03037    * Write generator in debugging format to TokenWriter, see Type::DWrite for public wrappers.
03038    *
03039    * Reimplement this method in derived classes to provide the std token io
03040    * interface defined in the public section of Type.
03041    *
03042    * @param rTw
03043    *   Reference to TokenWriter
03044    * @param rLabel
03045    *   Label of section to write
03046    * @param pContext
03047    *   Write context to provide contextual information (ignored)
03048    *
03049    * @exception Exception 
03050    *   - IO errors (id 2)
03051    */
03052   virtual void DoDWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
03053 
03054   /**
03055    * Write generator statistics as comment to TokenWriter, see Type::SWrite for public wrappers.
03056    *
03057    * Reimplement this method in derived classes to provide the std token io
03058    * interface defined in the public section of Type.
03059    *
03060    * @param rTw
03061    *   Reference to TokenWriter
03062    *
03063    * @exception Exception 
03064    *   - IO errors (id 2)
03065    */
03066   virtual void DoSWrite(TokenWriter& rTw) const;
03067 
03068   /**
03069    * Write generator to TokenWriter, see Type::XWrite for public wrappers.
03070    *
03071    * Virtual function for std token io interface. Context is ignored,
03072    * label defaults to "Generator". 
03073    *
03074    * @param rTw
03075    *   Reference to TokenWriter
03076    * @param rLabel
03077    *   Label of section to write
03078    * @param pContext
03079    *   Write context to provide contextual information (ignored)
03080    *
03081    * @exception Exception 
03082    *   - IO errors (id 2)
03083    */
03084   virtual void DoXWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
03085 
03086   /**
03087    * Read the generator's name from a file
03088    * 
03089    * @param rFileName
03090    *   File to read from
03091    *
03092    * @exception Exception
03093    *   - IO errors (id 1)
03094    *   - token mismatch (id 50, 51, 52)
03095    */
03096   void ReadGeneratorName(const std::string& rFileName);
03097 
03098   /**
03099    * Read the generator's name from a TokenReader
03100    * 
03101    * @param rTr
03102    *   Reference to TokenReader
03103    *
03104    * @exception Exception
03105    *   - IO errors (id 1)
03106    *   - token mismatch (id 50, 51, 52)
03107    */
03108   void ReadGeneratorName(TokenReader& rTr);
03109 
03110   /**
03111    * Read the generator's alphabet from a file.
03112    *
03113    * @param rFileName
03114    *   File to read from
03115    *
03116    * @exception Exception
03117    *   - IO errors (id 1)
03118    *   - token mismatch (id 50, 51, 52)
03119    */
03120   void ReadAlphabet(const std::string& rFileName);
03121 
03122   /**
03123    * Read the generator's alphabet from a TokenReader
03124    *
03125    * @param rTr
03126    *   Reference to TokenReader
03127    *
03128    * @exception Exception
03129    *   - IO errors (id 1)
03130    *   - token mismatch (id 50, 51, 52)
03131    */
03132   void ReadAlphabet(TokenReader& rTr);
03133 
03134   /**
03135    * Read the generator's state set from a file. 
03136    * This sets up the StateSymbolTable. In contrast
03137    * to ReadStateSet(), this version will accept
03138    * explicit symbol table information.
03139    *
03140    * @param rFileName
03141    *   File to read from
03142    *
03143    * @exception Exception
03144    *   - IO errors (id 1)
03145    *   - token mismatch (id 50, 51, 52)
03146    */
03147   void ReadStates(const std::string& rFileName);
03148 
03149   /**
03150    * Write generators stateset to TokenWriter. 
03151    *
03152    * This method differs from the general purpos version 
03153    * WriteStateSet(TokenWriter&, const StateSet&) in that it
03154    * can optionally write an explicit symbol table for state names.
03155    * This will happen whenever writing is done without re-indexing
03156    * states. 
03157    *
03158    * @param rTw
03159    *   Reference to TokenWriter
03160    * @param rStateSet
03161    *   Reference to stateset
03162    *
03163    * @exception Exception
03164    *   - IO errors (id 2)
03165    */
03166   void WriteStates(TokenWriter& rTw) const;
03167 
03168   /**
03169    * Read the generator's stateset from a TokenReader. 
03170    * This sets up the StateSymbolTable
03171    *
03172    * @param rTr
03173    *   Reference to TokenReader
03174    *
03175    * @exception Exception
03176    *   - IO errors (id 1)
03177    *   - token mismatch (id 50, 51, 52)
03178    */
03179   void ReadStates(TokenReader& rTr);
03180 
03181   /**
03182    * Read a stateset from TokenReader in XML format.
03183    *
03184    * This version for file IO supports the XML format introduced with libFAUDES 2.20.
03185    * Note that for Generators and derived classes, the native libFAUDES token
03186    * format is considered the default. To read  XML fromated data,
03187    * use the XRead() interface.
03188    *
03189    * @param rTr
03190    *   Reference to TokenReader
03191    * @param rStateSet
03192    *   Reference to stateset
03193    * @param rLabel
03194    *   Section name, defaults to name of set
03195    *
03196    * @exception Exception
03197    *   - IO errors (id 1)
03198    *   - token mismatch (id 50, 51, 52)
03199    */
03200   void XReadStateSet(TokenReader& rTr, StateSet& rStateSet, const std::string& rLabel="") const;
03201 
03202   /**
03203    * Read the generator's transition relation from a file. 
03204    *
03205    * @param rFileName
03206    *   File to read from
03207    *
03208    * @exception Exception
03209    *   - IO errors (id 1)
03210    *   - token mismatch (id 50, 51, 52)
03211    */
03212   void ReadTransRel(const std::string& rFileName);
03213 
03214   /**
03215    * Read the generator's transition relation from a TokenReader. 
03216    *
03217    * @param rTr
03218    *   Reference to TokenReader
03219    *
03220    * @exception Exception
03221    *   - IO errors (id 1)
03222    *   - token mismatch (id 50, 51, 52)
03223    */
03224   void ReadTransRel(TokenReader& rTr);
03225 
03226   /**
03227    * Read the generator's transition relation from a TokenReader. 
03228    *
03229    * @param rTr
03230    *   Reference to TokenReader
03231    *
03232    * @exception Exception
03233    *   - IO errors (id 1)
03234    *   - token mismatch (id 50, 51, 52)
03235    */
03236   void XReadTransRel(TokenReader& rTr);
03237 
03238   /**
03239    * Write a stateset to TokenWriter in XML format.
03240    *
03241    * This version for file IO supports the XML format introduced with libFAUDES 2.20.
03242    * Note that for Generators and derived classes, the native libFAUDES token
03243    * format is considered the default. To obtain XML fromated output of a Generator,
03244    * use the XWrite() interface.
03245    *
03246    * @param rTw
03247    *   Reference to TokenWriter
03248    * @param rStateSet
03249    *   Reference to stateset
03250    * @param rLabel
03251    *   Section name, defaults to name of set
03252    *
03253    * @exception Exception
03254    *   - IO errors (id 2)
03255    */
03256   void XWriteStateSet(TokenWriter& rTw, const StateSet& rStateSet, const std::string& rLabel="") const;
03257 
03258   /**
03259    * Write transition relation to tokenwriter in XML format.
03260    *
03261    * This version for file IO supports the XML format introduced with libFAUDES 2.20.
03262    * Note that for Generators and derived classes, the native libFAUDES token
03263    * format is considered the default. To obtain XML fromated output of a Generator,
03264    * use the XWrite() interface.
03265    *
03266    *
03267    * @param rTw
03268    *   Reference to TokenWriter
03269    *
03270    * @exception Exception
03271    *   - IO errors (id 2)
03272    */
03273   void XWriteTransRel(TokenWriter& rTw) const;
03274 
03275 
03276 };
03277 
03278 /** 
03279  * Plain generator, api typedef for generator with no attributes. 
03280  * \ingroup GeneratorClasses
03281  */
03282 typedef vGenerator Generator; 
03283 
03284 /** 
03285  * Convenience typedef for vectors og generators
03286  * \ingroup GeneratorClasses
03287  */
03288 typedef  TBaseVector<Generator> GeneratorVector;  
03289 
03290 
03291 /** 
03292  * RTI wrapper function. See also vGenerator::IsAccessible().
03293  * \ingroup GeneratorFunctions
03294  */
03295 bool IsAccessible(const vGenerator& rGen);
03296 
03297 /** 
03298  * RTI wrapper function. See also vGenerator::IsCoaccessible().
03299  * \ingroup GeneratorFunctions
03300  */
03301 bool IsCoaccessible(const vGenerator& rGen);
03302 
03303 /** 
03304  * RTI wrapper function. See also vGenerator::IsTrim().
03305  * \ingroup GeneratorFunctions
03306  */
03307 bool IsTrim(const vGenerator& rGen);
03308 
03309 /** 
03310  * RTI wrapper function. See also vGenerator::IsOmegaTrim().
03311  * \ingroup GeneratorFunctions
03312  */
03313 bool IsOmegaTrim(const vGenerator& rGen);
03314 
03315 /** 
03316  * RTI wrapper function. See also vGenerator::IsComplete().
03317  * \ingroup GeneratorFunctions
03318  */
03319 bool IsComplete(const vGenerator& rGen);
03320 
03321 /** 
03322  * RTI wrapper function. See also vGenerator::IsComplete().
03323  * \ingroup GeneratorFunctions
03324  */
03325 bool IsComplete(const vGenerator& rGen, const EventSet& rSigmaO);
03326 
03327 /** 
03328  * RTI wrapper function. See also vGenerator::IsDeterministic().
03329  * \ingroup GeneratorFunctions
03330  */
03331 bool IsDeterministic(const vGenerator& rGen);
03332 
03333 
03334 /** 
03335  * RTI wrapper function. See also vGenerator::Accessible().
03336  * \ingroup GeneratorFunctions
03337  */
03338 void Accessible(vGenerator& rGen);
03339 
03340 /** 
03341  * RTI wrapper function. See also vGenerator::Accessible().
03342  * \ingroup GeneratorFunctions
03343  */
03344 void Accessible(const vGenerator& rGen, vGenerator& rRes);
03345 
03346 /** 
03347  * RTI wrapper function. See also vGenerator::Coaccessible().
03348  * \ingroup GeneratorFunctions 
03349  */
03350 void Coaccessible(vGenerator& rGen);
03351 
03352 /** 
03353  * RTI wrapper function. See also vGenerator::Coaccessible().
03354  * \ingroup GeneratorFunctions
03355  */
03356 void Coaccessible(const vGenerator& rGen, vGenerator& rRes);
03357 
03358 /** 
03359  * RTI wrapper function. See also vGenerator::Complete().
03360  * \ingroup GeneratorFunctions
03361  */
03362 void Complete(vGenerator& rGen);
03363 
03364 /** 
03365  * RTI wrapper function. See also vGenerator::Complete().
03366  * \ingroup GeneratorFunctions
03367  */
03368 void Complete(const vGenerator& rGen, vGenerator& rRes);
03369 
03370 /** 
03371  * RTI wrapper function. See also vGenerator::Complete().
03372  * \ingroup GeneratorFunctions
03373  */
03374 void Complete(vGenerator& rGen, const EventSet& rSigmaO);
03375 
03376 /** 
03377  * RTI wrapper function. See also vGenerator::Complete().
03378  * \ingroup GeneratorFunctions
03379  */
03380 void Complete(const vGenerator& rGen, const EventSet& rSigmaO, vGenerator& rRes);
03381 
03382 /** 
03383  * RTI wrapper function. See also vGenerator::Trim().
03384  * \ingroup GeneratorFunctions
03385  */
03386 void Trim(vGenerator& rGen);
03387 
03388 /** 
03389  * RTI wrapper function. See also vGenerator::Trim().
03390  * \ingroup GeneratorFunctions
03391  */
03392 void Trim(const vGenerator& rGen, vGenerator& rRes);
03393 
03394 /** 
03395  * RTI wrapper function. See also vGenerator::OmegaTrim().
03396  * \ingroup GeneratorFunctions
03397  */
03398 void OmegaTrim(vGenerator& rGen);
03399 
03400 /** 
03401  * RTI wrapper function. See also vGenerator::OmegaTrim().
03402  * \ingroup GeneratorFunctions
03403  */
03404 void OmegaTrim(const vGenerator& rGen, vGenerator& rRes);
03405 
03406 /** 
03407  * RTI wrapper function. 
03408  * \ingroup GeneratorFunctions
03409  */
03410 void MarkAllStates(vGenerator& rGen);
03411 
03412 /** 
03413  * RTI wrapper function. 
03414  * \ingroup GeneratorFunctions
03415  */
03416 void AlphabetExtract(const vGenerator& rGen, EventSet& rRes);
03417 
03418 
03419 /** 
03420  * RTI convenience function. 
03421  */
03422 void SetIntersection(const vGenerator& rGenA, const vGenerator& rGenB, EventSet& rRes);
03423 
03424 /** 
03425  * RTI convenience function. 
03426  */
03427 void SetIntersection(const GeneratorVector& rGenVec, EventSet& rRes);
03428 
03429 /** 
03430  * RTI convenience function. 
03431  */
03432 void SetUnion(const vGenerator& rGenA, const vGenerator& rGenB, EventSet& rRes);
03433 
03434 /** 
03435  * RTI convenience function. 
03436  */
03437 void SetUnion(const GeneratorVector& rGenVec, EventSet& rRes);
03438 
03439 /** 
03440  * RTI convenience function. 
03441  */
03442 void SetDifference(const vGenerator& rGenA, const vGenerator& rGenB, EventSet& rRes);
03443 
03444 
03445 
03446 
03447 } // namespace faudes
03448 
03449 /*
03450 
03451 #define FAUDES_GENERATOR_DECLARATION(gtype,GlobalAttr,StateAttr,EventAttr,TransAttr) \
03452   public:                                                                     \
03453   virtual void EventAttribute(Idx index, const EventAttr& rAttr);             \
03454   virtual void EventAttributes(const TaEventSet<EventAttr>& rEventSet);       \
03455   virtual const EventAttr& EventAttribute(Idx index) const;                   \
03456   virtual const EventAttr& EventAttribute(const std::string& rName) const;    \
03457   virtual EventAttr* EventAttributep(Idx index);                              \
03458   virtual EventAttr* EventAttributep(const std::string& rName);               \
03459   virtual void StateAttribute(Idx index, const StateAttr& rAttr);             \
03460   virtual const StateAttr& StateAttribute(Idx index) const;                   \
03461   virtual StateAttr* StateAttributep(Idx index);                              \
03462   virtual void TransAttribute(const Transition& rTrans, const TransAttr& rAttr); \
03463   virtual const TransAttr& TransAttribute(const Transition& rTrans) const;     \
03464   virtual TransAttr* TransAttributep(const Transition& rTrans);               \
03465   virtual void GlobalAttribute(const GlobalAttr& rAttr);                      \
03466   virtual void GlobalAttributeTry(const Type& rAttr);                         \
03467   virtual const GlobalAttr& GlobalAttribute(void) const;                      \
03468   virtual GlobalAttr* GlobalAttributep(void);                       
03469 
03470 #define FAUDES_GENERATOR_IMPLEMENTATION(gtype,GlobalAttr,StateAttr,EventAttr,TransAttr) \
03471   public:                                                                     \
03472   virtual void EventAttribute(Idx index, const EventAttr& rAttr);             \
03473   virtual void EventAttributes(const TaEventSet<EventAttr>& rEventSet);       \
03474   virtual const EventAttr& EventAttribute(Idx index) const;                   \
03475   virtual const EventAttr& EventAttribute(const std::string& rName) const;    \
03476   virtual EventAttr* EventAttributep(Idx index);                              \
03477   virtual EventAttr* EventAttributep(const std::string& rName);               \
03478   virtual void StateAttribute(Idx index, const StateAttr& rAttr);             \
03479   virtual const StateAttr& StateAttribute(Idx index) const;                   \
03480   virtual StateAttr* StateAttributep(Idx index);                              \
03481   virtual void TransAttribute(const Transition& rTrans, const TransAttr& rAttr); \
03482   virtual const TransAttr& TransAttribute(const Transition& rTrans) const;     \
03483   virtual TransAttr* TransAttributep(const Transition& rTrans);               \
03484   virtual void GlobalAttribute(const GlobalAttr& rAttr);                      \
03485   virtual void GlobalAttributeTry(const Type& rAttr);                         \
03486   virtual const GlobalAttr& GlobalAttribute(void) const;                      \
03487   virtual GlobalAttr* GlobalAttributep(void);                       
03488 
03489 */
03490 
03491 
03492 #endif
03493 

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen