cfl_generator.h
Go to the documentation of this file.
1 /** @file cfl_generator.h Class vGenerator */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5 Copyright (C) 2006 Bernd Opitz
6 Copyright (C) 2007 Thomas Moor
7 Exclusive copyright is granted to Klaus Schmidt
8 
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13 
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 
24 #ifndef FAUDES_VGENERATOR_H
25 #define FAUDES_VGENERATOR_H
26 
27 #include "cfl_definitions.h"
28 #include "cfl_exception.h"
29 #include "cfl_types.h"
30 #include "cfl_symboltable.h"
31 #include "cfl_indexset.h"
32 #include "cfl_nameset.h"
33 #include "cfl_transset.h"
34 #include "cfl_token.h"
35 #include "cfl_tokenreader.h"
36 #include "cfl_tokenwriter.h"
37 
38 #include <map>
39 #include <set>
40 #include <sstream>
41 #include <cstdlib>
42 #include <cassert>
43 
44 namespace faudes {
45 
46 /**
47  * Base class of all FAUDES generators.
48  *
49  * \section GeneratorMembers Overview
50  *
51  * The faudes::vGenerator models the plain five-tupel G = (X, Sigma, Delta, X_0, X_m) to represent
52  * the marked language L(G) and closed language L_m(G), respectively. It provides read and write
53  * access to core menbers, e.g. methods for inserting/deleting events, states
54  * and transitions.
55  *
56  *
57  * States, events and transitions in a generator can be addressed in three alternative methods:
58  *
59  * - by index, involves a search on a sorted set (efficient)
60  * - by name, involves two searches on sorted sets (not quite so efficient)
61  * - by iterator, involves pointer dereferencing (very efficient)
62  *
63  * For read access, const refererences to sets are provided. In order to allow for consistency checks,
64  * write access is via generator methods only. When the compiletime option FAUDES_CHECKED is
65  * defined, write methods throw an exception on inconsistent data, eg. setting an initial state
66  * that is not an element of the state set, or introducing a transition with an event label that
67  * is not in the alphabet.
68  *
69  *
70  * \section SecEventsVersusStates Events Versus States
71  *
72  * While both, events and states, are represented by the integer type faudes::Idx, there
73  * is a fundamental distinction between both, which stems from the design choice to use generators
74  * as a tool to represent formal languages. From this perspective, events are global enteties while states
75  * are local to the respective generator. Any two events within libFAUDES are related while states only
76  * compare within a generator.
77  *
78  * In consequence, there is global sybmoltable for event name resolution,
79  * while there is one local state symboltable for
80  * each generator. Furthermore, state names are considered cosmetic and hence are optional, while
81  * event names are mandatory.
82  *
83  * Example: two machines both refer to the event name "alpha" that models the process of passing
84  * a workpiece from one machine to the other. In libFAUDES this is indeed modelled as one event
85  * which is represented by one index. However, both machines may have a state "Idle" which indicates
86  * that the respective machine is idle. In libFAUDES the two states are treated locally to the
87  * generators and whether or not they have the same index is regarded irrelevant.
88  *
89  * The generator class carries a flag to indicate that functions with result type
90  * generator shall attach names to the newly created states, based on the state names
91  * of the respective arguments. Turning of this feature and avoiding state names alltogether
92  * considerably increases libFAUDES performance.
93  *
94  * \section GeneratorFileFormat File I/O (default format)
95  *
96  * Generators inherit the standard token IO interface from the libFAUDES general purpose base Type,
97  * so you may use Read and Write functions for generators. The file-format consists of a generator
98  * section that includes one subsection for each core member. It is illustrated by the below example
99  *
100  * @code
101  * <Generator name="simple machine">
102  * % libFAUDES Generator for the simple machine
103  *
104  * <Alphabet>
105  * alpha beta mue lambda
106  * </Alphabet>
107  *
108  * <States>
109  * idle busy down
110  * </States>
111  *
112  * <TransRel>
113  * idle alpha busy
114  * busy beta idle
115  * busy mue down
116  * down lambda idle
117  * </TransRel>
118  *
119  * <InitStates>
120  * idle
121  * </InitStates>
122  *
123  * <MarkedStates>
124  * idle
125  * </MarkedStates>
126  * </Generator>
127  * @endcode
128  *
129  * Technical Detail: Since symbolic state names are optional, states may alternatively be represented
130  * by their index. In order to consitently read a generator from a token stream, the convention
131  * was that states are indexed consecutively starting from 1. This convention produces nice and human-readable output.
132  * However, it requires a re-indexing when writing the generator. As of libFAUDES 2.20j, the token format was extended to
133  * allow for explicit symbol table entries in the format "symbolic_state_name#index". Whether or not re-indexing
134  * is applied can be configured via ReindexOnWrite(bool). The default is not to re-index. If you want to read your token
135  * stream with libFAUDES pre 2.20j, you must turn re-index on.
136  *
137  *
138  * Technical Detail: The generator name, the alphabet and the state set are optional. The generator
139  * name defaults to "generator"; the alphabet and the state set are extracted from the transition relation.
140  * Furthermore, there alternative short labels "A" for "Alphabet", "S" for "States" etc. are accepted.
141  * This short format has been introduced in 2.24e and is meant for embedding data concisely into luafaudes scripts.
142  * In general, the full format is preferable.
143  *
144  * @code
145  * <Generator>
146  * <T>
147  * idle alpha busy
148  * busy beta idle
149  * busy mue down
150  * down lambda idle
151  * </T>
152  * <I> idle </I>
153  * <M> idle </M>
154  * </Generator>
155  * @endcode
156  *
157  * \section GeneratorFileFormatXML File I/O (XML file-format)
158  *
159  * The alternative file file format prodiced by XWrite() is meant to accomodate
160  * for additional attributes attached to states, events and transitions, including e.g.
161  * graph data for a graphical representation. It starts with the outer element "Generator" with
162  * name attribute (optionally) and type attribute (mandatory).
163  *
164  *
165  * @code
166  * <Generator name="simpla machine" ftype="Generator">
167  * <Alphabet>
168  * <Event name="alpha"/>
169  * <Event name="beta"/>
170  * <Event name="mue"/>
171  * <Event name="lambda"/>
172  * </Alphabet>
173  *
174  * <StateSet>
175  * <State name="idle" id="1">
176  <Marked/><Initial/>
177  <State/>
178  * <State name="busy" id="2"/>
179  * <State name="down" id="3"/>
180  * </StateSet>
181  *
182  * <TransitionRelation>
183  * <Transition x1="1" event="alphs" x2="2"/>
184  * <Transition x1="2" event="beta" x2="2"/>
185  * <Transition x1="2" event="mue" x2="3"/>
186  * <Transition x1="3" event="lambda" x2="1"/>
187  * <TransitionRelation/>
188  *
189  * </Generator>
190  * @endcode
191  *
192  *
193  * \section GeneratorAttributes Attributes
194  *
195  * libFAUDES generators provide an interface to access so called attributes, ie data that
196  * is optionally attached to individual states, events, transitions, or globally to the generator.
197  *
198  * The faudes::Generator's interface to attributes is abstract in the sense that a generator
199  * is not aware of the actual type of its attributes.
200  * Instances of the class Generator indeed have trivial attributes that hold no data at all.
201  * To use attributes, you are meant to instantiate objects of the derived class TaGenerator
202  * with template parameters to specify attribute types. Basic algorithms
203  * implemented for plain generators will accept attributed generators as arguments. Such algorithms may
204  * occasionally inspect or set attributes using the abstract interface and C++ dynamic casts. For
205  * specialised algorithms that refer to extended generator semantics, we recommend derived
206  * generator classes as argument type.
207  *
208  *
209  * @ingroup GeneratorClasses
210  */
211 
212 
213 class FAUDES_API vGenerator : public Type {
214 
215  public:
216 
217  /** @name Constructors & Destructor */
218  /** @{ doxygen group */
219 
220  /**
221  * Default constructor
222  */
223  vGenerator(void);
224 
225  /**
226  * Copy-constructror
227  */
228  vGenerator(const vGenerator& rOtherGen);
229 
230  /**
231  * Construct from file. This constructor
232  * effectively uses the DoRead(TokenReader&) function to read.
233  *
234  * @param rFileName
235  * Name of file
236  *
237  * @exception Exception
238  * - IO errors (id 1)
239  * - Token mismatch (id 50, 51, 52, 80, 85)
240  */
241  vGenerator(const std::string& rFileName);
242 
243  /**
244  * Construct on heap.
245  * Technically not a constructor, this function creates a vGenerator with the
246  * same event symboltable. It is the callers responsebilty to delete the object
247  * when no longer needed. Derived classes must reimplement
248  * this function to create an object of the same class and the same event
249  * symboltable.
250  *
251  * @return
252  * New vGenerator
253  */
254  virtual vGenerator* New(void) const;
255 
256  /**
257  * Construct copy on heap.
258  * Technically not a constructor, this function creates a vGenerator with the
259  * same event symboltable. It is the callers responsebilty to delete the object
260  * when no longer needed. Derived classes must reimplement
261  * this function to create an object of the same class and the same event
262  * symboltable.
263  *
264  * @return
265  * New vGenerator
266  */
267  virtual vGenerator* Copy(void) const;
268 
269  /**
270  * Type test.
271  * Uses C++ dynamic cast to test whether the specified object
272  * casts to a vGenerator.
273  *
274  * @return
275  * vGenerator reference if dynamic cast succeeds, else NULL
276  */
277  virtual const Type* Cast(const Type* pOther) const;
278 
279  /**
280  * Destructor
281  */
282  virtual ~vGenerator(void);
283 
284  /** @} doxygen group */
285 
286  /*****************************************
287  *****************************************
288  *****************************************
289  *****************************************/
290 
291  /** @name Copy and Assignment */
292  /** @{ doxygen group */
293 
294 
295  /**
296  * Copy from other faudes type.
297  * The current implementation tests whether the source
298  * object can be casted to a generator and then performs
299  * the according assignment.
300  *
301  * @param rSrc
302  * Source to copy from.
303  */
304  virtual vGenerator& Assign(const Type& rSrc);
305 
306  /**
307  * Copy from other vGenerator, ignore attributes.
308  *
309  * @param rGen
310  * Source to copy from.
311  */
312  virtual vGenerator& AssignWithoutAttributes(const vGenerator& rGen);
313 
314  /**
315  * Destructive copy to other vGenerator.
316  * Copy method with increased performance at the cost of invalidating
317  * the source data. If attribute types of source and destination differ,
318  * a std copy is invoked.
319  *
320  *
321  * @param rGen
322  * Destination for copy operation.
323  */
324  virtual void Move(vGenerator& rGen);
325 
326  /**
327  * Assignment operator (uses Assign method)
328  *
329  * Note: you must reimplement this operator in derived
330  * classes in order to handle internal pointers correctly.
331  *
332  * @param rOtherGen
333  * Other generator
334  */
335  virtual vGenerator& operator= (const vGenerator& rOtherGen);
336 
337  /**
338  * Create another version of this generator.
339  * Assembles a copy of this generator, however, with versioned events.
340  * The new event names are created by appending an underscore and a specified string.
341  * State names and indices as well as any attributes are maintained.
342  *
343  * @param rVersion
344  * String value to be appended to event names
345  * @param rResGen
346  * Resulting versioned generator
347  *
348  * @exception Exception
349  * - Source must not match destination (id 96)
350  */
351  virtual void Version(const std::string& rVersion, vGenerator& rResGen) const;
352 
353  /**
354  * Create another version of this generator.
355  * Assembles a copy of this generator, however, with versioned events.
356  * The new event names are created by appending an underscore and a numeric index.
357  * State names and indices as well as any attributes are maintained.
358  *
359  * @param version
360  * Numeric value to be appended to event names
361  * @param rResGen
362  * Resulting versioned generator
363  * @exception Exception
364  * - Source must not match destination (id 96)
365  */
366  virtual void Version(Idx version, vGenerator& rResGen) const;
367 
368  /**
369  * Create another version of this generator.
370  * Assembles a copy of this generator, however, with versioned events.
371  * The new event names are created by replacing all substrings matching
372  * a specified string pattern by a replacement string.
373  * State names and indices as well as any attributes are maintained.
374  *
375  * @param rPattern
376  * String value to be replaced in event names
377  * @param rReplacement
378  * String value to be inserted in event names in place of rPattern
379  * @param rResGen
380  * Resulting versioned generator
381  * @exception Exception
382  * - Source must not match destination (id 96)
383  */
384  virtual void Version(const std::string& rPattern,const std::string& rReplacement, vGenerator& rResGen) const;
385 
386 
387 
388  /** @} doxygen group */
389 
390 
391  /*****************************************
392  *****************************************
393  *****************************************
394  *****************************************/
395 
396  /** @name Basic Maintenance */
397  /** @{ doxygen group */
398 
399 
400  /**
401  * Set the generator's name
402  *
403  * @param rName
404  * Generator name
405  */
406  void Name(const std::string& rName);
407 
408  /**
409  * Get generator's name
410  *
411  * @return
412  * Name of generator
413  */
414  const std::string& Name(void) const;
415 
416  /**
417  * Check if generator is valid.
418  * Performs internal consistency tests, This method is intendend
419  * to test generators that have been manipulated by methods without
420  * consistency tests, eg InjectAlphabet.
421  *
422  * @return
423  * True for success
424  */
425  virtual bool Valid(void) const;
426 
427  /**
428  * Clear generator data.
429  * Clears state set, alphabet and transitionrealtion. Behavioural flags
430  * eg StateNamesEnabled are maintained.
431  */
432  virtual void Clear(void);
433 
434 
435  /**
436  * Clear all states and transitions, maintain alphabet.
437  */
438  void ClearStates(void);
439 
440  /**
441  * Get number of events in alphabet
442  *
443  * @return
444  * Number of events
445  */
446  Idx AlphabetSize(void) const;
447 
448  /**
449  * Get generator size (number of states)
450  *
451  * @return
452  * Number of states
453  */
454  Idx Size(void) const;
455 
456  /**
457  * Get number of transitions
458  *
459  * @return
460  * Number of transitions
461  */
462  Idx TransRelSize(void) const;
463 
464  /**
465  * Get number of initial states
466  *
467  * @return
468  * Number of initial states
469  */
470  Idx InitStatesSize(void) const;
471 
472  /**
473  * Get number of marked states
474  *
475  * @return
476  * Number of marked states
477  */
478  Idx MarkedStatesSize(void) const;
479 
480  /**
481  * Check if generator is empty (no states)
482  *
483  * @return
484  * True if state set is empty
485  */
486  bool Empty(void) const;
487 
488  /**
489  * Check if alphabet is Empty
490  *
491  * @return
492  * True if mpAlphabet is empty
493  */
494  bool AlphabetEmpty(void) const;
495 
496  /**
497  * Check if transition relation is empty
498  *
499  * @return
500  * True if transition relation is empty
501  */
502  bool TransRelEmpty(void) const;
503 
504  /**
505  * Check if set of initial states are empty
506  *
507  * @return
508  * True if mInitStates is empty
509  */
510  bool InitStatesEmpty(void) const;
511 
512  /**
513  * Check if set of marked states are empty
514  *
515  * @return
516  * True if mMarkedStates is empty
517  */
518  bool MarkedStatesEmpty(void) const;
519 
520 
521  /** @} doxygen group */
522 
523  /*****************************************
524  *****************************************
525  *****************************************
526  *****************************************/
527 
528  /** @name Event Symboltable */
529  /** @{ doxygen group */
530 
531  /**
532  * Get Pointer to EventSymbolTable currently used
533  * by this vGenerator.
534  *
535  * @return
536  * Pointer to EventSymbolTable
537  */
538  SymbolTable* EventSymbolTablep(void) const;
539 
540  /**
541  * Set EventSymbolTable to be used by this vGenerator.
542  * This function sets the reference to the event symboltable. The current implementation
543  * in derived classes clears the generator, future versions may implement a re-indexing.
544  *
545  * @param pSymTab
546  * Pointer to SymbolTable
547  */
548  virtual void EventSymbolTablep(SymbolTable* pSymTab);
549 
550  /**
551  * Set EventSymbolTable as given by rOtherGen.
552  * This function sets the reference to the event symboltable. The current implementation
553  * clears the generator, future versions may implement a re-indexing.
554  *
555  * @param rOtherGen
556  * Other generator
557  *
558  */
559  virtual void EventSymbolTablep(const vGenerator& rOtherGen);
560 
561  /**
562  * Create EventSet with generator's EventSymbolTable (on stack).
563  *
564  * @return
565  * New empty EventSet on stack
566  */
567  EventSet NewEventSet(void) const;
568 
569  /**
570  * Create EventSet with generator's EventSymbolTable (on heap).
571  *
572  * @return
573  * Pointer to new empty EventSet on heap
574  */
575  EventSet* NewEventSetp(void) const;
576 
577  /**
578  * Event index lookup
579  *
580  * @param rName
581  * Name of event to lookup
582  *
583  * @return
584  * Valid index or 0 if name unknown to symboltable
585  */
586  Idx EventIndex(const std::string& rName) const;
587 
588  /**
589  * Event name lookup
590  *
591  * @param index
592  * Index of event to look up
593  *
594  * @return
595  * Name or empty std::string if non-existent
596  */
597  std::string EventName(Idx index) const;
598 
599  /**
600  * Set name for existing event
601  *
602  * Note: since the event symboltable is global, this affect all
603  * generators that refer to the specified event.
604  *
605  * @param index
606  * Event index
607  * @param rName
608  * New name
609  *
610  * @exception Exception
611  * - index not found in EventSymbolMap (id 42)
612  * - name already associated with another index (id 44)
613  * - event does not exist in generator (id 89)
614  */
615  void EventName(Idx index, const std::string& rName);
616 
617  /**
618  * Create a new unique symbolic event name.
619  * See also SymbolTable::UniqueSymbol().
620  *
621  * @param rName
622  * suggestion for new state name
623  */
624  std::string UniqueEventName(const std::string& rName) const;
625 
626 
627  /**
628  * Rename event in this generator.
629  * This method renames the specified event. It does so by
630  * removing and adding transitions. This does not
631  * effect other generators.
632  *
633  * @param event
634  * Event to rename
635  * @param rNewName
636  * New name
637  * @return
638  * True, if the new name did already exist
639  *
640  * @exception Exception
641  * - specified event does not exist (id 89)
642  */
643  bool EventRename(Idx event, const std::string& rNewName);
644 
645 
646  /**
647  * Rename event in this generator.
648  * Convenience wrapper for EventRename(Idx, const std::string&).
649  *
650  * @param rOldName
651  * Event to rename
652  * @param rNewName
653  * New name
654  * @return
655  * True, if the new name did already exist
656  *
657  * @exception Exception
658  * - specified event does not exist (id 89)
659  */
660  bool EventRename(const std::string& rOldName, const std::string& rNewName);
661 
662 
663  /** @} doxygen group */
664 
665  /* statics outside doxygen group */
666 
667  /**
668  * Get Pointer to global EventSymbolTable. This is
669  * a static member of SymbolTable and used as default
670  * for all derived generator classes and instantiated objects.
671  *
672  * @return
673  * Pointer to global EventSymbolTable
674  */
675  static SymbolTable* GlobalEventSymbolTablep(void);
676 
677 
678  /*****************************************
679  *****************************************
680  *****************************************
681  *****************************************/
682 
683  /** @name State Symboltable */
684  /** @{ doxygen group */
685 
686 
687  /**
688  * Get StateSymbolTable.
689  *
690  * @return
691  * ref to state-symboltable
692  */
693  const SymbolTable& StateSymbolTable(void) const;
694 
695  /**
696  * Set StateSymbolTable.
697  *
698  * By convention, state names and indices are local to the
699  * respective generator. It is most unlikely that you want to use
700  * this function.
701  *
702  * @return
703  * Pointer to mpStateSymbolTable
704  */
705  void StateSymbolTable(const SymbolTable& rSymTab);
706 
707  /**
708  * State index lookup.
709  *
710  * @param rName
711  *
712  * @return
713  * Valid index (or 0 for non-existent)
714  */
715  Idx StateIndex(const std::string& rName) const;
716 
717  /**
718  * State name lookup
719  *
720  * @param index
721  *
722  * @return name (or empty string if no such exists)
723  */
724  std::string StateName(Idx index) const;
725 
726  /**
727  * Set name of state
728  *
729  * @param index
730  * Index
731  * @param rName
732  * Name
733  *
734  * @exception Exception
735  * - name already associated with another index (id 44)
736  * - state does not exist in generator (id 90)
737  */
738  void StateName(Idx index, const std::string& rName);
739 
740  /**
741  * Remove all names from generator's StateSymbolTable
742  */
743  void ClearStateNames(void);
744 
745  /**
746  * Clear name for individual state
747  *
748  * @param index
749  * State index
750  * @exception Exception
751  * - state does not exist in generator (id 90)
752  */
753  void ClrStateName(Idx index);
754 
755  /**
756  * Clear name for individual state
757  *
758  * @param rName
759  * State name
760  */
761  void ClrStateName(const std::string& rName);
762 
763  /**
764  * Whether libFAUEDS functions are requested to generate state names.
765  * Most libFAUDES functions that introduce new states to a generator can be enabled
766  * to also assign (more or less sensible) names to those states. This feature is
767  * purely cosmetic and may be disabled for performance reasons.
768  *
769  *
770  * @return
771  * True, if generation of statenames is enabled.
772  */
773  bool StateNamesEnabled(void) const;
774 
775  /**
776  * Enable/disable libFAUEDS functions to automatically generate state names.
777  * Disabling state name generation implies ClearStateNames().
778  *
779  * @param flag
780  * True enables statenames / false disables them
781  */
782  void StateNamesEnabled(bool flag);
783 
784  /**
785  * Assign each state a default name based on its index.
786  */
787  void SetDefaultStateNames(void);
788 
789  /**
790  * For all states without a symbolic name, assign a name
791  * based on suggested template and the index.
792  *
793  * @param rTemplate
794  * Basis for name generation
795  */
796  void EnforceStateNames(const std::string& rTemplate);
797 
798  /**
799  * Create a new unique symbolic state name.
800  * See also SymbolTable::UniqueSymbol().
801  *
802  * @param rName
803  * suggestion for new state name
804  */
805  std::string UniqueStateName(const std::string& rName) const;
806 
807 
808  /** @} doxygen group */
809 
810  /* statics outside doxygen group */
811 
812  /**
813  * Sets the default for automatic state name generation.
814  * This flag takes effect only on generators newly created by the default
815  * constructor. The copy constructor copies the state name flag from the
816  * source generator. See also StateNamesEnabled(bool).
817  *
818  * @param flag
819  * True enables statenames / false disables them
820  */
821  static void StateNamesEnabledDefault(bool flag);
822 
823 
824  /*****************************************
825  *****************************************
826  *****************************************
827  *****************************************
828  *****************************************/
829 
830  /** @name Read Access to Core Members */
831  /** @{ doxygen group */
832 
833  /**
834  * Iterator to Begin() of alphabet
835  *
836  * @return
837  * Iterator to begin of mpAlphabet
838  */
839  EventSet::Iterator AlphabetBegin(void) const;
840 
841  /**
842  * Iterator to End() of alphabet
843  *
844  * @return
845  * Iterator to end of mpAlphabet
846  */
847  EventSet::Iterator AlphabetEnd(void) const;
848 
849  /**
850  * Test existence of event in alphabet
851  *
852  * @param index
853  * Event index
854  *
855  * @return
856  * True / false
857  */
858  bool ExistsEvent(Idx index) const;
859 
860  /**
861  * Test existence of event in alphabet
862  *
863  * @param rName
864  * Event name
865  *
866  * @return
867  * True / false
868  */
869  bool ExistsEvent(const std::string& rName) const;
870 
871  /**
872  * Returns a iterator to event index in alphabet
873  *
874  * @param index
875  * Index to find
876  *
877  * @return
878  * Iterator to event index
879  */
880  EventSet::Iterator FindEvent(Idx index) const;
881 
882  /**
883  * Returns a iterator to event index in alphabet
884  *
885  * @param rName
886  * Event name of index to find
887  *
888  * @return
889  * Iterator to event index
890  */
891  EventSet::Iterator FindEvent(const std::string& rName) const;
892 
893  /**
894  * Return const reference to alphabet
895  *
896  * @return EventSet
897  * Reference to mpAlphabet
898  */
899  const EventSet& Alphabet(void) const;
900 
901  /**
902  * Iterator to Begin() of state set
903  *
904  * @return
905  * Iterator to begin of state set
906  */
907  StateSet::Iterator StatesBegin(void) const;
908 
909  /**
910  * Iterator to End() of state set
911  *
912  * @return
913  * Iterator to end of state set
914  */
915  StateSet::Iterator StatesEnd(void) const;
916 
917  /**
918  * Test existence of state in state set
919  *
920  * @param index
921  * State index
922  *
923  * @return
924  * true / false
925  */
926  bool ExistsState(Idx index) const;
927 
928  /**
929  * Test existence of state in state set
930  *
931  * @param name
932  * State name
933  *
934  * @return
935  * true / false
936  */
937  bool ExistsState(const std::string& name) const;
938 
939  /**
940  * Returns a iterator to state index in state set
941  *
942  * @param index
943  * Index to find
944  *
945  * @return
946  * StateSet::Iterator to state index
947  */
948  StateSet::Iterator FindState(Idx index) const;
949 
950  /**
951  * Returns a iterator to state with specified name
952  *
953  * @param rName
954  * name of state to find
955  *
956  * @return
957  * StateSet::Iterator to state
958  */
959  StateSet::Iterator FindState(const std::string& rName) const;
960 
961 
962  /**
963  * Return reference to state set
964  *
965  * @return
966  * StateSet reference incl actual attribute type
967  */
968  const StateSet& States(void) const;
969 
970  /**
971  * Return initial state
972  *
973  * If the initial state is not unique, this function
974  * returns 0.
975  *
976  * @return
977  * Index of initial state
978  *
979  */
980  Idx InitState(void) const;
981 
982  /**
983  * Iterator to Begin() of mInitStates
984  *
985  * @return
986  * Iterator to begin of mInitStates
987  */
988  StateSet::Iterator InitStatesBegin(void) const;
989 
990  /**
991  * Iterator to End() of mInitStates
992  *
993  * @returns
994  * Iterator to end of mInitStates
995  */
996  StateSet::Iterator InitStatesEnd(void) const;
997 
998  /**
999  * Test existence of state in mInitStates
1000  *
1001  * @param index
1002  * State index
1003  *
1004  * @return
1005  * true / false
1006  */
1007  bool ExistsInitState(Idx index) const;
1008 
1009  /**
1010  * Iterator to state index in mInitStates
1011  *
1012  * @param index
1013  * Index to find
1014  *
1015  * @return
1016  * StateSet::Iterator to state index
1017  */
1018  StateSet::Iterator FindInitState(Idx index) const;
1019 
1020  /**
1021  * Const ref to initial states
1022  *
1023  * @return StateSet
1024  */
1025  const StateSet& InitStates(void) const;
1026 
1027  /**
1028  * Iterator to Begin() of mMarkedStates
1029  *
1030  * @returns
1031  * iterator to Begin of mMarkedStates
1032  */
1033  StateSet::Iterator MarkedStatesBegin(void) const;
1034 
1035  /**
1036  * Iterator to End() of mMarkedStates
1037  *
1038  * @returns
1039  * iterator to End of mMarkedStates
1040  */
1041  StateSet::Iterator MarkedStatesEnd(void) const;
1042 
1043  /**
1044  * Test existence of state in mMarkedStates
1045  *
1046  * @param index
1047  * State index
1048  *
1049  * @return
1050  * true / false
1051  */
1052  bool ExistsMarkedState(Idx index) const;
1053 
1054  /**
1055  * Returns a iterator to state index in mMarkedStates
1056  *
1057  * @param index
1058  * Index to find
1059  *
1060  * @return
1061  * StateSet::Iterator to state index
1062  */
1063  StateSet::Iterator FindMarkedState(Idx index) const;
1064 
1065  /**
1066  * Return const ref of marked states
1067  *
1068  * @return StateSet
1069  */
1070  const StateSet& MarkedStates(void) const;
1071 
1072  /**
1073  * Iterator to Begin() of transition relation
1074  *
1075  * @return
1076  * Iterator to Begin of mpTransRel
1077  */
1078  TransSet::Iterator TransRelBegin(void) const;
1079 
1080  /**
1081  * Iterator to End() of transition relation
1082  *
1083  * @return
1084  * Iterator to End of mpTransRel
1085  */
1086  TransSet::Iterator TransRelEnd(void) const;
1087 
1088  /**
1089  * Iterator to begin of transitions with x1 as predecessor state.
1090  *
1091  * @param x1
1092  * Predecessor state
1093  *
1094  * @return
1095  * iterator to begin of transitions with x1
1096  */
1097  TransSet::Iterator TransRelBegin(Idx x1) const;
1098 
1099  /**
1100  * iterator to end of transitions with x1 as predecessor state.
1101  *
1102  * Note: Set the End(x1) iterator to a variable, so it won't be
1103  * recalculated every iteration.
1104  *
1105  * @param x1
1106  * Predecessor state
1107  *
1108  * @return
1109  * iterator to end of transitions with x1
1110  * (one after last matching transition)
1111  */
1112  TransSet::Iterator TransRelEnd(Idx x1) const;
1113 
1114  /**
1115  * iterator to begin of transitions with x1 as predecessor state and
1116  * event ev.
1117  *
1118  * @param x1
1119  * Predecessor state
1120  * @param ev
1121  * Event
1122  *
1123  * @return
1124  * iterator to begin of transitions with x1 and ev
1125  */
1126  TransSet::Iterator TransRelBegin(Idx x1, Idx ev) const;
1127 
1128  /**
1129  * Iterator to end of transitions with x1 as predecessor state and
1130  * event ev.
1131  *
1132  * Note: Set the End(x1,ev) iterator to a variable, so it won't be
1133  * recalculated every iteration.
1134  *
1135  * @param x1
1136  * Predecessor state
1137  * @param ev
1138  * Event
1139  *
1140  * @return
1141  * iterator to end of transitions with x1 and ev
1142  * (one after last matching transition)
1143  */
1144  TransSet::Iterator TransRelEnd(Idx x1, Idx ev) const;
1145 
1146  /**
1147  * iterator to transition given by x1, ev, x2
1148  *
1149  *
1150  * @param rX1
1151  * name of Predecessor state
1152  * @param rEv
1153  * name of Event
1154  * @param rX2
1155  * name of Successor state
1156  *
1157  * @return
1158  * iterator to transition or end() if not exists
1159  */
1160  TransSet::Iterator FindTransition(
1161  const std::string& rX1, const std::string& rEv, const std::string& rX2) const;
1162 
1163  /**
1164  * Iterator to transition given by x1, ev, x2
1165  *
1166  *
1167  * @param x1
1168  * Predecessor state
1169  * @param ev
1170  * Event
1171  * @param x2
1172  * Successor state
1173  *
1174  * @return
1175  * iterator to transition or End() if not exists
1176  */
1177  TransSet::Iterator FindTransition(Idx x1, Idx ev, Idx x2) const;
1178 
1179  /**
1180  * Iterator to transition
1181  *
1182  *
1183  * @param rTrans
1184  * transition
1185  *
1186  * @return
1187  * iterator to transition or end() if not exists
1188  */
1189  TransSet::Iterator FindTransition(const Transition& rTrans) const;
1190 
1191  /**
1192  * Test for transition given by x1, ev, x2
1193  *
1194  *
1195  * @param rX1
1196  * name of Predecessor state
1197  * @param rEv
1198  * name of Event
1199  * @param rX2
1200  * name of Successor state
1201  *
1202  * @return
1203  * true / false
1204  */
1205  bool ExistsTransition(
1206  const std::string& rX1, const std::string& rEv, const std::string& rX2) const;
1207 
1208  /**
1209  * Test for transition given by x1, ev, x2
1210  *
1211  * @param x1
1212  * Predecessor state
1213  * @param ev
1214  * Event
1215  * @param x2
1216  * Successor state
1217  *
1218  * @return
1219  * true / false
1220  */
1221  bool ExistsTransition(Idx x1, Idx ev, Idx x2) const;
1222 
1223  /**
1224  * test for transition
1225  *
1226  *
1227  * @param rTrans
1228  * transition
1229  *
1230  * @return
1231  * true / false
1232  */
1233  bool ExistsTransition(const Transition& rTrans) const;
1234 
1235  /**
1236  * Test for transition given by x1, ev
1237  *
1238  * @param x1
1239  * Predecessor state
1240  * @param ev
1241  * Event
1242  *
1243  * @return
1244  * true / false
1245  */
1246  bool ExistsTransition(Idx x1, Idx ev) const;
1247 
1248  /**
1249  * Test for transition given by x1
1250  *
1251  * @param x1
1252  * Predecessor state
1253  *
1254  * @return
1255  * true / false
1256  */
1257  bool ExistsTransition(Idx x1) const;
1258 
1259  /**
1260  * Return reference to transition relation
1261  *
1262  * @return TransRel
1263  */
1264  const TransSet& TransRel(void) const;
1265 
1266  /**
1267  * Get copy of trantision relation sorted by other compare
1268  * operator, e.g. "x2,ev,x1"
1269  *
1270  * @param res
1271  * resulting transition relation
1272  */
1273  void TransRel(TransSetX1EvX2& res) const;
1274  void TransRel(TransSetEvX1X2& res) const;
1275  void TransRel(TransSetEvX2X1& res) const;
1276  void TransRel(TransSetX2EvX1& res) const;
1277  void TransRel(TransSetX2X1Ev& res) const;
1278  void TransRel(TransSetX1X2Ev& res) const;
1279 
1280  /**
1281  * Convebience function.
1282  *
1283  * @param rX1
1284  * Name of Predecessor state
1285  * @param rEv
1286  * Name of Event
1287  * @param rX2
1288  * Name of Successor state
1289  *
1290  * @return
1291  * Transition as specified.
1292  */
1293  Transition TransitionByNames(
1294  const std::string& rX1, const std::string& rEv, const std::string& rX2) const;
1295 
1296  /** @} doxygen group */
1297 
1298 
1299 
1300  /*****************************************
1301  *****************************************
1302  *****************************************
1303  *****************************************/
1304 
1305  /** @name Write Access to Core Members */
1306  /** @{ doxygen group */
1307 
1308 
1309  /**
1310  * Add an existing event to alphabet by index. It is an error to insert
1311  * an event index that is not known to the mpEventSymbolTable.
1312  *
1313  * @param index
1314  * Event index
1315  * @return
1316  * True, if event was new to alphabet
1317  */
1318  bool InsEvent(Idx index);
1319 
1320  /**
1321  * Add named event to generator. An entry in the mpEventSymbolTable will
1322  * be made if event name is not known so far.
1323  *
1324  * @param rName
1325  * Name of the event to add
1326  *
1327  * @return
1328  * New unique index
1329  */
1330  Idx InsEvent(const std::string& rName);
1331 
1332  /**
1333  * Add new named events to generator.
1334  * If the event allready exists, the attribute is maintained.
1335  *
1336  * @param events
1337  * EventSet
1338  */
1339  void InsEvents(const EventSet& events);
1340 
1341  /**
1342  * Delete event from generator by index. mpEventSymbolTable stays untouched.
1343  * Transitions containing event will be removed too.
1344  *
1345  * @param index
1346  * Index of event
1347  * @return
1348  * True, if event was in alphabet
1349  *
1350  */
1351  bool DelEvent(Idx index);
1352 
1353  /**
1354  * Delete event from generator by name. mpEventSymbolTable stays untouched.
1355  * Transitions containing event will be removed too.
1356  *
1357  * @param rName
1358  * Name of event
1359  * @return
1360  * True, if event was in alphabet
1361  *
1362  */
1363  bool DelEvent(const std::string& rName);
1364 
1365  /**
1366  * Delete a set of events from generator. mpEventSymbolTable stays untouched.
1367  * Transitions containing events will be removed too.
1368  *
1369  * @param rEvents
1370  * EventSet containing events to remove
1371  */
1372  void DelEvents(const EventSet& rEvents);
1373 
1374  /**
1375  * Delete event from alphabet without consistency check. The event is only
1376  * deleted from mpAlphabet but not from transition relation.
1377  *
1378  * @param index
1379  * Index of event
1380  * @return
1381  * True, if event was in alphabet
1382  *
1383  */
1384  bool DelEventFromAlphabet(Idx index);
1385 
1386  /**
1387  * Set mpAlphabet without consistency check.
1388  * Sets the alphabet incl attributes, if provided.
1389  *
1390  * @param rNewalphabet
1391  * EventSet with new alphabet
1392  */
1393  void InjectAlphabet(const EventSet& rNewalphabet);
1394 
1395  /**
1396  * Restricts mpAlphabet incl removing resp. transition.
1397  * Maintains attributes if any.
1398  *
1399  * Note: before libFAUDES 2.23, this method did not remove
1400  * transitions. Use InjectAlphabet(const EventSet&) for direct
1401  * write acces to the alphabet.
1402  *
1403  * @param rNewalphabet
1404  * EventSet with alphabet
1405  */
1406  void RestrictAlphabet(const EventSet& rNewalphabet);
1407 
1408  /**
1409  * Add new anonymous state to generator
1410  *
1411  * @return
1412  * Index of new unique state
1413  */
1414  Idx InsState(void);
1415 
1416  /**
1417  * Add (perhaps new) state to generator
1418  *
1419  * @return
1420  * True to indicate that state was new to generator
1421  */
1422  bool InsState(Idx index);
1423 
1424  /**
1425  * Add new named state to generator.
1426  *
1427  * @param rName
1428  * Name of the state to add
1429  *
1430  * @return
1431  * Index of new unique state
1432  *
1433  * @exception Exception
1434  * Name already exists (id 44)
1435  */
1436  Idx InsState(const std::string& rName);
1437 
1438  /**
1439  * Add anonymous states to generator
1440  *
1441  * @param rStates
1442  * Set of states to add
1443  */
1444  void InsStates(const StateSet& rStates);
1445 
1446  /**
1447  * Delete a state from generator by index.
1448  * Cleans mpStates, mInitStates, mMarkedStates, mpTransRel and mpStateSymbolTable.
1449  *
1450  * @param index
1451  * Index of state to delete.
1452  * @return
1453  * True, if state was in stateset
1454  */
1455  bool DelState(Idx index);
1456 
1457  /**
1458  * Delete a state from generator by name.
1459  * Cleans mpStates, mInitStates, mMarkedStates, mpTransRel and mpStateSymbolTable.
1460  *
1461  * @param rName
1462  * Name of state to delete. Will be erased in mpStateSymbolTable too
1463  * @return
1464  * True, if state was in stateset
1465  *
1466  * @exception Exception
1467  * - Symbolic name not known (id 90)
1468  */
1469  bool DelState(const std::string& rName);
1470 
1471  /**
1472  * Delete a set of states
1473  * Cleans mpStates, mInitStates, mMarkedStates, mpTransrel, and mpStateSymboltable
1474  *
1475  * @param rDelStates
1476  * StateSet containing states aka indicees to delete
1477  */
1478  void DelStates(const StateSet& rDelStates);
1479 
1480 
1481  /**
1482  * Delete a state from generator without consistency check. This removes the
1483  * state from mpStates and mpStateSymbolTable but doesn't touch mpTransRel,
1484  * mInitStates and mMarkedStates.
1485  *
1486  * @param index
1487  * Index of state to delete.
1488  * @return
1489  * True, if state was in stateset
1490  *
1491  */
1492  bool DelStateFromStates(Idx index);
1493 
1494  /**
1495  * Delete a state from generator without consistency check. This removes the
1496  * state from mpStates and mpStateSymbolTable but doesn't touch mpTransRel,
1497  * mInitStates and mMarkedStates.
1498  * Index to delete is given by iterator.
1499  *
1500  * @param pos
1501  * StateSet::Iterator
1502  * @return
1503  * Iteraror to next state
1504  */
1505  StateSet::Iterator DelStateFromStates(StateSet::Iterator pos);
1506 
1507  /**
1508  * Restrict states
1509  * Cleans mpStates, mInitStates, mMarkedStates, mpTransrel, and mpStateSymboltable
1510  *
1511  * @param rStates
1512  * StateSet containing valid states
1513  */
1514  void RestrictStates(const StateSet& rStates);
1515 
1516 
1517  /**
1518  * Inject an existing state index into generators mStates
1519  * Use with care! For use in performance optimized functions.
1520  *
1521  * @param index
1522  * State index to inject
1523  */
1524  void InjectState(Idx index);
1525 
1526  /**
1527  * Inject a complete state set without consistency checks (without attributes)
1528  *
1529  * @param rNewStates
1530  * StateSet
1531  */
1532  void InjectStates(const StateSet& rNewStates);
1533 
1534 
1535  /**
1536  * Create new anonymous state and set as initial state
1537  *
1538  * @return
1539  * Index of new unique
1540  */
1541  Idx InsInitState(void);
1542 
1543  /**
1544  * Add (perhaps new) state to generator and turn it
1545  * into a initial state.
1546  *
1547  * @param index
1548  * State to insert
1549  * @return
1550  * True to indicate that state was new to generator
1551  */
1552  bool InsInitState(Idx index);
1553 
1554  /**
1555  * Create a new named state and set as initial state
1556  *
1557  * @param rName
1558  * Name of the state to add
1559  *
1560  * @return
1561  * Index of new unique state
1562  */
1563  Idx InsInitState(const std::string& rName);
1564 
1565  /**
1566  * Add (perhaps new) anonymous initial states to generator
1567  *
1568  * @param rStates
1569  * Set of states to add
1570  */
1571  void InsInitStates(const StateSet& rStates);
1572 
1573  /**
1574  * Create new anonymous state and set as marked state
1575  *
1576  * @return
1577  * Index of new unique state
1578  */
1579  Idx InsMarkedState(void);
1580 
1581  /**
1582  * Add (perhaps new) state to generator and turn it
1583  * into a marked state.
1584  *
1585  * @param index
1586  * State to insert
1587  * @return
1588  * True to indicate that state was new to generator
1589  */
1590  bool InsMarkedState(Idx index);
1591 
1592  /**
1593  * Create a new named state and set as marked state
1594  *
1595  * @param rName
1596  * Name of the state to add
1597  *
1598  * @return
1599  * Index of new unique state
1600  */
1601  Idx InsMarkedState(const std::string& rName);
1602 
1603  /**
1604  * Add (perhaps new) anonymous initial states to generator
1605  *
1606  * @param rStates
1607  * Set of states to add
1608  */
1609  void InsMarkedStates(const StateSet& rStates);
1610 
1611  /**
1612  * Set an existing state as initial state by index.
1613  *
1614  * @param index
1615  * Index of state to set as initial state
1616  * @exception Exception
1617  * - State index not found in generator (id 91)
1618  */
1619  void SetInitState(Idx index);
1620 
1621  /**
1622  * Set an existing state as initial state by name.
1623  *
1624  * @param rName
1625  * Name of state to set as initial state
1626  *
1627  * @exception Exception
1628  * - State name not known in generator (id 90)
1629  */
1630  void SetInitState(const std::string& rName);
1631 
1632  /**
1633  * Replace mInitStates with StateSet given as parameter without consistency checks.
1634  *
1635  * @param rNewInitStates
1636  * StateSet containing new mInitStates
1637  */
1638  void InjectInitStates(const StateSet& rNewInitStates);
1639 
1640  /**
1641  * Unset an existing state as initial state by index
1642  *
1643  * Define FAUDES_CHECKED for consistency checks.
1644  *
1645  * @param index
1646  * State index
1647  *
1648  * @exception Exception
1649  * - State index not found in generator (id 91)
1650  */
1651  void ClrInitState(Idx index);
1652 
1653  /**
1654  * Unset an existing state as initial state by name
1655  *
1656  * @param rName
1657  * State name
1658  *
1659  * @exception Exception
1660  * - State name not known in generator (id 90)
1661  */
1662  void ClrInitState(const std::string& rName);
1663 
1664  /**
1665  * Unset an existing state as initial state by iterator
1666  *
1667  * @param pos
1668  * StateSet::iterator
1669  * @return
1670  * Iterator to next init state
1671  */
1672  StateSet::Iterator ClrInitState(StateSet::Iterator pos);
1673 
1674  /**
1675  * Clear all mInitStates
1676  */
1677  void ClearInitStates(void);
1678 
1679  /**
1680  * Set an existing state as marked state by index
1681  *
1682  * @param index
1683  * Index of state to set as initial state
1684  * @exception Exception
1685  * - State index not found in generator (id 91)
1686  */
1687  void SetMarkedState(Idx index);
1688 
1689  /**
1690  * Set an existing state as marked state by name.
1691  *
1692  * @param rName
1693  * Name of state to set as marked state
1694  *
1695  * @exception Exception
1696  * - State name not known in generator (id 90)
1697  */
1698  void SetMarkedState(const std::string& rName);
1699 
1700  /**
1701  * Unset an existing state as marked state by index
1702  *
1703  * @param index
1704  * State index
1705  *
1706  * @exception Exception
1707  * - State index not found in generator (id 91)
1708  */
1709  void ClrMarkedState(Idx index);
1710 
1711  /**
1712  * Unset an existing state as marked state by name
1713  *
1714  * @param rName
1715  * State name
1716  *
1717  * @exception Exception
1718  * - State index not found in generator (id 91)
1719  */
1720  void ClrMarkedState(const std::string& rName);
1721 
1722  /**
1723  * Unset an existing state as marked state by iterator
1724  *
1725  * @param pos
1726  * StateSet::iterator
1727  * @return
1728  * Iterator to next marked state
1729  */
1730  StateSet::Iterator ClrMarkedState(StateSet::Iterator pos);
1731 
1732  /**
1733  * Clear all marked states
1734  */
1735  void ClearMarkedStates(void);
1736 
1737  /**
1738  * Replace mMarkedStates with StateSet given as parameter without consistency checks.
1739  *
1740  * @param rNewMarkedStates
1741  * StateSet containing new marked states
1742  */
1743  void InjectMarkedStates(const StateSet& rNewMarkedStates);
1744 
1745  /**
1746  * Add a transition to generator by indices. States and event
1747  * must already exist.
1748  *
1749  * @param x1
1750  * Predecessor state index
1751  * @param ev
1752  * Event index
1753  * @param x2
1754  * Successor state index
1755  *
1756  * @return
1757  * True, if the transition was new the generator
1758  *
1759  * @exception Exception
1760  * - state or event not in generator (id 95)
1761  */
1762  bool SetTransition(Idx x1, Idx ev, Idx x2);
1763 
1764  /**
1765  * Add a transition to generator by names. Statename and eventname
1766  * must already exist.
1767  *
1768  * @param rX1
1769  * Predecessor state name
1770  * @param rEv
1771  * Event name
1772  * @param rX2
1773  * Successor state name
1774  *
1775  * @return
1776  * True, if the transition was new the generator
1777  *
1778  * @exception Exception
1779  * - state or event not in generator (id 95)
1780  * - state name not known (id 90)
1781  * - event name not known (id 66)
1782  */
1783  bool SetTransition(const std::string& rX1, const std::string& rEv,
1784  const std::string& rX2);
1785 
1786  /**
1787  * Add a transition to generator. States and event
1788  * must already exist.
1789  *
1790  *
1791  * @param rTransition
1792  * Transition
1793  *
1794  * @return
1795  * True, if the transition was new the generator
1796  * @exception Exception
1797  * - state or event not in generator (id 95)
1798  */
1799  bool SetTransition(const Transition& rTransition);
1800 
1801  /**
1802  * Remove a transition by indices
1803  *
1804  * @param x1
1805  * Predecessor state index
1806  * @param ev
1807  * Event index
1808  * @param x2
1809  * Successor state index
1810  */
1811  void ClrTransition(Idx x1, Idx ev, Idx x2);
1812 
1813  /**
1814  * Remove a transition by transition object
1815  *
1816  * @param rTrans
1817  * Transition object
1818  */
1819  void ClrTransition(const Transition& rTrans);
1820 
1821  /**
1822  * Remove a transition by iterator
1823  *
1824  * @param it
1825  * TransSet::iterator
1826  * @return
1827  * Iterator to next transition
1828  */
1829  TransSet::Iterator ClrTransition(TransSet::Iterator it);
1830 
1831  /**
1832  * Remove a transitions by state and event
1833  *
1834  * @param x1
1835  * Predecessor state index
1836  * @param ev
1837  * Event index
1838  */
1839  void ClrTransitions(Idx x1, Idx ev);
1840 
1841  /**
1842  * Remove a transitions by state
1843  *
1844  * @param x1
1845  * Predecessor state index
1846  */
1847  void ClrTransitions(Idx x1);
1848 
1849  /**
1850  * Clear all transitions
1851  */
1852  void ClearTransRel(void);
1853 
1854  /**
1855  * Set transition without consistency check.
1856  *
1857  * @param rTrans
1858  * Transition to insert
1859  */
1860  void InjectTransition(const Transition& rTrans);
1861 
1862  /**
1863  * Set transition relation without consistency check (no attributes)
1864  *
1865  * @param rNewtransrel
1866  * TransRel to insert
1867  */
1868  void InjectTransRel(const TransSet& rNewtransrel);
1869 
1870  /** @} doxygen group */
1871 
1872 
1873 
1874  /*****************************************
1875  *****************************************
1876  *****************************************
1877  *****************************************/
1878 
1879  /** @name Attributes */
1880  /** @{ doxygen group */
1881 
1882 
1883  /**
1884  * Clear Attributes
1885  */
1886  virtual void ClearAttributes(void);
1887 
1888  /**
1889  * Updates internal attributes.
1890  * This method does nothing and may be reimplemented
1891  * by a any class that adds semantics to attributes
1892  * Eg. you may set a particular state flag, if this state
1893  * is reachable.
1894  *
1895  * @return True if value changed
1896  */
1897  virtual bool UpdateAttributes(void) {return false;};
1898 
1899  /**
1900  * Clear event attributes
1901  */
1902  virtual void ClearEventAttributes(void);
1903 
1904  /**
1905  * Clear attribute for existing event
1906  *
1907  * @param index
1908  * Event index
1909  */
1910  virtual void ClrEventAttribute(Idx index);
1911 
1912  /**
1913  * Set attribute for existing event.
1914  * This version uses a dynamic cast
1915  * to test the actual type of the provided attribute. An exception is
1916  * thrown for an invalid attribute type.
1917  * In a context where
1918  * the attribute type is known, you may prefer the TaGenerator method.
1919  *
1920  * @param index
1921  * Event index
1922  * @param rAttr
1923  * New attribute
1924  *
1925  * @exception Exception
1926  * - Index not found in alphabet (id 60)
1927  * - Cannot cast attribute (id 63)
1928  */
1929  virtual void EventAttribute(Idx index, const Type& rAttr);
1930 
1931  /**
1932  * Set attributes for existing events.
1933  * This version uses a dynamic cast
1934  * to test the actual type of the provided attributes. An exception is
1935  * thrown for an invalid attribute type.
1936  *
1937  * @param rEventSet
1938  * Set of attributed events
1939  * @exception Exception
1940  * - Element not found in alphabet (id 60)
1941  * - Cannot cast attribute (id 63)
1942  */
1943  virtual void EventAttributes(const EventSet& rEventSet);
1944 
1945  /**
1946  * Event attribute lookup.
1947  * In a context where
1948  * the attribute type is known, you may prefer the TaGenerator method.
1949  *
1950  * @param index
1951  *
1952  * @return
1953  * reference to attribute
1954  */
1955  virtual const AttributeVoid& EventAttribute(Idx index) const;
1956 
1957  /**
1958  * Event attribute lookup.
1959  * In a context where the attribute type is known,
1960  * you may prefer the TaGenerator method.
1961  *
1962  * @param rName
1963  *
1964  * @return
1965  * reference to attribute
1966  */
1967  virtual const AttributeVoid& EventAttribute(const std::string& rName) const;
1968 
1969  /**
1970  * Event attribute pointer to access Attribute methods.
1971  * If there are no attributes (plain vGenerator) this method
1972  * returs 0. If there are attributes, an explicit default value
1973  * may be inserted.
1974  * In a context where the attribute type is known,
1975  * you may prefer the TaGenerator method.
1976  *
1977  * @param index
1978  *
1979  * @return
1980  * pointer to attribute
1981  */
1982  virtual AttributeVoid* EventAttributep(Idx index);
1983 
1984  /**
1985  * Event attribute pointer to access Attribute methods.
1986  * If there are no attributes (plain vGenerator) this method
1987  * returs 0. If there are attributes, an explicit default value
1988  * may be inserted.
1989  * In a context where the attribute type is known,
1990  * you may prefer the TaGenerator method.
1991  *
1992  * @param rName
1993  *
1994  * @return
1995  * pointer to attribute
1996  */
1997  virtual AttributeVoid* EventAttributep(const std::string& rName);
1998 
1999 
2000  /**
2001  * Clear state attributes
2002  */
2003  virtual void ClearStateAttributes(void);
2004 
2005  /**
2006  * Clear attribute for existing state
2007  *
2008  * @param index
2009  * State index
2010  */
2011  virtual void ClrStateAttribute(Idx index);
2012 
2013  /**
2014  * Set attribute for existing state.
2015  * This version uses a dynamic cast
2016  * to test the actual type of the provided attribute. An exception is
2017  * thrown for an invalid attribute type.
2018  * In a context where
2019  * the attribute type is known, you may prefer the TaGenerator method.
2020  *
2021  * @param index
2022  * State index
2023  * @param rAttr
2024  * New attribute
2025  *
2026  * @exception Exception
2027  * - Index not found in Stateset (id 60)
2028  * - Cannot cast attribute (id 63)
2029  */
2030  virtual void StateAttribute(Idx index, const Type& rAttr);
2031 
2032  /**
2033  * State attribute lookup.
2034  * In a context where the attribute type is known,
2035  * you may prefer the TaGenerator method.
2036  *
2037  * @param index
2038  * State index
2039  *
2040  * @return Ref to attribute of state
2041  */
2042  virtual const AttributeVoid& StateAttribute(Idx index) const;
2043 
2044  /**
2045  * State attribute pointer to access Attribute methods.
2046  * If there are no attributes (plain vGenerator) this method
2047  * returns 0. If there are attributes, an explicit default value
2048  * may be inserted.
2049  * In a context where the attribute type is known,
2050  * you may prefer the TaGenerator method.
2051  *
2052  * @param index
2053  * State index
2054  *
2055  * @return Pointer to attribute of state
2056  */
2057  virtual AttributeVoid* StateAttributep(Idx index);
2058 
2059  /**
2060  * Clear transition attributes
2061  */
2062  virtual void ClearTransAttributes(void);
2063 
2064  /**
2065  * Set attribute for existing transition.
2066  * This version uses a dynamic cast
2067  * to test the actual type of the provided attribute. An exception is
2068  * thrown for an invalid attribute type.
2069  * In a context where
2070  * the attribute type is known, you may prefer the TaGenerator method.
2071  *
2072  * @param rTrans
2073  * Transition
2074  * @param rAttr
2075  * New attribute
2076  *
2077  * @exception Exception
2078  * - Transition not found in transition relation(id 60)
2079  * - Cannot cast attribute (id 63)
2080  */
2081  virtual void TransAttribute(const Transition& rTrans, const Type& rAttr);
2082 
2083 
2084  /**
2085  * Clear attribute for existing transition
2086  *
2087  * @param rTrans
2088  * transition
2089  */
2090  virtual void ClrTransAttribute(const Transition& rTrans);
2091 
2092  /**
2093  * Transition attribute lookup.
2094  * In a context where the attribute type is known,
2095  * you may prefer the TaGenerator method.
2096  *
2097  * @return
2098  * Attribute
2099  *
2100  */
2101  virtual const AttributeVoid& TransAttribute(const Transition& rTrans) const;
2102 
2103  /**
2104  * Transition attribute pointer to access Attribute methods.
2105  * If there are no attributes (plain vGenerator) this method
2106  * returns 0. If there are attributes, an explicit default value
2107  * may be inserted.
2108  * In a context where the attribute type is known,
2109  * you may prefer the TaGenerator method.
2110  *
2111  * @return
2112  * Attribute pointer
2113  *
2114  */
2115  virtual AttributeVoid* TransAttributep(const Transition& rTrans);
2116 
2117  /**
2118  * Clear global attribute
2119  */
2120  virtual void ClearGlobalAttribute(void);
2121 
2122  /**
2123  * Set global attribute.
2124  * The vGenerator does not have attributes, so this function throws an exception for
2125  * any specified attribute different to AttributeVoid.
2126  * The TaGenarator provides a re-implementation to actually set the global attribute.
2127  *
2128  * @param rAttr
2129  * Attribute
2130  * @exception Exception
2131  * - Cannot cast attribute (id 63)
2132  */
2133  virtual void GlobalAttribute(const Type& rAttr);
2134 
2135  /**
2136  * Set global attribute.
2137  * The vGenerator does not have attributes, so this function does nothing.
2138  * The TaGenarator provides a re-implementation to actually set the global attribute.
2139  *
2140  * @param rAttr
2141  * Attribute
2142  */
2143  virtual void GlobalAttributeTry(const Type& rAttr);
2144 
2145  /**
2146  * Global attribute lookup.
2147  * In a context where the attribute type is known,
2148  * you may prefer the TaGenerator method.
2149  */
2150  virtual const AttributeVoid& GlobalAttribute(void) const;
2151 
2152 
2153  /**
2154  * Get attribute pointer
2155  * The global attribute allways exits. For the vGenerator its of
2156  * type AttributeVoid, the TaGenerator sets a nontrivial type.
2157  * In a context where the attribute type is known,
2158  * you may prefer the TaGenerator method.
2159  */
2160  virtual AttributeVoid* GlobalAttributep(void);
2161 
2162 
2163  /** @} doxygen group */
2164 
2165 
2166 
2167  /*****************************************
2168  *****************************************
2169  *****************************************
2170  *****************************************/
2171 
2172  /** @name Reachability */
2173  /** @{ doxygen group */
2174 
2175 
2176  /**
2177  * Compute set of accessible states
2178  */
2179  StateSet AccessibleSet(void) const;
2180 
2181  /**
2182  * Make generator accessible.
2183  *
2184  * @return
2185  * True if generator contains at least one initial state
2186  */
2187  bool Accessible(void);
2188 
2189  /**
2190  * Check if generator is accessible
2191  *
2192  * @return
2193  * True if generator is accesssible
2194  */
2195  bool IsAccessible(void) const;
2196 
2197  /**
2198  * Compute set of Coaccessible states
2199  */
2200  StateSet CoaccessibleSet(void) const;
2201 
2202  /**
2203  * Make generator Coaccessible
2204  *
2205  * @return
2206  * True if generator contains at least one marked state
2207  */
2208  bool Coaccessible(void);
2209 
2210  /**
2211  * Check if generator is Coaccessible
2212  *
2213  * @return
2214  * True if generator is coaccessible
2215  */
2216  bool IsCoaccessible(void) const;
2217 
2218  /**
2219  * Compute set of blocking states.
2220  *
2221  * A state is considered blocking if it is accessible but not coaccessible.
2222  */
2223  StateSet BlockingStates(void) const;
2224 
2225 
2226  /**
2227  * Compute set of terminal states.
2228  *
2229  * A terminal state is a state with no successor state.
2230  * If and only if the set of terminal states is empty, the generator is complete.
2231  * @return
2232  * Set of terminal states.
2233  */
2234  StateSet TerminalStates(void) const;
2235 
2236 
2237  /**
2238  * Compute set of terminal states.
2239  *
2240  * A terminal state is a state with no successor state.
2241  * This function returns the the set terminal states contained
2242  * in the specified state ste.
2243  *
2244  * @param rStates
2245  * Set of state indices to restrict the search
2246  * @return
2247  * Set of terminal states.
2248  */
2249  StateSet TerminalStates(const StateSet& rStates) const;
2250 
2251  /**
2252  * Check if generator is complete.
2253  *
2254  * A generator is considered complete, if each state has at least
2255  * one successor state.
2256  *
2257  * If the generator is accessible, completeness
2258  * is equivalent to completeness of the generated language, ie
2259  * forall s in L(G) there exists r>s such that r in L(G)
2260  *
2261  * If the generator is trim, completeness is equivalent to
2262  * completeness of the markede language, ie forall s in Lm(G) there exists
2263  * r>s such that r in Lm(G)
2264  *
2265  * @return
2266  * True if generator is complete
2267  */
2268  bool IsComplete(void) const;
2269 
2270  /**
2271  * Check if generator is complete.
2272  *
2273  * Same as IsComplete(void), however, only the specified
2274  * states are considered. The rational is to e.g. apply the test
2275  * to accessible (resp. trim) states only. Then, test is equivalent
2276  * to completeness of the generated (resp. marked) language.
2277  *
2278  * @param rStates
2279  * Set of state indices to restrict the completeness test
2280  * @return
2281  * True if generator is relatively complete
2282  */
2283  bool IsComplete(const StateSet& rStates) const;
2284 
2285 
2286  /**
2287  * Check if generator is complete w.r.t. an alphabet
2288  *
2289  * A generator is considered complete w.r.t. an alphabet Sigma_o,
2290  * if each state can be continued to a state in which a symbol
2291  * of Sigma_c is enabled.
2292  *
2293  * If the generator is accessible, completeness w.r.t. Sigma_o
2294  * is equivalent to:
2295  *
2296  * forall s in L(G) there exists t in (Sigma*)Sigma_u such that st in L(G)
2297  *
2298  * @param rSigmaO
2299  * Specified alphabet Sigma_o
2300  *
2301  * @return
2302  * True if generator is complete
2303  */
2304  bool IsComplete(const EventSet& rSigmaO) const;
2305 
2306 
2307  /**
2308  * Make generator Complete.
2309  *
2310  * This procedure removes all states that are guaranteed to evolve
2311  * into a terminal state within a finite number of transitios.
2312  * The current implementations is initialized by
2313  * the set of terminal states and then performs a backward
2314  * reachability analysis.
2315  *
2316  * @return
2317  * True if generator contains at least one initial state
2318  */
2319  bool Complete(void);
2320 
2321  /**
2322  * Make generator Complete w.r.t. an alphabet
2323  *
2324  * This procedure removes all states that conflict with
2325  * completes w.r.t. the specified alphabet Sigma_o until
2326  * a fixpoint is reached. The current implementation consists of
2327  * an outer iteration to restrict a domain of states and an inner iteration
2328  * for abcakwar reachability analyis.
2329  *
2330  * THIS IS EXPERIMENTAL / NEEDS TESTING
2331  *
2332  * @param rSigmaO
2333  * Specified alphabet Sigma_o
2334  *
2335  * @return
2336  * True if generator contains at least one initial state
2337  */
2338  bool Complete(const EventSet& rSigmaO);
2339 
2340 
2341 
2342 
2343  /**
2344  * Compute set of trim states
2345  */
2346  StateSet TrimSet(void) const;
2347 
2348  /**
2349  * Make generator trim
2350  *
2351  * This function removes all states are not accessible or not
2352  * coaccessible. In other words: only those states are kept, that
2353  * contribute to that marked language.
2354  *
2355  * @return
2356  * True if resulting generator contains at least one initial state and at least one marked state.
2357  */
2358  bool Trim(void);
2359 
2360  /**
2361  * Check if generator is trim.
2362  *
2363  * Returns true if all states are rechable and coreachale.
2364  *
2365  * @return
2366  * True if generator is trim
2367  */
2368  bool IsTrim(void) const;
2369 
2370 
2371  /**
2372  * Make generator omega-trim
2373  *
2374  * This function removes states such that the generator becomes
2375  * omega trim while not affecting the induced omega language.
2376  *
2377  * The implementation first makes the generator accessible
2378  * and then iteratively removes state that either
2379  * never reach a marked state or that are guaranteed to eventually
2380  * reach a terminal state. There might be a more efficient
2381  * approach.
2382  *
2383  * @return
2384  * True if resulting generator contains at least one initial state and at least one marked state.
2385  */
2386  bool OmegaTrim(void);
2387 
2388 
2389  /**
2390  * Check if generator is omega-trim.
2391  *
2392  * Returns true if all states are accessible, coacessible, and
2393  * have a successor state.
2394  *
2395  * @return
2396  * True if generator is omega-trim
2397  */
2398  bool IsOmegaTrim(void) const;
2399 
2400 
2401 
2402  /** @} doxygen group */
2403 
2404  /*****************************************
2405  *****************************************
2406  *****************************************
2407  *****************************************/
2408 
2409  /** @name File IO */
2410  /** @{ doxygen group */
2411 
2412  /**
2413  * Write generators alphabet to console
2414  */
2415  void WriteAlphabet(void) const;
2416 
2417  /**
2418  * Write generators alphabet to string
2419  *
2420  * @return
2421  * std::string
2422  * @exception Exception
2423  * - IO errors (id 2)
2424  */
2425  std::string AlphabetToString(void) const;
2426 
2427  /**
2428  * Write generators alphabet to tokenwriter
2429  *
2430  * @param rTw
2431  * Reference to TokenWriter
2432  *
2433  * @exception Exception
2434  * - IO errors (id 2)
2435  */
2436  void WriteAlphabet(TokenWriter& rTw) const;
2437 
2438  /**
2439  * Write a stateset to console (no re-indexing).
2440  * Uses WriteStateSet(TokenWriter& rTw, const StateSet&) const to write
2441  * the specified state set to console referring to this generators state names.
2442  *
2443  * @param rStateSet
2444  * Reference to stateset
2445  */
2446  void WriteStateSet(const StateSet& rStateSet) const;
2447 
2448  /**
2449  * Write a stateset to string (no re-indexing).
2450  * Uses WriteStateSet(TokenWriter& rTw, const StateSet&) const to write
2451  * the specified state set to a string referring to this generators state names.
2452  *
2453  * @param rStateSet
2454  * Reference to stateset
2455  * @return
2456  * std::string
2457  * @exception Exception
2458  * - IO errors (id 2)
2459  */
2460  std::string StateSetToString(const StateSet& rStateSet) const;
2461 
2462  /**
2463  * Write a stateset to formated text (no re-indexing).
2464  * Uses WriteStateSet(TokenWriter& rTw, const StateSet&) const to write
2465  * the specified state set to a string referring to this generators state names.
2466  *
2467  * @param rStateSet
2468  * Reference to stateset
2469  * @return
2470  * std::string
2471  * @exception Exception
2472  * - IO errors (id 2)
2473  */
2474  std::string StateSetToText(const StateSet& rStateSet) const;
2475 
2476  /**
2477  * Write a stateset to TokenWriter.
2478  * All native output of external state sets done with this function.
2479  * Technically, a StateSet is a set of plain indices with no references
2480  * to symbolic names. Thus, it is only the context of a Generator that provides
2481  * the symbolic names for file output.
2482  *
2483  * Output of state sets always uses the mMinStateIndexMap to re-index states.
2484  * However, this map is only set up automatically for file output. If You require
2485  * re-indexed output to e.g. a string, you must set up the map by calling SetMinStateIndexMap().
2486  * To ensure that no re-indexing takes place, call ClearMinStateIndexMap().
2487  *
2488  * @param rTw
2489  * Reference to TokenWriter
2490  * @param rStateSet
2491  * Reference to stateset
2492  *
2493  * @exception Exception
2494  * - IO errors (id 2)
2495  */
2496  void WriteStateSet(TokenWriter& rTw, const StateSet& rStateSet) const;
2497 
2498  /**
2499  * Write a stateset to TokenWriter (debug version, no re-indexing)
2500  *
2501  * @param rTw
2502  * Reference to TokenWriter
2503  * @param rStateSet
2504  * Reference to stateset
2505  *
2506  * @exception Exception
2507  * - IO errors (id 2)
2508  */
2509  void DWriteStateSet(TokenWriter& rTw, const StateSet& rStateSet) const;
2510 
2511  /**
2512  * Write stateset of this generator to a string (no re-indexing)
2513  *
2514  * @return
2515  * std::string
2516  * @exception Exception
2517  * - IO errors (id 2)
2518  */
2519  std::string StatesToString(void) const;
2520 
2521  /**
2522  * Write stateset of this generator to formated text (no re-indexing)
2523  *
2524  * @return
2525  * std::string
2526  * @exception Exception
2527  * - IO errors (id 2)
2528  */
2529  std::string StatesToText(void) const;
2530 
2531  /**
2532  * Write set of marked states to a string (no re-indexing)
2533  *
2534  * @return
2535  * std::string
2536  * @exception Exception
2537  * - IO errors (id 2)
2538  */
2539  std::string MarkedStatesToString(void) const;
2540 
2541  /**
2542  * Write set of initial states to a string (no re-indexing)
2543  *
2544  * @return
2545  * std::string
2546  * @exception Exception
2547  * - IO errors (id 2)
2548  */
2549  std::string InitStatesToString(void) const;
2550 
2551  /**
2552  * Write transition relation to console (no re-indexing)
2553  */
2554  void WriteTransRel(void) const;
2555 
2556  /**
2557  * Write transition relation to string (no re-indexing)
2558  */
2559  std::string TransRelToString(void) const;
2560 
2561  /**
2562  * Write transition relation to formated text (no re-indexing)
2563  */
2564  std::string TransRelToText(void) const;
2565 
2566  /**
2567  * Write transition relation to tokenwriter.
2568  * Re-indexing and symbolic state names are handled in the same way
2569  * as with state sets: this function refers to the generators state symboltable to
2570  * obtain state names and uses the mMinStateIndexMap to re-index the output.
2571  *
2572  * @param rTw
2573  * Reference to TokenWriter
2574  *
2575  * @exception Exception
2576  * - IO errors (id 2)
2577  */
2578  void WriteTransRel(TokenWriter& rTw) const;
2579 
2580  /**
2581  * Write transition relation to tokenwriter (debug version)
2582  * @param rTw
2583  * Reference to TokenWriter
2584  *
2585  * @exception Exception
2586  * - IO errors (id 2)
2587  */
2588  void DWriteTransRel(TokenWriter& rTw) const;
2589 
2590 
2591  /**
2592  * Writes generator to dot input format.
2593  * The dot file format is specified by the graphiz package; see http://www.graphviz.org.
2594  * The package includes the dot command line tool to generate a graphical
2595  * representation of the generators graph. See also GraphWrite().
2596  * This functions sets the re-indexing to minimal indices.
2597  *
2598  * @param rFileName
2599  * File to write
2600  *
2601  * @exception Exception
2602  * - IO errors (id 2)
2603  */
2604  virtual void DotWrite(const std::string& rFileName) const;
2605 
2606  /**
2607  * Writes generator to dot input format (no re-indexing).
2608  * Variant of DotWrite() without re-indexing.
2609  *
2610  * @param rFileName
2611  * File to write
2612  *
2613  * @exception Exception
2614  * - IO errors (id 2)
2615  */
2616  virtual void DDotWrite(const std::string& rFileName) const;
2617 
2618  /**
2619  * Writes generator to dot input format for export to VioLib.
2620  * Variant of DotWrite() using strategic state and event names
2621  * to simplify import to VioLib (qt widget for graphical representation
2622  * of FAUDES generators).
2623  *
2624  * @param rFileName
2625  * File to write
2626  * @exception Exception
2627  * - IO errors (id 2)
2628  */
2629  virtual void XDotWrite(const std::string& rFileName) const;
2630 
2631  /**
2632  * Read a state set.
2633  * Refer to the generators state symboltable while reading a state set.
2634  * Ignore any attributes.
2635  *
2636  * @param rTr
2637  * Reference to TokenReader
2638  * @param rLabel
2639  * Label of set in source
2640  * @param rStateSet
2641  * Destination state set
2642  *
2643  * @exception Exception
2644  * - IO errors (id 1)
2645  * - token mismatch (id 50, 51, 52, 80, 85)
2646  */
2647  void ReadStateSet(TokenReader& rTr, const std::string& rLabel, StateSet& rStateSet) const;
2648 
2649 
2650  /**
2651  * Test whether file-i/o uses minimal state indicees.
2652  *
2653  * @return
2654  * True when minimal state indicees are enabled
2655  */
2656  bool ReindexOnWrite(void) const;
2657 
2658  /**
2659  * Enable/disable minimal state indicees for file-i/o.
2660  *
2661  * @param flag
2662  * True enables reindexing.
2663  */
2664  void ReindexOnWrite(bool flag);
2665 
2666 
2667  /**
2668  * Enable/disable reindexing states for file-i/o.
2669  *
2670  * Set default value for re-indexing. Initially, the default
2671  * is set to "false".
2672  *
2673  * @param flag
2674  * True enables reindexing.
2675  */
2676  static void ReindexOnWriteDefault(bool flag);
2677 
2678 
2679  /**
2680  * Enable/disable reindexing states for file-i/o.
2681  *
2682  * Set default value for re-indexing.
2683  *
2684  * @return
2685  * True for reindexing enabled.
2686  */
2687  static bool ReindexOnWriteDefault(void);
2688 
2689 
2690  /** @} doxygen group */
2691 
2692 
2693  /*****************************************
2694  *****************************************
2695  *****************************************
2696  *****************************************/
2697 
2698  /** @name Misc */
2699  /** @{ doxygen group */
2700 
2701  /**
2702  * Return used events (executed in transitions)
2703  *
2704  * @return EventSet
2705  */
2706  EventSet UsedEvents(void) const;
2707 
2708  /**
2709  * Return unused events
2710  *
2711  * @return EventSet
2712  */
2713  EventSet UnusedEvents(void) const;
2714 
2715  /**
2716  * Set the alphabet to used events
2717  */
2718  void MinimizeAlphabet(void);
2719 
2720  /**
2721  * Return active event set at state x1
2722  *
2723  * @param x1
2724  * Index of x1
2725  *
2726  * @return EventSet
2727  */
2728  EventSet ActiveEventSet(Idx x1) const;
2729 
2730  /**
2731  * Return active transition set at state x1
2732  *
2733  * @param x1
2734  * Index of x1
2735  *
2736  * @return EventSet
2737  */
2738  TransSet ActiveTransSet(Idx x1) const;
2739 
2740  /**
2741  * Return the states covered by transitions
2742  *
2743  * @return StateSet
2744  */
2745  StateSet TransRelStates(void) const;
2746 
2747  /**
2748  * Return the successor state of state x1 with event ev.
2749  * If no such transition exists, return 0.
2750  * If multiple such transitions exit, through expection.
2751  *
2752  * A more egeneral set valued interface is provided by TransSet
2753  *
2754  * @return next state
2755  * @exception Exception
2756  * - Successor state does not exist uniquely (id 92)
2757  */
2758  Idx SuccessorState(Idx x1, Idx ev) const;
2759 
2760  /**
2761  * Return the successor states of state x1
2762  *
2763  * @return StateSet
2764  */
2765  StateSet SuccessorStates(Idx x1) const;
2766 
2767  /**
2768  * Return the successor states of state x1 with event ev
2769  *
2770  * @return StateSet
2771  */
2772  StateSet SuccessorStates(Idx x1, Idx ev) const;
2773 
2774  /**
2775  * Check if generator is deterministic.
2776  *
2777  * We require the transition relation to be a partial function
2778  * and at most one initial state.
2779  *
2780  * Note: pre 2.19 libFAUDES also insisted in exactly one initial state.
2781  *
2782  *
2783  * @return
2784  * True if generator is deterministic
2785  */
2786  bool IsDeterministic(void) const;
2787 
2788  /**
2789  * Set minimal index map for file io of generator states
2790  *
2791  * This function is implemented as fake-const to allow for
2792  * const Write function.
2793  *
2794  */
2795  void SetMinStateIndexMap(void) const;
2796 
2797  /**
2798  * Clear minimal index map for 1:1 file io
2799  *
2800  */
2801  void ClearMinStateIndexMap(void) const;
2802 
2803  /**
2804  * Get state index as is it will be written to file.
2805  *
2806  * @param index
2807  * state index
2808  * @return
2809  * minimal index
2810  */
2811  Idx MinStateIndex(Idx index) const;
2812 
2813 
2814  /**
2815  * Re-enumerate states.
2816  *
2817  * This method re-enumerates states such that the resulting
2818  * state set consist of consecutive indexes; i.e. Size()=MaxStateIndex().
2819  * The current implementation sets up the minimal-state-index map used for
2820  * file i/o and applies it to the state set and the transition relation.
2821  *
2822  * Note: libFAUDES does not maintain consecutive state indices.
2823  * This was a design decision and it comes pros and cons. The method MinStateIndex()
2824  * was implemented to provide some limited support for the implementation of algorithms in a
2825  * consecutive state enumeration paradigm. However, mixing both paradigms most likely
2826  * involves an overall performace penalty.
2827  */
2828  void MinStateIndex(void);
2829 
2830 
2831  /**
2832  * Get maximum state index used in this generator.
2833  * Returns 0 if no states at all.
2834  * @return
2835  * maximal index
2836  */
2837  Idx MaxStateIndex(void) const;
2838 
2839 
2840  /**
2841  * Get state index translation map
2842  *
2843  * @return
2844  * minimal index map
2845  */
2846  const std::map<Idx,Idx>& MinStateIndexMap(void) const;
2847 
2848 
2849  /**
2850  * Pretty printable event name for index (eg for debugging).
2851  *
2852  * @param index
2853  * Event index
2854  *
2855  * @return
2856  * std::string
2857  */
2858  std::string EStr(Idx index) const;
2859 
2860  /**
2861  * Return pretty printable state name for index (eg for debugging)
2862  *
2863  * @param index
2864  * State index
2865  *
2866  * @return
2867  * std::string
2868  */
2869  std::string SStr(Idx index) const;
2870 
2871 
2872  /**
2873  * Return pretty printable transition (eg for debugging)
2874  *
2875  * @param rTrans
2876  * Transition
2877  *
2878  * @return
2879  * std::string
2880  */
2881  std::string TStr(const Transition& rTrans) const;
2882 
2883 
2884  /**
2885  * Produce graphical representation of this generator.
2886  * This method calls the generator's DotWrite function and then processes the output
2887  * with the dot tool from graphiz package. If no output format is given,
2888  * try to guess from filename extension. See also ProcessDot().
2889  *
2890  * @param rFileName
2891  * Name of output file
2892  * @param rOutFormat
2893  * Graphics file format, eg "png", "jpg", "svg"
2894  * @param rDotExec
2895  * path/name of executable
2896  * @exception Exception
2897  * - IO errors (id 2)
2898  * - error during systemcall for dot (id 3)
2899  */
2900  void GraphWrite(const std::string& rFileName, const std::string& rOutFormat="",
2901  const std::string& rDotExec="dot") const;
2902 
2903  /**
2904  * Order for sorting containers of generators
2905  */
2906  bool operator < (const vGenerator& rOtherGen) const {
2907  return (mId < rOtherGen.mId);
2908  }
2909 
2910 
2911  /** @} doxygen group */
2912 
2913 
2914  protected:
2915 
2916  /** Name of generator */
2917  std::string mMyName;
2918 
2919  /** Number of generator */
2921 
2922  /** Number of generator objects */
2924 
2925  /** State symbol table (local per Generator)*/
2927 
2928  /** Pointer to State symbol table */
2930 
2931  /** Pointer to Event symbol table */
2933 
2934  /** Automatic state names */
2936 
2937  /** Default for automatic statenames */
2939 
2940  /** Reindex states on file-i/o */
2942 
2943  /** Default for automatic statenames */
2945 
2946  /** Pointer to alphabet (actual type depends on attributes) */
2948 
2949  /** Pointer to state set (actual type depends on attributes) */
2951 
2952  /** Pointer to ransition relation (actual type depends on attributes) */
2954 
2955  /** Pointer to lobal attribute (actual type depends on attributes) */
2957 
2958  /** Pointer to alphabet prototype (incl. attribute type) */
2960 
2961  /** Pointer to state set prototype (incl. attribute type) */
2963 
2964  /** Pointer to transition relation prototype (incl. attribute type) */
2966 
2967  /** Pointer to global attribute prototype (configures global attribute type) */
2969 
2970  /** Static default alphabet prototype (incl. attribute type) */
2971  static const EventSet& AlphabetVoid(void);
2972 
2973  /** Static default state set prototype (incl. attribute type) */
2974  static const StateSet& StatesVoid(void);
2975 
2976  /** Static default transition relation prototype (incl. attribute type) */
2977  static const TransSet& TransRelVoid(void);
2978 
2979  /** Static default global attribute prototype (configures global attribute type) */
2980  static const AttributeVoid& GlobalVoid(void);
2981 
2982  /** Initial states */
2984 
2985  /** Marked states */
2987 
2988  /** Map State indices to consecutive indices */
2989  std::map<Idx,Idx> mMinStateIndexMap;
2990 
2991  /** Allocate my heap members (attribute dependent types) */
2992  virtual void NewCore(void);
2993 
2994  /** Free my heap members (attribute dependent types) */
2995  virtual void DeleteCore(void);
2996 
2997  /** Callback for core update */
2998  virtual void UpdateCore(void);
2999 
3000  /** Configure attribute types */
3001  void ConfigureAttributeTypes(const AttributeVoid* pNewGlobalPrototype,
3002  const StateSet* pNewStatesPrototype, const EventSet* pNewAlphabetPrototype,
3003  const TransSet* pNewTransRelPrototype);
3004 
3005  /** Assignment for matching type */
3006  void DoAssign(const vGenerator& rSrc);
3007 
3008  /**
3009  * Read generator object from TokenReader, see Type::Read for public wrappers.
3010  *
3011  * Virtual function for std token io interface. Context is ignored,
3012  * label defaults to "Generator".
3013  *
3014  * @param rTr
3015  * TokenReader to read from
3016  * @param rLabel
3017  * Section to read
3018  * @param pContext
3019  * Read context to provide contextual information (ignored)
3020  *
3021  * @exception Exception
3022  * - token mismatch (id 50, 51, 52, 80, 85)
3023  * - IO error (id 1)
3024  */
3025  virtual void DoRead(TokenReader& rTr, const std::string& rLabel = "", const Type* pContext=0);
3026 
3027  /**
3028  * Write generator to TokenWriter, see Type::Write for public wrappers.
3029  *
3030  * Virtual function for std token io interface. Context is ignored,
3031  * label defaults to "Generator". If the tokenwriter writes to a file,
3032  * state indices will be re-indext to start from 1.
3033  *
3034  * @param rTw
3035  * Reference to TokenWriter
3036  * @param rLabel
3037  * Label of section to write
3038  * @param pContext
3039  * Write context to provide contextual information (ignored)
3040  *
3041  * @exception Exception
3042  * - IO errors (id 2)
3043  */
3044  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
3045 
3046  /**
3047  * Write generator in debugging format to TokenWriter, see Type::DWrite for public wrappers.
3048  *
3049  * Reimplement this method in derived classes to provide the std token io
3050  * interface defined in the public section of Type.
3051  *
3052  * @param rTw
3053  * Reference to TokenWriter
3054  * @param rLabel
3055  * Label of section to write
3056  * @param pContext
3057  * Write context to provide contextual information (ignored)
3058  *
3059  * @exception Exception
3060  * - IO errors (id 2)
3061  */
3062  virtual void DoDWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
3063 
3064  /**
3065  * Write generator statistics as comment to TokenWriter, see Type::SWrite for public wrappers.
3066  *
3067  * Reimplement this method in derived classes to provide the std token io
3068  * interface defined in the public section of Type.
3069  *
3070  * @param rTw
3071  * Reference to TokenWriter
3072  *
3073  * @exception Exception
3074  * - IO errors (id 2)
3075  */
3076  virtual void DoSWrite(TokenWriter& rTw) const;
3077 
3078  /**
3079  * Write generator to TokenWriter, see Type::XWrite for public wrappers.
3080  *
3081  * Virtual function for std token io interface. Context is ignored,
3082  * label defaults to "Generator".
3083  *
3084  * @param rTw
3085  * Reference to TokenWriter
3086  * @param rLabel
3087  * Label of section to write
3088  * @param pContext
3089  * Write context to provide contextual information (ignored)
3090  *
3091  * @exception Exception
3092  * - IO errors (id 2)
3093  */
3094  virtual void DoXWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
3095 
3096  /**
3097  * Read the generator's alphabet from a TokenReader.
3098  * As of 2.24e, this method returns silently if no alphabet-tag is found.
3099  *
3100  * @param rTr
3101  * Reference to TokenReader
3102  *
3103  * @exception Exception
3104  * - IO errors (id 1)
3105  * - token mismatch (id 50, 51, 52)
3106  */
3107  void ReadAlphabet(TokenReader& rTr);
3108 
3109  /**
3110  * Write generators stateset to TokenWriter.
3111  *
3112  * This method differs from the general purpos version
3113  * WriteStateSet(TokenWriter&, const StateSet&) in that it
3114  * can optionally write an explicit symbol table for state names.
3115  * This will happen whenever writing is done without re-indexing
3116  * states.
3117  *
3118  * @param rTw
3119  * Reference to TokenWriter
3120  *
3121  * @exception Exception
3122  * - IO errors (id 2)
3123  */
3124  void WriteStates(TokenWriter& rTw) const;
3125 
3126  /**
3127  * Read the generator's stateset from a TokenReader.
3128  * This sets up the StateSymbolTable.
3129  * As of 2.24e, this method returns silently if no alphabet-tag is found.
3130  *
3131  * @param rTr
3132  * Reference to TokenReader
3133  * @exception Exception
3134  * - IO errors (id 1)
3135  * - token mismatch (id 50, 51, 52)
3136  */
3137  void ReadStates(TokenReader& rTr);
3138 
3139  /**
3140  * Read a stateset from TokenReader in XML format.
3141  *
3142  * This version for file IO supports the XML format introduced with libFAUDES 2.20.
3143  * Note that for Generators and derived classes, the native libFAUDES token
3144  * format is considered the default. To read XML fromated data,
3145  * use the XRead() interface.
3146  *
3147  * @param rTr
3148  * Reference to TokenReader
3149  * @param rStateSet
3150  * Reference to stateset
3151  * @param rLabel
3152  * Section name, defaults to name of set
3153  *
3154  * @exception Exception
3155  * - IO errors (id 1)
3156  * - token mismatch (id 50, 51, 52)
3157  */
3158  void XReadStateSet(TokenReader& rTr, StateSet& rStateSet, const std::string& rLabel="") const;
3159 
3160  /**
3161  * Read the generator's transition relation from a file.
3162  *
3163  * @param rFileName
3164  * File to read from
3165  *
3166  * @exception Exception
3167  * - IO errors (id 1)
3168  * - token mismatch (id 50, 51, 52)
3169  */
3170  void ReadTransRel(const std::string& rFileName);
3171 
3172  /**
3173  * Read the generator's transition relation from a TokenReader.
3174  *
3175  * @param rTr
3176  * Reference to TokenReader
3177  *
3178  * @exception Exception
3179  * - IO errors (id 1)
3180  * - token mismatch (id 50, 51, 52)
3181  */
3182  void ReadTransRel(TokenReader& rTr);
3183 
3184  /**
3185  * Read the generator's transition relation from a TokenReader.
3186  *
3187  * @param rTr
3188  * Reference to TokenReader
3189  *
3190  * @exception Exception
3191  * - IO errors (id 1)
3192  * - token mismatch (id 50, 51, 52)
3193  */
3194  void XReadTransRel(TokenReader& rTr);
3195 
3196  /**
3197  * Write a stateset to TokenWriter in XML format.
3198  *
3199  * This version for file IO supports the XML format introduced with libFAUDES 2.20.
3200  * Note that for Generators and derived classes, the native libFAUDES token
3201  * format is considered the default. To obtain XML fromated output of a Generator,
3202  * use the XWrite() interface.
3203  *
3204  * @param rTw
3205  * Reference to TokenWriter
3206  * @param rStateSet
3207  * Reference to stateset
3208  * @param rLabel
3209  * Section name, defaults to name of set
3210  *
3211  * @exception Exception
3212  * - IO errors (id 2)
3213  */
3214  void XWriteStateSet(TokenWriter& rTw, const StateSet& rStateSet, const std::string& rLabel="") const;
3215 
3216  /**
3217  * Write transition relation to tokenwriter in XML format.
3218  *
3219  * This version for file IO supports the XML format introduced with libFAUDES 2.20.
3220  * Note that for Generators and derived classes, the native libFAUDES token
3221  * format is considered the default. To obtain XML fromated output of a Generator,
3222  * use the XWrite() interface.
3223  *
3224  *
3225  * @param rTw
3226  * Reference to TokenWriter
3227  *
3228  * @exception Exception
3229  * - IO errors (id 2)
3230  */
3231  void XWriteTransRel(TokenWriter& rTw) const;
3232 
3233 
3234 };
3235 
3236 /**
3237  * Plain generator, api typedef for generator with no attributes.
3238  * \ingroup GeneratorClasses
3239  */
3241 
3242 /**
3243  * Convenience typedef for vectors og generators
3244  * \ingroup GeneratorClasses
3245  */
3247 
3248 
3249 /**
3250  * RTI wrapper function. See also vGenerator::IsAccessible().
3251  * \ingroup GeneratorFunctions
3252  */
3253 extern FAUDES_API bool IsAccessible(const vGenerator& rGen);
3254 
3255 /**
3256  * RTI wrapper function. See also vGenerator::IsCoaccessible().
3257  * \ingroup GeneratorFunctions
3258  */
3259 extern FAUDES_API bool IsCoaccessible(const vGenerator& rGen);
3260 
3261 /**
3262  * RTI wrapper function. See also vGenerator::IsTrim().
3263  * \ingroup GeneratorFunctions
3264  */
3265 extern FAUDES_API bool IsTrim(const vGenerator& rGen);
3266 
3267 /**
3268  * RTI wrapper function. See also vGenerator::IsOmegaTrim().
3269  * \ingroup GeneratorFunctions
3270  */
3271 extern FAUDES_API bool IsOmegaTrim(const vGenerator& rGen);
3272 
3273 /**
3274  * RTI wrapper function. See also vGenerator::IsComplete().
3275  * \ingroup GeneratorFunctions
3276  */
3277 extern FAUDES_API bool IsComplete(const vGenerator& rGen);
3278 
3279 /**
3280  * RTI wrapper function. See also vGenerator::IsComplete().
3281  * \ingroup GeneratorFunctions
3282  */
3283 extern FAUDES_API bool IsComplete(const vGenerator& rGen, const EventSet& rSigmaO);
3284 
3285 /**
3286  * RTI wrapper function. See also vGenerator::IsDeterministic().
3287  * \ingroup GeneratorFunctions
3288  */
3289 extern FAUDES_API bool IsDeterministic(const vGenerator& rGen);
3290 
3291 
3292 /**
3293  * RTI wrapper function. See also vGenerator::Accessible().
3294  * \ingroup GeneratorFunctions
3295  */
3296 extern FAUDES_API void Accessible(vGenerator& rGen);
3297 
3298 /**
3299  * RTI wrapper function. See also vGenerator::Accessible().
3300  * \ingroup GeneratorFunctions
3301  */
3302 extern FAUDES_API void Accessible(const vGenerator& rGen, vGenerator& rRes);
3303 
3304 /**
3305  * RTI wrapper function. See also vGenerator::Coaccessible().
3306  * \ingroup GeneratorFunctions
3307  */
3308 extern FAUDES_API void Coaccessible(vGenerator& rGen);
3309 
3310 /**
3311  * RTI wrapper function. See also vGenerator::Coaccessible().
3312  * \ingroup GeneratorFunctions
3313  */
3314 extern FAUDES_API void Coaccessible(const vGenerator& rGen, vGenerator& rRes);
3315 
3316 /**
3317  * RTI wrapper function. See also vGenerator::Complete().
3318  * \ingroup GeneratorFunctions
3319  */
3320 extern FAUDES_API void Complete(vGenerator& rGen);
3321 
3322 /**
3323  * RTI wrapper function. See also vGenerator::Complete().
3324  * \ingroup GeneratorFunctions
3325  */
3326 extern FAUDES_API void Complete(const vGenerator& rGen, vGenerator& rRes);
3327 
3328 /**
3329  * RTI wrapper function. See also vGenerator::Complete().
3330  * \ingroup GeneratorFunctions
3331  */
3332 extern FAUDES_API void Complete(vGenerator& rGen, const EventSet& rSigmaO);
3333 
3334 /**
3335  * RTI wrapper function. See also vGenerator::Complete().
3336  * \ingroup GeneratorFunctions
3337  */
3338 extern FAUDES_API void Complete(const vGenerator& rGen, const EventSet& rSigmaO, vGenerator& rRes);
3339 
3340 /**
3341  * RTI wrapper function. See also vGenerator::Trim().
3342  * \ingroup GeneratorFunctions
3343  */
3344 extern FAUDES_API void Trim(vGenerator& rGen);
3345 
3346 /**
3347  * RTI wrapper function. See also vGenerator::Trim().
3348  * \ingroup GeneratorFunctions
3349  */
3350 extern FAUDES_API void Trim(const vGenerator& rGen, vGenerator& rRes);
3351 
3352 /**
3353  * RTI wrapper function. See also vGenerator::OmegaTrim().
3354  * \ingroup GeneratorFunctions
3355  */
3356 extern FAUDES_API void OmegaTrim(vGenerator& rGen);
3357 
3358 /**
3359  * RTI wrapper function. See also vGenerator::OmegaTrim().
3360  * \ingroup GeneratorFunctions
3361  */
3362 extern FAUDES_API void OmegaTrim(const vGenerator& rGen, vGenerator& rRes);
3363 
3364 /**
3365  * RTI wrapper function.
3366  * \ingroup GeneratorFunctions
3367  */
3368 extern FAUDES_API void MarkAllStates(vGenerator& rGen);
3369 
3370 /**
3371  * RTI wrapper function.
3372  * \ingroup GeneratorFunctions
3373  */
3374 extern FAUDES_API void AlphabetExtract(const vGenerator& rGen, EventSet& rRes);
3375 
3376 
3377 /**
3378  * RTI convenience function.
3379  */
3380 extern FAUDES_API void SetIntersection(const vGenerator& rGenA, const vGenerator& rGenB, EventSet& rRes);
3381 
3382 /**
3383  * RTI convenience function.
3384  */
3385 extern FAUDES_API void SetIntersection(const GeneratorVector& rGenVec, EventSet& rRes);
3386 
3387 /**
3388  * RTI convenience function.
3389  */
3390 extern FAUDES_API void SetUnion(const vGenerator& rGenA, const vGenerator& rGenB, EventSet& rRes);
3391 
3392 /**
3393  * RTI convenience function.
3394  */
3395 extern FAUDES_API void SetUnion(const GeneratorVector& rGenVec, EventSet& rRes);
3396 
3397 /**
3398  * RTI convenience function.
3399  */
3400 extern FAUDES_API void SetDifference(const vGenerator& rGenA, const vGenerator& rGenB, EventSet& rRes);
3401 
3402 
3403 
3404 
3405 } // namespace faudes
3406 
3407 /*
3408 
3409 #define FAUDES_GENERATOR_DECLARATION(gtype,GlobalAttr,StateAttr,EventAttr,TransAttr) \
3410  public: \
3411  virtual void EventAttribute(Idx index, const EventAttr& rAttr); \
3412  virtual void EventAttributes(const TaEventSet<EventAttr>& rEventSet); \
3413  virtual const EventAttr& EventAttribute(Idx index) const; \
3414  virtual const EventAttr& EventAttribute(const std::string& rName) const; \
3415  virtual EventAttr* EventAttributep(Idx index); \
3416  virtual EventAttr* EventAttributep(const std::string& rName); \
3417  virtual void StateAttribute(Idx index, const StateAttr& rAttr); \
3418  virtual const StateAttr& StateAttribute(Idx index) const; \
3419  virtual StateAttr* StateAttributep(Idx index); \
3420  virtual void TransAttribute(const Transition& rTrans, const TransAttr& rAttr); \
3421  virtual const TransAttr& TransAttribute(const Transition& rTrans) const; \
3422  virtual TransAttr* TransAttributep(const Transition& rTrans); \
3423  virtual void GlobalAttribute(const GlobalAttr& rAttr); \
3424  virtual void GlobalAttributeTry(const Type& rAttr); \
3425  virtual const GlobalAttr& GlobalAttribute(void) const; \
3426  virtual GlobalAttr* GlobalAttributep(void);
3427 
3428 #define FAUDES_GENERATOR_IMPLEMENTATION(gtype,GlobalAttr,StateAttr,EventAttr,TransAttr) \
3429  public: \
3430  virtual void EventAttribute(Idx index, const EventAttr& rAttr); \
3431  virtual void EventAttributes(const TaEventSet<EventAttr>& rEventSet); \
3432  virtual const EventAttr& EventAttribute(Idx index) const; \
3433  virtual const EventAttr& EventAttribute(const std::string& rName) const; \
3434  virtual EventAttr* EventAttributep(Idx index); \
3435  virtual EventAttr* EventAttributep(const std::string& rName); \
3436  virtual void StateAttribute(Idx index, const StateAttr& rAttr); \
3437  virtual const StateAttr& StateAttribute(Idx index) const; \
3438  virtual StateAttr* StateAttributep(Idx index); \
3439  virtual void TransAttribute(const Transition& rTrans, const TransAttr& rAttr); \
3440  virtual const TransAttr& TransAttribute(const Transition& rTrans) const; \
3441  virtual TransAttr* TransAttributep(const Transition& rTrans); \
3442  virtual void GlobalAttribute(const GlobalAttr& rAttr); \
3443  virtual void GlobalAttributeTry(const Type& rAttr); \
3444  virtual const GlobalAttr& GlobalAttribute(void) const; \
3445  virtual GlobalAttr* GlobalAttributep(void);
3446 
3447 */
3448 
3449 
3450 #endif
3451 
Compiletime options.
Class Exception.
Classes IndexSet, TaIndexSet.
Classes NameSet, TaNameSet.
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:81
Class SymbolTable.
Class Token.
Class TokenReader.
Class TokenWriter.
Classes Transition, TTransSet and TaTransSet.
Runtime interface, faudes types.
Minimal Attribute.
Set of indices.
Definition: cfl_indexset.h:78
Set of indices with symbolic names.
Definition: cfl_nameset.h:69
A SymbolTable associates sybolic names with indices.
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
Iterator on transition.
Definition: cfl_transset.h:269
A TokenReader reads sequential tokens from a file or string.
A TokenWriter writes sequential tokens to a file, a string or stdout.
Triple (X1,Ev,X2) to represent current state, event and next state.
Definition: cfl_transset.h:57
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
Base class of all FAUDES generators.
const EventSet * pAlphabetPrototype
Pointer to alphabet prototype (incl.
const AttributeVoid * pGlobalPrototype
Pointer to global attribute prototype (configures global attribute type)
bool mReindexOnWrite
Reindex states on file-i/o.
EventSet * mpAlphabet
Pointer to alphabet (actual type depends on attributes)
virtual bool UpdateAttributes(void)
Updates internal attributes.
AttributeVoid * mpGlobalAttribute
Pointer to lobal attribute (actual type depends on attributes)
void TransRel(TransSetX1X2Ev &res) const
static bool msReindexOnWriteDefault
Default for automatic statenames.
StateSet mMarkedStates
Marked states.
SymbolTable mStateSymbolTable
State symbol table (local per Generator)
SymbolTable * mpEventSymbolTable
Pointer to Event symbol table.
StateSet * mpStates
Pointer to state set (actual type depends on attributes)
TransSet * mpTransRel
Pointer to ransition relation (actual type depends on attributes)
void TransRel(TransSetEvX2X1 &res) const
bool mStateNamesEnabled
Automatic state names.
void TransRel(TransSetX2X1Ev &res) const
const TransSet * pTransRelPrototype
Pointer to transition relation prototype (incl.
void TransRel(TransSetX2EvX1 &res) const
static bool msStateNamesEnabledDefault
Default for automatic statenames.
std::map< Idx, Idx > mMinStateIndexMap
Map State indices to consecutive indices.
static Idx msObjectCount
Number of generator objects.
StateSet mInitStates
Initial states.
std::string mMyName
Name of generator.
const StateSet * pStatesPrototype
Pointer to state set prototype (incl.
Idx mId
Number of generator.
SymbolTable * mpStateSymbolTable
Pointer to State symbol table.
void ReadTransRel(const std::string &rFileName)
Read the generator's transition relation from a file.
TaNameSet< AttributeCFlags > Alphabet
Convenience typedef for event sets with controllability attributes.
void SetDifference(const TBaseSet< T, Cmp > &rSetA, const TBaseSet< T, Cmp > &rSetB, TBaseSet< T, Cmp > &rRes)
Definition: cfl_baseset.h:1078
void SetUnion(const TBaseSet< T, Cmp > &rSetA, const TBaseSet< T, Cmp > &rSetB, TBaseSet< T, Cmp > &rRes)
Definition: cfl_baseset.h:1019
void SetIntersection(const TBaseSet< T, Cmp > &rSetA, const TBaseSet< T, Cmp > &rSetB, TBaseSet< T, Cmp > &rRes)
Definition: cfl_baseset.h:1049
vGenerator Generator
Plain generator, api typedef for generator with no attributes.
TBaseVector< Generator > GeneratorVector
Convenience typedef for vectors og generators.
bool IsComplete(const vGenerator &rGen)
RTI wrapper function.
void Trim(vGenerator &rGen)
RTI wrapper function.
void OmegaTrim(vGenerator &rGen)
RTI wrapper function.
void Complete(vGenerator &rGen)
RTI wrapper function.
bool IsOmegaTrim(const vGenerator &rGen)
RTI wrapper function.
bool IsAccessible(const vGenerator &rGen)
RTI wrapper function.
bool IsTrim(const vGenerator &rGen)
RTI wrapper function.
void MarkAllStates(vGenerator &rGen)
RTI wrapper function.
bool IsCoaccessible(const vGenerator &rGen)
RTI wrapper function.
void AlphabetExtract(const vGenerator &rGen, EventSet &rRes)
RTI wrapper function.
void Accessible(vGenerator &rGen)
RTI wrapper function.
void Coaccessible(vGenerator &rGen)
RTI wrapper function.
bool IsDeterministic(const vGenerator &rGen)
RTI wrapper function.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen