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 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 TTransSet : public TBaseSet<Transition,Cmp> {
243 #endif
244 
246 
247 
248  public:
249 
250  /** @name Constructors & Destructor */
251  /** @{ doxygen group */
252 
253  /** Construct an empty TTransSet object */
254  TTransSet(void);
255 
256  /**
257  * Copy-constructor
258  */
259  //TTransSet(const TBaseSet<Transition,Cmp>& rOtherSet);
260  TTransSet(const TTransSet<Cmp>& rOtherSet);
261 
262  /**
263  * Re-Sort Copy-constructor
264  */
265  template<class OtherCmp>
267 
268  /** Virtual destructor */
269  virtual ~TTransSet() {};
270 
271 
272  /** @} doxygen group */
273 
274 
275  /** Iterator on transition */
277 
278 
279  /** @name Accessing individual transitions */
280  /** @{ doxygen group */
281 
282  /**
283  * Add a Transition.
284  *
285  * @param rTransition
286  * Reference to transition object
287  * @return
288  * True if the transition was new to the set
289  *
290  */
291  bool Insert(const Transition& rTransition);
292 
293  /**
294  * Add a Transition by indices
295  *
296  * @param x1
297  * Predecessor state
298  * @param ev
299  * Event
300  * @param x2
301  * Successor state
302  * @return
303  * True if the transition was new to the set
304  *
305  */
306  bool Insert(Idx x1, Idx ev, Idx x2);
307 
308  /**
309  * Add a Transition.
310  *
311  * @param pos
312  * Insertion hint passed to STL
313  * @param rTransition
314  * Reference to transition object
315  * @return
316  * Insertion position
317  *
318  */
319  Iterator Inject(const Iterator& pos, const Transition& rTransition);
320 
321  /**
322  * Add a Transition.
323  *
324  * @param rTransition
325  * Reference to transition object
326  * @return
327  * Insertion position
328  *
329  */
330  void Inject(const Transition& rTransition);
331 
332  /**
333  * Remove a Transition
334  *
335  * @return
336  * True if transition did exist
337  */
338  bool Erase(const Transition& t);
339 
340  /**
341  * Remove a Transition by x1, ev, x2
342  *
343  * @return
344  * True if transition did exist
345  */
346  bool Erase(Idx x1, Idx ev, Idx x2);
347 
348  /**
349  * Remove a Transition by iterator
350  *
351  * @return
352  * Iterator to next transition
353  */
354  Iterator Erase(const Iterator& it);
355 
356  /**
357  * Remove all transitions containing predecessor state x1.
358  *
359  * @param x1
360  * State index
361  * @exception Exception
362  * - sorting mismatch (id 68)
363  */
364  void EraseByX1(Idx x1);
365 
366  /**
367  * Remove all transitions containing predecessor state x1 and event ev.
368  *
369  * @param x1
370  * State index
371  * @param ev
372  * Event index
373  * @exception Exception
374  * - sorting mismatch (id 68)
375  */
376  void EraseByX1Ev(Idx x1, Idx ev);
377 
378  /**
379  * Remove all transitions containing successor state x2.
380  * This function iterates over all transitions to work with any sorting.
381  *
382  * @param x2
383  * State index
384  */
385  void EraseByX2(Idx x2);
386 
387  /**
388  * Remove all transitions containing event ev.
389  * This function iterates over all transitions to work with any sorting.
390  *
391  * @param ev
392  * Event index
393  */
394  void EraseByEv(Idx ev);
395 
396  /**
397  * Remove all transitions containing state x,
398  * This function iterates over all transitions to work with any sorting.
399  *
400  * @param x
401  * State index
402  */
404 
405  /**
406  * Remove all transitions containing a specified state.
407  * This function iterates over all transitions to work with any sorting.
408  *
409  * @param rStates
410  * Set of states to remore
411  */
412  void EraseByX1OrX2(const StateSet& rStates);
413 
414  /**
415  * Restrict to transitions with states as specified.
416  * Erases any transition with X1 or X2 not in the specified state set.
417  *
418  * @param rStateSet
419  * Set of states to keep.
420  */
421  void RestrictStates(const StateSet& rStateSet);
422 
423  /**
424  * Restrict to transitions with events as specified.
425  * Erases any transition with event not in the specified state set.
426  *
427  * @param rEventSet
428  * Set of events to keep.
429  */
430  void RestrictEvents(const EventSet& rEventSet);
431 
432  /**
433  * Find transition given by x1, ev, x2
434  *
435  *
436  * @param x1
437  * Predecessor state
438  * @param ev
439  * Event
440  * @param x2
441  * Successor state
442  *
443  * @return
444  * Iterator to transition or End() if not exists
445  */
446  Iterator Find(Idx x1, Idx ev, Idx x2) const;
447 
448  /**
449  * Find specified transition
450  *
451  *
452  * @param t
453  * Transition
454  *
455  * @return
456  * Iterator to transition or End() if not exists
457  */
458  Iterator Find(const Transition& t) const;
459 
460 
461  /**
462  * Test existence
463  *
464  * @param t
465  * Transition
466  *
467  * @return
468  * bool
469  */
470  bool Exists(const Transition& t) const;
471 
472  /**
473  * Test existence
474  *
475  * @param x1
476  * Predecessor state Idx
477  * @param ev
478  * Event Idx
479  * @param x2
480  * Successor state Idx
481  *
482  * @return
483  * bool
484  */
485  bool Exists(Idx x1, Idx ev, Idx x2) const;
486 
487  /**
488  * Test existence
489  *
490  * @param x1
491  * Predecessor state Idx
492  * @param ev
493  * Event Idx
494  *
495  * @return
496  * bool
497  */
498  bool ExistsByX1Ev(Idx x1, Idx ev) const;
499 
500  /**
501  * Test existence
502  *
503  * @param x1
504  * Predecessor state Idx
505  *
506  * @return
507  * bool
508  */
509  bool ExistsByX1(Idx x1) const;
510 
511  /**
512  * Tests if a transition with specified predecessor or successor state
513  * exists.
514  *
515  * @param x
516  * State Idx
517  *
518  * @return
519  * bool
520  */
521  bool ExistsByX1OrX2(Idx x) const;
522 
523  /** @} doxygen group */
524 
525 
526  /** @name Transition iterators
527  *
528  * A variaty of iterators are provided to examine specified
529  * segments of the transition relation, e.g. all transitions starting
530  * from a given state. Note that implemetation of these iterators
531  * requires the transition set to be of sorted accordingly. Eg.
532  * scanning all transitions that are labled with a particular event
533  * requires a sorting TransSOrt::EvX1X2 orT ransSOrt::EvX2X1.
534  *
535  *
536  */
537 
538  /** @{ doxygen group: iterators */
539 
540  /**
541  * Iterator to begin of set
542  *
543  * @return
544  * TTransSet<Cmp>::Iterator
545  */
546  Iterator Begin(void) const;
547 
548  /**
549  * Iterator to end of set
550  *
551  * @return
552  * TTransSet<Cmp>::Iterator
553  */
554  Iterator End(void) const;
555 
556 
557  /**
558  * Iterator to first Transition specified by current state.
559  *
560  * @param x1
561  * Predecessor state index
562  *
563  * @return
564  * TTransSet<Cmp>::Iterator
565  *
566  * @exception Exception
567  * - Sorting mismatch (id 68)
568  */
569  Iterator Begin(Idx x1) const;
570 
571  /**
572  * Iterator to end or Transitions with specified current state.
573  *
574  * @param x1
575  * Predecessor state index
576  *
577  * @return
578  * TTransSet<Cmp>::Iterator
579  *
580  * @exception Exception
581  * - Sorting mismatch (id 68)
582  */
583  Iterator End(Idx x1) const;
584 
585  /**
586  * Iterator to first Transitions specified by current state and event.
587  *
588  * @param x1
589  * Predecessor state index
590  * @param ev
591  * Event index
592  *
593  * @return
594  * TTransSet<Cmp>::Iterator
595  *
596  * @exception Exception
597  * - Sorting mismatch (id 68)
598  */
599  Iterator Begin(Idx x1, Idx ev) const;
600 
601  /**
602  * Iterator to first Transition after spcified current state and event.
603  *
604  * @param x1
605  * Predecessor state index
606  * @param ev
607  * Event index
608  *
609  * @return
610  * TTransSet<Cmp>::Iterator
611  *
612  * @exception Exception
613  * - sorting mismatch (id 68)
614  */
615  Iterator End(Idx x1, Idx ev) const;
616 
617  /**
618  * Iterator to first Transition specified by event.
619  * This function requires sorting TransSort::EvX1X2 or TransSort::EvX2X1.
620  *
621  * @param ev
622  * Event index
623  *
624  * @return
625  * TTransSet<Cmp>::iterator
626  *
627  * @exception Exception
628  * - sorting mismatch (id 68)
629  */
630  Iterator BeginByEv(Idx ev) const;
631 
632  /**
633  * Iterator to first Transition after specified by event.
634  * This function requires sorting TransSort::EvX1X2 or TransSort::EvX2X1
635  *
636  * @param ev
637  * Predecessor state index
638  *
639  * @return
640  * TTransSet<Cmp>::Iterator
641  *
642  * @exception Exception
643  * - sorting mismatch (id 68)
644  */
645  Iterator EndByEv(Idx ev) const;
646 
647  /**
648  * Iterator to first Transition specified by event and current state.
649  * This function requires sorting TransSort::EvX1X2.
650  *
651  * @param ev
652  * Event index
653  * @param x1
654  * Predecessor state index
655  *
656  * @return
657  * TTransSet<Cmp>::iterator
658  *
659  * @exception Exception
660  * - sorting mismatch (id 68)
661  */
662  Iterator BeginByEvX1(Idx ev, Idx x1) const;
663 
664  /**
665  * Iterator to first Transition after specified ev and current state.
666  * This function requires sorting TransSort::EvX1X2.
667  *
668  * @param ev
669  * Event index
670  * @param x1
671  * Predecessor state index
672  *
673  * @return
674  * TTransSet<Cmp>::Iterator
675  *
676  * @exception Exception
677  * - sorting mismatch (id 68)
678  */
679  Iterator EndByEvX1(Idx ev, Idx x1) const;
680 
681  /**
682  * Iterator to first Transition specified by event and next state.
683  * This function requires sorting TransSort::EvX2X1.
684  *
685  * @param ev
686  * Event index
687  * @param x2
688  * Predecessor state index
689  *
690  * @return
691  * TTransSet<Cmp>::Iterator
692  *
693  * @exception Exception
694  * - sorting mismatch (id 68)
695  */
696  Iterator BeginByEvX2(Idx ev, Idx x2) const;
697 
698  /**
699  * Iterator to first Transition after specified event and next state.
700  * This function requires sorting TransSort::EvX2X1.
701  *
702  * @param ev
703  * Event index
704  * @param x2
705  * Predecessor state index
706  *
707  * @return
708  * TTransSet<Cmp>::Iterator
709  *
710  * @exception Exception
711  * - sorting mismatch (id 68)
712  */
713  Iterator EndByEvX2(Idx ev, Idx x2) const;
714 
715  /**
716  * Iterator to first Transition specified by successor state x2.
717  * This function requires sorting TransSort::X2EvX1 or TransSort::X2X1Ev.
718  *
719  * @param x2
720  * Predecessor state index
721  *
722  * @return
723  * TTransSet<Cmp>::iterator
724  *
725  * @exception Exception
726  * - sorting mismatch (id 68)
727  */
728  Iterator BeginByX2(Idx x2) const;
729 
730  /**
731  * Iterator to first Transition after specified successor state x2.
732  * This function requires sorting TransSort::X2EvX1 or TransSort::X2X1Ev
733  *
734  * @param x2
735  * Predecessor state index
736  *
737  * @return
738  * TTransSet<Cmp>::Iterator
739  *
740  * @exception Exception
741  * - sorting mismatch (id 68)
742  */
743  Iterator EndByX2(Idx x2) const;
744 
745  /**
746  * Iterator to first Transition specified by successor x2 and ev.
747  * This function requires sorting TransSort::X2EvX1.
748  *
749  * @param x2
750  * Predecessor state index
751  * @param ev
752  * Event index
753  *
754  * @return
755  * TTransSet<Cmp>::Iterator
756  *
757  * @exception Exception
758  * - sorting mismatch (id 68)
759  */
760  Iterator BeginByX2Ev(Idx x2, Idx ev) const;
761 
762  /**
763  * Iterator to first Transition after specified successor x2 and ev.
764  * This function requires sorting TransSort::X2EvX1.
765  *
766  * @param x2
767  * Predecessor state index
768  * @param ev
769  * Event index
770  *
771  * @return
772  * TTransSet<Cmp>::Iterator
773  *
774  * @exception Exception
775  * - sorting mismatch (id 68)
776  */
777  Iterator EndByX2Ev(Idx x2, Idx ev) const;
778 
779  /** @} doxygen group */
780 
781  /** @name Set Operators
782  *
783  * Reimplement boolean operators.
784  *
785  */
786 
787  /** @{ doxygen group: operators */
788 
789 
790  /**
791  * Set union operator
792  *
793  * @return
794  * Union Set
795  *
796  */
797  TTransSet<Cmp> operator + (const TTransSet<Cmp>& rOtherSet) const;
798 
799  /**
800  * Set difference operator
801  *
802  * @return
803  * Set Difference NameSet
804  *
805  */
806  TTransSet<Cmp> operator - (const TTransSet<Cmp>& rOtherSet) const;
807 
808  /**
809  * Set intersection operator
810  *
811  * @return
812  * Set Intersection
813  *
814  */
815  TTransSet<Cmp> operator * (const TTransSet<Cmp>& rOtherSet) const;
816 
817  /** @} doxygen group */
818 
819  /** @name Misc */
820  /** @{ doxygen group */
821 
822  /**
823  * Get copy of trantision relation sorted by other compare
824  * operator, e.g. TSort::X2EvX1
825  *
826  * @return
827  * Transition relation
828  */
829  template<class OtherCmp>
830  void ReSort(TTransSet<OtherCmp>& res) const;
831 
832  /**
833  * Get state set covered by transition set
834  *
835  * @return
836  * Set of state indices used by some transition
837  */
838  StateSet States(void) const;
839 
840  /**
841  * Get set of successor states for specified current state
842  *
843  * @param x1
844  * Current state
845  *
846  * @return
847  * Set of state indices
848  */
850 
851  /**
852  * Get set of successor states for specified current states
853  *
854  * @param rX1Set
855  * Current state
856  *
857  * @return
858  * Set of state indices
859  */
860  StateSet SuccessorStates(const StateSet& rX1Set) const;
861 
862  /**
863  * Get set of successor states for specified current state and event
864  *
865  * @param x1
866  * Current state
867  * @param ev
868  * Event
869  *
870  * @return
871  * Set of state indices
872  */
874 
875  /**
876  * Get set of successor states for specified current states and events
877  *
878  * @param rX1Set
879  * Current states
880  * @param rEvSet
881  * Events
882  *
883  * @return
884  * Set of state indices
885  */
886  StateSet SuccessorStates(const StateSet& rX1Set, const EventSet& rEvSet) const;
887 
888 
889  /**
890  * Get set of events that are active for a specified current state
891  * Since a transition set does not refer to a SymbolTable, this function
892  * returns a set of plain indices. In order to interpret the set as an EventSet,
893  * the relevant SymbolTable must be supplied as second argument. If obmitting the second
894  * argument, the defult SymbolTable is used.
895  *
896  * @param x1
897  * Current state
898  * @param pSymTab
899  * SymbolTable to refer to
900  *
901  * @return
902  * Set of events.
903  */
904  EventSet ActiveEvents(Idx x1, SymbolTable* pSymTab=NULL) const;
905 
906  /**
907  * Return pretty printable string representation.
908  * Primary meant for debugging messages.
909  *
910  * @param rTrans
911  * Transition to print
912  *
913  * @return
914  * String
915  */
916  std::string Str(const Transition& rTrans) const;
917 
918 
919  /** @} doxygen group */
920 
921  protected:
922 
923 
924  /**
925  * Assign my members.
926  *
927  * @param rSource
928  * Source to copy from
929  * @return
930  * Ref to this set
931  */
932  void DoAssign(const TTransSet& rSource);
933 
934  /**
935  * Write to TokenWriter, see Type::Write for public wrappers.
936  *
937  * @param rTw
938  * Reference to TokenWriter
939  * @param rLabel
940  * Label of section to write, defaults to name of set
941  * @param pContext
942  * Write context eg symboltables
943  *
944  * @exception Exception
945  * - IO errors (id 2)
946  */
947 
948  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
949 
950 
951 };
952 
953 /** Type definition for default sorted TTransSet */
955 
956 /** Type definition for default sorted TTransSet */
958 
959 /** Type definition for ev, x1, x2 sorted TTransSet */
961 
962 /** Type definition for ev, x2, x1 sorted TTransSet */
964 
965 /** Type definition for x2, ev, x1 sorted TTransSet */
967 
968 /** Type definition for x2, x1, ev sorted TTransSet */
970 
971 /** Type definition for x1, x2, ev sorted TTransSet */
973 
974 
975 /**
976  * Set of Transitions with attributes.
977  *
978  * This container class is derived from TTransSet to provide attributes as an
979  * additional feature. The template parameter specifies the attribute class,
980  * which in turn must provide some basic funtionality. In contrast to the TTransSet, the TaTransSet
981  * is restricted to standard ordering.
982  *
983  * Note that it is the context of a Generator that
984  * actually allows to interpret a TaTransSet as a set of transitions as opposed to
985  * a set of triples of indices with attributes. In particular, file IO of transitions is provided
986  * by the generator class (although TaTransSet provides output functions for debugging)
987  */
988 
989 
990 template <class Attr>
991 class FAUDES_API TaTransSet : public TransSet, public TAttrMap<Transition,Attr,TransSort::X1EvX2> {
992 
994 
995 public:
996 
997 
998  /** @name Constructors & Destructor */
999  /** @{ doxygen group */
1000 
1001  /** Construct an empty TaTransSet object */
1002  TaTransSet(void);
1003 
1004  /**
1005  * Copy-constructor (incl attributes)
1006  */
1007  TaTransSet(const TaTransSet& rOtherSet);
1008 
1009  /**
1010  * Copy-Constructor (set attributes to default)
1011  */
1012  TaTransSet(const TTransSet<TransSort::X1EvX2>& rOtherSet);
1013 
1014  /** Virtual destructor */
1015  virtual ~TaTransSet() {}
1016 
1017  /** Relaxed assignment method.
1018  *
1019  * Runtime typecheck for TransSet, maintains attributes provided they can be casted.
1020  *
1021  * @param rSrc
1022  * Source from which to assign
1023  * @return
1024  * Ref to this set
1025  */
1026  virtual TaTransSet& Assign(const TBaseSet<Transition,TransSort::X1EvX2>& rSrc);
1027 
1028  /** Relaxed assignment operator.
1029  *
1030  * @param rSrc
1031  * Source from which to assign
1032  * @return
1033  * Ref to this set
1034  */
1035  virtual TaTransSet& operator=(const TransSet& rSrc) {return Assign(rSrc);}
1036 
1037  /** @} doxygen group */
1038 
1039 
1040 
1041  /** @name Accessing individual transitions */
1042  /** @{ doxygen group */
1043 
1044  /** Iterator on transition */
1046 
1047  /**
1048  * Add a Transition by indices
1049  *
1050  * @param x1
1051  * Predecessor state
1052  * @param ev
1053  * Event
1054  * @param x2
1055  * Successor state
1056  *
1057  * @return
1058  * True if the transition was new to the set
1059  */
1060  bool Insert(Idx x1, Idx ev, Idx x2);
1061 
1062  /**
1063  * Add a Transition directly. If the transition already
1064  * exists, the attribute is maintained. Otherwise, the transition
1065  * is inserted with default attribute.
1066  *
1067  * @param rTransition
1068  * Reference to transition object
1069  *
1070  * @return
1071  * True if the transition was new to the set
1072  */
1073  bool Insert(const Transition& rTransition);
1074 
1075  /**
1076  * Add a Transition with attribute.
1077  *
1078  * @param rTransition
1079  * Reference to transition object
1080  * @param rAttr
1081  * Reference to attribute
1082  *
1083  * @return
1084  * True if the transition was new to the set
1085  */
1086  bool Insert(const Transition& rTransition, const Attr& rAttr);
1087 
1088  /**
1089  * Inserts elements of rOtherSet.
1090  *
1091  * Attributes of this set are maintained, newly inserted elements attain the
1092  * attribute from rOtherSet if it can be casted appropriately.
1093  *
1094  *
1095  * @param rOtherSet
1096  * Other IndexSet
1097  */
1098  virtual void InsertSet(const TransSet& rOtherSet);
1099 
1100  /**
1101  * Inserts elements of rOtherSet.
1102  *
1103  * This variant uses a runtime cast to access attributes.
1104  *
1105  * @param rOtherSet
1106  * Other IndexSet
1107  * @exception Exception
1108  * - cast failed (id 67)
1109  */
1110  virtual void InsertSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1111 
1112  /**
1113  * Remove a Transition
1114  *
1115  * @return
1116  * True if transition did exist
1117  */
1118  bool Erase(const Transition& t);
1119 
1120  /**
1121  * Remove a Transition
1122  *
1123  * @return
1124  * True if transition did exist
1125  */
1126  bool Erase(Idx x1, Idx ev, Idx x2);
1127 
1128  /**
1129  * Remove a Transition by iterator
1130  *
1131  * @return
1132  * Iterator to next transition
1133  */
1134  Iterator Erase(const Iterator& it);
1135 
1136  /**
1137  * Inserts elements of rOtherSet.
1138  *
1139  * Attributes of this set are maintained.
1140  *
1141  *
1142  * @param rOtherSet
1143  * Other IndexSet
1144  */
1145  virtual void EraseSet(const TransSet& rOtherSet);
1146 
1147  /**
1148  * Inserts elements of rOtherSet.
1149  *
1150  * This variant uses a runtime cast to access attributes.
1151  *
1152  * @param rOtherSet
1153  * Other IndexSet
1154  * @exception Exception
1155  * - cast failed (id 67)
1156  */
1157  virtual void EraseSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1158 
1159 
1160  /**
1161  * Restrict to specified subset.
1162  *
1163  * Erases any elements no in the specified set. This function
1164  * ignores the attributes of the other set and maintains the attributes
1165  * of the remaining elements in this set.
1166  *
1167  * @param rOtherSet
1168  * Elements to erase
1169  */
1170  void RestrictSet(const TransSet& rOtherSet);
1171 
1172 
1173  /**
1174  * Restrict to specified subset.
1175  *
1176  * This variant uses a runtime cast to access attributes.
1177  *
1178  * @param rOtherSet
1179  * Elements to erase
1180  */
1181  void RestrictSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1182 
1183 
1184 
1185 
1186  /** resolve ambiguities from attribute interface ("using" wont do the job) */
1189  const Attr& Attribute(const Transition& rElem) const { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem); };
1190  void Attribute(const Transition& rElem, const Attr& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem,rAttr); };
1191  void Attribute(const Transition& rElem, const Type& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem,rAttr); };
1192  void AttributeTry(const Transition& rElem, const Type& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::AttributeTry(rElem,rAttr); };
1193 
1194 
1195  /** @} doxygen group */
1196 
1197 
1198  protected:
1199 
1200  /**
1201  * Assign my members. Maintain attributes.
1202  *
1203  * @param rSource
1204  * Source to copy from
1205  * @return
1206  * Ref to this set
1207  */
1208  void DoAssign(const TaTransSet& rSource);
1209 
1210 };
1211 
1212 /** @} doxygen group*/
1213 
1214 
1215 /*
1216 *************************************************************************************************
1217 *************************************************************************************************
1218 * Implementation of transset without attributes
1219 *************************************************************************************************
1220 *************************************************************************************************
1221 */
1222 
1223 
1224 /* convenience access to relevant scopes */
1225 #define THIS TTransSet<Cmp>
1226 #define TEMP template<class Cmp>
1227 #define BASE TBaseSet<Transition,Cmp>
1228 
1229 // std faudes type
1231 
1232 // TTransSet(void)
1234 {
1235  FD_DC("TTransSet(" << this << ")::TTransSet()");
1236 }
1237 
1238 // TTransSet(othertransrel)
1239 //TEMP THIS::TTransSet(const TBaseSet<Transition,Cmp>& rOtherSet) :
1240  TEMP THIS::TTransSet(const TTransSet<Cmp>& rOtherSet) :
1241  BASE()
1242 {
1243  FD_DC("TTransSet(" << this << ")::TTransSet(rOtherSet "<< &rOtherSet <<")");
1244  Assign(rOtherSet);
1245 }
1246 
1247 // TTransSet(othertransrel othersort)
1248 TEMP template<class OtherCmp>
1249 THIS::TTransSet(const TTransSet<OtherCmp>& rOtherSet) :
1250  BASE()
1251 {
1252  FD_DC("TTransSet(" << this << ")::TTransSet(rOtherSet/ReSort "<< &rOtherSet <<")");
1253  rOtherSet.ReSort(*this);
1254 }
1255 
1256 // assignment (maintain attributes)
1257 TEMP void THIS::DoAssign(const TTransSet& rSourceSet) {
1258  FD_DC("TTransSet(" << this << ")::DoAssign(..)");
1259  // call base (incl attributes if the have identival type)
1260  BASE::DoAssign(rSourceSet);
1261 }
1262 
1263 // iterator Begin() const
1264 TEMP typename THIS::Iterator THIS::Begin(void) const {
1265  return BASE::Begin();
1266 }
1267 
1268 // iterator End() const
1269 TEMP typename THIS::Iterator THIS::End(void) const {
1270  return BASE::End();
1271 }
1272 
1273 
1274 // Convenience macro for order typecheck
1275 #define SORT_EXCEPTION { std::stringstream errstr; \
1276  errstr << "Transition set order mismatch " << std::endl; \
1277  throw Exception("TransSet::Iterator()", errstr.str(), 68); }
1278 
1279 
1280 // iterator Begin(x1) const
1281 TEMP typename THIS::Iterator THIS::Begin(Idx x1) const {
1282 #ifdef FAUDES_CHECKED
1283  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1284  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1286 #endif
1287  Transition tlx(x1,0,0);
1288  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1289 }
1290 
1291 // iterator End(x1) const
1292 TEMP typename THIS::Iterator THIS::End(Idx x1) const {
1293 #ifdef FAUDES_CHECKED
1294  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1295  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1297 #endif
1298  Transition tlx(x1+1,0,0);
1299  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1300 }
1301 
1302 // iterator Begin(x1,ev) const
1303 TEMP typename THIS::Iterator THIS::Begin(Idx x1, Idx ev) const {
1304 #ifdef FAUDES_CHECKED
1305  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1307 #endif
1308  Transition tlx(x1,ev,0);
1309  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1310 }
1311 
1312 // iterator End(x1,ev) const
1313 TEMP typename THIS::Iterator THIS::End(Idx x1, Idx ev) const {
1314 #ifdef FAUDES_CHECKED
1315  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1317 #endif
1318  Transition tlx(x1,ev+1, 0);
1319  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1320 }
1321 
1322 // iterator BeginByEv(ev) const
1323 TEMP typename THIS::Iterator THIS::BeginByEv(Idx ev) const {
1324 #ifdef FAUDES_CHECKED
1325  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1326  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1328 #endif
1329  Transition tlx(0,ev,0);
1330  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1331 }
1332 
1333 // iterator EndByEv(ev) const
1334 TEMP typename THIS::Iterator THIS::EndByEv(Idx ev) const {
1335 #ifdef FAUDES_CHECKED
1336  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1337  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1339 #endif
1340  Transition tlx(0,ev+1,0);
1341  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1342 }
1343 
1344 // iterator BeginByEvX1(ev,x1) const
1345 TEMP typename THIS::Iterator THIS::BeginByEvX1(Idx ev, Idx x1) const {
1346 #ifdef FAUDES_CHECKED
1347  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1349 #endif
1350  Transition tlx(x1,ev,0);
1351  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1352 }
1353 
1354 // iterator EndByEvX1(ev,x1) const
1355 TEMP typename THIS::Iterator THIS::EndByEvX1(Idx ev, Idx x1) const {
1356 #ifdef FAUDES_CHECKED
1357  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1359 #endif
1360  Transition tlx(x1+1,ev,0);
1361  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1362 }
1363 
1364 // iterator BeginByEvX2(ev,x2) const
1365 TEMP typename THIS::Iterator THIS::BeginByEvX2(Idx ev, Idx x2) const {
1366 #ifdef FAUDES_CHECKED
1367  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1369 #endif
1370  Transition tlx(0,ev,x2);
1371  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1372 }
1373 
1374 // iterator EndByEvX2(ev,x2) const
1375 TEMP typename THIS::Iterator THIS::EndByEvX2(Idx ev, Idx x2) const {
1376 #ifdef FAUDES_CHECKED
1377  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1379 #endif
1380  Transition tlx(0,ev,x2+1);
1381  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1382 }
1383 
1384 // iterator BeginByX2(x2) const
1385 TEMP typename THIS::Iterator THIS::BeginByX2(Idx x2) const {
1386 #ifdef FAUDES_CHECKED
1387  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1388  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1390 #endif
1391  Transition tlx(0,0,x2);
1392  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1393 }
1394 
1395 // iterator EndByX2(x2) const
1396 TEMP typename THIS::Iterator THIS::EndByX2(Idx x2) const {
1397 #ifdef FAUDES_CHECKED
1398  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1399  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1401 #endif
1402  Transition tlx(0,0,x2+1);
1403  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1404 }
1405 
1406 // iterator BeginByX2Ev(x2,ev) const
1407 TEMP typename THIS::Iterator THIS::BeginByX2Ev(Idx x2, Idx ev) const {
1408 #ifdef FAUDES_CHECKED
1409  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1411 #endif
1412  Transition tlx(0,ev,x2);
1413  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1414 }
1415 
1416 // iterator EndByX2Ev(x2,ev) const
1417 TEMP typename THIS::Iterator THIS::EndByX2Ev(Idx x2, Idx ev) const {
1418 #ifdef FAUDES_CHECKED
1419  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1421 #endif
1422  Transition tlx(0,ev+1,x2);
1423  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1424 }
1425 
1426 // operator+
1427 TEMP THIS THIS::operator+ (const TTransSet<Cmp>& rOtherSet) const {
1428  TTransSet<Cmp> res(*this);
1429  res.InsertSet(rOtherSet);
1430  return res;
1431 }
1432 
1433 // operator-
1434 TEMP THIS THIS::operator- (const TTransSet<Cmp>& rOtherSet) const {
1435  TTransSet<Cmp> res(*this);
1436  res.EraseSet(rOtherSet);
1437  return res;
1438 }
1439 
1440 
1441 // operator*
1442 TEMP TTransSet<Cmp> THIS::operator* (const TTransSet<Cmp>& rOtherSet) const {
1443  TTransSet<Cmp> res(*this);
1444  res.RestrictSet(rOtherSet);
1445  return res;
1446 }
1447 
1448 
1449 // DoWrite(rw,label)
1450 TEMP void THIS::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const
1451 {
1452  (void) pContext;
1453  std::string label=rLabel;
1454  if(label=="") label=BASE::Name();
1455  rTw.WriteBegin(label);
1456  int oldcolumns = rTw.Columns();
1457  rTw.Columns(3);
1458 
1459  Iterator tit;
1460  for (tit = Begin(); tit != End(); ++tit) {
1461  rTw << tit->X1; rTw << tit->Ev; rTw << tit->X2;
1462  }
1463 
1464  rTw.WriteEnd(label);
1465  rTw.Columns(oldcolumns);
1466 }
1467 
1468 
1469 // Insert(transition)
1470 TEMP bool THIS::Insert(const Transition& t) {
1471  return BASE::Insert(t);
1472 }
1473 
1474 // Insert(x1,ev,x2)
1475 TEMP bool THIS::Insert(Idx x1, Idx ev, Idx x2) {
1476  FD_DC("TTransSet(" << this << ")::Insert(" << x1 << "-" << ev << "-" << x2 << ")");
1477  return BASE::Insert(Transition(x1, ev, x2));
1478 }
1479 
1480 // Inject(transition)
1481 TEMP typename THIS::Iterator THIS::Inject(const Iterator& pos, const Transition& t) {
1482  return BASE::Inject(pos,t);
1483 }
1484 
1485 // Inject(transition)
1486 TEMP void THIS::Inject(const Transition& t) {
1487  BASE::Inject(t);
1488 }
1489 
1490 
1491 // Erase(transition)
1492 TEMP bool THIS::Erase(const Transition& t) {
1493  FD_DC("TTransSet(" << this << ")::Erase(" << t.Str() << " [t])");
1494  return BASE::Erase(t);
1495 }
1496 
1497 // Erase(x1,ev,x2)
1498 TEMP bool THIS::Erase(Idx x1, Idx ev, Idx x2) {
1499  FD_DC("TTransSet(" << this << ")::Erase(" << x1 << "-" << ev << "-" << x2 << ")");
1500  return BASE::Erase(Transition(x1, ev, x2));
1501 }
1502 
1503 // Erase(it)
1504 TEMP typename THIS::Iterator THIS::Erase(const Iterator& it) {
1505  FD_DC("TTransSet(" << this << ")::Erase(" << this->Str(*it) << " [it])");
1506  return BASE::Erase(it);
1507 }
1508 
1509 // EraseByX1(x)
1510 TEMP void THIS::EraseByX1(Idx x1) {
1511  FD_DC("TTransSet(" << this << ")::EraseByX1(" << x1 << ")");
1512 #ifdef FAUDES_CHECKED
1513  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1514  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1516 #endif
1517  this->Detach();
1518  typename BASE::iterator lower, upper, it;
1519  Transition tl(x1,0,0);
1520  Transition tu(x1+1,0,0);
1521  lower = BASE::pSet->lower_bound(tl);
1522  upper = BASE::pSet->upper_bound(tu);
1523  if(this->AttributesSize()!=0)
1524  for(it=lower; it!=upper; ++it)
1525  BASE::ClrAttribute(*it);
1526  BASE::pSet->erase(lower, upper);
1527 }
1528 
1529 // EraseByX1Ev(x,e)
1530 TEMP void THIS::EraseByX1Ev(Idx x1, Idx ev) {
1531  FD_DC("TTransSet(" << this << ")::EraseByX1Ev(" << x1 << "," << ev << ")");
1532 #ifdef FAUDES_CHECKED
1533  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1535 #endif
1536  this->Detach();
1537  typename BASE::iterator lower, upper, it;
1538  Transition tl(x1,ev,0);
1539  Transition tu(x1,ev+1,0);
1540  lower = BASE::pSet->lower_bound(tl);
1541  upper = BASE::pSet->upper_bound(tu);
1542  if(this->AttributesSize()!=0)
1543  for(it=lower; it!=upper; ++it)
1544  BASE::ClrAttribute(*it);
1545  BASE::pSet->erase(lower, upper);
1546 }
1547 
1548 // EraseByX2(x)
1549 TEMP void THIS::EraseByX2(Idx x2) {
1550  FD_DC("TTransSet(" << this << ")::EraseByX2(" << x2 << ")");
1551  this->Detach();
1552  bool doattr = (this->AttributesSize()!=0);
1553  typename BASE::iterator it;
1554  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1555  if(it->X2 == x2) {
1556  if(doattr) BASE::ClrAttribute(*it);
1557  BASE::pSet->erase(it++);
1558  continue;
1559  }
1560  it++;
1561  }
1562 }
1563 
1564 // EraseByEv(ev)
1565 TEMP void THIS::EraseByEv(Idx ev) {
1566  FD_DC("TTransSet(" << this << ")::EraseByEv(" << ev << ")");
1567  this->Detach();
1568  bool doattr = (this->AttributesSize()!=0);
1569  typename BASE::iterator it;
1570  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1571  if (it->Ev == ev) {
1572  if(doattr) BASE::ClrAttribute(*it);
1573  BASE::pSet->erase(it++);
1574  continue;
1575  }
1576  it++;
1577  }
1578 }
1579 
1580 
1581 // EraseByX1OrX2(x)
1582 TEMP void THIS::EraseByX1OrX2(Idx x) {
1583  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(" << x << ")");
1584  this->Detach();
1585  bool doattr = (this->AttributesSize()!=0);
1586  typename BASE::iterator it;
1587  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1588  if ((it->X1 == x) || (it->X2 == x)) {
1589  if(doattr) BASE::ClrAttribute(*it);
1590  BASE::pSet->erase(it++);
1591  continue;
1592  }
1593  it++;
1594  }
1595  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(" << x << "): done");
1596 }
1597 
1598 
1599 // EraseByX1OrX2(xset)
1600 TEMP void THIS::EraseByX1OrX2(const StateSet& rStates) {
1601  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(#" << rStates.Size() <<")");
1602  this->Detach();
1603  bool doattr = (this->AttributesSize()!=0);
1604  typename BASE::iterator it=BASE::pSet->begin();
1605  while(it != BASE::pSet->end()) {
1606  if(!rStates.Exists(it->X1) && !rStates.Exists(it->X2)) { ++it; continue;}
1607  if(doattr) BASE::ClrAttribute(*it);
1608  BASE::pSet->erase(it++);
1609  }
1610  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(): done");
1611 }
1612 
1613 
1614 // RestrictStates(xset)
1615 TEMP void THIS::RestrictStates(const StateSet& rStates) {
1616  FD_DC("TTransSet(" << this << ")::RestrictByX1AndX2(#" << rStates.Size() <<")");
1617  this->Detach();
1618  bool doattr = (this->AttributesSize()!=0);
1619  typename BASE::iterator it;
1620  it = BASE::pSet->begin();
1621  while(it != BASE::pSet->end()) {
1622  if(rStates.Exists(it->X1) && rStates.Exists(it->X2)) { ++it; continue;}
1623  if(doattr) BASE::ClrAttribute(*it);
1624  BASE::pSet->erase(it++);
1625  }
1626  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(): done");
1627 }
1628 
1629 
1630 // RestrictEvents(eset)
1631 TEMP void THIS::RestrictEvents(const EventSet& rEvents) {
1632  FD_DC("TTransSet(" << this << ")::RestrictEvents(#" << rEvents.Size() <<")");
1633  this->Detach();
1634  bool doattr = (this->AttributesSize()!=0);
1635  typename BASE::iterator it;
1636  it = BASE::pSet->begin();
1637  while(it != BASE::pSet->end()) {
1638  if(rEvents.Exists(it->Ev)) { ++it; continue;}
1639  if(doattr) BASE::ClrAttribute(*it);
1640  BASE::pSet->erase(it++);
1641  }
1642  FD_DC("TTransSet(" << this << ")::RestrictEvents(): done");
1643 }
1644 
1645 
1646 // iterator Find(x1,ev,x2)
1647 TEMP typename THIS::Iterator THIS::Find(Idx x1, Idx ev, Idx x2) const {
1648  return BASE::Find(Transition(x1,ev,x2));
1649 }
1650 
1651 
1652 // iterator Find(t)
1653 TEMP typename THIS::Iterator THIS::Find(const Transition& t) const{
1654  return BASE::Find(t);
1655 }
1656 
1657 // Exists(t)
1658 TEMP bool THIS::Exists(const Transition& t) const {
1659  return BASE::Exists(t);
1660 }
1661 
1662 // Exists(x1, ev, x2)
1663 TEMP bool THIS::Exists(Idx x1, Idx ev, Idx x2) const {
1664  return BASE::Exists(Transition(x1,ev,x2));
1665 }
1666 
1667 // Exists(x)
1668 TEMP bool THIS::ExistsByX1OrX2(Idx x) const {
1669  typename BASE::iterator it;
1670  for(it = BASE::pSet->begin(); it != BASE::pSet->end(); ++it) {
1671  if ((it->X1 == x) || (it->X2 == x)) {
1672  return true;
1673  }
1674  }
1675  return false;
1676 }
1677 
1678 // ExistsByX1Ev(x,e)
1679 TEMP bool THIS::ExistsByX1Ev(Idx x1, Idx ev) const {
1680  FD_DC("TTransSet(" << this << ")::ExistsByX1Ev(" << x1 << "," << ev << ")");
1681 #ifdef FAUDES_CHECKED
1682  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1684 #endif
1685  this->Detach();
1686  typename BASE::iterator lower, upper, it;
1687  Transition tl(x1,ev,0);
1688  Transition tu(x1,ev+1,0);
1689  lower = BASE::pSet->lower_bound(tl);
1690  upper = BASE::pSet->upper_bound(tu);
1691  return lower != upper;
1692 }
1693 
1694 // ExistsByX1(x)
1695 TEMP bool THIS::ExistsByX1(Idx x1) const {
1696  FD_DC("TTransSet(" << this << ")::ExistsByX1(" << x1 << ")");
1697 #ifdef FAUDES_CHECKED
1698  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1699  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1701 #endif
1702  this->Detach();
1703  typename BASE::iterator lower, upper, it;
1704  Transition tl(x1,0,0);
1705  Transition tu(x1+1,0,0);
1706  lower = BASE::pSet->lower_bound(tl);
1707  upper = BASE::pSet->upper_bound(tu);
1708  return lower != upper;
1709 }
1710 
1711 
1712 // ReSort(res)
1713 TEMP template<class OtherCmp>
1714 void THIS::ReSort(TTransSet<OtherCmp>& res) const {
1715  Iterator it;
1716  res.Clear();
1717  for (it = Begin(); it != End(); ++it) {
1718  res.Insert(*it);
1719  }
1720 }
1721 
1722 // States()
1723 TEMP StateSet THIS::States(void) const {
1724  StateSet states;
1725  Iterator it;
1726  for (it=Begin(); it!=End(); ++it) {
1727  states.Insert(it->X1);
1728  states.Insert(it->X2);
1729  }
1730  return states;
1731 }
1732 
1733 // SuccessorStates(x1)
1734 TEMP StateSet THIS::SuccessorStates(Idx x1) const {
1735 #ifdef FAUDES_CHECKED
1736  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1737  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1739 #endif
1740  StateSet states;
1741  Iterator it = Begin(x1);
1742  Iterator it_end = End(x1);
1743  while (it != it_end) {
1744  states.Insert(it->X2);
1745  ++it;
1746  }
1747  return states;
1748 }
1749 
1750 // SuccessorStates(x1set)
1751 TEMP StateSet THIS::SuccessorStates(const StateSet& rX1Set) const {
1752 #ifdef FAUDES_CHECKED
1753  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1754  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1756 #endif
1757  StateSet states;
1758  StateSet::Iterator sit= rX1Set.Begin();
1759  StateSet::Iterator sit_end= rX1Set.End();
1760  for(;sit!=sit_end; ++sit) {
1761  Iterator tit = Begin(*sit);
1762  Iterator tit_end = End(*sit);
1763  while(tit!=tit_end) {
1764  states.Insert(tit->X2);
1765  ++tit;
1766  }
1767  }
1768  return states;
1769 }
1770 
1771 // SuccessorStates(x1, ev)
1772 TEMP StateSet THIS::SuccessorStates(Idx x1, Idx ev) const {
1773 #ifdef FAUDES_CHECKED
1774  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1776 #endif
1777  StateSet states;
1778  Iterator it = Begin(x1, ev);
1779  Iterator it_end = End(x1, ev);
1780  while (it != it_end) {
1781  states.Insert(it->X2);
1782  ++it;
1783  }
1784  return states;
1785 }
1786 
1787 // SuccessorStates(x1set, evset)
1788 TEMP StateSet THIS::SuccessorStates(const StateSet& rX1Set, const EventSet& rEvSet) const {
1789 #ifdef FAUDES_CHECKED
1790  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1792 #endif
1793  StateSet states;
1794  if(rEvSet.Empty()) return states;
1795  StateSet::Iterator sit= rX1Set.Begin();
1796  StateSet::Iterator sit_end= rX1Set.End();
1797  for(;sit!=sit_end; ++sit) {
1798  EventSet::Iterator eit= rEvSet.Begin();
1799  EventSet::Iterator eit_end= rEvSet.End();
1800  Iterator tit = Begin(*sit,*eit);
1801  Iterator tit_end = End(*sit);
1802  while(tit!=tit_end) {
1803  // match
1804  if(tit->Ev == *eit) {
1805  states.Insert(tit->X2);
1806  ++tit;
1807  continue;
1808  }
1809  // tit behind
1810  if(tit->Ev < *eit) {
1811  ++tit;
1812  continue;
1813  }
1814  // tit upfront
1815  ++eit;
1816  if(eit==eit_end) break;
1817  }
1818  }
1819  return states;
1820 }
1821 
1822 // ActiveEvents(x1,pSymTab)
1823 TEMP EventSet THIS::ActiveEvents(Idx x1, SymbolTable* pSymTab) const {
1824  Iterator it = Begin(x1);
1825  Iterator it_end = End(x1);
1826  EventSet result;
1827  if(pSymTab!=NULL) result.SymbolTablep(pSymTab);
1828  for (; it != it_end; ++it) {
1829  result.Insert(it->Ev);
1830  }
1831  return result;
1832 }
1833 
1834 // Prettz printable sring
1835 TEMP std::string THIS::Str(const Transition& rTrans) const {
1836  return rTrans.Str();
1837 }
1838 
1839 
1840 
1841 #undef THIS
1842 #undef TEMP
1843 #undef BASE
1844 
1845 /*
1846 *************************************************************************************************
1847 *************************************************************************************************
1848 * Implementation of transset with attributes
1849 *************************************************************************************************
1850 *************************************************************************************************
1851 */
1852 
1853 
1854 /* convenience access to relevant scopes */
1855 #define THIS TaTransSet<Attr>
1856 #define TEMP template <class Attr>
1857 #define BASE TTransSet<TransSort::X1EvX2>
1858 #define ABASE TAttrMap<Transition,Attr,TransSort::X1EvX2>
1859 
1860 // std faudes type
1862 
1863 // TaTransSet(void)
1865  BASE(),
1866  ABASE(this)
1867 {
1868  FD_DC("TaTransSet(" << this << ")::TaTransSet()");
1869 }
1870 
1871 // TaTransSet(othertransrel)
1872 TEMP THIS::TaTransSet(const TaTransSet& rOtherSet) :
1873  BASE(),
1874  ABASE(this)
1875 {
1876  FD_DC("TaTransSet(" << this << ")::TaTransSet(rOtherSet "<< &rOtherSet <<")");
1877  DoAssign(rOtherSet);
1878 }
1879 
1880 
1881 // TaTransSet(othertransrel)
1882 TEMP THIS::TaTransSet(const BASE& rOtherSet) :
1883  BASE(),
1884  ABASE(this)
1885 {
1886  FD_DC("TaTransSet(" << this << ")::TaTransSet(rOtherSet "<< &rOtherSet <<")");
1887  Assign(rOtherSet);
1888 }
1889 
1890 
1891 // copy to known same attributes
1892 TEMP void THIS::DoAssign(const THIS& rSourceSet) {
1893  // call base incl attributes
1894  BASE::DoAssign(rSourceSet);
1895 }
1896 
1897 // Relaxed Assign()
1898 TEMP THIS& THIS::Assign(const TBaseSet<Transition,TransSort::X1EvX2>& rSourceSet) {
1899  FD_DC("TaTransSet(" << this << ")::Assign([v] " << &rSourceSet<<")");
1900 #ifdef FAUDES_CHECKED
1901  FD_DC("TaTransSet(" << this << ")::Assign(): src at " << &rSourceSet);
1902  FD_DC("TaTransSet(" << this << ")::Assign(): src type " << typeid(rSourceSet).name());
1903  FD_DC("TaTransSet(" << this << ")::Assign(): dst type " << typeid(*this).name());
1904  const TransSet* tset = dynamic_cast<const TransSet*>(&rSourceSet);
1905  if(!tset) {
1906  std::stringstream errstr;
1907  errstr << "cannot cast " << typeid(rSourceSet).name() << " to TransSet" << std::endl;
1908  throw Exception("TaTransSet::Assign", errstr.str(), 67);
1909  }
1910 #endif
1911  // call attribute smart base
1912  ABASE::AssignWithAttributes(rSourceSet);
1913  // done
1914  return *this;
1915 }
1916 
1917 
1918 // Insert(transition)
1919 TEMP bool THIS::Insert(const Transition& t) {
1920  FD_DC("TaTransSet(" << this << ")::Insert(" << t.Str() << ")");
1921  return ABASE::Insert(t);
1922 }
1923 
1924 // Insert(x1,ev,x2)
1925 TEMP bool THIS::Insert(Idx x1, Idx ev, Idx x2) {
1926  FD_DC("TaTransSet(" << this << ")::Insert(" << x1 << "-" << ev << "-" << x2 << ")");
1927  Transition t(x1, ev, x2);
1928  return ABASE::Insert(t);
1929 }
1930 
1931 // Insert(transition,attr)
1932 TEMP bool THIS::Insert(const Transition& t, const Attr& attr) {
1933  return ABASE::Insert(t,attr);
1934 }
1935 
1936 
1937 // InsertSet(set)
1938 TEMP void THIS::InsertSet(const TransSet& rOtherSet) {
1939  FD_DC("TaTransSet(" << this << ")::InsertSet( [a] " << &rOtherSet << ")");
1940  ABASE::InsertSet(rOtherSet);
1941 }
1942 
1943 // InsertSet(set)
1944 TEMP void THIS::InsertSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
1945 #ifdef FAUDES_CHECKED
1946  FD_DC("TaTransSet(" << this << ")::InsertSet(" << rOtherSet.ToString() << ")");
1947  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
1948  if(!tset) {
1949  std::stringstream errstr;
1950  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
1951  throw Exception("TaTransSet::InsertSet", errstr.str(), 67);
1952  }
1953 #endif
1954  ABASE::InsertSet(rOtherSet);
1955 }
1956 
1957 
1958 // Erase(transition)
1959 TEMP bool THIS::Erase(const Transition& t) {
1960  return ABASE::Erase(t);
1961 }
1962 
1963 // Erase(x1,ev,x2)
1964 TEMP bool THIS::Erase(Idx x1, Idx ev, Idx x2) {
1965  FD_DC("TaTransSet(" << this << ")::Erase(" << x1 << "-" << ev << "-" << x2 << ")");
1966  Transition t(x1, ev, x2);
1967  return ABASE::Erase(t);
1968 }
1969 
1970 // Erase(it)
1971 TEMP typename THIS::Iterator THIS::Erase(const Iterator& it) {
1972 #ifdef FAUDES_CHECKED
1973  if (it == End()) {
1974  std::stringstream errstr;
1975  errstr << "iterator out of range " << std::endl;
1976  throw Exception("TTransSet::Erase", errstr.str(), 69);
1977  }
1978 #endif
1979  return ABASE::Erase(it);
1980 }
1981 
1982 // EraseSet(set)
1983 TEMP void THIS::EraseSet(const TransSet& rOtherSet) {
1984  FD_DC("TaTransSet(" << this << ")::RestrictSet( [a] " << &rOtherSet << ")");
1985  ABASE::EraseSet(rOtherSet);
1986 }
1987 
1988 // EraseSet(set)
1989 TEMP void THIS::EraseSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
1990 #ifdef FAUDES_CHECKED
1991  FD_DC("TaTransSet(" << this << ")::EraseSet(" << rOtherSet.ToString() << ")");
1992  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
1993  if(!tset) {
1994  std::stringstream errstr;
1995  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
1996  throw Exception("TaTransSet::EraseSet", errstr.str(), 67);
1997  }
1998 #endif
1999  ABASE::EraseSet(rOtherSet);
2000 }
2001 
2002 // RestrictSet(set)
2003 TEMP void THIS::RestrictSet(const TransSet& rOtherSet) {
2004  FD_DC("TaTransSet(" << this << ")::RestrictSet( [a] " << &rOtherSet << ")");
2005  ABASE::RestrictSet(rOtherSet);
2006 }
2007 
2008 
2009 // RestrictSet(set)
2010 TEMP void THIS::RestrictSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
2011 #ifdef FAUDES_CHECKED
2012  FD_DC("TaTransSet(" << this << ")::RestrictSet(" << rOtherSet.ToString() << ")");
2013  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
2014  if(!tset) {
2015  std::stringstream errstr;
2016  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2017  throw Exception("TaTransSet::RestrictSet", errstr.str(), 67);
2018  }
2019 #endif
2020  ABASE::RestrictSet(rOtherSet);
2021 }
2022 
2023 
2024 
2025 #undef THIS
2026 #undef TEMP
2027 #undef BASE
2028 #undef ABASE
2029 
2030 #undef SORT_EXECPTION
2031 
2032 } // namespace faudes
2033 
2034 
2035 
2036 
2037 #endif
2038 
Classes AttributeVoid and AttributeFlags
Class TAttrMap.
Class TBaseSet.
Compiletime options.
#define FD_DC(message)
Debug: optional report on container operations.
Classes IndexSet, TaIndexSet.
Classes NameSet, TaNameSet.
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:81
Class TokenReader.
#define TEMP
#define BASE
#define SORT_EXCEPTION
#define ABASE
#define THIS
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
faudes type declaration macro
Definition: cfl_types.h:867
#define FAUDES_TYPE_TIMPLEMENTATION(ftype, ctype, cbase, ctemp)
faudes type implementation macros, overall
Definition: cfl_types.h:972
Faudes exception class.
Set of indices.
Definition: cfl_indexset.h:78
Idx Insert(void)
Insert new index to set.
Set of indices with symbolic names.
Definition: cfl_nameset.h:69
bool Exists(const Idx &rIndex) const
Test existence of index.
SymbolTable * SymbolTablep(void) const
Get Pointer mpSymbolTable.
bool Insert(const Idx &rIndex)
Add an element by index.
A SymbolTable associates sybolic names with indices.
Attribute interface for TBaseSet.
Definition: cfl_attrmap.h:52
const Attr & Attribute(const T &rElem) const
Get attribute by element.
Definition: cfl_attrmap.h:464
Attr * Attributep(const T &rElem)
Get attribute reference by element.
Definition: cfl_attrmap.h:446
void AttributeTry(const T &rElem, const Type &attr)
Set attribute.
Definition: cfl_attrmap.h:499
const Attr * AttributeType(void) const
Attribute typeinfo.
Definition: cfl_attrmap.h:438
Iterator class for high-level api to TBaseSet.
Definition: cfl_baseset.h:387
STL style set template.
Definition: cfl_baseset.h:93
Set of Transitions.
Definition: cfl_transset.h:242
Iterator EndByEvX2(Idx ev, Idx x2) const
Iterator to first Transition after specified event and next state.
Iterator Begin(void) const
Iterator to begin of set.
Iterator End(void) const
Iterator to end of set.
bool ExistsByX1OrX2(Idx x) const
Tests if a transition with specified predecessor or successor state exists.
bool Insert(Idx x1, Idx ev, Idx x2)
Add a Transition by indices.
Iterator Find(Idx x1, Idx ev, Idx x2) const
Find transition given by x1, ev, x2.
void EraseByEv(Idx ev)
Remove all transitions containing event ev.
bool Erase(Idx x1, Idx ev, Idx x2)
Remove a Transition by x1, ev, x2.
Iterator Find(const Transition &t) const
Find specified transition.
Iterator BeginByX2Ev(Idx x2, Idx ev) const
Iterator to first Transition specified by successor x2 and ev.
Iterator Begin(Idx x1) const
Iterator to first Transition specified by current state.
void EraseByX1(Idx x1)
Remove all transitions containing predecessor state x1.
TTransSet(void)
Construct an empty TTransSet object.
virtual void DoWrite(TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
Write to TokenWriter, see Type::Write for public wrappers.
EventSet ActiveEvents(Idx x1, SymbolTable *pSymTab=NULL) const
Get set of events that are active for a specified current state Since a transition set does not refer...
Iterator Begin(Idx x1, Idx ev) const
Iterator to first Transitions specified by current state and event.
StateSet SuccessorStates(const StateSet &rX1Set) const
Get set of successor states for specified current states.
TTransSet(const TTransSet< Cmp > &rOtherSet)
Copy-constructor.
bool Exists(const Transition &t) const
Test existence.
void EraseByX2(Idx x2)
Remove all transitions containing successor state x2.
Iterator BeginByEvX1(Idx ev, Idx x1) const
Iterator to first Transition specified by event and current state.
Iterator End(Idx x1, Idx ev) const
Iterator to first Transition after spcified current state and event.
StateSet SuccessorStates(Idx x1, Idx ev) const
Get set of successor states for specified current state and event.
void RestrictStates(const StateSet &rStateSet)
Restrict to transitions with states as specified.
Iterator EndByEv(Idx ev) const
Iterator to first Transition after specified by event.
Iterator EndByEvX1(Idx ev, Idx x1) const
Iterator to first Transition after specified ev and current state.
Iterator EndByX2Ev(Idx x2, Idx ev) const
Iterator to first Transition after specified successor x2 and ev.
StateSet States(void) const
Get state set covered by transition set.
Iterator BeginByX2(Idx x2) const
Iterator to first Transition specified by successor state x2.
TTransSet(const TTransSet< OtherCmp > &res)
Re-Sort Copy-constructor.
void EraseByX1Ev(Idx x1, Idx ev)
Remove all transitions containing predecessor state x1 and event ev.
Iterator BeginByEv(Idx ev) const
Iterator to first Transition specified by event.
bool Insert(const Transition &rTransition)
Add a Transition.
Iterator EndByX2(Idx x2) const
Iterator to first Transition after specified successor state x2.
bool ExistsByX1Ev(Idx x1, Idx ev) const
Test existence.
Iterator Inject(const Iterator &pos, const Transition &rTransition)
Add a Transition.
bool Exists(Idx x1, Idx ev, Idx x2) const
Test existence.
Iterator Erase(const Iterator &it)
Remove a Transition by iterator.
void DoAssign(const TTransSet &rSource)
Assign my members.
virtual ~TTransSet()
Virtual destructor.
Definition: cfl_transset.h:269
void Inject(const Transition &rTransition)
Add a Transition.
bool Erase(const Transition &t)
Remove a Transition.
StateSet SuccessorStates(Idx x1) const
Get set of successor states for specified current state.
void EraseByX1OrX2(const StateSet &rStates)
Remove all transitions containing a specified state.
void RestrictEvents(const EventSet &rEventSet)
Restrict to transitions with events as specified.
void EraseByX1OrX2(Idx x)
Remove all transitions containing state x, This function iterates over all transitions to work with a...
TBaseSet< Transition, Cmp >::Iterator Iterator
Iterator on transition.
Definition: cfl_transset.h:269
Iterator End(Idx x1) const
Iterator to end or Transitions with specified current state.
StateSet SuccessorStates(const StateSet &rX1Set, const EventSet &rEvSet) const
Get set of successor states for specified current states and events.
std::string Str(const Transition &rTrans) const
Return pretty printable string representation.
void ReSort(TTransSet< OtherCmp > &res) const
Get copy of trantision relation sorted by other compare operator, e.g.
bool ExistsByX1(Idx x1) const
Test existence.
Iterator BeginByEvX2(Idx ev, Idx x2) const
Iterator to first Transition specified by event and next state.
Set of Transitions with attributes.
Definition: cfl_transset.h:991
virtual TaTransSet & Assign(const TBaseSet< Transition, TransSort::X1EvX2 > &rSrc)
Relaxed assignment method.
virtual ~TaTransSet()
Virtual destructor.
virtual TaTransSet & operator=(const TransSet &rSrc)
Relaxed assignment operator.
Attr * Attributep(const Transition &rElem)
TTransSet< TransSort::X1EvX2 >::Iterator Iterator
Iterator on transition.
void DoAssign(const TaTransSet &rSource)
Assign my members.
void AttributeTry(const Transition &rElem, const Type &rAttr)
Attribute access.
void Attribute(const Transition &rElem, const Attr &rAttr)
const Attr * AttributeType(void) const
resolve ambiguities from attribute interface ("using" wont do the job)
void Attribute(const Transition &rElem, const Type &rAttr)
const Attr & Attribute(const Transition &rElem) const
A TokenWriter writes sequential tokens to a file, a string or stdout.
void WriteEnd(const std::string &rLabel)
Write end label.
int Columns(void) const
Get number of columns in a line.
void WriteBegin(const std::string &rLabel)
Write begin label.
Alternative ordering of Transitions.
Definition: cfl_transset.h:123
Triple (X1,Ev,X2) to represent current state, event and next state.
Definition: cfl_transset.h:57
Transition(Idx x1, Idx ev, Idx x2)
Construct from values.
Definition: cfl_transset.h:73
Idx X1
Current state.
Definition: cfl_transset.h:99
bool Valid(void) const
Test validity (all indices !=0)
Definition: cfl_transset.h:97
std::string Str(void) const
Pretty print to string.
Definition: cfl_transset.h:111
Transition(void)
Construct invalid Transition.
Definition: cfl_transset.h:62
Idx X2
Next state.
Definition: cfl_transset.h:108
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const
Write configuration data to a string.
Definition: cfl_types.cpp:169
virtual Type & Assign(const Type &rSrc)
Assign configuration data from other object.
Definition: cfl_types.cpp:77
TTransSet< TransSort::EvX2X1 > TransSetEvX2X1
Type definition for ev, x2, x1 sorted TTransSet.
Definition: cfl_transset.h:963
TTransSet< TransSort::X1EvX2 > TransSetX1EvX2
Type definition for default sorted TTransSet.
Definition: cfl_transset.h:957
bool Empty(void) const
Test whether if the TBaseSet is Empty.
Definition: cfl_baseset.h:1824
bool Exists(const T &rElem) const
Test existence of element.
Definition: cfl_baseset.h:2115
virtual void Clear(void)
Clear all set.
Definition: cfl_baseset.h:1902
TTransSet< TransSort::X1EvX2 > TransSet
Type definition for default sorted TTransSet.
Definition: cfl_transset.h:954
TTransSet< TransSort::X2EvX1 > TransSetX2EvX1
Type definition for x2, ev, x1 sorted TTransSet.
Definition: cfl_transset.h:966
Iterator End(void) const
Iterator to the end of set.
Definition: cfl_baseset.h:1896
TTransSet< TransSort::X1X2Ev > TransSetX1X2Ev
Type definition for x1, x2, ev sorted TTransSet.
Definition: cfl_transset.h:972
virtual void RestrictSet(const TBaseSet &rOtherSet)
Restrict elements given by other set.
Definition: cfl_baseset.h:2064
virtual void InsertSet(const TBaseSet &rOtherSet)
Insert elements given by rOtherSet.
Definition: cfl_baseset.h:1987
Iterator Begin(void) const
Iterator to the begin of set.
Definition: cfl_baseset.h:1891
TTransSet< TransSort::EvX1X2 > TransSetEvX1X2
Type definition for ev, x1, x2 sorted TTransSet.
Definition: cfl_transset.h:960
TTransSet< TransSort::X2X1Ev > TransSetX2X1Ev
Type definition for x2, x1, ev sorted TTransSet.
Definition: cfl_transset.h:969
virtual void EraseSet(const TBaseSet &rOtherSet)
Erase elements given by other set.
Definition: cfl_baseset.h:2042
Idx Size(void) const
Get Size of TBaseSet.
Definition: cfl_baseset.h:1819
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
std::string ToStringInteger(Int number)
integer to string
Definition: cfl_helper.cpp:43
Binary predicate for sorting transitions in order Ev, X1, X2.
Definition: cfl_transset.h:128
Binary predicate for sorting transitions in order Ev, X2, X1.
Definition: cfl_transset.h:140
Binary predicate for sorting transitions in order X1, Ev, X2.
Definition: cfl_transset.h:188
Binary predicate for sorting transitions in order X1, X2, Ev.
Definition: cfl_transset.h:176
Binary predicate for sorting transitions in order X2, Ev, X1.
Definition: cfl_transset.h:152
Binary predicate for sorting transitions in order X2, X1, Ev.
Definition: cfl_transset.h:164

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