pd_pdgenerator.h
Go to the documentation of this file.
1 /** @file pd_pdgenerator.h pushdown generator class TpdGenerator */
2 
3 /* Pushdown plugin for FAU Discrete Event Systems Library (libfaudes)
4 
5  Copyright (C) 2013 Stefan Jacobi, Sven Schneider, Anne-Kathrin Hess
6 
7 */
8 
9 #ifndef FAUDES_PD_PDGENERATOR_H
10 #define FAUDES_PD_PDGENERATOR_H
11 #define FAUDES_DEBUG_GENERATOR
12 #define FAUDES_DEBUG_CONTAINER
13 
14 #include "corefaudes.h"
15 #include "pd_attributes.h"
16 #include "pd_grammar.h"
17 
18 
19 namespace faudes {
20 
21 
22 
23 /**
24  * Generator with push down extensions.
25  *
26  *
27  * @ingroup PushdownPlugin
28  *
29  * @section Overview
30  * tratarterteartawrtrae
31  *
32  * @section Contents
33  * fvdgdthrthorthtiop
34  */
35 
36 template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
37 class TpdGenerator : public TcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr> {
38 
39 public:
40  /**
41  * Constructor
42  */
43  TpdGenerator(void);
44 
45  /**
46  * Copy constructor
47  *
48  * @param rOtherGen
49  */
50  TpdGenerator(const TpdGenerator& rOtherGen);
51 
52  /**
53  * Copy constructor (no attributes)
54  *
55  * @param rOtherGen
56  */
57  TpdGenerator(const vGenerator& rOtherGen);
58 
59  /**
60  * Assignment operator (uses copy)
61  * Note: you must reimplement this operator in derived
62  * classes in order to handle internal pointers correctly
63  *
64  * @param rOtherGen
65  * Other generator
66  */
67  virtual TpdGenerator& operator= (const TpdGenerator& rOtherGen) {this->Assign(rOtherGen); return *this;};
68 
69  /**
70  * Assignment operator (uses copy)
71  *
72  * @param rOtherGen
73  * Other generator
74  */
75  virtual TpdGenerator& operator= (const vGenerator& rOtherGen) {this->Assign(rOtherGen); return *this;};
76 
77  /**
78  * Construct from file
79  *
80  * @param rFileName
81  * Name of file
82  *
83  * @exception Exception
84  * - file format errors (id 1, 50, 51, 52)
85  */
86  TpdGenerator(const std::string& rFileName);
87 
88  /**
89  * Construct on heap.
90  * Constructs a TpdGenerator on heap.
91  *
92  * @return
93  * new Generator
94  */
95  TpdGenerator* New(void) const;
96 
97  /**
98  * Construct copy on heap.
99  * Constructs a TpdGenerator on heap.
100  *
101  * @return
102  * new Generator
103  */
104  TpdGenerator* Copy(void) const;
105 
106  /**
107  * Type test.
108  * Uses C++ dynamic cast to test whether the specified object
109  * casts to a PushdownGenerator.
110  *
111  * @return
112  * TpdGenerator reference if dynamic cast succeeds, else NULL
113  */
114  virtual const Type* Cast(const Type* pOther) const {
115  return dynamic_cast< const TpdGenerator* > (pOther);
116  };
117 
118 
119  /**
120  * Construct on stack.
121  * Constructs a TpdGenerator on stack.
122  *
123  * @return
124  * new Generator
125  */
126  TpdGenerator NewPdGen(void) const;
127 
128  /**
129  * Get Pointer to global StackSymbolTable. This is
130  * a static member of SymbolTable and used as default
131  * for all derived generator classes and instantiated objects.
132  *
133  * @return
134  * Pointer to global StackSymbolTable
135  */
136  static SymbolTable* GlobalStackSymbolTablep(void);
137 
138 
139  /**
140  * Get Pointer to mpStackSymbolTable.
141  *
142  * @return Pointer mpStackSymbolTable
143  */
144  SymbolTable* StackSymbolTablep(void) const;
145 
146  /**
147  * Set StackSymbolTable.
148  *
149  * @param pStackSymTab
150  * Pointer SymbolTable
151  */
152  void StackSymbolTablep(SymbolTable* pStackSymTab);
153 
154  /**
155  * Return a NameSet with generator's StackSymbolTable
156  *
157  * @return
158  * New empty StackSymbolSet on stack
159  */
160  StackSymbolSet NewStackSymbolSet(void) const;
161 
162  /**
163  * Construct a stack symbol on heap.
164  *
165  * @return
166  * Pointer to new empty StackSymbolSet on heap
167  */
168  StackSymbolSet* NewStackSymbolSetp(void) const;
169 
170  /**
171  * Number of stacks symbols in mStackSymbols
172  *
173  * @return Number of stack symbols in mStackSymbols
174  */
175  Idx StackSymbolsSize(void) const;
176 
177  /**
178  * Get stack symbol set as const reference
179  *
180  * @return mStackSymbols
181  */
182  const StackSymbolSet& StackSymbols(void) const;
183 
184 
185  /**
186  * Get stack symbol set as pointer
187  *
188  * @return mStackSymbols
189  */
191 
192  /**
193  * Overwrites mStackSymbols with new stack symbols without consistency check
194  *
195  * @param newstacksymbols
196  * New stack symbols that are written to mStackSymbols
197  */
198  void InjectStackSymbols(const StackSymbolSet& newstacksymbols);
199 
200  /**
201  * Looks up stack symbol name for given index
202  *
203  * @param index
204  * Stack symbol index
205  *
206  * @return Stack symbol name
207  */
208  std::string StackSymbolName(Idx index) const;
209 
210  /**
211  * Returns stack symbol for given index
212  *
213  * @param index
214  * Stack symbol index
215  *
216  * @return Stack symbol object
217  */
218  StackSymbol StackSymbolObj(Idx index) const;
219 
220  /**
221  * Looks up stack symbol index for given name
222  *
223  * @param rName
224  * Stack symbol name
225  *
226  * @return Stack symbol index or 0 for nonexistent
227  */
228  Idx StackSymbolIndex(const std::string& rName) const;
229 
230  /**
231  * Add named stack symbol to generator. An entry in the mpStackSymbolTable will
232  * be made if stack symbol is new.
233  *
234  * @param rName
235  * Name of the stack symbol to add
236  *
237  * @return
238  * New unique index
239  */
240  Idx InsStackSymbol(const std::string& rName);
241 
242  /**
243  * Add stack symbol to generator. An entry in the mpStackSymbolTable will
244  * be made if stack symbol is new.
245  *
246  * @param rSymbol
247  * The stack symbol to add
248  *
249  * @return
250  * New unique index
251  */
252  Idx InsStackSymbol(const StackSymbol& rSymbol);
253 
254  /**
255  * Add named stack bottom to generator. An entry in the mpStackSymbolTable will
256  * be made if stack symbol is new. This will replace any old stack bottom symbol.
257  *
258  * @param rName
259  * Name of the stack bottom symbol to add
260  *
261  * @return
262  * Stack bottom symbol index
263  */
264  Idx SetStackBottom(const std::string& rName);
265 
266  /**
267  * Add stack bottom to generator. An entry in the mpStackSymbolTable will
268  * be made if stack symbol is new. This will replace any old stack bottom symbol.
269  *
270  * @param rSymbol
271  * The stack bottom symbol to add
272  *
273  * @return
274  * Stack bottom symbol index
275  */
276  Idx SetStackBottom(const StackSymbol& rSymbol);
277 
278  /**
279  * Add stack bottom to generator. An entry in the mpStackSymbolTable will
280  * be made if stack symbol is new. This will replace any old stack bottom symbol.
281  *
282  * @param idx
283  * The index of the stack bottom symbol to add
284  *
285  * @return
286  * Stack bottom symbol index
287  */
288  Idx SetStackBottom(const Idx idx);
289 
290  /**
291  * Get the index of the stack bottom symbol
292  *
293  * @return
294  * index of the stack bottom symbol
295  */
296  Idx StackBottom() const;
297 
298  /**
299  * Add new named stack symbols to generator.
300  *
301  * @param rStackSymbolSet
302  * StackSymbolSet
303  */
304  void InsStackSymbols(const StackSymbolSet& rStackSymbolSet);
305 
306  /**
307  * Delete stack symbol from generator by index.
308  *
309  * @param index
310  * Index of stack symbol
311  * @return
312  * True if stack symbol did exist
313  *
314  */
315  bool DelStackSymbol(Idx index);
316 
317  /**
318  * Delete stack symbol from generator by name. mpStackSymbolTable stays untouched.
319  *
320  * @param rName
321  * Name of stack symbol
322  * @return
323  * True if stack symbol did exist
324  */
325  bool DelStackSymbol(const std::string& rName);
326 
327  /**
328  * Delete a set of stack symbols from generator.
329  *
330  * @param rStackSymbols
331  * StackSymbolSet containing stack symbols to remove
332  */
333  void DelStackSymbols(const StackSymbolSet& rStackSymbols);
334 
335  /**
336  * Test existence of stack symbol in mStackSymbols
337  *
338  * @param index
339  * Stack symbol index
340  *
341  * @return
342  * true / false
343  */
344  bool ExistsStackSymbol(Idx index) const;
345 
346  /**
347  * Test existence of stack symbol in mStackSymbols
348  *
349  * @param rName
350  * Stack symbol name
351  *
352  * @return
353  * True if stack symbol exists
354  */
355  bool ExistsStackSymbol(const std::string& rName) const;
356 
357  /**
358  * Returns an iterator to stack symbol index in mStackSymbols
359  *
360  * @param index
361  * Index to find
362  *
363  * @return
364  * StackSymbolSet::Iterator to stack symbol index
365  */
366  StackSymbolSet::Iterator FindStackSymbol(Idx index) const;
367 
368  /**
369  * Returns an iterator to stack symbol index in mStackSymbols
370  *
371  * @param rName
372  * Stack symbol name of index to find
373  *
374  * @return
375  * StackSymbolSet::Iterator to stack symbol index
376  */
377  StackSymbolSet::Iterator FindStackSymbol(const std::string& rName) const;
378 
379  /**
380  * Iterator to Begin() of mStackSymbols
381  *
382  * @return iterator to begin of mStackSymbols
383  */
384  StackSymbolSet::Iterator StackSymbolsBegin(void) const;
385 
386  /**
387  * Iterator to End() of mStackSymbols
388  *
389  * @return iterator to end of mStackSymbols
390  */
391  StackSymbolSet::Iterator StackSymbolsEnd(void) const;
392 
393  /**
394  * Converts a vector of stack symbols to a vector of Idx
395  *
396  * @param symbols
397  * the vector of stack symbols
398  * @return
399  * vector of Idx
400  */
401  std::vector<Idx> StackSymbolsToIndices(const std::vector<StackSymbol> symbols) const;
402 
403 
404  /**
405  * Get number of transitions including pop-push-pairs
406  *
407  * @return
408  * number of transitions
409  */
410  Idx TransRelSize() const;
411 
412  /**
413  * Add a transition to generator by indices. States and event
414  * must already exist!
415  *
416  * Define FAUDES_CHECKED for consistency checks.
417  *
418  * @param x1
419  * Predecessor state index
420  * @param ev
421  * Event index
422  * @param x2
423  * Successor state index
424  *
425  * @return
426  * True, if the transition was new the generator
427  *
428  * @exception Exception
429  * - state or event not in generator (id 95)
430  */
431  bool SetTransition(Idx x1, Idx ev, Idx x2);
432 
433  /**
434  * Add a transition to generator by names. Statename and eventname
435  * must already exist!
436  *
437  * @param rX1
438  * Predecessor state name
439  * @param rEv
440  * Event name
441  * @param rX2
442  * Successor state name
443  *
444  * @return
445  * True, if the transition was new the generator
446  *
447  * @exception Exception
448  * - state or event not in generator (id 95)
449  * - state name not known (id 90)
450  * - event name not known (id 66)
451  */
452  bool SetTransition(const std::string& rX1, const std::string& rEv,
453  const std::string& rX2);
454 
455  /**
456  * Add a transition with attribute to generator. States and event
457  * must already exist!
458  *
459  * Define FAUDES_CHECKED for consistency checks.
460  *
461  * @param rTransition
462  * transition
463  * @param rAttr
464  * attribute
465  *
466  * @return
467  * True, if the transition was new the generator
468  *
469  */
470  bool SetTransition(const Transition& rTransition, const TransAttr& rAttr);
471 
472  /**
473  * Inserts new PushdownTransition constructed from parameters.
474  * Performs consistency checks for x1, x2, ev and all stack symbols in rPop and rPush.
475  *
476  * @param rTrans
477  * new transition
478  * @param rPop
479  * Stack symbol vector to be popped when transitioning
480  * @param rPush
481  * Stack symbol vector to be pushed when transitioning
482  * @return
483  * True, if the transition was new to the generator
484  */
485  bool SetTransition(const Transition& rTrans, const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush);
486 
487 
488  /**
489  * Inserts new PushdownTransition constructed from parameters.
490  * Performs consistency checks for x1, x2, ev and all stack symbols in rPop and rPush.
491  *
492  * @param rTrans
493  * new transition
494  * @param rPop
495  * Stack symbol vector to be popped when transitioning
496  * @param rPush
497  * Stack symbol vector to be pushed when transitioning
498  * @return
499  * True, if the transition was new to the generator
500  */
501  bool SetTransition(const Transition& rTrans, const std::vector<Idx>& rPop, const std::vector<Idx>& rPush);
502 
503 
504  /**
505  * Inserts new PushdownTransition constructed from parameters.
506  * Performs consistency checks for x1, x2, ev and stack symbols in rPop and rPush.
507  *
508  * @param x1
509  * Start state of new PushdownTransition.
510  * @param ev
511  * Event of new PushdownTransition.
512  * @param x2
513  * End state of new PushdownTransition.
514  * @param rPop
515  * Stack symbol vector to be popped when transitioning
516  * @param rPush
517  * Stack symbol vector to be pushed when transitioning
518  * @return
519  * True, if the transition was new to the generator
520  */
521  bool SetTransition(Idx x1, Idx ev, Idx x2,
522  const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush);
523 
524  /**
525  * Inserts new PushdownTransition constructed from parameters.
526  * Performs consistency checks for x1, x2, ev and stack symbols in rPop and rPush.
527  *
528  * @param x1
529  * Start state of new PushdownTransition.
530  * @param ev
531  * Event of new PushdownTransition.
532  * @param x2
533  * End state of new PushdownTransition.
534  * @param rPop
535  * Stack symbol vector to be popped when transitioning
536  * @param rPush
537  * Stack symbol vector to be pushed when transitioning
538  * @return
539  * True, if the transition was new to the generator
540  */
541  bool SetTransition(Idx x1, Idx ev, Idx x2,
542  const std::vector<Idx>& rPop, const std::vector<Idx>& rPush);
543 
544  /**
545  * Inserts new PushdownTransition constructed from parameters.
546  * Performs consistency checks for x1, x2, ev and stack symbols in rPop and rPush.
547  *
548  * @param rX1
549  * Start state of new PushdownTransition.
550  * @param rEv
551  * Event of new PushdownTransition.
552  * @param rX2
553  * End state of new PushdownTransition.
554  * @param rPop
555  * Stack symbol vector to be popped when transitioning
556  * @param rPush
557  * Stack symbol vector to be pushed when transitioning
558  * @return
559  * True, if the transition was new to the generator
560  */
561  bool SetTransition(const std::string& rX1, const std::string& rEv, const std::string& rX2, const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush);
562 
563  /**
564  * Inserts new PushdownTransition constructed from parameters.
565  * Performs consistency checks for x1, x2, ev and stack symbols in rPop and rPush.
566  *
567  * @param rX1
568  * Start state of new PushdownTransition.
569  * @param rEv
570  * Event of new PushdownTransition.
571  * @param rX2
572  * End state of new PushdownTransition.
573  * @param rPop
574  * Stack symbol vector to be popped when transitioning
575  * @param rPush
576  * Stack symbol vector to be pushed when transitioning
577  * @return
578  * True, if the transition was new to the generator
579  */
580  bool SetTransition(const std::string& rX1, const std::string& rEv, const std::string& rX2, const std::vector<Idx>& rPop, const std::vector<Idx>& rPush);
581 
582  /**
583  * Delete an exisiting PushdownTransition with the provided parameters.
584  *
585  * @param x1
586  * Start state of the PushdownTransition.
587  * @param ev
588  * Event of the PushdownTransition.
589  * @param x2
590  * End state of the PushdownTransition.
591  * @param rPop
592  * Stack symbol vector to be popped when transitioning
593  * @param rPush
594  * Stack symbol vector to be pushed when transitioning
595  * @return
596  * True, if the transition was deleted from the generator
597  */
598  bool ClrTransition(Idx x1, Idx ev, Idx x2,
599  const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush);
600 
601  /**
602  * Delete an exisiting PushdownTransition with the provided parameters.
603  *
604  * @param x1
605  * Start state of the PushdownTransition.
606  * @param ev
607  * Event of the PushdownTransition.
608  * @param x2
609  * End state of the PushdownTransition.
610  * @param rPop
611  * Stack symbol vector to be popped when transitioning
612  * @param rPush
613  * Stack symbol vector to be pushed when transitioning
614  * @return
615  * True, if the transition was deleted from the generator
616  */
617  bool ClrTransition(Idx x1, Idx ev, Idx x2,
618  const std::vector<Idx>& rPop, const std::vector<Idx>& rPush);
619 
620 
621  /**
622  * Delete an exisiting PushdownTransition with the provided parameters.
623  *
624  * @param rTrans
625  * the transition
626  * @param rPop
627  * Stack symbol vector to be popped when transitioning
628  * @param rPush
629  * Stack symbol vector to be pushed when transitioning
630  * @return
631  * True, if the transition was deleted from the generator
632  */
633  bool ClrTransition(const Transition& rTrans,
634  const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush);
635 
636  /**
637  * Delete an exisiting PushdownTransition with the provided parameters.
638  *
639  * @param rTrans
640  * the transition
641  * @param rPop
642  * Stack symbol vector to be popped when transitioning
643  * @param rPush
644  * Stack symbol vector to be pushed when transitioning
645  * @return
646  * True, if the transition was deleted from the generator
647  */
648  bool ClrTransition(const Transition& rTrans,
649  const std::vector<Idx>& rPop, const std::vector<Idx>& rPush);
650 
651 
652  /**
653  * Get the pop/push set attached to this transition
654  *
655  * @param rTrans
656  * the transition
657  * @return
658  * the pop/push set
659  */
660  const PopPushSet& PopPush(const Transition& rTrans) const;
661 
662  /**
663  * Get an iterator to the beginning of the pop/push set attached to this
664  * transition
665  *
666  * @param rTrans
667  * the transition
668  * @return
669  * iterator to the beginning of the pop/push set
670  */
671  PopPushSet::const_iterator PopPushBegin(const Transition& rTrans) const;
672 
673  /**
674  * Get an iterator to the end of the pop/push set attached to this
675  * transition
676  *
677  * @param rTrans
678  * the transition
679  * @return
680  * iterator to the end of the pop/push set
681  */
682  PopPushSet::const_iterator PopPushEnd(const Transition& rTrans) const;
683 
684 
685  /**
686  * determine if the stack symbol associated with the given index is lambda
687  *
688  * @param index
689  * index of a stack symbol
690  * @return
691  * true if the associated stack symbol is lambda, else false
692  */
693  bool IsStackSymbolLambda(Idx index) const;
694 
695  /**
696  * determine if the event associated with the given index is lambda
697  *
698  * @param index
699  * index of an event
700  * @return
701  * true if the associated event is lambda, else false
702  */
703  bool IsEventLambda(Idx index) const;
704 
705 
706  /**
707  * Throw exception if stack symbol refers to stack symbol not
708  * in stack symbol set
709  *
710  * @exception Exception
711  * - invalid stack symbol (id 1001)
712  */
713  void ConsistentStackSymbol(const StackSymbol& rStackSymbol) const;
714 
715  /**
716  * Throw exception if stack symbol refers to stack symbol not
717  * in stack symbol set
718  *
719  * @exception Exception
720  * - invalid stack symbol (id 1001)
721  */
722  void ConsistentStackSymbol(Idx idx) const;
723 
724  /**
725  * Throw exception if vector of stack symbols contains stack symbols not
726  * in generators stack symbol set
727  *
728  * @exception Exception
729  * - invalid stack symbol (id 1001)
730  */
731  void ConsistentVectorStackSymbol(const std::vector<StackSymbol>& rVector) const;
732 
733  /**
734  * Throw exception if vector of stack symbols contains stack symbols not
735  * in generators stack symbol set
736  *
737  * @exception Exception
738  * - invalid stack symbol (id 1001)
739  */
740  void ConsistentVectorStackSymbol(const std::vector<Idx>& rVector) const;
741 
742  /**
743  * Throw exception if vector of stack symbols is empty
744  *
745  * @exception Exception
746  * - invalid stack symbol (id 1001)
747  */
748  void EmptyVectorPopPush(const std::vector<StackSymbol>& rVector) const;
749 
750  /**
751  * Throw exception if vector of stack symbols is empty
752  *
753  * @exception Exception
754  * - invalid stack symbol (id 1001)
755  */
756  void EmptyVectorPopPush(const std::vector<Idx>& rVector) const;
757 
758  /**
759  * Marks a state as being merged from other data type by setting mpMerge.
760  *
761  * @param stateName
762  * the name of the state to mark
763  * @param rMerge
764  * the merged state
765  */
766  void SetMerge(const std::string& stateName, MergeAbstract& rMerge);
767 
768  /**
769  * Marks a state as being merged from other data type by setting mpMerge.
770  *
771  * @param index
772  * the index of the state to mark
773  * @param rMerge
774  * the merged state
775  */
776  void SetMerge(Idx index, MergeAbstract& rMerge);
777 
778  /**
779  * Return the merge attribute of a state.
780  *
781  * @param index
782  * the index of the state
783  */
784  const MergeAbstract* Merge(Idx index) const;
785 
786  /**
787  * Marks a state as being derived from the intersection with a DFA.
788  *
789  * @param stateName
790  * the name of the state to mark
791  * @param dfaIndex
792  * the index of the DFA state
793  */
794  void SetDfaState(const std::string& stateName, Idx dfaIndex);
795 
796  /**
797  * Marks a state as being derived from the intersection with a DPA.
798  *
799  * @param index
800  * the index of the state to mark
801  * @param dfaIndex
802  * the index of the DFA state
803  */
804  void SetDfaState(Idx index, Idx dfaIndex);
805 
806  /**
807  * Return the dfaState attribute of a state.
808  *
809  * @param index
810  * the index of the state
811  */
812  Idx DfaState(Idx index) const;
813 
814  /**
815  * Check if generator is valid
816  *
817  * @return
818  * Success
819  */
820  virtual bool Valid(void);
821 
822 }; //end class TpdGenerator
823 
824 /** Convenience typedef for std PushdownGenerator */
825 typedef TpdGenerator<AttributePushdownGlobal, AttributePushdownState, AttributeCFlags,AttributePushdownTransition>
827 
829 
830 
831 // convenient scope macros
832 #define THIS TpdGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
833 #define BASE TcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
834 #define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
835 
836 // TpdGenerator(void)
837 TEMP THIS::TpdGenerator(void) : BASE() {
838  // set basic members (cosmetic)
839  BASE::pGlobalAttribute->mStackSymbols.Name("StackSymbols");
840  BASE::pGlobalAttribute->mpStackSymbolTable=StackSymbolSet::StaticSymbolTablep();
841  FD_DG("PushdownGenerator(" << this << ")::PushdownGenerator() with csymtab "
842  << (BASE::pGlobalAttribute->mpStackSymbolTable ));
843 }
844 
845 
846 
847 // TpdGenerator(rOtherGen)
848 TEMP THIS::TpdGenerator(const TpdGenerator& rOtherGen) : BASE(rOtherGen) {
849  FD_DG("PushdownGenerator(" << this << ")::PushdownGenerator(rOtherGen) with csymtab"
850  << "(BASE::pGlobalAttribute->mpStackSymbolTable)" );
851 }
852 
853 // TpdGenerator(rOtherGen)
854 TEMP THIS::TpdGenerator(const vGenerator& rOtherGen) : BASE(rOtherGen) {
855  // set basic members (cosmetic)
856  BASE::pGlobalAttribute->mStackSymbols.Name("StackSymbols");
857  BASE::pGlobalAttribute->mpStackSymbolTable=StackSymbolSet::StaticSymbolTablep();
858  FD_DG("PushdownGenerator(" << this << ")::PushdownGenerator(rOtherGen) with csymtab"
859  << "(BASE::pGlobalAttribute->mpStackSymbolTable)" );
860 }
861 
862 // TpdGenerator(rFilename)
863 TEMP THIS::TpdGenerator(const std::string& rFileName) : BASE(rFileName) {
864  FD_DG("PushdownGenerator(" << this << ")::PushdownGenerator(" << rFileName << ") with csymtab"
865  << "(BASE::pGlobalAttribute->mpStackSymbolTable)" );
866 }
867 
868 //GlobalStackSymbolTablep
869 TEMP SymbolTable* THIS::GlobalStackSymbolTablep(void) {
871 }
872 
873 // StackSymbolTablep()
874 TEMP SymbolTable* THIS::StackSymbolTablep(void) const {
875  return BASE::pGlobalAttribute->mpStackSymbolTable;
876 }
877 
878 // StackSymbolTablep(pSymTab)
879 TEMP void THIS::StackSymbolTablep(SymbolTable* pSymTab) {
880  BASE::Clear(); // TODO: relax this
881  BASE::pGlobalAttribute->mpStackSymbolTable=pSymTab;
882 }
883 
884 // New
885 TEMP THIS* THIS::New(void) const {
886  // allocate
887  THIS* res = new THIS;
888  // fix base data
889  res->EventSymbolTablep(BASE::mpEventSymbolTable);
890  res->mStateNamesEnabled=BASE::mStateNamesEnabled;
891  res->mReindexOnWrite=BASE::mReindexOnWrite;
892  // fix my data
893  res->StackSymbolTablep(StackSymbolTablep());
894  return res;
895 }
896 
897 // Copy
898 TEMP THIS* THIS::Copy(void) const {
899  // allocate
900  THIS* res = new THIS(*this);
901  // done
902  return res;
903 }
904 
905 // NewTGen
906 TEMP THIS THIS::NewPdGen(void) const {
907  // call base (fixes by assignment constructor)
908  THIS res= BASE::NewCGen();
909  // fix my data
910  res.StackSymbolTablep(StackSymbolTablep());
911  return res;
912 }
913 
914 // StackSymbolsSize() const
915 TEMP Idx THIS::StackSymbolsSize(void) const {
916  return BASE::pGlobalAttribute->mStackSymbols.Size();
917 }
918 
919 // StackSymbols()
920 TEMP const StackSymbolSet& THIS::StackSymbols(void) const {
921  return BASE::pGlobalAttribute->mStackSymbols;
922 }
923 
924 // StackSymbolssp()
925 TEMP StackSymbolSet* THIS::StackSymbolsp(void) {
926  return &BASE::pGlobalAttribute->mStackSymbols;
927 }
928 
929 // InjectStackSymbols(set)
930 TEMP void THIS::InjectStackSymbols(const StackSymbolSet& newstacksymbols) {
931  BASE::pGlobalAttribute->mStackSymbols=newstacksymbols;
932  BASE::pGlobalAttribute->mStackSymbols.Name("StackSymbols");
933 }
934 
935 // StackSymbolName(index)
936 TEMP std::string THIS::StackSymbolName(Idx index) const {
937  return BASE::pGlobalAttribute->mStackSymbols.SymbolicName(index);
938 }
939 
940 //StackSymbolObj(index)
941 TEMP StackSymbol THIS::StackSymbolObj(Idx index) const {
942  return StackSymbol(BASE::pGlobalAttribute->mStackSymbols.SymbolicName(index));
943 }
944 
945 // StackSymbolIndex(name)
946 TEMP Idx THIS::StackSymbolIndex(const std::string& rName) const {
947  return BASE::pGlobalAttribute->mStackSymbols.Index(rName);
948 }
949 
950 // InsStackSymbol(name)
951 TEMP Idx THIS::InsStackSymbol(const std::string& rName) {
952  return BASE::pGlobalAttribute->mStackSymbols.Insert(rName);
953 }
954 
955 //InsStackSymbol(symbol)
956 TEMP Idx THIS::InsStackSymbol(const StackSymbol& rSymbol){
957  return BASE::pGlobalAttribute->mStackSymbols.Insert(rSymbol.Symbol());
958 }
959 
960 // InsStackSymbols(set)
961 TEMP void THIS::InsStackSymbols(const StackSymbolSet& rStackSymbolSet) {
962  BASE::pGlobalAttribute->mStackSymbols.InsertSet(rStackSymbolSet);
963 }
964 
965 // SetStackBottom(name)
966 TEMP Idx THIS::SetStackBottom(const std::string& rName) {
967  Idx i = BASE::pGlobalAttribute->mStackSymbols.Insert(rName);
968  BASE::pGlobalAttribute->mStackBottom = i;
969  return i;
970 }
971 
972 //SetStackBottom(symbol)
973 TEMP Idx THIS::SetStackBottom(const StackSymbol& rSymbol){
974  Idx i = BASE::pGlobalAttribute->mStackSymbols.Insert(rSymbol.Symbol());
975  BASE::pGlobalAttribute->mStackBottom = i;
976  return i;
977 }
978 
979 //SetStackBottom(index)
980 TEMP Idx THIS::SetStackBottom(const Idx idx){
981  if(!ExistsStackSymbol(idx)) {
982  std::stringstream errstr;
983  errstr << "stack symbol with index " << idx << " not found in generator. " << std::endl;
984  throw Exception("PushdownGenerator::SetStackBottom(idx)", errstr.str(), 200);
985  }
986  BASE::pGlobalAttribute->mStackBottom = StackSymbol(StackSymbolName(idx));
987  return idx;
988 }
989 
990 //StackBottom()
991 TEMP Idx THIS::StackBottom() const{
992  return BASE::pGlobalAttribute->mStackBottom;
993 }
994 
995 // DelStackSymbol(index)
996 TEMP bool THIS::DelStackSymbol(Idx index) {
997  FD_DG("PushdownGenerator(" << this << ")::DelStackSymbol(" << index << ")");
998  return BASE::pGlobalAttribute->mStackSymbols.Erase(index);
999 }
1000 
1001 // DelStackSymbol(name)
1002 TEMP bool THIS::DelStackSymbol(const std::string& rName) {
1003  Idx index=BASE::pGlobalAttribute->mStackSymbols.Index(rName);
1004  return DelStackSymbol(index);
1005 }
1006 
1007 // DelStackSymbols(set)
1008 TEMP void THIS::DelStackSymbols(const StackSymbolSet& rStackSymbols) {
1009  StackSymbolSet::Iterator it=StackSymbolsBegin();
1010  while(it!=StackSymbolsEnd()){
1011  DelStackSymbol(*(it++)); // fixed: 2013-12-17
1012  }
1013 }
1014 
1015 // ExistsStackSymbol(index)
1016 TEMP bool THIS::ExistsStackSymbol(Idx index) const {
1017  return BASE::pGlobalAttribute->mStackSymbols.Exists(index);
1018 }
1019 
1020 // ExistsStackSymbol(name)
1021 TEMP bool THIS::ExistsStackSymbol(
1022  const std::string& rName) const {
1023  return BASE::pGlobalAttribute->mStackSymbols.Exists(rName);
1024 }
1025 
1026 // FindStackSymbol(index)
1027 TEMP StackSymbolSet::Iterator THIS::FindStackSymbol(Idx index) const {
1028  return BASE::pGlobalAttribute->mStackSymbols.Find(index);
1029 }
1030 
1031 // FindStackSymbol(name)
1032 TEMP StackSymbolSet::Iterator THIS::FindStackSymbol(const std::string& rName) const {
1033  return BASE::pGlobalAttribute->mStackSymbols.Find(rName);
1034 }
1035 
1036 // iterator StackSymbolsBegin() const
1037 TEMP StackSymbolSet::Iterator THIS::StackSymbolsBegin(void) const {
1038  return BASE::pGlobalAttribute->mStackSymbols.Begin();
1039 }
1040 
1041 // iterator StackSymbolsEnd() const
1042 TEMP StackSymbolSet::Iterator THIS::StackSymbolsEnd(void) const {
1043  return BASE::pGlobalAttribute->mStackSymbols.End();
1044 }
1045 //StackSymbolsToIndices
1046 TEMP std::vector<Idx> THIS::StackSymbolsToIndices(const std::vector<StackSymbol> symbols) const{
1047  std::vector<StackSymbol>::const_iterator ssit;
1048  std::vector<Idx> rV;
1049  for(ssit = symbols.begin(); ssit != symbols.end(); ssit++){
1050  rV.push_back(StackSymbolIndex(ssit->Symbol()));
1051  }
1052  return rV;
1053 }
1054 
1055 TEMP Idx THIS::TransRelSize() const{
1056 
1057  TransSet::Iterator transit;
1058  Idx s = 0;
1059  for(transit = BASE::TransRelBegin(); transit != BASE::TransRelEnd(); transit++){
1060  s += PopPush(*transit).size();
1061  }
1062  return s;
1063 }
1064 
1065 // SetTransition(rX1, rEv, rX2)
1066 TEMP bool THIS::SetTransition(const std::string& rX1, const std::string& rEv, const std::string& rX2) {
1067  return BASE::SetTransition(rX1,rEv,rX2);
1068 }
1069 
1070 
1071 // SetTransition(x1, ev, x2)
1072 TEMP bool THIS::SetTransition(Idx x1, Idx ev, Idx x2) {
1073  return BASE::SetTransition(Transition(x1,ev,x2));
1074 }
1075 
1076 // SetTransition(rTransition, rAttr)
1077 TEMP bool THIS::SetTransition(const Transition& rTransition, const TransAttr& rAttr) {
1078  return BASE::SetTransition(rTransition,rAttr);
1079 }
1080 
1081 // SetTransition(trans,....)
1082 
1083 TEMP bool THIS::SetTransition(const Transition& rTrans,
1084  const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush) {
1085 // FD_DG("PushdownGenerator(" << this << ")::SetTransition(" << (BASE::TStr(rTrans)) <<", " <<
1086 // ", PopVector" << ", " << "PushVector" << ") const");
1087 // #ifdef FAUDES_CHECKED
1088 // EmptyVectorPopPush(rPop);
1089 // EmptyVectorPopPush(rPush);
1090 // #endif
1091 // BASE::SetTransition(rTrans);
1092 // //get the transition attribute or take new one if it does not exist
1093 // TransAttr attr;
1094 // if(BASE::TransAttributep(rTrans) != 0){
1095 // attr = *BASE::TransAttributep(rTrans);
1096 // }
1097 // std::pair<std::vector<Idx>, std::vector<Idx> > popPushPair;
1098 // popPushPair.first = StackSymbolsToIndices(rPop);
1099 // popPushPair.second = StackSymbolsToIndices(rPush);
1100 // //add new PopPushPair
1101 // attr.mPopPush.insert(popPushPair);
1102 // #ifdef FAUDES_CHECKED
1103 // ConsistentVectorStackSymbol(rPop);
1104 // ConsistentVectorStackSymbol(rPush);
1105 // #endif
1106 // return BASE::SetTransition(rTrans,attr);
1107  return SetTransition(rTrans, StackSymbolsToIndices(rPop), StackSymbolsToIndices(rPush));
1108 }
1109 
1110 TEMP bool THIS::SetTransition(const Transition& rTrans,
1111  const std::vector<Idx>& rPop, const std::vector<Idx>& rPush) {
1112  FD_DG("PushdownGenerator(" << this << ")::SetTransition(" << (BASE::TStr(rTrans)) <<", " <<
1113  ", PopVector" << ", " << "PushVector" << ") const");
1114 #ifdef FAUDES_CHECKED
1115  EmptyVectorPopPush(rPop);
1116  EmptyVectorPopPush(rPush);
1117 #endif
1118  BASE::SetTransition(rTrans);
1119  //get the transition attribute or take new one if it does not exist
1120  TransAttr attr;
1121  if(BASE::TransAttributep(rTrans) != 0){
1122  attr = *BASE::TransAttributep(rTrans);
1123  }
1124  std::pair<std::vector<Idx>, std::vector<Idx> > popPushPair;
1125  popPushPair.first = rPop;
1126  popPushPair.second = rPush;
1127  //add new PopPushPair
1128  attr.mPopPush.insert(popPushPair);
1129 #ifdef FAUDES_CHECKED
1130  ConsistentVectorStackSymbol(rPop);
1131  ConsistentVectorStackSymbol(rPush);
1132 #endif
1133  return BASE::SetTransition(rTrans,attr);
1134 }
1135 
1136 // SetTransition(x1,ev,x2, ...)
1137 TEMP bool THIS::SetTransition(Idx x1, Idx ev, Idx x2,
1138  const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush) {
1139  return SetTransition(Transition(x1,ev,x2),rPop,rPush);
1140 }
1141 
1142 // SetTransition(x1,ev,x2, ...)
1143 TEMP bool THIS::SetTransition(Idx x1, Idx ev, Idx x2,
1144  const std::vector<Idx>& rPop, const std::vector<Idx>& rPush) {
1145  return SetTransition(Transition(x1,ev,x2),rPop,rPush);
1146 }
1147 
1148 // SetTransition(X1,Ev,X2, ...)
1149 TEMP bool THIS::SetTransition(
1150  const std::string& rX1, const std::string& rEv, const std::string& rX2,
1151  const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush) {
1152  FD_DG("PushdownGenerator(" << this << ")::SetTransition(" << rX1 << " " << rEv <<" " << rX2 <<
1153  ", PopVector" << ", " << "PushVector" << ") const");
1154  //try to add transition, will do nothing if transition exists
1155  bool res=BASE::SetTransition(rX1,rEv,rX2);
1156  //get transition via iterator
1157  Transition rTrans = *(BASE::FindTransition(rX1,rEv,rX2));
1158 #ifdef FAUDES_CHECKED
1159  EmptyVectorPopPush(rPop);
1160  EmptyVectorPopPush(rPush);
1161 #endif
1162  //get the transition attribute or take new one if it does not exist
1163  TransAttr attr;
1164  if(BASE::TransAttributep(rTrans) != 0){
1165  attr = *BASE::TransAttributep(rTrans);
1166  }
1167  std::pair<std::vector<Idx>, std::vector<Idx> > popPushPair;
1168  popPushPair.first = StackSymbolsToIndices(rPop);
1169  popPushPair.second = StackSymbolsToIndices(rPush);
1170  //add new PopPushPair
1171  attr.mPopPush.insert(popPushPair);
1172 #ifdef FAUDES_CHECKED
1173  ConsistentVectorStackSymbol(rPop);
1174  ConsistentVectorStackSymbol(rPush);
1175 #endif
1176  BASE::TransAttribute(Transition(BASE::StateIndex(rX1),BASE::EventIndex(rEv),BASE::StateIndex(rX2)),attr);
1177  return res;
1178 }
1179 
1180 // SetTransition(X1,Ev,X2, ...)
1181 TEMP bool THIS::SetTransition(
1182  const std::string& rX1, const std::string& rEv, const std::string& rX2,
1183  const std::vector<Idx>& rPop, const std::vector<Idx>& rPush) {
1184 
1185  Transition(BASE::StateIndex(rX1),BASE::EventIndex(rEv),BASE::StateIndex(rX2));
1186  return SetTransition(Transition(BASE::StateIndex(rX1),BASE::EventIndex(rEv),BASE::StateIndex(rX2)),rPop,rPush);
1187 }
1188 
1189 //clearTransition(x1,ev,x2,rPop,rPush)
1190 TEMP bool THIS::ClrTransition(Idx x1, Idx ev, Idx x2,
1191  const std::vector<StackSymbol>& rPop, const std::vector<StackSymbol>& rPush){
1192  return ClrTransition(Transition(x1,ev,x2),rPop,rPush);
1193 }
1194 
1195 //clearTransition(x1,ev,x2,rPop,rPush)
1196 TEMP bool THIS::ClrTransition(Idx x1, Idx ev, Idx x2,
1197  const std::vector<Idx>& rPop, const std::vector<Idx>& rPush){
1198  return ClrTransition(Transition(x1,ev,x2),rPop,rPush);
1199 }
1200 
1201 //clearTransition(rTrans,rPop,rPush)
1202 TEMP bool THIS::ClrTransition(const Transition& rTrans, const std::vector<StackSymbol>& rPop,const std::vector<StackSymbol>& rPush){
1203 
1204 // //check for existence of base transition
1205 // if(!BASE::ExistsTransition(rTrans)){
1206 // return false;
1207 // }
1208 //
1209 // //delete pop/push pair in said transition
1210 // if(!BASE::pTransRel->Attributep(rTrans)->ClrPopPush(StackSymbolsToIndices(rPop),StackSymbolsToIndices(rPush))){
1211 // return false;
1212 // }
1213 //
1214 // //delete transition if popPush is empty
1215 // if(PopPush(rTrans).empty()){
1216 // BASE::ClrTransition(rTrans);
1217 // }
1218 // return true;
1219  return ClrTransition(rTrans,StackSymbolsToIndices(rPop),StackSymbolsToIndices(rPush));
1220 }
1221 
1222 //clearTransition(rTrans,rPop,rPush)
1223 TEMP bool THIS::ClrTransition(const Transition& rTrans, const std::vector<Idx>& rPop,const std::vector<Idx>& rPush){
1224 
1225  //check for existence of base transition
1226  if(!BASE::ExistsTransition(rTrans)){
1227  return false;
1228  }
1229 
1230  //delete pop/push pair in said transition
1231  if(!BASE::pTransRel->Attributep(rTrans)->ClrPopPush(rPop, rPush)){
1232  return false;
1233  }
1234 
1235  //delete transition if popPush is empty
1236  if(PopPush(rTrans).empty()){
1237  BASE::ClrTransition(rTrans);
1238  }
1239  return true;
1240 }
1241 
1242 //PopPush(trans)
1243 TEMP const PopPushSet& THIS::PopPush(const Transition& rTrans) const{
1244 #ifdef FAUDES_CHECKED
1245  if(!BASE::ExistsTransition(rTrans)) {
1246  std::stringstream errstr;
1247  errstr << "transition " << BASE::TStr(rTrans) << " not found " << std::endl;
1248  throw Exception("PushdownGenerator::PopPush(trans)", errstr.str(), 200);
1249  }
1250 #endif
1251  return BASE::pTransRel->Attribute(rTrans).PopPush();
1252 }
1253 
1254 //PopPushBegin(trans)
1255 TEMP PopPushSet::const_iterator THIS::PopPushBegin(const Transition& rTrans) const {
1256  return BASE::pTransRel->Attribute(rTrans).PopPush().begin();
1257 }
1258 
1259 //PopPushEnd(trans)
1260 TEMP PopPushSet::const_iterator THIS::PopPushEnd(const Transition& rTrans) const {
1261  return BASE::pTransRel->Attribute(rTrans).PopPush().end();
1262 }
1263 
1264 //IsStackSymbolLambda(index)
1265 TEMP bool THIS::IsStackSymbolLambda(Idx index) const{
1266  if(StackSymbolName(index).compare(FAUDES_PD_LAMBDA) == 0)
1267  return true;
1268  else
1269  return false;
1270 }
1271 
1272 //IsEventLambda(index)
1273 TEMP bool THIS::IsEventLambda(Idx index) const{
1274  if(BASE::EventName(index).compare(FAUDES_PD_LAMBDA) == 0)
1275  return true;
1276  else
1277  return false;
1278 }
1279 
1280 
1281 // ConsistentStackSymbol(rStackSymbol)
1282 TEMP void THIS::ConsistentStackSymbol(const StackSymbol& rStackSymbol) const {
1283  FD_DG("PushdownGenerator(" << this << ")::ConsistentStackSymbol(rStackSymbol)");
1284  if(!StackSymbols().Exists(rStackSymbol.Symbol())) {
1285  std::stringstream errstr;
1286  errstr << "stack symbol table mismatch (symbol " << rStackSymbol.mSymbol << " does not exist)" << std::endl;
1287  throw Exception("PushdownGenerator::ConsistentStackSymbol", errstr.str(), 1001);
1288  }
1289  FD_DG("PushdownGenerator(" << this << ")::ConsistentStackSymbol(rStackSymbol): ok");
1290 }
1291 
1292 // ConsistentStackSymbol(Idx)
1293 TEMP void THIS::ConsistentStackSymbol(Idx idx) const {
1294  FD_DG("PushdownGenerator(" << this << ")::ConsistentStackSymbol(idx)");
1295  if(!StackSymbols().Exists(idx)) {
1296  std::stringstream errstr;
1297  errstr << "stack symbol table mismatch (symbol with idx " << idx << " does not exist)" << std::endl;
1298  throw Exception("PushdownGenerator::ConsistentStackSymbol", errstr.str(), 1001);
1299  }
1300  FD_DG("PushdownGenerator(" << this << ")::ConsistentStackSymbol(idx): ok");
1301 }
1302 
1303 // ConsistentVectorStackSymbol(vector)
1304 TEMP void THIS::ConsistentVectorStackSymbol(const std::vector<StackSymbol>& rVector) const {
1305  FD_DG("PushdownGenerator(" << this << ")::ConsistentVectorStackSymbol(rVector)");
1306  std::vector<StackSymbol>::const_iterator it;
1307  it = rVector.begin();
1308  for ( ; it < rVector.end(); it++){
1309  if(!StackSymbols().Exists(it->Symbol())) {
1310  std::stringstream errstr;
1311  errstr << "stack symbol table mismatch (symbol " << it->mSymbol << " does not exist)" <<std::endl;
1312  throw Exception("PushdownGenerator::ConsistentVectorStackSymbol", errstr.str(), 1001);
1313  }
1314  }
1315  FD_DG("PushdownGenerator(" << this << ")::ConsistentVectorStackSymbol(rVector): ok");
1316 }
1317 
1318 // ConsistentVectorStackSymbol(vector)
1319 TEMP void THIS::ConsistentVectorStackSymbol(const std::vector<Idx>& rVector) const {
1320  FD_DG("PushdownGenerator(" << this << ")::ConsistentVectorStackSymbol(rVector)");
1321  std::vector<Idx>::const_iterator it;
1322  it = rVector.begin();
1323  for ( ; it < rVector.end(); it++){
1324  if(!StackSymbols().Exists(*it)) {
1325  std::stringstream errstr;
1326  errstr << "stack symbol table mismatch (symbol with index " << *it << " does not exist)" <<std::endl;
1327  throw Exception("PushdownGenerator::ConsistentVectorStackSymbol", errstr.str(), 1001);
1328  }
1329  }
1330  FD_DG("PushdownGenerator(" << this << ")::ConsistentVectorStackSymbol(rVector): ok");
1331 }
1332 
1333 // EmptyVector(vector)
1334 TEMP void THIS::EmptyVectorPopPush(const std::vector<StackSymbol>& rVector) const {
1335  FD_DG("PushdownGenerator(" << this << ")::EmptyVector(rVector)");
1336  if(rVector.empty()) {
1337  std::stringstream errstr;
1338  errstr << "empty vector not allowed in pop or push" <<std::endl;
1339  throw Exception("PushdownGenerator::EmptyVector", errstr.str(), 1001);
1340  }
1341  FD_DG("PushdownGenerator(" << this << ")::EmptyVectorPopPush(rVector): ok");
1342 }
1343 
1344 // EmptyVector(vector)
1345 TEMP void THIS::EmptyVectorPopPush(const std::vector<Idx>& rVector) const {
1346  FD_DG("PushdownGenerator(" << this << ")::EmptyVector(rVector)");
1347  if(rVector.empty()) {
1348  std::stringstream errstr;
1349  errstr << "empty vector not allowed in pop or push" <<std::endl;
1350  throw Exception("PushdownGenerator::EmptyVector", errstr.str(), 1001);
1351  }
1352  FD_DG("PushdownGenerator(" << this << ")::EmptyVectorPopPush(rVector): ok");
1353 }
1354 
1355 
1356 //SetMerge(stateName,rMerge)
1357 TEMP void THIS::SetMerge(const std::string& stateName, MergeAbstract& rMerge){
1358  Idx index=BASE::StateIndex(stateName);
1359  BASE::pStates->Attributep(index)->SetMerge(rMerge);
1360 }
1361 
1362 //SetMerge(index,rMerge)
1363 TEMP void THIS::SetMerge(Idx index, MergeAbstract& rMerge){
1364  BASE::pStates->Attributep(index)->SetMerge(rMerge);
1365 }
1366 
1367 //Merge(index)
1368 TEMP const MergeAbstract* THIS::Merge(Idx index) const{
1369  return BASE::pStates->Attributep(index)->Merge();
1370 }
1371 
1372 //SetDfaState(stateName, dpaIndex)
1373 TEMP void THIS::SetDfaState(const std::string& stateName, Idx dfaIndex){
1374  Idx index=BASE::StateIndex(stateName);
1375  BASE::pStates->Attributep(index)->DfaState(dfaIndex);
1376 }
1377 
1378 //SetDfaState(index, dpaIndex)
1379 TEMP void THIS::SetDfaState(Idx index, Idx dfaIndex){
1380  BASE::pStates->Attributep(index)->DfaState(dfaIndex);
1381 }
1382 
1383 //DfaState(index)
1384 TEMP Idx THIS::DfaState(Idx index) const{
1385  return BASE::pStates->Attributep(index)->DfaState();
1386 }
1387 
1388 // Valid() TODO checks?
1389 TEMP bool THIS::Valid(void) {
1390  FD_DV("PushdownGenerator(" << this << ")::Valid()");
1391  //call base
1392  if(!BASE::Valid()) return false;
1393  // check my names
1394 
1395  // check my clockset
1396 
1397  // check all clocksymboltables
1398 
1399  return true;
1400 }
1401 
1402 
1403 // clean up defs (tmoor)
1404 #undef THIS
1405 #undef BASE
1406 #undef TEMP
1407 
1408 
1409 
1410 } // namespace faudes
1411 
1412 
1413 #endif
1414 

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