cfl_transset.h
Go to the documentation of this file.
1 /** @file cfl_transset.h @brief Classes Transition, TTransSet and TaTransSet */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5 Copyright (C) 2006 Bernd Opitz
6 Copyright (C) 2007,2024 Thomas Moor
7 
8 Exclusive copyright is granted to Klaus Schmidt
9 
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14 
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23 
24 
25 #ifndef FAUDES_TRANSSET_H
26 #define FAUDES_TRANSSET_H
27 
28 
29 #include <sstream>
30 #include <map>
31 #include <iostream>
32 #include <typeinfo>
33 
34 #include "cfl_definitions.h"
35 #include "cfl_baseset.h"
36 #include "cfl_attrmap.h"
37 #include "cfl_indexset.h"
38 #include "cfl_nameset.h"
39 #include "cfl_attributes.h"
40 #include "cfl_tokenreader.h"
41 
42 
43 namespace faudes {
44 
45 /** @addtogroup ContainerClasses */
46 /** @{*/
47 
48 /**
49  * Triple (X1,Ev,X2) to represent current state, event and next state.
50  * This class provides the triple in struct like fashion where the components
51  * are of type faudes::Idx. While default order is lexographic, the transition
52  * container TTransSet allows for alternative sorting. Since technically a
53  * Transition is just a triple of indices, it is only the context of a generator
54  * that actually makes it a transition (eg by providing mandatory symbolic event
55  * names).
56  */
58 
59  public:
60 
61  /** Construct invalid Transition */
62  Transition(void) : X1(0), Ev(0), X2(0) {};
63 
64  /**
65  * Construct from values.
66  * @param x1
67  * Index of current state
68  * @param ev
69  * Index of Event
70  * @param x2
71  * Index of next state
72  */
73  Transition(Idx x1, Idx ev,Idx x2) :
74  X1(x1), Ev(ev), X2(x2) {}
75 
76  /** Default order for sorting container of Transition (lexographic) */
77  inline bool operator < (const Transition& othertrans) const {
78  if (X1 < othertrans.X1) return true;
79  if (X1 > othertrans.X1) return false;
80  if (Ev < othertrans.Ev) return true;
81  if (Ev > othertrans.Ev) return false;
82  if (X2 < othertrans.X2) return true;
83  return false;
84  }
85 
86  /** Equality operator */
87  inline bool operator == (const Transition& othertrans) const {
88  return ((X1 == othertrans.X1) && (Ev == othertrans.Ev) && (X2 == othertrans.X2));
89  };
90 
91  /** Inequality operator */
92  inline bool operator != (const Transition& othertrans) const {
93  return ((X1 != othertrans.X1) || (Ev != othertrans.Ev) || (X2 != othertrans.X2));
94  };
95 
96  /** Test validity (all indices !=0) */
97  inline bool Valid(void) const {
98  return (X1!=0) && (Ev!=0) && (X2!=0);
99  };
100 
101  /** Current state */
103 
104  /** Event */
105  Idx Ev;
106 
107  /** Next state */
109 
110  /** Pretty print to string */
111  std::string Str(void) const {
112  return ToStringInteger(X1)+"--("+ToStringInteger(Ev) + ")->" + ToStringInteger(X2);}
113 };
114 
115 
116 
117 
118 /**
119  * Alternative ordering of Transitions. This class provides binary predicates
120  * for sorting transition containers by variant lexographic order.
121  */
122 
124 
125  public:
126 
127  /** Binary predicate for sorting transitions in order Ev, X1, X2 */
128  struct EvX1X2 {
129  inline bool operator () (const Transition& left, const Transition& right) const {
130  if (left.Ev < right.Ev) return true;
131  if (left.Ev > right.Ev) return false;
132  if (left.X1 < right.X1) return true;
133  if (left.X1 > right.X1) return false;
134  if (left.X2 < right.X2) return true;
135  return false;
136  }
137  };
138 
139  /** Binary predicate for sorting transitions in order Ev, X2, X1 */
140  struct EvX2X1 {
141  inline bool operator () (const Transition& left, const Transition& right) const {
142  if (left.Ev < right.Ev) return true;
143  if (left.Ev > right.Ev) return false;
144  if (left.X2 < right.X2) return true;
145  if (left.X2 > right.X2) return false;
146  if (left.X1 < right.X1) return true;
147  return false;
148  }
149  };
150 
151  /** Binary predicate for sorting transitions in order X2, Ev, X1 */
152  struct X2EvX1 {
153  inline bool operator () (const Transition& left, const Transition& right) const {
154  if (left.X2 < right.X2) return true;
155  if (left.X2 > right.X2) return false;
156  if (left.Ev < right.Ev) return true;
157  if (left.Ev > right.Ev) return false;
158  if (left.X1 < right.X1) return true;
159  return false;
160  }
161  };
162 
163  /** Binary predicate for sorting transitions in order X2, X1, Ev */
164  struct X2X1Ev {
165  inline bool operator () (const Transition& left, const Transition& right) const {
166  if (left.X2 < right.X2) return true;
167  if (left.X2 > right.X2) return false;
168  if (left.X1 < right.X1) return true;
169  if (left.X1 > right.X1) return false;
170  if (left.Ev < right.Ev) return true;
171  return false;
172  }
173  };
174 
175  /** Binary predicate for sorting transitions in order X1, X2, Ev */
176  struct X1X2Ev {
177  inline bool operator () (const Transition& left, const Transition& right) const {
178  if (left.X1 < right.X1) return true;
179  if (left.X1 > right.X1) return false;
180  if (left.X2 < right.X2) return true;
181  if (left.X2 > right.X2) return false;
182  if (left.Ev < right.Ev) return true;
183  return false;
184  }
185  };
186 
187  /** Binary predicate for sorting transitions in order X1, Ev, X2 */
188  struct X1EvX2 {
189  inline bool operator () (const Transition& left, const Transition& right) const {
190  if (left.X1 < right.X1) return true;
191  if (left.X1 > right.X1) return false;
192  if (left.Ev < right.Ev) return true;
193  if (left.Ev > right.Ev) return false;
194  if (left.X2 < right.X2) return true;
195  return false;
196  }
197  };
198 
199 };
200 
201 
202 
203 /**
204  * Set of Transitions.
205  *
206  * This container class provides similar functionality and interface as BaseSet, but
207  * for Transitions rather than indices. The additional feature is a template parameter
208  * that allows to specify alternative sorting. For algorithms that examine a transition
209  * relation by e.g. the successor state X2, it may be worthwhile to copy a given
210  * TTransRel<TransSort::X1EvX2> to a TTransRel<TransSort::X2EvX1>. Example,
211  * assuming some transition relation is given in default order
212  *
213  * \code
214  * TransSet transrel; // transrel default order X1-Ev-X2
215  *
216  * // ... some operation to set up transrel
217  *
218  * TTransSet<TransSort::X2EvX1> transByX2; // alternative order X2-Ev-X1
219  * transrel.ReSort(transByX2); // copy and re-order transrel
220  * Iterator tit =transByX2.BeginByX2(x2) // begin iterator, X2 specified
221  * Iterator tit_end=transByX2.EndByX2(x2) // end iterator, X2 specified
222  * for(; tit!=tit_end; ++tit) { // loop over all transitions with specified x2
223  *
224  * // ... code to examine tramsitions with specified x2
225  *
226  * }
227  *
228  * \endcode
229  *
230  * Note: it is the context of a Generator that
231  * actually allows to interpret a TTransSet as a set of transitions as opposed to
232  * a set of triples of indices. In particular, file IO of transitions is provided
233  * by the generator class (although TTransSet provides basic output functions for debugging)
234  */
235 
236 // tweak: this appears to be a g++ 4.2 (OsX) issue --- fails at dynamic cast if this symbol is not explicitly exposed
237 //#ifdef __GNUC__
238 //template <class Cmp=TransSort::X1EvX2>
239 //class FAUDES_API TTransSet : public TBaseSet<Transition,Cmp> {
240 //#else
241 template <class Cmp=TransSort::X1EvX2>
242 class FAUDES_TAPI TTransSet : public TBaseSet<Transition,Cmp> {
243 //#endif
244 
246 
247 
248  public:
249 
253 
254  /** @name Constructors & Destructor */
255  /** @{ doxygen group */
256 
257  /** Construct an empty TTransSet object */
258  TTransSet(void);
259 
260  /**
261  * Copy-constructor
262  */
263  //TTransSet(const TBaseSet<Transition,Cmp>& rOtherSet);
264  TTransSet(const TTransSet<Cmp>& rOtherSet);
265 
266  /**
267  * Re-Sort Copy-constructor
268  */
269  template<class OtherCmp>
271 
272  /** Virtual destructor */
273  virtual ~TTransSet() {};
274 
275 
276  /** @} doxygen group */
277 
278 
279  /** Iterator on transition */
281 
282 
283  /** @name Accessing individual transitions */
284  /** @{ doxygen group */
285 
286  /**
287  * Add a Transition.
288  *
289  * @param rTransition
290  * Reference to transition object
291  * @return
292  * True if the transition was new to the set
293  *
294  */
295  bool Insert(const Transition& rTransition);
296 
297  /**
298  * Add a Transition by indices
299  *
300  * @param x1
301  * Predecessor state
302  * @param ev
303  * Event
304  * @param x2
305  * Successor state
306  * @return
307  * True if the transition was new to the set
308  *
309  */
310  bool Insert(Idx x1, Idx ev, Idx x2);
311 
312  /**
313  * Add a Transition.
314  *
315  * @param pos
316  * Insertion hint passed to STL
317  * @param rTransition
318  * Reference to transition object
319  * @return
320  * Insertion position
321  *
322  */
323  Iterator Inject(const Iterator& pos, const Transition& rTransition);
324 
325  /**
326  * Add a Transition.
327  *
328  * @param rTransition
329  * Reference to transition object
330  * @return
331  * Insertion position
332  *
333  */
334  void Inject(const Transition& rTransition);
335 
336  /**
337  * Remove a Transition
338  *
339  * @return
340  * True if transition did exist
341  */
342  bool Erase(const Transition& t);
343 
344  /**
345  * Remove a Transition by x1, ev, x2
346  *
347  * @return
348  * True if transition did exist
349  */
350  bool Erase(Idx x1, Idx ev, Idx x2);
351 
352  /**
353  * Remove a Transition by iterator
354  *
355  * @return
356  * Iterator to next transition
357  */
358  Iterator Erase(const Iterator& it);
359 
360  /**
361  * Remove all transitions containing predecessor state x1.
362  *
363  * @param x1
364  * State index
365  * @exception Exception
366  * - sorting mismatch (id 68)
367  */
368  void EraseByX1(Idx x1);
369 
370  /**
371  * Remove all transitions containing predecessor state x1 and event ev.
372  *
373  * @param x1
374  * State index
375  * @param ev
376  * Event index
377  * @exception Exception
378  * - sorting mismatch (id 68)
379  */
380  void EraseByX1Ev(Idx x1, Idx ev);
381 
382  /**
383  * Remove all transitions containing successor state x2.
384  * This function iterates over all transitions to work with any sorting.
385  *
386  * @param x2
387  * State index
388  */
389  void EraseByX2(Idx x2);
390 
391  /**
392  * Remove all transitions containing event ev.
393  * This function iterates over all transitions to work with any sorting.
394  *
395  * @param ev
396  * Event index
397  */
398  void EraseByEv(Idx ev);
399 
400  /**
401  * Remove all transitions containing state x,
402  * This function iterates over all transitions to work with any sorting.
403  *
404  * @param x
405  * State index
406  */
408 
409  /**
410  * Remove all transitions containing a specified state.
411  * This function iterates over all transitions to work with any sorting.
412  *
413  * @param rStates
414  * Set of states to remore
415  */
416  void EraseByX1OrX2(const StateSet& rStates);
417 
418  /**
419  * Restrict to transitions with states as specified.
420  * Erases any transition with X1 or X2 not in the specified state set.
421  *
422  * @param rStateSet
423  * Set of states to keep.
424  */
425  void RestrictStates(const StateSet& rStateSet);
426 
427  /**
428  * Restrict to transitions with events as specified.
429  * Erases any transition with event not in the specified state set.
430  *
431  * @param rEventSet
432  * Set of events to keep.
433  */
434  void RestrictEvents(const EventSet& rEventSet);
435 
436  /**
437  * Find transition given by x1, ev, x2
438  *
439  *
440  * @param x1
441  * Predecessor state
442  * @param ev
443  * Event
444  * @param x2
445  * Successor state
446  *
447  * @return
448  * Iterator to transition or End() if not exists
449  */
450  Iterator Find(Idx x1, Idx ev, Idx x2) const;
451 
452  /**
453  * Find specified transition
454  *
455  *
456  * @param t
457  * Transition
458  *
459  * @return
460  * Iterator to transition or End() if not exists
461  */
462  Iterator Find(const Transition& t) const;
463 
464 
465  /**
466  * Test existence
467  *
468  * @param t
469  * Transition
470  *
471  * @return
472  * bool
473  */
474  bool Exists(const Transition& t) const;
475 
476  /**
477  * Test existence
478  *
479  * @param x1
480  * Predecessor state Idx
481  * @param ev
482  * Event Idx
483  * @param x2
484  * Successor state Idx
485  *
486  * @return
487  * bool
488  */
489  bool Exists(Idx x1, Idx ev, Idx x2) const;
490 
491  /**
492  * Test existence
493  *
494  * @param x1
495  * Predecessor state Idx
496  * @param ev
497  * Event Idx
498  *
499  * @return
500  * bool
501  */
502  bool ExistsByX1Ev(Idx x1, Idx ev) const;
503 
504  /**
505  * Test existence
506  *
507  * @param x1
508  * Predecessor state Idx
509  *
510  * @return
511  * bool
512  */
513  bool ExistsByX1(Idx x1) const;
514 
515  /**
516  * Tests if a transition with specified predecessor or successor state
517  * exists.
518  *
519  * @param x
520  * State Idx
521  *
522  * @return
523  * bool
524  */
525  bool ExistsByX1OrX2(Idx x) const;
526 
527  /** @} doxygen group */
528 
529 
530  /** @name Transition iterators
531  *
532  * A variaty of iterators are provided to examine specified
533  * segments of the transition relation, e.g. all transitions starting
534  * from a given state. Note that implemetation of these iterators
535  * requires the transition set to be of sorted accordingly. Eg.
536  * scanning all transitions that are labled with a particular event
537  * requires a sorting TransSOrt::EvX1X2 orT ransSOrt::EvX2X1.
538  *
539  *
540  */
541 
542  /** @{ doxygen group: iterators */
543 
544  /**
545  * Iterator to begin of set
546  *
547  * @return
548  * TTransSet<Cmp>::Iterator
549  */
550  Iterator Begin(void) const;
551 
552  /**
553  * Iterator to end of set
554  *
555  * @return
556  * TTransSet<Cmp>::Iterator
557  */
558  Iterator End(void) const;
559 
560 
561  /**
562  * Iterator to first Transition specified by current state.
563  *
564  * @param x1
565  * Predecessor state index
566  *
567  * @return
568  * TTransSet<Cmp>::Iterator
569  *
570  * @exception Exception
571  * - Sorting mismatch (id 68)
572  */
573  Iterator Begin(Idx x1) const;
574 
575  /**
576  * Iterator to end or Transitions with specified current state.
577  *
578  * @param x1
579  * Predecessor state index
580  *
581  * @return
582  * TTransSet<Cmp>::Iterator
583  *
584  * @exception Exception
585  * - Sorting mismatch (id 68)
586  */
587  Iterator End(Idx x1) const;
588 
589  /**
590  * Iterator to first Transitions specified by current state and event.
591  *
592  * @param x1
593  * Predecessor state index
594  * @param ev
595  * Event index
596  *
597  * @return
598  * TTransSet<Cmp>::Iterator
599  *
600  * @exception Exception
601  * - Sorting mismatch (id 68)
602  */
603  Iterator Begin(Idx x1, Idx ev) const;
604 
605  /**
606  * Iterator to first Transition after spcified current state and event.
607  *
608  * @param x1
609  * Predecessor state index
610  * @param ev
611  * Event index
612  *
613  * @return
614  * TTransSet<Cmp>::Iterator
615  *
616  * @exception Exception
617  * - sorting mismatch (id 68)
618  */
619  Iterator End(Idx x1, Idx ev) const;
620 
621  /**
622  * Iterator to first Transition specified by event.
623  * This function requires sorting TransSort::EvX1X2 or TransSort::EvX2X1.
624  *
625  * @param ev
626  * Event index
627  *
628  * @return
629  * TTransSet<Cmp>::iterator
630  *
631  * @exception Exception
632  * - sorting mismatch (id 68)
633  */
634  Iterator BeginByEv(Idx ev) const;
635 
636  /**
637  * Iterator to first Transition after specified by event.
638  * This function requires sorting TransSort::EvX1X2 or TransSort::EvX2X1
639  *
640  * @param ev
641  * Predecessor state index
642  *
643  * @return
644  * TTransSet<Cmp>::Iterator
645  *
646  * @exception Exception
647  * - sorting mismatch (id 68)
648  */
649  Iterator EndByEv(Idx ev) const;
650 
651  /**
652  * Iterator to first Transition specified by event and current state.
653  * This function requires sorting TransSort::EvX1X2.
654  *
655  * @param ev
656  * Event index
657  * @param x1
658  * Predecessor state index
659  *
660  * @return
661  * TTransSet<Cmp>::iterator
662  *
663  * @exception Exception
664  * - sorting mismatch (id 68)
665  */
666  Iterator BeginByEvX1(Idx ev, Idx x1) const;
667 
668  /**
669  * Iterator to first Transition after specified ev and current state.
670  * This function requires sorting TransSort::EvX1X2.
671  *
672  * @param ev
673  * Event index
674  * @param x1
675  * Predecessor state index
676  *
677  * @return
678  * TTransSet<Cmp>::Iterator
679  *
680  * @exception Exception
681  * - sorting mismatch (id 68)
682  */
683  Iterator EndByEvX1(Idx ev, Idx x1) const;
684 
685  /**
686  * Iterator to first Transition specified by event and next state.
687  * This function requires sorting TransSort::EvX2X1.
688  *
689  * @param ev
690  * Event index
691  * @param x2
692  * Predecessor state index
693  *
694  * @return
695  * TTransSet<Cmp>::Iterator
696  *
697  * @exception Exception
698  * - sorting mismatch (id 68)
699  */
700  Iterator BeginByEvX2(Idx ev, Idx x2) const;
701 
702  /**
703  * Iterator to first Transition after specified event and next state.
704  * This function requires sorting TransSort::EvX2X1.
705  *
706  * @param ev
707  * Event index
708  * @param x2
709  * Predecessor state index
710  *
711  * @return
712  * TTransSet<Cmp>::Iterator
713  *
714  * @exception Exception
715  * - sorting mismatch (id 68)
716  */
717  Iterator EndByEvX2(Idx ev, Idx x2) const;
718 
719  /**
720  * Iterator to first Transition specified by successor state x2.
721  * This function requires sorting TransSort::X2EvX1 or TransSort::X2X1Ev.
722  *
723  * @param x2
724  * Predecessor state index
725  *
726  * @return
727  * TTransSet<Cmp>::iterator
728  *
729  * @exception Exception
730  * - sorting mismatch (id 68)
731  */
732  Iterator BeginByX2(Idx x2) const;
733 
734  /**
735  * Iterator to first Transition after specified successor state x2.
736  * This function requires sorting TransSort::X2EvX1 or TransSort::X2X1Ev
737  *
738  * @param x2
739  * Predecessor state index
740  *
741  * @return
742  * TTransSet<Cmp>::Iterator
743  *
744  * @exception Exception
745  * - sorting mismatch (id 68)
746  */
747  Iterator EndByX2(Idx x2) const;
748 
749  /**
750  * Iterator to first Transition specified by successor x2 and ev.
751  * This function requires sorting TransSort::X2EvX1.
752  *
753  * @param x2
754  * Predecessor state index
755  * @param ev
756  * Event index
757  *
758  * @return
759  * TTransSet<Cmp>::Iterator
760  *
761  * @exception Exception
762  * - sorting mismatch (id 68)
763  */
764  Iterator BeginByX2Ev(Idx x2, Idx ev) const;
765 
766  /**
767  * Iterator to first Transition after specified successor x2 and ev.
768  * This function requires sorting TransSort::X2EvX1.
769  *
770  * @param x2
771  * Predecessor state index
772  * @param ev
773  * Event index
774  *
775  * @return
776  * TTransSet<Cmp>::Iterator
777  *
778  * @exception Exception
779  * - sorting mismatch (id 68)
780  */
781  Iterator EndByX2Ev(Idx x2, Idx ev) const;
782 
783  /** @} doxygen group */
784 
785  /** @name Set Operators
786  *
787  * Reimplement boolean operators.
788  *
789  */
790 
791  /** @{ doxygen group: operators */
792 
793 
794  /**
795  * Set union operator
796  *
797  * @return
798  * Union Set
799  *
800  */
801  TTransSet<Cmp> operator + (const TTransSet<Cmp>& rOtherSet) const;
802 
803  /**
804  * Set difference operator
805  *
806  * @return
807  * Set Difference NameSet
808  *
809  */
810  TTransSet<Cmp> operator - (const TTransSet<Cmp>& rOtherSet) const;
811 
812  /**
813  * Set intersection operator
814  *
815  * @return
816  * Set Intersection
817  *
818  */
819  TTransSet<Cmp> operator * (const TTransSet<Cmp>& rOtherSet) const;
820 
821  /** @} doxygen group */
822 
823  /** @name Misc */
824  /** @{ doxygen group */
825 
826  /**
827  * Get copy of trantision relation sorted by other compare
828  * operator, e.g. TSort::X2EvX1
829  *
830  * @return
831  * Transition relation
832  */
833  template<class OtherCmp>
834  void ReSort(TTransSet<OtherCmp>& res) const;
835 
836  /**
837  * Get state set covered by transition set
838  *
839  * @return
840  * Set of state indices used by some transition
841  */
842  StateSet States(void) const;
843 
844  /**
845  * Get set of successor states for specified current state
846  *
847  * @param x1
848  * Current state
849  *
850  * @return
851  * Set of state indices
852  */
854 
855  /**
856  * Get set of successor states for specified current states
857  *
858  * @param rX1Set
859  * Current state
860  *
861  * @return
862  * Set of state indices
863  */
864  StateSet SuccessorStates(const StateSet& rX1Set) const;
865 
866  /**
867  * Get set of successor states for specified current state and event
868  *
869  * @param x1
870  * Current state
871  * @param ev
872  * Event
873  *
874  * @return
875  * Set of state indices
876  */
878 
879  /**
880  * Get set of successor states for specified current states and events
881  *
882  * @param rX1Set
883  * Current states
884  * @param rEvSet
885  * Events
886  *
887  * @return
888  * Set of state indices
889  */
890  StateSet SuccessorStates(const StateSet& rX1Set, const EventSet& rEvSet) const;
891 
892 
893  /**
894  * Get set of predecessor states for specified target state
895  * This function requires sorting TransSort::X2EvX1 or TransSort::X2X1Ev
896  *
897  * @param x2
898  * Target state
899  *
900  * @return
901  * Set of state indices
902  */
904 
905 
906  /**
907  * Get set of predecessor states for specified target states
908  * This function requires sorting TransSort::X2EvX1 or TransSort::X2X1Ev
909  *
910  * @param rX2Set
911  * Sarget states
912  *
913  * @return
914  * Set of state indices
915  */
916  StateSet PredecessorStates(const StateSet& rX2Set) const;
917 
918  /**
919  * Get set of predecessor states for specified targetstate and event
920  * This function requires sorting TransSort::X2EvX1 or TransSort::X2X1Ev
921  *
922  * @param x2
923  * Target state
924  * @param ev
925  * Event
926  *
927  * @return
928  * Set of state indices
929  */
931 
932  /**
933  * Get set of predecessor states for specified target states and events
934  * This function requires sorting TransSort::X2EvX1 or TransSort::X2X1Ev
935  *
936  * @param rX2Set
937  * Target states
938  * @param rEvSet
939  * Events
940  *
941  * @return
942  * Set of state indices
943  */
944  StateSet PredecessorStates(const StateSet& rX2Set, const EventSet& rEvSet) const;
945 
946 
947  /**
948  * Get set of events that are active for a specified current state
949  * Since a transition set does not refer to a SymbolTable, this function
950  * returns a set of plain indices. In order to interpret the set as an EventSet,
951  * the relevant SymbolTable must be supplied as second argument. If obmitting the second
952  * argument, the defult SymbolTable is used.
953  *
954  * @param x1
955  * Current state
956  * @param pSymTab
957  * SymbolTable to refer to
958  *
959  * @return
960  * Set of events.
961  */
962  EventSet ActiveEvents(Idx x1, SymbolTable* pSymTab=NULL) const;
963 
964  /**
965  * Return pretty printable string representation.
966  * Primary meant for debugging messages.
967  *
968  * @param rTrans
969  * Transition to print
970  *
971  * @return
972  * String
973  */
974  virtual std::string Str(const Transition& rTrans) const;
975 
976  /**
977  * Return pretty printable string representation.
978  * Primary meant for debugging messages.
979  *
980  * @return
981  * String
982  */
983  virtual std::string Str(void) const;
984 
985 
986  /** @} doxygen group */
987 
988  protected:
989 
990 
991  /**
992  * Assign my members.
993  *
994  * @param rSource
995  * Source to copy from
996  */
997  void DoAssign(const TTransSet& rSource);
998 
999  /**
1000  * Write to TokenWriter, see Type::Write for public wrappers.
1001  *
1002  * @param rTw
1003  * Reference to TokenWriter
1004  * @param rLabel
1005  * Label of section to write, defaults to name of set
1006  * @param pContext
1007  * Write context eg symboltables
1008  *
1009  * @exception Exception
1010  * - IO errors (id 2)
1011  */
1012 
1013  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
1014 
1015 
1016 };
1017 
1018 /** Type definition for default sorted TTransSet */
1020 
1021 /** Type definition for default sorted TTransSet */
1023 
1024 /** Type definition for ev, x1, x2 sorted TTransSet */
1026 
1027 /** Type definition for ev, x2, x1 sorted TTransSet */
1029 
1030 /** Type definition for x2, ev, x1 sorted TTransSet */
1032 
1033 /** Type definition for x2, x1, ev sorted TTransSet */
1035 
1036 /** Type definition for x1, x2, ev sorted TTransSet */
1038 
1039 
1040 /**
1041  * Set of Transitions with attributes.
1042  *
1043  * This container class is derived from TTransSet to provide attributes as an
1044  * additional feature. The template parameter specifies the attribute class,
1045  * which in turn must provide some basic funtionality. In contrast to the TTransSet, the TaTransSet
1046  * is restricted to standard ordering.
1047  *
1048  * Note that it is the context of a Generator that
1049  * actually allows to interpret a TaTransSet as a set of transitions as opposed to
1050  * a set of triples of indices with attributes. In particular, file IO of transitions is provided
1051  * by the generator class (although TaTransSet provides output functions for debugging)
1052  */
1053 
1054 
1055 template <class Attr>
1056 class FAUDES_TAPI TaTransSet : public TransSet, public TAttrMap<Transition,Attr,TransSort::X1EvX2> {
1057 
1059 
1060 public:
1061 
1062  using TransSet::operator=;
1063  using TransSet::operator==;
1064  using TransSet::operator!=;
1065 
1066 
1067  /** @name Constructors & Destructor */
1068  /** @{ doxygen group */
1069 
1070  /** Construct an empty TaTransSet object */
1071  TaTransSet(void);
1072 
1073  /**
1074  * Copy-constructor (incl attributes)
1075  */
1076  TaTransSet(const TaTransSet& rOtherSet);
1077 
1078  /**
1079  * Copy-Constructor (set attributes to default)
1080  */
1081  TaTransSet(const TTransSet<TransSort::X1EvX2>& rOtherSet);
1082 
1083  /** Virtual destructor */
1084  virtual ~TaTransSet() {}
1085 
1086  /** Relaxed assignment method.
1087  *
1088  * Runtime typecheck for TransSet, maintains attributes provided they can be casted.
1089  *
1090  * @param rSrc
1091  * Source from which to assign
1092  * @return
1093  * Ref to this set
1094  */
1095  virtual TaTransSet& Assign(const TBaseSet<Transition,TransSort::X1EvX2>& rSrc);
1096 
1097  /** Relaxed assignment operator.
1098  *
1099  * @param rSrc
1100  * Source from which to assign
1101  * @return
1102  * Ref to this set
1103  */
1104  virtual TaTransSet& operator=(const TransSet& rSrc) {return Assign(rSrc);}
1105 
1106  /** @} doxygen group */
1107 
1108 
1109 
1110  /** @name Accessing individual transitions */
1111  /** @{ doxygen group */
1112 
1113  /** Iterator on transition */
1115 
1116  /**
1117  * Add a Transition by indices
1118  *
1119  * @param x1
1120  * Predecessor state
1121  * @param ev
1122  * Event
1123  * @param x2
1124  * Successor state
1125  *
1126  * @return
1127  * True if the transition was new to the set
1128  */
1129  bool Insert(Idx x1, Idx ev, Idx x2);
1130 
1131  /**
1132  * Add a Transition directly. If the transition already
1133  * exists, the attribute is maintained. Otherwise, the transition
1134  * is inserted with default attribute.
1135  *
1136  * @param rTransition
1137  * Reference to transition object
1138  *
1139  * @return
1140  * True if the transition was new to the set
1141  */
1142  bool Insert(const Transition& rTransition);
1143 
1144  /**
1145  * Add a Transition with attribute.
1146  *
1147  * @param rTransition
1148  * Reference to transition object
1149  * @param rAttr
1150  * Reference to attribute
1151  *
1152  * @return
1153  * True if the transition was new to the set
1154  */
1155  bool Insert(const Transition& rTransition, const Attr& rAttr);
1156 
1157  /**
1158  * Inserts elements of rOtherSet.
1159  *
1160  * Attributes of this set are maintained, newly inserted elements attain the
1161  * attribute from rOtherSet if it can be casted appropriately.
1162  *
1163  *
1164  * @param rOtherSet
1165  * Other IndexSet
1166  */
1167  virtual void InsertSet(const TransSet& rOtherSet);
1168 
1169  /**
1170  * Inserts elements of rOtherSet.
1171  *
1172  * This variant uses a runtime cast to access attributes.
1173  *
1174  * @param rOtherSet
1175  * Other IndexSet
1176  * @exception Exception
1177  * - cast failed (id 67)
1178  */
1179  virtual void InsertSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1180 
1181  /**
1182  * Remove a Transition
1183  *
1184  * @return
1185  * True if transition did exist
1186  */
1187  bool Erase(const Transition& t);
1188 
1189  /**
1190  * Remove a Transition
1191  *
1192  * @return
1193  * True if transition did exist
1194  */
1195  bool Erase(Idx x1, Idx ev, Idx x2);
1196 
1197  /**
1198  * Remove a Transition by iterator
1199  *
1200  * @return
1201  * Iterator to next transition
1202  */
1203  Iterator Erase(const Iterator& it);
1204 
1205  /**
1206  * Inserts elements of rOtherSet.
1207  *
1208  * Attributes of this set are maintained.
1209  *
1210  *
1211  * @param rOtherSet
1212  * Other IndexSet
1213  */
1214  virtual void EraseSet(const TransSet& rOtherSet);
1215 
1216  /**
1217  * Inserts elements of rOtherSet.
1218  *
1219  * This variant uses a runtime cast to access attributes.
1220  *
1221  * @param rOtherSet
1222  * Other IndexSet
1223  * @exception Exception
1224  * - cast failed (id 67)
1225  */
1226  virtual void EraseSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1227 
1228 
1229  /**
1230  * Restrict to specified subset.
1231  *
1232  * Erases any elements no in the specified set. This function
1233  * ignores the attributes of the other set and maintains the attributes
1234  * of the remaining elements in this set.
1235  *
1236  * @param rOtherSet
1237  * Elements to erase
1238  */
1239  void RestrictSet(const TransSet& rOtherSet);
1240 
1241 
1242  /**
1243  * Restrict to specified subset.
1244  *
1245  * This variant uses a runtime cast to access attributes.
1246  *
1247  * @param rOtherSet
1248  * Elements to erase
1249  */
1250  void RestrictSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1251 
1252 
1253 
1254 
1255  /** resolve ambiguities from attribute interface ("using" wont do the job) */
1258  const Attr& Attribute(const Transition& rElem) const { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem); };
1259  void Attribute(const Transition& rElem, const Attr& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem,rAttr); };
1260  void Attribute(const Transition& rElem, const Type& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem,rAttr); };
1261  void AttributeTry(const Transition& rElem, const Type& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::AttributeTry(rElem,rAttr); };
1262 
1263 
1264  /** @} doxygen group */
1265 
1266 
1267  protected:
1268 
1269  /**
1270  * Assign my members. Maintain attributes.
1271  *
1272  * @param rSource
1273  * Source to copy from
1274  */
1275  void DoAssign(const TaTransSet& rSource);
1276 
1277 };
1278 
1279 
1280 
1281 /**
1282  * Apply relable map to nameset
1283  *
1284  * This implementation tries to keep the attributes from the
1285  * domain elements.
1286  *
1287  * @param rMap
1288  * map to apply
1289  * @param rSet
1290  * set to apply the map to
1291  * @param rRes
1292  * relabled set
1293  * @exceptions
1294  * - symboltable must match
1295  */
1296 extern FAUDES_API void ApplyRelabelMap(const RelabelMap& rMap, const TransSet& rSet, TransSet& rRes);
1297 
1298 
1299 /** @} doxygen group*/
1300 
1301 
1302 /*
1303 *************************************************************************************************
1304 *************************************************************************************************
1305 * Implementation of transset without attributes
1306 *************************************************************************************************
1307 *************************************************************************************************
1308 */
1309 
1310 
1311 /* convenience access to relevant scopes */
1312 #define THIS TTransSet<Cmp>
1313 #define TEMP template<class Cmp>
1314 #define BASE TBaseSet<Transition,Cmp>
1315 
1316 // std faudes type
1318 
1319 // TTransSet(void)
1321 {
1322  FD_DC("TTransSet(" << this << ")::TTransSet()");
1323 }
1324 
1325 // TTransSet(othertransrel)
1326 //TEMP THIS::TTransSet(const TBaseSet<Transition,Cmp>& rOtherSet) :
1327  TEMP THIS::TTransSet(const TTransSet<Cmp>& rOtherSet) :
1328  BASE()
1329 {
1330  FD_DC("TTransSet(" << this << ")::TTransSet(rOtherSet "<< &rOtherSet <<")");
1331  Assign(rOtherSet);
1332 }
1333 
1334 // TTransSet(othertransrel othersort)
1335 TEMP template<class OtherCmp>
1336 THIS::TTransSet(const TTransSet<OtherCmp>& rOtherSet) :
1337  BASE()
1338 {
1339  FD_DC("TTransSet(" << this << ")::TTransSet(rOtherSet/ReSort "<< &rOtherSet <<")");
1340  rOtherSet.ReSort(*this);
1341 }
1342 
1343 // assignment (maintain attributes)
1344 TEMP void THIS::DoAssign(const TTransSet& rSourceSet) {
1345  FD_DC("TTransSet(" << this << ")::DoAssign(..)");
1346  // call base (incl attributes if the have identival type)
1347  BASE::DoAssign(rSourceSet);
1348 }
1349 
1350 // iterator Begin() const
1351 TEMP typename THIS::Iterator THIS::Begin(void) const {
1352  return BASE::Begin();
1353 }
1354 
1355 // iterator End() const
1356 TEMP typename THIS::Iterator THIS::End(void) const {
1357  return BASE::End();
1358 }
1359 
1360 
1361 // Convenience macro for order typecheck
1362 #define SORT_EXCEPTION { std::stringstream errstr; \
1363  errstr << "Transition set order mismatch " << std::endl; \
1364  throw Exception("TransSet::Iterator()", errstr.str(), 68); }
1365 
1366 
1367 // iterator Begin(x1) const
1368 TEMP typename THIS::Iterator THIS::Begin(Idx x1) const {
1369 #ifdef FAUDES_CHECKED
1370  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1371  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1373 #endif
1374  Transition tlx(x1,0,0);
1375  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1376 }
1377 
1378 // iterator End(x1) const
1379 TEMP typename THIS::Iterator THIS::End(Idx x1) const {
1380 #ifdef FAUDES_CHECKED
1381  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1382  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1384 #endif
1385  Transition tlx(x1+1,0,0);
1386  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1387 }
1388 
1389 // iterator Begin(x1,ev) const
1390 TEMP typename THIS::Iterator THIS::Begin(Idx x1, Idx ev) const {
1391 #ifdef FAUDES_CHECKED
1392  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1394 #endif
1395  Transition tlx(x1,ev,0);
1396  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1397 }
1398 
1399 // iterator End(x1,ev) const
1400 TEMP typename THIS::Iterator THIS::End(Idx x1, Idx ev) const {
1401 #ifdef FAUDES_CHECKED
1402  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1404 #endif
1405  Transition tlx(x1,ev+1, 0);
1406  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1407 }
1408 
1409 // iterator BeginByEv(ev) const
1410 TEMP typename THIS::Iterator THIS::BeginByEv(Idx ev) const {
1411 #ifdef FAUDES_CHECKED
1412  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1413  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1415 #endif
1416  Transition tlx(0,ev,0);
1417  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1418 }
1419 
1420 // iterator EndByEv(ev) const
1421 TEMP typename THIS::Iterator THIS::EndByEv(Idx ev) const {
1422 #ifdef FAUDES_CHECKED
1423  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1424  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1426 #endif
1427  Transition tlx(0,ev+1,0);
1428  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1429 }
1430 
1431 // iterator BeginByEvX1(ev,x1) const
1432 TEMP typename THIS::Iterator THIS::BeginByEvX1(Idx ev, Idx x1) const {
1433 #ifdef FAUDES_CHECKED
1434  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1436 #endif
1437  Transition tlx(x1,ev,0);
1438  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1439 }
1440 
1441 // iterator EndByEvX1(ev,x1) const
1442 TEMP typename THIS::Iterator THIS::EndByEvX1(Idx ev, Idx x1) const {
1443 #ifdef FAUDES_CHECKED
1444  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1446 #endif
1447  Transition tlx(x1+1,ev,0);
1448  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1449 }
1450 
1451 // iterator BeginByEvX2(ev,x2) const
1452 TEMP typename THIS::Iterator THIS::BeginByEvX2(Idx ev, Idx x2) const {
1453 #ifdef FAUDES_CHECKED
1454  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1456 #endif
1457  Transition tlx(0,ev,x2);
1458  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1459 }
1460 
1461 // iterator EndByEvX2(ev,x2) const
1462 TEMP typename THIS::Iterator THIS::EndByEvX2(Idx ev, Idx x2) const {
1463 #ifdef FAUDES_CHECKED
1464  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1466 #endif
1467  Transition tlx(0,ev,x2+1);
1468  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1469 }
1470 
1471 // iterator BeginByX2(x2) const
1472 TEMP typename THIS::Iterator THIS::BeginByX2(Idx x2) const {
1473 #ifdef FAUDES_CHECKED
1474  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1475  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1477 #endif
1478  Transition tlx(0,0,x2);
1479  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1480 }
1481 
1482 // iterator EndByX2(x2) const
1483 TEMP typename THIS::Iterator THIS::EndByX2(Idx x2) const {
1484 #ifdef FAUDES_CHECKED
1485  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1486  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1488 #endif
1489  Transition tlx(0,0,x2+1);
1490  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1491 }
1492 
1493 // iterator BeginByX2Ev(x2,ev) const
1494 TEMP typename THIS::Iterator THIS::BeginByX2Ev(Idx x2, Idx ev) const {
1495 #ifdef FAUDES_CHECKED
1496  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1498 #endif
1499  Transition tlx(0,ev,x2);
1500  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1501 }
1502 
1503 // iterator EndByX2Ev(x2,ev) const
1504 TEMP typename THIS::Iterator THIS::EndByX2Ev(Idx x2, Idx ev) const {
1505 #ifdef FAUDES_CHECKED
1506  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1508 #endif
1509  Transition tlx(0,ev+1,x2);
1510  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1511 }
1512 
1513 // operator+
1514 TEMP THIS THIS::operator+ (const TTransSet<Cmp>& rOtherSet) const {
1515  TTransSet<Cmp> res(*this);
1516  res.InsertSet(rOtherSet);
1517  return res;
1518 }
1519 
1520 // operator-
1521 TEMP THIS THIS::operator- (const TTransSet<Cmp>& rOtherSet) const {
1522  TTransSet<Cmp> res(*this);
1523  res.EraseSet(rOtherSet);
1524  return res;
1525 }
1526 
1527 
1528 // operator*
1529 TEMP TTransSet<Cmp> THIS::operator* (const TTransSet<Cmp>& rOtherSet) const {
1530  TTransSet<Cmp> res(*this);
1531  res.RestrictSet(rOtherSet);
1532  return res;
1533 }
1534 
1535 
1536 // DoWrite(rw,label)
1537 TEMP void THIS::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const
1538 {
1539  (void) pContext;
1540  std::string label=rLabel;
1541  if(label=="") label=BASE::Name();
1542  rTw.WriteBegin(label);
1543  int oldcolumns = rTw.Columns();
1544  rTw.Columns(3);
1545 
1546  Iterator tit;
1547  for (tit = Begin(); tit != End(); ++tit) {
1548  rTw << tit->X1; rTw << tit->Ev; rTw << tit->X2;
1549  }
1550 
1551  rTw.WriteEnd(label);
1552  rTw.Columns(oldcolumns);
1553 }
1554 
1555 
1556 // Insert(transition)
1557 TEMP bool THIS::Insert(const Transition& t) {
1558  return BASE::Insert(t);
1559 }
1560 
1561 // Insert(x1,ev,x2)
1562 TEMP bool THIS::Insert(Idx x1, Idx ev, Idx x2) {
1563  FD_DC("TTransSet(" << this << ")::Insert(" << x1 << "-" << ev << "-" << x2 << ")");
1564  return BASE::Insert(Transition(x1, ev, x2));
1565 }
1566 
1567 // Inject(transition)
1568 TEMP typename THIS::Iterator THIS::Inject(const Iterator& pos, const Transition& t) {
1569  return BASE::Inject(pos,t);
1570 }
1571 
1572 // Inject(transition)
1573 TEMP void THIS::Inject(const Transition& t) {
1574  BASE::Inject(t);
1575 }
1576 
1577 
1578 // Erase(transition)
1579 TEMP bool THIS::Erase(const Transition& t) {
1580  FD_DC("TTransSet(" << this << ")::Erase(" << t.Str() << " [t])");
1581  return BASE::Erase(t);
1582 }
1583 
1584 // Erase(x1,ev,x2)
1585 TEMP bool THIS::Erase(Idx x1, Idx ev, Idx x2) {
1586  FD_DC("TTransSet(" << this << ")::Erase(" << x1 << "-" << ev << "-" << x2 << ")");
1587  return BASE::Erase(Transition(x1, ev, x2));
1588 }
1589 
1590 // Erase(it)
1591 TEMP typename THIS::Iterator THIS::Erase(const Iterator& it) {
1592  FD_DC("TTransSet(" << this << ")::Erase(" << this->EStr(*it) << " [it])");
1593  return BASE::Erase(it);
1594 }
1595 
1596 // EraseByX1(x)
1597 TEMP void THIS::EraseByX1(Idx x1) {
1598  FD_DC("TTransSet(" << this << ")::EraseByX1(" << x1 << ")");
1599 #ifdef FAUDES_CHECKED
1600  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1601  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1603 #endif
1604  this->Detach();
1605  typename BASE::iterator lower, upper, it;
1606  Transition tl(x1,0,0);
1607  Transition tu(x1+1,0,0);
1608  lower = BASE::pSet->lower_bound(tl);
1609  upper = BASE::pSet->upper_bound(tu);
1610  if(this->AttributesSize()!=0)
1611  for(it=lower; it!=upper; ++it)
1612  BASE::ClrAttribute(*it);
1613  BASE::pSet->erase(lower, upper);
1614 }
1615 
1616 // EraseByX1Ev(x,e)
1617 TEMP void THIS::EraseByX1Ev(Idx x1, Idx ev) {
1618  FD_DC("TTransSet(" << this << ")::EraseByX1Ev(" << x1 << "," << ev << ")");
1619 #ifdef FAUDES_CHECKED
1620  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1622 #endif
1623  this->Detach();
1624  typename BASE::iterator lower, upper, it;
1625  Transition tl(x1,ev,0);
1626  Transition tu(x1,ev+1,0);
1627  lower = BASE::pSet->lower_bound(tl);
1628  upper = BASE::pSet->upper_bound(tu);
1629  if(this->AttributesSize()!=0)
1630  for(it=lower; it!=upper; ++it)
1631  BASE::ClrAttribute(*it);
1632  BASE::pSet->erase(lower, upper);
1633 }
1634 
1635 // EraseByX2(x)
1636 TEMP void THIS::EraseByX2(Idx x2) {
1637  FD_DC("TTransSet(" << this << ")::EraseByX2(" << x2 << ")");
1638  this->Detach();
1639  bool doattr = (this->AttributesSize()!=0);
1640  typename BASE::iterator it;
1641  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1642  if(it->X2 == x2) {
1643  if(doattr) BASE::ClrAttribute(*it);
1644  BASE::pSet->erase(it++);
1645  continue;
1646  }
1647  it++;
1648  }
1649 }
1650 
1651 // EraseByEv(ev)
1652 TEMP void THIS::EraseByEv(Idx ev) {
1653  FD_DC("TTransSet(" << this << ")::EraseByEv(" << ev << ")");
1654  this->Detach();
1655  bool doattr = (this->AttributesSize()!=0);
1656  typename BASE::iterator it;
1657  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1658  if (it->Ev == ev) {
1659  if(doattr) BASE::ClrAttribute(*it);
1660  BASE::pSet->erase(it++);
1661  continue;
1662  }
1663  it++;
1664  }
1665 }
1666 
1667 
1668 // EraseByX1OrX2(x)
1669 TEMP void THIS::EraseByX1OrX2(Idx x) {
1670  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(" << x << ")");
1671  this->Detach();
1672  bool doattr = (this->AttributesSize()!=0);
1673  typename BASE::iterator it;
1674  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1675  if ((it->X1 == x) || (it->X2 == x)) {
1676  if(doattr) BASE::ClrAttribute(*it);
1677  BASE::pSet->erase(it++);
1678  continue;
1679  }
1680  it++;
1681  }
1682  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(" << x << "): done");
1683 }
1684 
1685 
1686 // EraseByX1OrX2(xset)
1687 TEMP void THIS::EraseByX1OrX2(const StateSet& rStates) {
1688  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(#" << rStates.Size() <<")");
1689  this->Detach();
1690  bool doattr = (this->AttributesSize()!=0);
1691  typename BASE::iterator it=BASE::pSet->begin();
1692  while(it != BASE::pSet->end()) {
1693  if(!rStates.Exists(it->X1) && !rStates.Exists(it->X2)) { ++it; continue;}
1694  if(doattr) BASE::ClrAttribute(*it);
1695  BASE::pSet->erase(it++);
1696  }
1697  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(): done");
1698 }
1699 
1700 
1701 // RestrictStates(xset)
1702 TEMP void THIS::RestrictStates(const StateSet& rStates) {
1703  FD_DC("TTransSet(" << this << ")::RestrictByX1AndX2(#" << rStates.Size() <<")");
1704  this->Detach();
1705  bool doattr = (this->AttributesSize()!=0);
1706  typename BASE::iterator it;
1707  it = BASE::pSet->begin();
1708  while(it != BASE::pSet->end()) {
1709  if(rStates.Exists(it->X1) && rStates.Exists(it->X2)) { ++it; continue;}
1710  if(doattr) BASE::ClrAttribute(*it);
1711  BASE::pSet->erase(it++);
1712  }
1713  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(): done");
1714 }
1715 
1716 
1717 // RestrictEvents(eset)
1718 TEMP void THIS::RestrictEvents(const EventSet& rEvents) {
1719  FD_DC("TTransSet(" << this << ")::RestrictEvents(#" << rEvents.Size() <<")");
1720  this->Detach();
1721  bool doattr = (this->AttributesSize()!=0);
1722  typename BASE::iterator it;
1723  it = BASE::pSet->begin();
1724  while(it != BASE::pSet->end()) {
1725  if(rEvents.Exists(it->Ev)) { ++it; continue;}
1726  if(doattr) BASE::ClrAttribute(*it);
1727  BASE::pSet->erase(it++);
1728  }
1729  FD_DC("TTransSet(" << this << ")::RestrictEvents(): done");
1730 }
1731 
1732 
1733 // iterator Find(x1,ev,x2)
1734 TEMP typename THIS::Iterator THIS::Find(Idx x1, Idx ev, Idx x2) const {
1735  return BASE::Find(Transition(x1,ev,x2));
1736 }
1737 
1738 
1739 // iterator Find(t)
1740 TEMP typename THIS::Iterator THIS::Find(const Transition& t) const{
1741  return BASE::Find(t);
1742 }
1743 
1744 // Exists(t)
1745 TEMP bool THIS::Exists(const Transition& t) const {
1746  return BASE::Exists(t);
1747 }
1748 
1749 // Exists(x1, ev, x2)
1750 TEMP bool THIS::Exists(Idx x1, Idx ev, Idx x2) const {
1751  return BASE::Exists(Transition(x1,ev,x2));
1752 }
1753 
1754 // Exists(x)
1755 TEMP bool THIS::ExistsByX1OrX2(Idx x) const {
1756  typename BASE::iterator it;
1757  for(it = BASE::pSet->begin(); it != BASE::pSet->end(); ++it) {
1758  if ((it->X1 == x) || (it->X2 == x)) {
1759  return true;
1760  }
1761  }
1762  return false;
1763 }
1764 
1765 // ExistsByX1Ev(x,e)
1766 TEMP bool THIS::ExistsByX1Ev(Idx x1, Idx ev) const {
1767  FD_DC("TTransSet(" << this << ")::ExistsByX1Ev(" << x1 << "," << ev << ")");
1768 #ifdef FAUDES_CHECKED
1769  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1771 #endif
1772  this->Detach();
1773  typename BASE::iterator lower, upper, it;
1774  Transition tl(x1,ev,0);
1775  Transition tu(x1,ev+1,0);
1776  lower = BASE::pSet->lower_bound(tl);
1777  upper = BASE::pSet->upper_bound(tu);
1778  return lower != upper;
1779 }
1780 
1781 // ExistsByX1(x)
1782 TEMP bool THIS::ExistsByX1(Idx x1) const {
1783  FD_DC("TTransSet(" << this << ")::ExistsByX1(" << x1 << ")");
1784 #ifdef FAUDES_CHECKED
1785  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1786  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1788 #endif
1789  this->Detach();
1790  typename BASE::iterator lower, upper, it;
1791  Transition tl(x1,0,0);
1792  Transition tu(x1+1,0,0);
1793  lower = BASE::pSet->lower_bound(tl);
1794  upper = BASE::pSet->upper_bound(tu);
1795  return lower != upper;
1796 }
1797 
1798 
1799 // ReSort(res)
1800 TEMP template<class OtherCmp>
1801 void THIS::ReSort(TTransSet<OtherCmp>& res) const {
1802  Iterator it;
1803  res.Clear();
1804  for (it = Begin(); it != End(); ++it) {
1805  res.Insert(*it);
1806  }
1807 }
1808 
1809 // States()
1810 TEMP StateSet THIS::States(void) const {
1811  StateSet states;
1812  Iterator it;
1813  for (it=Begin(); it!=End(); ++it) {
1814  states.Insert(it->X1);
1815  states.Insert(it->X2);
1816  }
1817  return states;
1818 }
1819 
1820 // SuccessorStates(x1)
1821 TEMP StateSet THIS::SuccessorStates(Idx x1) const {
1822 #ifdef FAUDES_CHECKED
1823  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1824  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1826 #endif
1827  StateSet states;
1828  Iterator it = Begin(x1);
1829  Iterator it_end = End(x1);
1830  while (it != it_end) {
1831  states.Insert(it->X2);
1832  ++it;
1833  }
1834  return states;
1835 }
1836 
1837 // SuccessorStates(x1set)
1838 TEMP StateSet THIS::SuccessorStates(const StateSet& rX1Set) const {
1839 #ifdef FAUDES_CHECKED
1840  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1841  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1843 #endif
1844  StateSet states;
1845  StateSet::Iterator sit= rX1Set.Begin();
1846  StateSet::Iterator sit_end= rX1Set.End();
1847  for(;sit!=sit_end; ++sit) {
1848  Iterator tit = Begin(*sit);
1849  Iterator tit_end = End(*sit);
1850  while(tit!=tit_end) {
1851  states.Insert(tit->X2);
1852  ++tit;
1853  }
1854  }
1855  return states;
1856 }
1857 
1858 // SuccessorStates(x1, ev)
1859 TEMP StateSet THIS::SuccessorStates(Idx x1, Idx ev) const {
1860 #ifdef FAUDES_CHECKED
1861  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1863 #endif
1864  StateSet states;
1865  Iterator it = Begin(x1, ev);
1866  Iterator it_end = End(x1, ev);
1867  while (it != it_end) {
1868  states.Insert(it->X2);
1869  ++it;
1870  }
1871  return states;
1872 }
1873 
1874 // SuccessorStates(x1set, evset)
1875 TEMP StateSet THIS::SuccessorStates(const StateSet& rX1Set, const EventSet& rEvSet) const {
1876 #ifdef FAUDES_CHECKED
1877  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1879 #endif
1880  StateSet states;
1881  if(rEvSet.Empty()) return states;
1882  StateSet::Iterator sit= rX1Set.Begin();
1883  StateSet::Iterator sit_end= rX1Set.End();
1884  for(;sit!=sit_end; ++sit) {
1885  EventSet::Iterator eit= rEvSet.Begin();
1886  EventSet::Iterator eit_end= rEvSet.End();
1887  Iterator tit = Begin(*sit,*eit);
1888  Iterator tit_end = End(*sit);
1889  while(tit!=tit_end) {
1890  // match
1891  if(tit->Ev == *eit) {
1892  states.Insert(tit->X2);
1893  ++tit;
1894  continue;
1895  }
1896  // tit behind
1897  if(tit->Ev < *eit) {
1898  ++tit;
1899  continue;
1900  }
1901  // tit upfront
1902  ++eit;
1903  if(eit==eit_end) break;
1904  }
1905  }
1906  return states;
1907 }
1908 
1909 // PredecessorStates(x2)
1910 TEMP StateSet THIS::PredecessorStates(Idx x2) const {
1911 #ifdef FAUDES_CHECKED
1912  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1913  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1915 #endif
1916  StateSet states;
1917  Iterator it = BeginByX2(x2);
1918  Iterator it_end = EndByX2(x2);
1919  while (it != it_end) {
1920  states.Insert(it->X1);
1921  ++it;
1922  }
1923  return states;
1924 }
1925 
1926 
1927 // PredecessorStates(x2set)
1928 TEMP StateSet THIS::PredecessorStates(const StateSet& rX2Set) const {
1929 #ifdef FAUDES_CHECKED
1930  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1931  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1933 #endif
1934  StateSet states;
1935  StateSet::Iterator sit= rX2Set.Begin();
1936  StateSet::Iterator sit_end= rX2Set.End();
1937  for(;sit!=sit_end; ++sit) {
1938  Iterator tit = BeginByX2(*sit);
1939  Iterator tit_end = EndByX2(*sit);
1940  while(tit!=tit_end) {
1941  states.Insert(tit->X1);
1942  ++tit;
1943  }
1944  }
1945  return states;
1946 }
1947 
1948 // PredecessorStates(x2, ev)
1949 TEMP StateSet THIS::PredecessorStates(Idx x2, Idx ev) const {
1950 #ifdef FAUDES_CHECKED
1951  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1953 #endif
1954  StateSet states;
1955  Iterator it = BeginByX2Ev(x2, ev);
1956  Iterator it_end = EndByX2Ev(x2, ev);
1957  while (it != it_end) {
1958  states.Insert(it->X1);
1959  ++it;
1960  }
1961  return states;
1962 }
1963 
1964 // PredecessorStates(x2set, evset)
1965 TEMP StateSet THIS::PredecessorStates(const StateSet& rX2Set, const EventSet& rEvSet) const {
1966 #ifdef FAUDES_CHECKED
1967  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1969 #endif
1970  StateSet states;
1971  if(rEvSet.Empty()) return states;
1972  StateSet::Iterator sit= rX2Set.Begin();
1973  StateSet::Iterator sit_end= rX2Set.End();
1974  for(;sit!=sit_end; ++sit) {
1975  EventSet::Iterator eit= rEvSet.Begin();
1976  EventSet::Iterator eit_end= rEvSet.End();
1977  Iterator tit = BeginByX2Ev(*sit,*eit);
1978  Iterator tit_end = EndByX2(*sit);
1979  while(tit!=tit_end) {
1980  // match
1981  if(tit->Ev == *eit) {
1982  states.Insert(tit->X1);
1983  ++tit;
1984  continue;
1985  }
1986  // tit behind
1987  if(tit->Ev < *eit) {
1988  ++tit;
1989  continue;
1990  }
1991  // tit upfront
1992  ++eit;
1993  if(eit==eit_end) break;
1994  }
1995  }
1996  return states;
1997 }
1998 
1999 
2000 // ActiveEvents(x1,pSymTab)
2001 TEMP EventSet THIS::ActiveEvents(Idx x1, SymbolTable* pSymTab) const {
2002  Iterator it = Begin(x1);
2003  Iterator it_end = End(x1);
2004  EventSet result;
2005  if(pSymTab!=NULL) result.SymbolTablep(pSymTab);
2006  for (; it != it_end; ++it) {
2007  result.Insert(it->Ev);
2008  }
2009  return result;
2010 }
2011 
2012 // Pretty printable string
2013 TEMP std::string THIS::Str(const Transition& rTrans) const {
2014  return rTrans.Str();
2015 }
2016 
2017 // Pretty printable string
2018 TEMP std::string THIS::Str(void) const {
2019  std::stringstream str;
2020  str << "[" << THIS::Name() << "]" << std::endl;
2021  Iterator eit=Begin();
2022  Iterator eit_end=End();
2023  if(THIS::Size()>0) while(true) {
2024  str << Str(*(eit++));
2025  if(eit==eit_end) break;
2026  str << std::endl;
2027  }
2028  return str.str();
2029 }
2030 
2031 
2032 
2033 #undef THIS
2034 #undef TEMP
2035 #undef BASE
2036 
2037 /*
2038 *************************************************************************************************
2039 *************************************************************************************************
2040 * Implementation of transset with attributes
2041 *************************************************************************************************
2042 *************************************************************************************************
2043 */
2044 
2045 
2046 /* convenience access to relevant scopes */
2047 #define THIS TaTransSet<Attr>
2048 #define TEMP template <class Attr>
2049 #define BASE TTransSet<TransSort::X1EvX2>
2050 #define ABASE TAttrMap<Transition,Attr,TransSort::X1EvX2>
2051 
2052 // std faudes type
2054 
2055 // TaTransSet(void)
2057  BASE(),
2058  ABASE(this)
2059 {
2060  FD_DC("TaTransSet(" << this << ")::TaTransSet()");
2061 }
2062 
2063 // TaTransSet(othertransrel)
2064 TEMP THIS::TaTransSet(const TaTransSet& rOtherSet) :
2065  BASE(),
2066  ABASE(this)
2067 {
2068  FD_DC("TaTransSet(" << this << ")::TaTransSet(rOtherSet "<< &rOtherSet <<")");
2069  DoAssign(rOtherSet);
2070 }
2071 
2072 
2073 // TaTransSet(othertransrel)
2074 TEMP THIS::TaTransSet(const BASE& rOtherSet) :
2075  BASE(),
2076  ABASE(this)
2077 {
2078  FD_DC("TaTransSet(" << this << ")::TaTransSet(rOtherSet "<< &rOtherSet <<")");
2079  Assign(rOtherSet);
2080 }
2081 
2082 
2083 // copy to known same attributes
2084 TEMP void THIS::DoAssign(const THIS& rSourceSet) {
2085  // call base incl attributes
2086  BASE::DoAssign(rSourceSet);
2087 }
2088 
2089 // Relaxed Assign()
2090 TEMP THIS& THIS::Assign(const TBaseSet<Transition,TransSort::X1EvX2>& rSourceSet) {
2091  FD_DC("TaTransSet(" << this << ")::Assign([v] " << &rSourceSet<<")");
2092 #ifdef FAUDES_CHECKED
2093  FD_DC("TaTransSet(" << this << ")::Assign(): src at " << &rSourceSet);
2094  FD_DC("TaTransSet(" << this << ")::Assign(): src type " << typeid(rSourceSet).name());
2095  FD_DC("TaTransSet(" << this << ")::Assign(): dst type " << typeid(*this).name());
2096  const TransSet* tset = dynamic_cast<const TransSet*>(&rSourceSet);
2097  if(!tset) {
2098  std::stringstream errstr;
2099  errstr << "cannot cast " << typeid(rSourceSet).name() << " to TransSet" << std::endl;
2100  throw Exception("TaTransSet::Assign", errstr.str(), 67);
2101  }
2102 #endif
2103  // call attribute smart base
2104  ABASE::AssignWithAttributes(rSourceSet);
2105  // done
2106  return *this;
2107 }
2108 
2109 
2110 // Insert(transition)
2111 TEMP bool THIS::Insert(const Transition& t) {
2112  FD_DC("TaTransSet(" << this << ")::Insert(" << t.Str() << ")");
2113  return ABASE::Insert(t);
2114 }
2115 
2116 // Insert(x1,ev,x2)
2117 TEMP bool THIS::Insert(Idx x1, Idx ev, Idx x2) {
2118  FD_DC("TaTransSet(" << this << ")::Insert(" << x1 << "-" << ev << "-" << x2 << ")");
2119  Transition t(x1, ev, x2);
2120  return ABASE::Insert(t);
2121 }
2122 
2123 // Insert(transition,attr)
2124 TEMP bool THIS::Insert(const Transition& t, const Attr& attr) {
2125  return ABASE::Insert(t,attr);
2126 }
2127 
2128 
2129 // InsertSet(set)
2130 TEMP void THIS::InsertSet(const TransSet& rOtherSet) {
2131  FD_DC("TaTransSet(" << this << ")::InsertSet( [a] " << &rOtherSet << ")");
2132  ABASE::InsertSet(rOtherSet);
2133 }
2134 
2135 // InsertSet(set)
2136 TEMP void THIS::InsertSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
2137 #ifdef FAUDES_CHECKED
2138  FD_DC("TaTransSet(" << this << ")::InsertSet(" << rOtherSet.ToString() << ")");
2139  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
2140  if(!tset) {
2141  std::stringstream errstr;
2142  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2143  throw Exception("TaTransSet::InsertSet", errstr.str(), 67);
2144  }
2145 #endif
2146  ABASE::InsertSet(rOtherSet);
2147 }
2148 
2149 
2150 // Erase(transition)
2151 TEMP bool THIS::Erase(const Transition& t) {
2152  return ABASE::Erase(t);
2153 }
2154 
2155 // Erase(x1,ev,x2)
2156 TEMP bool THIS::Erase(Idx x1, Idx ev, Idx x2) {
2157  FD_DC("TaTransSet(" << this << ")::Erase(" << x1 << "-" << ev << "-" << x2 << ")");
2158  Transition t(x1, ev, x2);
2159  return ABASE::Erase(t);
2160 }
2161 
2162 // Erase(it)
2163 TEMP typename THIS::Iterator THIS::Erase(const Iterator& it) {
2164 #ifdef FAUDES_CHECKED
2165  if (it == End()) {
2166  std::stringstream errstr;
2167  errstr << "iterator out of range " << std::endl;
2168  throw Exception("TTransSet::Erase", errstr.str(), 69);
2169  }
2170 #endif
2171  return ABASE::Erase(it);
2172 }
2173 
2174 // EraseSet(set)
2175 TEMP void THIS::EraseSet(const TransSet& rOtherSet) {
2176  FD_DC("TaTransSet(" << this << ")::RestrictSet( [a] " << &rOtherSet << ")");
2177  ABASE::EraseSet(rOtherSet);
2178 }
2179 
2180 // EraseSet(set)
2181 TEMP void THIS::EraseSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
2182 #ifdef FAUDES_CHECKED
2183  FD_DC("TaTransSet(" << this << ")::EraseSet(" << rOtherSet.ToString() << ")");
2184  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
2185  if(!tset) {
2186  std::stringstream errstr;
2187  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2188  throw Exception("TaTransSet::EraseSet", errstr.str(), 67);
2189  }
2190 #endif
2191  ABASE::EraseSet(rOtherSet);
2192 }
2193 
2194 // RestrictSet(set)
2195 TEMP void THIS::RestrictSet(const TransSet& rOtherSet) {
2196  FD_DC("TaTransSet(" << this << ")::RestrictSet( [a] " << &rOtherSet << ")");
2197  ABASE::RestrictSet(rOtherSet);
2198 }
2199 
2200 
2201 // RestrictSet(set)
2202 TEMP void THIS::RestrictSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
2203 #ifdef FAUDES_CHECKED
2204  FD_DC("TaTransSet(" << this << ")::RestrictSet(" << rOtherSet.ToString() << ")");
2205  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
2206  if(!tset) {
2207  std::stringstream errstr;
2208  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2209  throw Exception("TaTransSet::RestrictSet", errstr.str(), 67);
2210  }
2211 #endif
2212  ABASE::RestrictSet(rOtherSet);
2213 }
2214 
2215 
2216 
2217 #undef THIS
2218 #undef TEMP
2219 #undef BASE
2220 #undef ABASE
2221 
2222 #undef SORT_EXECPTION
2223 
2224 } // namespace faudes
2225 
2226 
2227 
2228 
2229 #endif
2230 
Class TAttrMap.
Class TBaseSet.
#define FD_DC(message)
Classes IndexSet, TaIndexSet.
Classes NameSet, TaNameSet.
#define FAUDES_API
Definition: cfl_platform.h:85
#define FAUDES_TAPI
Definition: cfl_platform.h:88
Class TokenReader.
#define TEMP
#define BASE
#define SORT_EXCEPTION
#define ABASE
#define THIS
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
Definition: cfl_types.h:879
#define FAUDES_TYPE_TIMPLEMENTATION(ftype, ctype, cbase, ctemp)
Definition: cfl_types.h:984
bool Exists(const Idx &rIndex) const
SymbolTable * SymbolTablep(void) const
bool Insert(const Idx &rIndex)
const Attr & Attribute(const T &rElem) const
Definition: cfl_attrmap.h:463
Attr * Attributep(const T &rElem)
Definition: cfl_attrmap.h:445
void AttributeTry(const T &rElem, const Type &attr)
Definition: cfl_attrmap.h:498
const Attr * AttributeType(void) const
Definition: cfl_attrmap.h:437
StateSet PredecessorStates(Idx x2) const
Iterator EndByEvX2(Idx ev, Idx x2) const
Iterator Begin(void) const
Iterator End(void) const
bool ExistsByX1OrX2(Idx x) const
bool Insert(Idx x1, Idx ev, Idx x2)
Iterator Find(Idx x1, Idx ev, Idx x2) const
void EraseByEv(Idx ev)
bool Erase(Idx x1, Idx ev, Idx x2)
Iterator Find(const Transition &t) const
Iterator BeginByX2Ev(Idx x2, Idx ev) const
Iterator Begin(Idx x1) const
void EraseByX1(Idx x1)
virtual void DoWrite(TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
EventSet ActiveEvents(Idx x1, SymbolTable *pSymTab=NULL) const
Iterator Begin(Idx x1, Idx ev) const
StateSet SuccessorStates(const StateSet &rX1Set) const
TTransSet(const TTransSet< Cmp > &rOtherSet)
virtual std::string Str(void) const
StateSet PredecessorStates(const StateSet &rX2Set) const
bool Exists(const Transition &t) const
void EraseByX2(Idx x2)
Iterator BeginByEvX1(Idx ev, Idx x1) const
Iterator End(Idx x1, Idx ev) const
StateSet SuccessorStates(Idx x1, Idx ev) const
void RestrictStates(const StateSet &rStateSet)
Iterator EndByEv(Idx ev) const
Iterator EndByEvX1(Idx ev, Idx x1) const
Iterator EndByX2Ev(Idx x2, Idx ev) const
StateSet States(void) const
Iterator BeginByX2(Idx x2) const
TTransSet(const TTransSet< OtherCmp > &res)
void EraseByX1Ev(Idx x1, Idx ev)
Iterator BeginByEv(Idx ev) const
bool Insert(const Transition &rTransition)
Iterator EndByX2(Idx x2) const
bool ExistsByX1Ev(Idx x1, Idx ev) const
Iterator Inject(const Iterator &pos, const Transition &rTransition)
bool Exists(Idx x1, Idx ev, Idx x2) const
Iterator Erase(const Iterator &it)
void DoAssign(const TTransSet &rSource)
virtual ~TTransSet()
Definition: cfl_transset.h:273
void Inject(const Transition &rTransition)
bool Erase(const Transition &t)
StateSet SuccessorStates(Idx x1) const
void EraseByX1OrX2(const StateSet &rStates)
void RestrictEvents(const EventSet &rEventSet)
void EraseByX1OrX2(Idx x)
TBaseSet< Transition, Cmp >::Iterator Iterator
Definition: cfl_transset.h:273
StateSet PredecessorStates(Idx x2, Idx ev) const
Iterator End(Idx x1) const
StateSet SuccessorStates(const StateSet &rX1Set, const EventSet &rEvSet) const
virtual std::string Str(const Transition &rTrans) const
void ReSort(TTransSet< OtherCmp > &res) const
StateSet PredecessorStates(const StateSet &rX2Set, const EventSet &rEvSet) const
bool ExistsByX1(Idx x1) const
Iterator BeginByEvX2(Idx ev, Idx x2) const
virtual TaTransSet & Assign(const TBaseSet< Transition, TransSort::X1EvX2 > &rSrc)
virtual TaTransSet & operator=(const TransSet &rSrc)
Attr * Attributep(const Transition &rElem)
TTransSet< TransSort::X1EvX2 >::Iterator Iterator
void DoAssign(const TaTransSet &rSource)
void AttributeTry(const Transition &rElem, const Type &rAttr)
void Attribute(const Transition &rElem, const Attr &rAttr)
const Attr * AttributeType(void) const
void Attribute(const Transition &rElem, const Type &rAttr)
const Attr & Attribute(const Transition &rElem) const
void WriteEnd(const std::string &rLabel)
int Columns(void) const
void WriteBegin(const std::string &rLabel)
Transition(Idx x1, Idx ev, Idx x2)
Definition: cfl_transset.h:73
bool Valid(void) const
Definition: cfl_transset.h:97
std::string Str(void) const
Definition: cfl_transset.h:111
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const
Definition: cfl_types.cpp:175
virtual Type & Assign(const Type &rSrc)
Definition: cfl_types.cpp:82
TTransSet< TransSort::EvX2X1 > TransSetEvX2X1
TTransSet< TransSort::X1EvX2 > TransSetX1EvX2
bool Empty(void) const
Definition: cfl_baseset.h:1904
bool Exists(const T &rElem) const
Definition: cfl_baseset.h:2322
virtual void Clear(void)
Definition: cfl_baseset.h:2104
TTransSet< TransSort::X1EvX2 > TransSet
TTransSet< TransSort::X2EvX1 > TransSetX2EvX1
Iterator End(void) const
Definition: cfl_baseset.h:2098
TTransSet< TransSort::X1X2Ev > TransSetX1X2Ev
virtual void RestrictSet(const TBaseSet &rOtherSet)
Definition: cfl_baseset.h:2271
virtual void InsertSet(const TBaseSet &rOtherSet)
Definition: cfl_baseset.h:2194
Iterator Begin(void) const
Definition: cfl_baseset.h:2093
TTransSet< TransSort::EvX1X2 > TransSetEvX1X2
TTransSet< TransSort::X2X1Ev > TransSetX2X1Ev
virtual void EraseSet(const TBaseSet &rOtherSet)
Definition: cfl_baseset.h:2249
Idx Size(void) const
Definition: cfl_baseset.h:1899
uint32_t Idx
void ApplyRelabelMap(const RelabelMap &rMap, const vGenerator &rGen, vGenerator &rRes)
std::string ToStringInteger(Int number)
Definition: cfl_utils.cpp:43

libFAUDES 2.33l --- 2025.09.16 --- c++ api documentaion by doxygen