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  std::string Str(const Transition& rTrans) const;
975 
976 
977  /** @} doxygen group */
978 
979  protected:
980 
981 
982  /**
983  * Assign my members.
984  *
985  * @param rSource
986  * Source to copy from
987  */
988  void DoAssign(const TTransSet& rSource);
989 
990  /**
991  * Write to TokenWriter, see Type::Write for public wrappers.
992  *
993  * @param rTw
994  * Reference to TokenWriter
995  * @param rLabel
996  * Label of section to write, defaults to name of set
997  * @param pContext
998  * Write context eg symboltables
999  *
1000  * @exception Exception
1001  * - IO errors (id 2)
1002  */
1003 
1004  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
1005 
1006 
1007 };
1008 
1009 /** Type definition for default sorted TTransSet */
1011 
1012 /** Type definition for default sorted TTransSet */
1014 
1015 /** Type definition for ev, x1, x2 sorted TTransSet */
1017 
1018 /** Type definition for ev, x2, x1 sorted TTransSet */
1020 
1021 /** Type definition for x2, ev, x1 sorted TTransSet */
1023 
1024 /** Type definition for x2, x1, ev sorted TTransSet */
1026 
1027 /** Type definition for x1, x2, ev sorted TTransSet */
1029 
1030 
1031 /**
1032  * Set of Transitions with attributes.
1033  *
1034  * This container class is derived from TTransSet to provide attributes as an
1035  * additional feature. The template parameter specifies the attribute class,
1036  * which in turn must provide some basic funtionality. In contrast to the TTransSet, the TaTransSet
1037  * is restricted to standard ordering.
1038  *
1039  * Note that it is the context of a Generator that
1040  * actually allows to interpret a TaTransSet as a set of transitions as opposed to
1041  * a set of triples of indices with attributes. In particular, file IO of transitions is provided
1042  * by the generator class (although TaTransSet provides output functions for debugging)
1043  */
1044 
1045 
1046 template <class Attr>
1047 class FAUDES_TAPI TaTransSet : public TransSet, public TAttrMap<Transition,Attr,TransSort::X1EvX2> {
1048 
1050 
1051 public:
1052 
1053  using TransSet::operator=;
1054  using TransSet::operator==;
1055  using TransSet::operator!=;
1056 
1057 
1058  /** @name Constructors & Destructor */
1059  /** @{ doxygen group */
1060 
1061  /** Construct an empty TaTransSet object */
1062  TaTransSet(void);
1063 
1064  /**
1065  * Copy-constructor (incl attributes)
1066  */
1067  TaTransSet(const TaTransSet& rOtherSet);
1068 
1069  /**
1070  * Copy-Constructor (set attributes to default)
1071  */
1072  TaTransSet(const TTransSet<TransSort::X1EvX2>& rOtherSet);
1073 
1074  /** Virtual destructor */
1075  virtual ~TaTransSet() {}
1076 
1077  /** Relaxed assignment method.
1078  *
1079  * Runtime typecheck for TransSet, maintains attributes provided they can be casted.
1080  *
1081  * @param rSrc
1082  * Source from which to assign
1083  * @return
1084  * Ref to this set
1085  */
1086  virtual TaTransSet& Assign(const TBaseSet<Transition,TransSort::X1EvX2>& rSrc);
1087 
1088  /** Relaxed assignment operator.
1089  *
1090  * @param rSrc
1091  * Source from which to assign
1092  * @return
1093  * Ref to this set
1094  */
1095  virtual TaTransSet& operator=(const TransSet& rSrc) {return Assign(rSrc);}
1096 
1097  /** @} doxygen group */
1098 
1099 
1100 
1101  /** @name Accessing individual transitions */
1102  /** @{ doxygen group */
1103 
1104  /** Iterator on transition */
1106 
1107  /**
1108  * Add a Transition by indices
1109  *
1110  * @param x1
1111  * Predecessor state
1112  * @param ev
1113  * Event
1114  * @param x2
1115  * Successor state
1116  *
1117  * @return
1118  * True if the transition was new to the set
1119  */
1120  bool Insert(Idx x1, Idx ev, Idx x2);
1121 
1122  /**
1123  * Add a Transition directly. If the transition already
1124  * exists, the attribute is maintained. Otherwise, the transition
1125  * is inserted with default attribute.
1126  *
1127  * @param rTransition
1128  * Reference to transition object
1129  *
1130  * @return
1131  * True if the transition was new to the set
1132  */
1133  bool Insert(const Transition& rTransition);
1134 
1135  /**
1136  * Add a Transition with attribute.
1137  *
1138  * @param rTransition
1139  * Reference to transition object
1140  * @param rAttr
1141  * Reference to attribute
1142  *
1143  * @return
1144  * True if the transition was new to the set
1145  */
1146  bool Insert(const Transition& rTransition, const Attr& rAttr);
1147 
1148  /**
1149  * Inserts elements of rOtherSet.
1150  *
1151  * Attributes of this set are maintained, newly inserted elements attain the
1152  * attribute from rOtherSet if it can be casted appropriately.
1153  *
1154  *
1155  * @param rOtherSet
1156  * Other IndexSet
1157  */
1158  virtual void InsertSet(const TransSet& rOtherSet);
1159 
1160  /**
1161  * Inserts elements of rOtherSet.
1162  *
1163  * This variant uses a runtime cast to access attributes.
1164  *
1165  * @param rOtherSet
1166  * Other IndexSet
1167  * @exception Exception
1168  * - cast failed (id 67)
1169  */
1170  virtual void InsertSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1171 
1172  /**
1173  * Remove a Transition
1174  *
1175  * @return
1176  * True if transition did exist
1177  */
1178  bool Erase(const Transition& t);
1179 
1180  /**
1181  * Remove a Transition
1182  *
1183  * @return
1184  * True if transition did exist
1185  */
1186  bool Erase(Idx x1, Idx ev, Idx x2);
1187 
1188  /**
1189  * Remove a Transition by iterator
1190  *
1191  * @return
1192  * Iterator to next transition
1193  */
1194  Iterator Erase(const Iterator& it);
1195 
1196  /**
1197  * Inserts elements of rOtherSet.
1198  *
1199  * Attributes of this set are maintained.
1200  *
1201  *
1202  * @param rOtherSet
1203  * Other IndexSet
1204  */
1205  virtual void EraseSet(const TransSet& rOtherSet);
1206 
1207  /**
1208  * Inserts elements of rOtherSet.
1209  *
1210  * This variant uses a runtime cast to access attributes.
1211  *
1212  * @param rOtherSet
1213  * Other IndexSet
1214  * @exception Exception
1215  * - cast failed (id 67)
1216  */
1217  virtual void EraseSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1218 
1219 
1220  /**
1221  * Restrict to specified subset.
1222  *
1223  * Erases any elements no in the specified set. This function
1224  * ignores the attributes of the other set and maintains the attributes
1225  * of the remaining elements in this set.
1226  *
1227  * @param rOtherSet
1228  * Elements to erase
1229  */
1230  void RestrictSet(const TransSet& rOtherSet);
1231 
1232 
1233  /**
1234  * Restrict to specified subset.
1235  *
1236  * This variant uses a runtime cast to access attributes.
1237  *
1238  * @param rOtherSet
1239  * Elements to erase
1240  */
1241  void RestrictSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1242 
1243 
1244 
1245 
1246  /** resolve ambiguities from attribute interface ("using" wont do the job) */
1249  const Attr& Attribute(const Transition& rElem) const { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem); };
1250  void Attribute(const Transition& rElem, const Attr& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem,rAttr); };
1251  void Attribute(const Transition& rElem, const Type& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem,rAttr); };
1252  void AttributeTry(const Transition& rElem, const Type& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::AttributeTry(rElem,rAttr); };
1253 
1254 
1255  /** @} doxygen group */
1256 
1257 
1258  protected:
1259 
1260  /**
1261  * Assign my members. Maintain attributes.
1262  *
1263  * @param rSource
1264  * Source to copy from
1265  */
1266  void DoAssign(const TaTransSet& rSource);
1267 
1268 };
1269 
1270 /** @} doxygen group*/
1271 
1272 
1273 /*
1274 *************************************************************************************************
1275 *************************************************************************************************
1276 * Implementation of transset without attributes
1277 *************************************************************************************************
1278 *************************************************************************************************
1279 */
1280 
1281 
1282 /* convenience access to relevant scopes */
1283 #define THIS TTransSet<Cmp>
1284 #define TEMP template<class Cmp>
1285 #define BASE TBaseSet<Transition,Cmp>
1286 
1287 // std faudes type
1289 
1290 // TTransSet(void)
1292 {
1293  FD_DC("TTransSet(" << this << ")::TTransSet()");
1294 }
1295 
1296 // TTransSet(othertransrel)
1297 //TEMP THIS::TTransSet(const TBaseSet<Transition,Cmp>& rOtherSet) :
1298  TEMP THIS::TTransSet(const TTransSet<Cmp>& rOtherSet) :
1299  BASE()
1300 {
1301  FD_DC("TTransSet(" << this << ")::TTransSet(rOtherSet "<< &rOtherSet <<")");
1302  Assign(rOtherSet);
1303 }
1304 
1305 // TTransSet(othertransrel othersort)
1306 TEMP template<class OtherCmp>
1307 THIS::TTransSet(const TTransSet<OtherCmp>& rOtherSet) :
1308  BASE()
1309 {
1310  FD_DC("TTransSet(" << this << ")::TTransSet(rOtherSet/ReSort "<< &rOtherSet <<")");
1311  rOtherSet.ReSort(*this);
1312 }
1313 
1314 // assignment (maintain attributes)
1315 TEMP void THIS::DoAssign(const TTransSet& rSourceSet) {
1316  FD_DC("TTransSet(" << this << ")::DoAssign(..)");
1317  // call base (incl attributes if the have identival type)
1318  BASE::DoAssign(rSourceSet);
1319 }
1320 
1321 // iterator Begin() const
1322 TEMP typename THIS::Iterator THIS::Begin(void) const {
1323  return BASE::Begin();
1324 }
1325 
1326 // iterator End() const
1327 TEMP typename THIS::Iterator THIS::End(void) const {
1328  return BASE::End();
1329 }
1330 
1331 
1332 // Convenience macro for order typecheck
1333 #define SORT_EXCEPTION { std::stringstream errstr; \
1334  errstr << "Transition set order mismatch " << std::endl; \
1335  throw Exception("TransSet::Iterator()", errstr.str(), 68); }
1336 
1337 
1338 // iterator Begin(x1) const
1339 TEMP typename THIS::Iterator THIS::Begin(Idx x1) const {
1340 #ifdef FAUDES_CHECKED
1341  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1342  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1344 #endif
1345  Transition tlx(x1,0,0);
1346  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1347 }
1348 
1349 // iterator End(x1) const
1350 TEMP typename THIS::Iterator THIS::End(Idx x1) const {
1351 #ifdef FAUDES_CHECKED
1352  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1353  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1355 #endif
1356  Transition tlx(x1+1,0,0);
1357  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1358 }
1359 
1360 // iterator Begin(x1,ev) const
1361 TEMP typename THIS::Iterator THIS::Begin(Idx x1, Idx ev) const {
1362 #ifdef FAUDES_CHECKED
1363  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1365 #endif
1366  Transition tlx(x1,ev,0);
1367  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1368 }
1369 
1370 // iterator End(x1,ev) const
1371 TEMP typename THIS::Iterator THIS::End(Idx x1, Idx ev) const {
1372 #ifdef FAUDES_CHECKED
1373  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1375 #endif
1376  Transition tlx(x1,ev+1, 0);
1377  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1378 }
1379 
1380 // iterator BeginByEv(ev) const
1381 TEMP typename THIS::Iterator THIS::BeginByEv(Idx ev) const {
1382 #ifdef FAUDES_CHECKED
1383  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1384  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1386 #endif
1387  Transition tlx(0,ev,0);
1388  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1389 }
1390 
1391 // iterator EndByEv(ev) const
1392 TEMP typename THIS::Iterator THIS::EndByEv(Idx ev) const {
1393 #ifdef FAUDES_CHECKED
1394  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1395  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1397 #endif
1398  Transition tlx(0,ev+1,0);
1399  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1400 }
1401 
1402 // iterator BeginByEvX1(ev,x1) const
1403 TEMP typename THIS::Iterator THIS::BeginByEvX1(Idx ev, Idx x1) const {
1404 #ifdef FAUDES_CHECKED
1405  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1407 #endif
1408  Transition tlx(x1,ev,0);
1409  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1410 }
1411 
1412 // iterator EndByEvX1(ev,x1) const
1413 TEMP typename THIS::Iterator THIS::EndByEvX1(Idx ev, Idx x1) const {
1414 #ifdef FAUDES_CHECKED
1415  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1417 #endif
1418  Transition tlx(x1+1,ev,0);
1419  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1420 }
1421 
1422 // iterator BeginByEvX2(ev,x2) const
1423 TEMP typename THIS::Iterator THIS::BeginByEvX2(Idx ev, Idx x2) const {
1424 #ifdef FAUDES_CHECKED
1425  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1427 #endif
1428  Transition tlx(0,ev,x2);
1429  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1430 }
1431 
1432 // iterator EndByEvX2(ev,x2) const
1433 TEMP typename THIS::Iterator THIS::EndByEvX2(Idx ev, Idx x2) const {
1434 #ifdef FAUDES_CHECKED
1435  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1437 #endif
1438  Transition tlx(0,ev,x2+1);
1439  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1440 }
1441 
1442 // iterator BeginByX2(x2) const
1443 TEMP typename THIS::Iterator THIS::BeginByX2(Idx x2) const {
1444 #ifdef FAUDES_CHECKED
1445  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1446  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1448 #endif
1449  Transition tlx(0,0,x2);
1450  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1451 }
1452 
1453 // iterator EndByX2(x2) const
1454 TEMP typename THIS::Iterator THIS::EndByX2(Idx x2) const {
1455 #ifdef FAUDES_CHECKED
1456  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1457  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1459 #endif
1460  Transition tlx(0,0,x2+1);
1461  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1462 }
1463 
1464 // iterator BeginByX2Ev(x2,ev) const
1465 TEMP typename THIS::Iterator THIS::BeginByX2Ev(Idx x2, Idx ev) const {
1466 #ifdef FAUDES_CHECKED
1467  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1469 #endif
1470  Transition tlx(0,ev,x2);
1471  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1472 }
1473 
1474 // iterator EndByX2Ev(x2,ev) const
1475 TEMP typename THIS::Iterator THIS::EndByX2Ev(Idx x2, Idx ev) const {
1476 #ifdef FAUDES_CHECKED
1477  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1479 #endif
1480  Transition tlx(0,ev+1,x2);
1481  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1482 }
1483 
1484 // operator+
1485 TEMP THIS THIS::operator+ (const TTransSet<Cmp>& rOtherSet) const {
1486  TTransSet<Cmp> res(*this);
1487  res.InsertSet(rOtherSet);
1488  return res;
1489 }
1490 
1491 // operator-
1492 TEMP THIS THIS::operator- (const TTransSet<Cmp>& rOtherSet) const {
1493  TTransSet<Cmp> res(*this);
1494  res.EraseSet(rOtherSet);
1495  return res;
1496 }
1497 
1498 
1499 // operator*
1500 TEMP TTransSet<Cmp> THIS::operator* (const TTransSet<Cmp>& rOtherSet) const {
1501  TTransSet<Cmp> res(*this);
1502  res.RestrictSet(rOtherSet);
1503  return res;
1504 }
1505 
1506 
1507 // DoWrite(rw,label)
1508 TEMP void THIS::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const
1509 {
1510  (void) pContext;
1511  std::string label=rLabel;
1512  if(label=="") label=BASE::Name();
1513  rTw.WriteBegin(label);
1514  int oldcolumns = rTw.Columns();
1515  rTw.Columns(3);
1516 
1517  Iterator tit;
1518  for (tit = Begin(); tit != End(); ++tit) {
1519  rTw << tit->X1; rTw << tit->Ev; rTw << tit->X2;
1520  }
1521 
1522  rTw.WriteEnd(label);
1523  rTw.Columns(oldcolumns);
1524 }
1525 
1526 
1527 // Insert(transition)
1528 TEMP bool THIS::Insert(const Transition& t) {
1529  return BASE::Insert(t);
1530 }
1531 
1532 // Insert(x1,ev,x2)
1533 TEMP bool THIS::Insert(Idx x1, Idx ev, Idx x2) {
1534  FD_DC("TTransSet(" << this << ")::Insert(" << x1 << "-" << ev << "-" << x2 << ")");
1535  return BASE::Insert(Transition(x1, ev, x2));
1536 }
1537 
1538 // Inject(transition)
1539 TEMP typename THIS::Iterator THIS::Inject(const Iterator& pos, const Transition& t) {
1540  return BASE::Inject(pos,t);
1541 }
1542 
1543 // Inject(transition)
1544 TEMP void THIS::Inject(const Transition& t) {
1545  BASE::Inject(t);
1546 }
1547 
1548 
1549 // Erase(transition)
1550 TEMP bool THIS::Erase(const Transition& t) {
1551  FD_DC("TTransSet(" << this << ")::Erase(" << t.Str() << " [t])");
1552  return BASE::Erase(t);
1553 }
1554 
1555 // Erase(x1,ev,x2)
1556 TEMP bool THIS::Erase(Idx x1, Idx ev, Idx x2) {
1557  FD_DC("TTransSet(" << this << ")::Erase(" << x1 << "-" << ev << "-" << x2 << ")");
1558  return BASE::Erase(Transition(x1, ev, x2));
1559 }
1560 
1561 // Erase(it)
1562 TEMP typename THIS::Iterator THIS::Erase(const Iterator& it) {
1563  FD_DC("TTransSet(" << this << ")::Erase(" << this->Str(*it) << " [it])");
1564  return BASE::Erase(it);
1565 }
1566 
1567 // EraseByX1(x)
1568 TEMP void THIS::EraseByX1(Idx x1) {
1569  FD_DC("TTransSet(" << this << ")::EraseByX1(" << x1 << ")");
1570 #ifdef FAUDES_CHECKED
1571  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1572  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1574 #endif
1575  this->Detach();
1576  typename BASE::iterator lower, upper, it;
1577  Transition tl(x1,0,0);
1578  Transition tu(x1+1,0,0);
1579  lower = BASE::pSet->lower_bound(tl);
1580  upper = BASE::pSet->upper_bound(tu);
1581  if(this->AttributesSize()!=0)
1582  for(it=lower; it!=upper; ++it)
1583  BASE::ClrAttribute(*it);
1584  BASE::pSet->erase(lower, upper);
1585 }
1586 
1587 // EraseByX1Ev(x,e)
1588 TEMP void THIS::EraseByX1Ev(Idx x1, Idx ev) {
1589  FD_DC("TTransSet(" << this << ")::EraseByX1Ev(" << x1 << "," << ev << ")");
1590 #ifdef FAUDES_CHECKED
1591  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1593 #endif
1594  this->Detach();
1595  typename BASE::iterator lower, upper, it;
1596  Transition tl(x1,ev,0);
1597  Transition tu(x1,ev+1,0);
1598  lower = BASE::pSet->lower_bound(tl);
1599  upper = BASE::pSet->upper_bound(tu);
1600  if(this->AttributesSize()!=0)
1601  for(it=lower; it!=upper; ++it)
1602  BASE::ClrAttribute(*it);
1603  BASE::pSet->erase(lower, upper);
1604 }
1605 
1606 // EraseByX2(x)
1607 TEMP void THIS::EraseByX2(Idx x2) {
1608  FD_DC("TTransSet(" << this << ")::EraseByX2(" << x2 << ")");
1609  this->Detach();
1610  bool doattr = (this->AttributesSize()!=0);
1611  typename BASE::iterator it;
1612  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1613  if(it->X2 == x2) {
1614  if(doattr) BASE::ClrAttribute(*it);
1615  BASE::pSet->erase(it++);
1616  continue;
1617  }
1618  it++;
1619  }
1620 }
1621 
1622 // EraseByEv(ev)
1623 TEMP void THIS::EraseByEv(Idx ev) {
1624  FD_DC("TTransSet(" << this << ")::EraseByEv(" << ev << ")");
1625  this->Detach();
1626  bool doattr = (this->AttributesSize()!=0);
1627  typename BASE::iterator it;
1628  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1629  if (it->Ev == ev) {
1630  if(doattr) BASE::ClrAttribute(*it);
1631  BASE::pSet->erase(it++);
1632  continue;
1633  }
1634  it++;
1635  }
1636 }
1637 
1638 
1639 // EraseByX1OrX2(x)
1640 TEMP void THIS::EraseByX1OrX2(Idx x) {
1641  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(" << x << ")");
1642  this->Detach();
1643  bool doattr = (this->AttributesSize()!=0);
1644  typename BASE::iterator it;
1645  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1646  if ((it->X1 == x) || (it->X2 == x)) {
1647  if(doattr) BASE::ClrAttribute(*it);
1648  BASE::pSet->erase(it++);
1649  continue;
1650  }
1651  it++;
1652  }
1653  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(" << x << "): done");
1654 }
1655 
1656 
1657 // EraseByX1OrX2(xset)
1658 TEMP void THIS::EraseByX1OrX2(const StateSet& rStates) {
1659  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(#" << rStates.Size() <<")");
1660  this->Detach();
1661  bool doattr = (this->AttributesSize()!=0);
1662  typename BASE::iterator it=BASE::pSet->begin();
1663  while(it != BASE::pSet->end()) {
1664  if(!rStates.Exists(it->X1) && !rStates.Exists(it->X2)) { ++it; continue;}
1665  if(doattr) BASE::ClrAttribute(*it);
1666  BASE::pSet->erase(it++);
1667  }
1668  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(): done");
1669 }
1670 
1671 
1672 // RestrictStates(xset)
1673 TEMP void THIS::RestrictStates(const StateSet& rStates) {
1674  FD_DC("TTransSet(" << this << ")::RestrictByX1AndX2(#" << rStates.Size() <<")");
1675  this->Detach();
1676  bool doattr = (this->AttributesSize()!=0);
1677  typename BASE::iterator it;
1678  it = BASE::pSet->begin();
1679  while(it != BASE::pSet->end()) {
1680  if(rStates.Exists(it->X1) && rStates.Exists(it->X2)) { ++it; continue;}
1681  if(doattr) BASE::ClrAttribute(*it);
1682  BASE::pSet->erase(it++);
1683  }
1684  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(): done");
1685 }
1686 
1687 
1688 // RestrictEvents(eset)
1689 TEMP void THIS::RestrictEvents(const EventSet& rEvents) {
1690  FD_DC("TTransSet(" << this << ")::RestrictEvents(#" << rEvents.Size() <<")");
1691  this->Detach();
1692  bool doattr = (this->AttributesSize()!=0);
1693  typename BASE::iterator it;
1694  it = BASE::pSet->begin();
1695  while(it != BASE::pSet->end()) {
1696  if(rEvents.Exists(it->Ev)) { ++it; continue;}
1697  if(doattr) BASE::ClrAttribute(*it);
1698  BASE::pSet->erase(it++);
1699  }
1700  FD_DC("TTransSet(" << this << ")::RestrictEvents(): done");
1701 }
1702 
1703 
1704 // iterator Find(x1,ev,x2)
1705 TEMP typename THIS::Iterator THIS::Find(Idx x1, Idx ev, Idx x2) const {
1706  return BASE::Find(Transition(x1,ev,x2));
1707 }
1708 
1709 
1710 // iterator Find(t)
1711 TEMP typename THIS::Iterator THIS::Find(const Transition& t) const{
1712  return BASE::Find(t);
1713 }
1714 
1715 // Exists(t)
1716 TEMP bool THIS::Exists(const Transition& t) const {
1717  return BASE::Exists(t);
1718 }
1719 
1720 // Exists(x1, ev, x2)
1721 TEMP bool THIS::Exists(Idx x1, Idx ev, Idx x2) const {
1722  return BASE::Exists(Transition(x1,ev,x2));
1723 }
1724 
1725 // Exists(x)
1726 TEMP bool THIS::ExistsByX1OrX2(Idx x) const {
1727  typename BASE::iterator it;
1728  for(it = BASE::pSet->begin(); it != BASE::pSet->end(); ++it) {
1729  if ((it->X1 == x) || (it->X2 == x)) {
1730  return true;
1731  }
1732  }
1733  return false;
1734 }
1735 
1736 // ExistsByX1Ev(x,e)
1737 TEMP bool THIS::ExistsByX1Ev(Idx x1, Idx ev) const {
1738  FD_DC("TTransSet(" << this << ")::ExistsByX1Ev(" << x1 << "," << ev << ")");
1739 #ifdef FAUDES_CHECKED
1740  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1742 #endif
1743  this->Detach();
1744  typename BASE::iterator lower, upper, it;
1745  Transition tl(x1,ev,0);
1746  Transition tu(x1,ev+1,0);
1747  lower = BASE::pSet->lower_bound(tl);
1748  upper = BASE::pSet->upper_bound(tu);
1749  return lower != upper;
1750 }
1751 
1752 // ExistsByX1(x)
1753 TEMP bool THIS::ExistsByX1(Idx x1) const {
1754  FD_DC("TTransSet(" << this << ")::ExistsByX1(" << x1 << ")");
1755 #ifdef FAUDES_CHECKED
1756  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1757  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1759 #endif
1760  this->Detach();
1761  typename BASE::iterator lower, upper, it;
1762  Transition tl(x1,0,0);
1763  Transition tu(x1+1,0,0);
1764  lower = BASE::pSet->lower_bound(tl);
1765  upper = BASE::pSet->upper_bound(tu);
1766  return lower != upper;
1767 }
1768 
1769 
1770 // ReSort(res)
1771 TEMP template<class OtherCmp>
1772 void THIS::ReSort(TTransSet<OtherCmp>& res) const {
1773  Iterator it;
1774  res.Clear();
1775  for (it = Begin(); it != End(); ++it) {
1776  res.Insert(*it);
1777  }
1778 }
1779 
1780 // States()
1781 TEMP StateSet THIS::States(void) const {
1782  StateSet states;
1783  Iterator it;
1784  for (it=Begin(); it!=End(); ++it) {
1785  states.Insert(it->X1);
1786  states.Insert(it->X2);
1787  }
1788  return states;
1789 }
1790 
1791 // SuccessorStates(x1)
1792 TEMP StateSet THIS::SuccessorStates(Idx x1) const {
1793 #ifdef FAUDES_CHECKED
1794  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1795  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1797 #endif
1798  StateSet states;
1799  Iterator it = Begin(x1);
1800  Iterator it_end = End(x1);
1801  while (it != it_end) {
1802  states.Insert(it->X2);
1803  ++it;
1804  }
1805  return states;
1806 }
1807 
1808 // SuccessorStates(x1set)
1809 TEMP StateSet THIS::SuccessorStates(const StateSet& rX1Set) const {
1810 #ifdef FAUDES_CHECKED
1811  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1812  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1814 #endif
1815  StateSet states;
1816  StateSet::Iterator sit= rX1Set.Begin();
1817  StateSet::Iterator sit_end= rX1Set.End();
1818  for(;sit!=sit_end; ++sit) {
1819  Iterator tit = Begin(*sit);
1820  Iterator tit_end = End(*sit);
1821  while(tit!=tit_end) {
1822  states.Insert(tit->X2);
1823  ++tit;
1824  }
1825  }
1826  return states;
1827 }
1828 
1829 // SuccessorStates(x1, ev)
1830 TEMP StateSet THIS::SuccessorStates(Idx x1, Idx ev) const {
1831 #ifdef FAUDES_CHECKED
1832  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1834 #endif
1835  StateSet states;
1836  Iterator it = Begin(x1, ev);
1837  Iterator it_end = End(x1, ev);
1838  while (it != it_end) {
1839  states.Insert(it->X2);
1840  ++it;
1841  }
1842  return states;
1843 }
1844 
1845 // SuccessorStates(x1set, evset)
1846 TEMP StateSet THIS::SuccessorStates(const StateSet& rX1Set, const EventSet& rEvSet) const {
1847 #ifdef FAUDES_CHECKED
1848  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1850 #endif
1851  StateSet states;
1852  if(rEvSet.Empty()) return states;
1853  StateSet::Iterator sit= rX1Set.Begin();
1854  StateSet::Iterator sit_end= rX1Set.End();
1855  for(;sit!=sit_end; ++sit) {
1856  EventSet::Iterator eit= rEvSet.Begin();
1857  EventSet::Iterator eit_end= rEvSet.End();
1858  Iterator tit = Begin(*sit,*eit);
1859  Iterator tit_end = End(*sit);
1860  while(tit!=tit_end) {
1861  // match
1862  if(tit->Ev == *eit) {
1863  states.Insert(tit->X2);
1864  ++tit;
1865  continue;
1866  }
1867  // tit behind
1868  if(tit->Ev < *eit) {
1869  ++tit;
1870  continue;
1871  }
1872  // tit upfront
1873  ++eit;
1874  if(eit==eit_end) break;
1875  }
1876  }
1877  return states;
1878 }
1879 
1880 // PredecessorStates(x2)
1881 TEMP StateSet THIS::PredecessorStates(Idx x2) const {
1882 #ifdef FAUDES_CHECKED
1883  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1884  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1886 #endif
1887  StateSet states;
1888  Iterator it = BeginByX2(x2);
1889  Iterator it_end = EndByX2(x2);
1890  while (it != it_end) {
1891  states.Insert(it->X1);
1892  ++it;
1893  }
1894  return states;
1895 }
1896 
1897 
1898 // PredecessorStates(x2set)
1899 TEMP StateSet THIS::PredecessorStates(const StateSet& rX2Set) const {
1900 #ifdef FAUDES_CHECKED
1901  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1902  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1904 #endif
1905  StateSet states;
1906  StateSet::Iterator sit= rX2Set.Begin();
1907  StateSet::Iterator sit_end= rX2Set.End();
1908  for(;sit!=sit_end; ++sit) {
1909  Iterator tit = BeginByX2(*sit);
1910  Iterator tit_end = EndByX2(*sit);
1911  while(tit!=tit_end) {
1912  states.Insert(tit->X1);
1913  ++tit;
1914  }
1915  }
1916  return states;
1917 }
1918 
1919 // PredecessorStates(x2, ev)
1920 TEMP StateSet THIS::PredecessorStates(Idx x2, Idx ev) const {
1921 #ifdef FAUDES_CHECKED
1922  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1924 #endif
1925  StateSet states;
1926  Iterator it = BeginByX2Ev(x2, ev);
1927  Iterator it_end = EndByX2Ev(x2, ev);
1928  while (it != it_end) {
1929  states.Insert(it->X1);
1930  ++it;
1931  }
1932  return states;
1933 }
1934 
1935 // PredecessorStates(x2set, evset)
1936 TEMP StateSet THIS::PredecessorStates(const StateSet& rX2Set, const EventSet& rEvSet) const {
1937 #ifdef FAUDES_CHECKED
1938  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1940 #endif
1941  StateSet states;
1942  if(rEvSet.Empty()) return states;
1943  StateSet::Iterator sit= rX2Set.Begin();
1944  StateSet::Iterator sit_end= rX2Set.End();
1945  for(;sit!=sit_end; ++sit) {
1946  EventSet::Iterator eit= rEvSet.Begin();
1947  EventSet::Iterator eit_end= rEvSet.End();
1948  Iterator tit = BeginByX2Ev(*sit,*eit);
1949  Iterator tit_end = EndByX2(*sit);
1950  while(tit!=tit_end) {
1951  // match
1952  if(tit->Ev == *eit) {
1953  states.Insert(tit->X1);
1954  ++tit;
1955  continue;
1956  }
1957  // tit behind
1958  if(tit->Ev < *eit) {
1959  ++tit;
1960  continue;
1961  }
1962  // tit upfront
1963  ++eit;
1964  if(eit==eit_end) break;
1965  }
1966  }
1967  return states;
1968 }
1969 
1970 
1971 // ActiveEvents(x1,pSymTab)
1972 TEMP EventSet THIS::ActiveEvents(Idx x1, SymbolTable* pSymTab) const {
1973  Iterator it = Begin(x1);
1974  Iterator it_end = End(x1);
1975  EventSet result;
1976  if(pSymTab!=NULL) result.SymbolTablep(pSymTab);
1977  for (; it != it_end; ++it) {
1978  result.Insert(it->Ev);
1979  }
1980  return result;
1981 }
1982 
1983 // Prettz printable sring
1984 TEMP std::string THIS::Str(const Transition& rTrans) const {
1985  return rTrans.Str();
1986 }
1987 
1988 
1989 
1990 #undef THIS
1991 #undef TEMP
1992 #undef BASE
1993 
1994 /*
1995 *************************************************************************************************
1996 *************************************************************************************************
1997 * Implementation of transset with attributes
1998 *************************************************************************************************
1999 *************************************************************************************************
2000 */
2001 
2002 
2003 /* convenience access to relevant scopes */
2004 #define THIS TaTransSet<Attr>
2005 #define TEMP template <class Attr>
2006 #define BASE TTransSet<TransSort::X1EvX2>
2007 #define ABASE TAttrMap<Transition,Attr,TransSort::X1EvX2>
2008 
2009 // std faudes type
2011 
2012 // TaTransSet(void)
2014  BASE(),
2015  ABASE(this)
2016 {
2017  FD_DC("TaTransSet(" << this << ")::TaTransSet()");
2018 }
2019 
2020 // TaTransSet(othertransrel)
2021 TEMP THIS::TaTransSet(const TaTransSet& rOtherSet) :
2022  BASE(),
2023  ABASE(this)
2024 {
2025  FD_DC("TaTransSet(" << this << ")::TaTransSet(rOtherSet "<< &rOtherSet <<")");
2026  DoAssign(rOtherSet);
2027 }
2028 
2029 
2030 // TaTransSet(othertransrel)
2031 TEMP THIS::TaTransSet(const BASE& rOtherSet) :
2032  BASE(),
2033  ABASE(this)
2034 {
2035  FD_DC("TaTransSet(" << this << ")::TaTransSet(rOtherSet "<< &rOtherSet <<")");
2036  Assign(rOtherSet);
2037 }
2038 
2039 
2040 // copy to known same attributes
2041 TEMP void THIS::DoAssign(const THIS& rSourceSet) {
2042  // call base incl attributes
2043  BASE::DoAssign(rSourceSet);
2044 }
2045 
2046 // Relaxed Assign()
2047 TEMP THIS& THIS::Assign(const TBaseSet<Transition,TransSort::X1EvX2>& rSourceSet) {
2048  FD_DC("TaTransSet(" << this << ")::Assign([v] " << &rSourceSet<<")");
2049 #ifdef FAUDES_CHECKED
2050  FD_DC("TaTransSet(" << this << ")::Assign(): src at " << &rSourceSet);
2051  FD_DC("TaTransSet(" << this << ")::Assign(): src type " << typeid(rSourceSet).name());
2052  FD_DC("TaTransSet(" << this << ")::Assign(): dst type " << typeid(*this).name());
2053  const TransSet* tset = dynamic_cast<const TransSet*>(&rSourceSet);
2054  if(!tset) {
2055  std::stringstream errstr;
2056  errstr << "cannot cast " << typeid(rSourceSet).name() << " to TransSet" << std::endl;
2057  throw Exception("TaTransSet::Assign", errstr.str(), 67);
2058  }
2059 #endif
2060  // call attribute smart base
2061  ABASE::AssignWithAttributes(rSourceSet);
2062  // done
2063  return *this;
2064 }
2065 
2066 
2067 // Insert(transition)
2068 TEMP bool THIS::Insert(const Transition& t) {
2069  FD_DC("TaTransSet(" << this << ")::Insert(" << t.Str() << ")");
2070  return ABASE::Insert(t);
2071 }
2072 
2073 // Insert(x1,ev,x2)
2074 TEMP bool THIS::Insert(Idx x1, Idx ev, Idx x2) {
2075  FD_DC("TaTransSet(" << this << ")::Insert(" << x1 << "-" << ev << "-" << x2 << ")");
2076  Transition t(x1, ev, x2);
2077  return ABASE::Insert(t);
2078 }
2079 
2080 // Insert(transition,attr)
2081 TEMP bool THIS::Insert(const Transition& t, const Attr& attr) {
2082  return ABASE::Insert(t,attr);
2083 }
2084 
2085 
2086 // InsertSet(set)
2087 TEMP void THIS::InsertSet(const TransSet& rOtherSet) {
2088  FD_DC("TaTransSet(" << this << ")::InsertSet( [a] " << &rOtherSet << ")");
2089  ABASE::InsertSet(rOtherSet);
2090 }
2091 
2092 // InsertSet(set)
2093 TEMP void THIS::InsertSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
2094 #ifdef FAUDES_CHECKED
2095  FD_DC("TaTransSet(" << this << ")::InsertSet(" << rOtherSet.ToString() << ")");
2096  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
2097  if(!tset) {
2098  std::stringstream errstr;
2099  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2100  throw Exception("TaTransSet::InsertSet", errstr.str(), 67);
2101  }
2102 #endif
2103  ABASE::InsertSet(rOtherSet);
2104 }
2105 
2106 
2107 // Erase(transition)
2108 TEMP bool THIS::Erase(const Transition& t) {
2109  return ABASE::Erase(t);
2110 }
2111 
2112 // Erase(x1,ev,x2)
2113 TEMP bool THIS::Erase(Idx x1, Idx ev, Idx x2) {
2114  FD_DC("TaTransSet(" << this << ")::Erase(" << x1 << "-" << ev << "-" << x2 << ")");
2115  Transition t(x1, ev, x2);
2116  return ABASE::Erase(t);
2117 }
2118 
2119 // Erase(it)
2120 TEMP typename THIS::Iterator THIS::Erase(const Iterator& it) {
2121 #ifdef FAUDES_CHECKED
2122  if (it == End()) {
2123  std::stringstream errstr;
2124  errstr << "iterator out of range " << std::endl;
2125  throw Exception("TTransSet::Erase", errstr.str(), 69);
2126  }
2127 #endif
2128  return ABASE::Erase(it);
2129 }
2130 
2131 // EraseSet(set)
2132 TEMP void THIS::EraseSet(const TransSet& rOtherSet) {
2133  FD_DC("TaTransSet(" << this << ")::RestrictSet( [a] " << &rOtherSet << ")");
2134  ABASE::EraseSet(rOtherSet);
2135 }
2136 
2137 // EraseSet(set)
2138 TEMP void THIS::EraseSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
2139 #ifdef FAUDES_CHECKED
2140  FD_DC("TaTransSet(" << this << ")::EraseSet(" << rOtherSet.ToString() << ")");
2141  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
2142  if(!tset) {
2143  std::stringstream errstr;
2144  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2145  throw Exception("TaTransSet::EraseSet", errstr.str(), 67);
2146  }
2147 #endif
2148  ABASE::EraseSet(rOtherSet);
2149 }
2150 
2151 // RestrictSet(set)
2152 TEMP void THIS::RestrictSet(const TransSet& rOtherSet) {
2153  FD_DC("TaTransSet(" << this << ")::RestrictSet( [a] " << &rOtherSet << ")");
2154  ABASE::RestrictSet(rOtherSet);
2155 }
2156 
2157 
2158 // RestrictSet(set)
2159 TEMP void THIS::RestrictSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
2160 #ifdef FAUDES_CHECKED
2161  FD_DC("TaTransSet(" << this << ")::RestrictSet(" << rOtherSet.ToString() << ")");
2162  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
2163  if(!tset) {
2164  std::stringstream errstr;
2165  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2166  throw Exception("TaTransSet::RestrictSet", errstr.str(), 67);
2167  }
2168 #endif
2169  ABASE::RestrictSet(rOtherSet);
2170 }
2171 
2172 
2173 
2174 #undef THIS
2175 #undef TEMP
2176 #undef BASE
2177 #undef ABASE
2178 
2179 #undef SORT_EXECPTION
2180 
2181 } // namespace faudes
2182 
2183 
2184 
2185 
2186 #endif
2187 
Class TAttrMap.
Class TBaseSet.
#define FD_DC(message)
Classes IndexSet, TaIndexSet.
Classes NameSet, TaNameSet.
#define FAUDES_API
Definition: cfl_platform.h:80
#define FAUDES_TAPI
Definition: cfl_platform.h:83
Class TokenReader.
#define TEMP
#define BASE
#define SORT_EXCEPTION
#define ABASE
#define THIS
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
Definition: cfl_types.h:880
#define FAUDES_TYPE_TIMPLEMENTATION(ftype, ctype, cbase, ctemp)
Definition: cfl_types.h:985
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)
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
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:1787
bool Exists(const T &rElem) const
Definition: cfl_baseset.h:2180
virtual void Clear(void)
Definition: cfl_baseset.h:1962
TTransSet< TransSort::X1EvX2 > TransSet
TTransSet< TransSort::X2EvX1 > TransSetX2EvX1
Iterator End(void) const
Definition: cfl_baseset.h:1956
TTransSet< TransSort::X1X2Ev > TransSetX1X2Ev
virtual void RestrictSet(const TBaseSet &rOtherSet)
Definition: cfl_baseset.h:2129
virtual void InsertSet(const TBaseSet &rOtherSet)
Definition: cfl_baseset.h:2052
Iterator Begin(void) const
Definition: cfl_baseset.h:1951
TTransSet< TransSort::EvX1X2 > TransSetEvX1X2
TTransSet< TransSort::X2X1Ev > TransSetX2X1Ev
virtual void EraseSet(const TBaseSet &rOtherSet)
Definition: cfl_baseset.h:2107
Idx Size(void) const
Definition: cfl_baseset.h:1782
uint32_t Idx
std::string ToStringInteger(Int number)
Definition: cfl_utils.cpp:43

libFAUDES 2.33h --- 2025.06.18 --- c++ api documentaion by doxygen