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 events that are active for a specified current state
895  * Since a transition set does not refer to a SymbolTable, this function
896  * returns a set of plain indices. In order to interpret the set as an EventSet,
897  * the relevant SymbolTable must be supplied as second argument. If obmitting the second
898  * argument, the defult SymbolTable is used.
899  *
900  * @param x1
901  * Current state
902  * @param pSymTab
903  * SymbolTable to refer to
904  *
905  * @return
906  * Set of events.
907  */
908  EventSet ActiveEvents(Idx x1, SymbolTable* pSymTab=NULL) const;
909 
910  /**
911  * Return pretty printable string representation.
912  * Primary meant for debugging messages.
913  *
914  * @param rTrans
915  * Transition to print
916  *
917  * @return
918  * String
919  */
920  std::string Str(const Transition& rTrans) const;
921 
922 
923  /** @} doxygen group */
924 
925  protected:
926 
927 
928  /**
929  * Assign my members.
930  *
931  * @param rSource
932  * Source to copy from
933  */
934  void DoAssign(const TTransSet& rSource);
935 
936  /**
937  * Write to TokenWriter, see Type::Write for public wrappers.
938  *
939  * @param rTw
940  * Reference to TokenWriter
941  * @param rLabel
942  * Label of section to write, defaults to name of set
943  * @param pContext
944  * Write context eg symboltables
945  *
946  * @exception Exception
947  * - IO errors (id 2)
948  */
949 
950  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
951 
952 
953 };
954 
955 /** Type definition for default sorted TTransSet */
957 
958 /** Type definition for default sorted TTransSet */
960 
961 /** Type definition for ev, x1, x2 sorted TTransSet */
963 
964 /** Type definition for ev, x2, x1 sorted TTransSet */
966 
967 /** Type definition for x2, ev, x1 sorted TTransSet */
969 
970 /** Type definition for x2, x1, ev sorted TTransSet */
972 
973 /** Type definition for x1, x2, ev sorted TTransSet */
975 
976 
977 /**
978  * Set of Transitions with attributes.
979  *
980  * This container class is derived from TTransSet to provide attributes as an
981  * additional feature. The template parameter specifies the attribute class,
982  * which in turn must provide some basic funtionality. In contrast to the TTransSet, the TaTransSet
983  * is restricted to standard ordering.
984  *
985  * Note that it is the context of a Generator that
986  * actually allows to interpret a TaTransSet as a set of transitions as opposed to
987  * a set of triples of indices with attributes. In particular, file IO of transitions is provided
988  * by the generator class (although TaTransSet provides output functions for debugging)
989  */
990 
991 
992 template <class Attr>
993 class FAUDES_TAPI TaTransSet : public TransSet, public TAttrMap<Transition,Attr,TransSort::X1EvX2> {
994 
996 
997 public:
998 
999  using TransSet::operator=;
1000  using TransSet::operator==;
1001  using TransSet::operator!=;
1002 
1003 
1004  /** @name Constructors & Destructor */
1005  /** @{ doxygen group */
1006 
1007  /** Construct an empty TaTransSet object */
1008  TaTransSet(void);
1009 
1010  /**
1011  * Copy-constructor (incl attributes)
1012  */
1013  TaTransSet(const TaTransSet& rOtherSet);
1014 
1015  /**
1016  * Copy-Constructor (set attributes to default)
1017  */
1018  TaTransSet(const TTransSet<TransSort::X1EvX2>& rOtherSet);
1019 
1020  /** Virtual destructor */
1021  virtual ~TaTransSet() {}
1022 
1023  /** Relaxed assignment method.
1024  *
1025  * Runtime typecheck for TransSet, maintains attributes provided they can be casted.
1026  *
1027  * @param rSrc
1028  * Source from which to assign
1029  * @return
1030  * Ref to this set
1031  */
1032  virtual TaTransSet& Assign(const TBaseSet<Transition,TransSort::X1EvX2>& rSrc);
1033 
1034  /** Relaxed assignment operator.
1035  *
1036  * @param rSrc
1037  * Source from which to assign
1038  * @return
1039  * Ref to this set
1040  */
1041  virtual TaTransSet& operator=(const TransSet& rSrc) {return Assign(rSrc);}
1042 
1043  /** @} doxygen group */
1044 
1045 
1046 
1047  /** @name Accessing individual transitions */
1048  /** @{ doxygen group */
1049 
1050  /** Iterator on transition */
1052 
1053  /**
1054  * Add a Transition by indices
1055  *
1056  * @param x1
1057  * Predecessor state
1058  * @param ev
1059  * Event
1060  * @param x2
1061  * Successor state
1062  *
1063  * @return
1064  * True if the transition was new to the set
1065  */
1066  bool Insert(Idx x1, Idx ev, Idx x2);
1067 
1068  /**
1069  * Add a Transition directly. If the transition already
1070  * exists, the attribute is maintained. Otherwise, the transition
1071  * is inserted with default attribute.
1072  *
1073  * @param rTransition
1074  * Reference to transition object
1075  *
1076  * @return
1077  * True if the transition was new to the set
1078  */
1079  bool Insert(const Transition& rTransition);
1080 
1081  /**
1082  * Add a Transition with attribute.
1083  *
1084  * @param rTransition
1085  * Reference to transition object
1086  * @param rAttr
1087  * Reference to attribute
1088  *
1089  * @return
1090  * True if the transition was new to the set
1091  */
1092  bool Insert(const Transition& rTransition, const Attr& rAttr);
1093 
1094  /**
1095  * Inserts elements of rOtherSet.
1096  *
1097  * Attributes of this set are maintained, newly inserted elements attain the
1098  * attribute from rOtherSet if it can be casted appropriately.
1099  *
1100  *
1101  * @param rOtherSet
1102  * Other IndexSet
1103  */
1104  virtual void InsertSet(const TransSet& rOtherSet);
1105 
1106  /**
1107  * Inserts elements of rOtherSet.
1108  *
1109  * This variant uses a runtime cast to access attributes.
1110  *
1111  * @param rOtherSet
1112  * Other IndexSet
1113  * @exception Exception
1114  * - cast failed (id 67)
1115  */
1116  virtual void InsertSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1117 
1118  /**
1119  * Remove a Transition
1120  *
1121  * @return
1122  * True if transition did exist
1123  */
1124  bool Erase(const Transition& t);
1125 
1126  /**
1127  * Remove a Transition
1128  *
1129  * @return
1130  * True if transition did exist
1131  */
1132  bool Erase(Idx x1, Idx ev, Idx x2);
1133 
1134  /**
1135  * Remove a Transition by iterator
1136  *
1137  * @return
1138  * Iterator to next transition
1139  */
1140  Iterator Erase(const Iterator& it);
1141 
1142  /**
1143  * Inserts elements of rOtherSet.
1144  *
1145  * Attributes of this set are maintained.
1146  *
1147  *
1148  * @param rOtherSet
1149  * Other IndexSet
1150  */
1151  virtual void EraseSet(const TransSet& rOtherSet);
1152 
1153  /**
1154  * Inserts elements of rOtherSet.
1155  *
1156  * This variant uses a runtime cast to access attributes.
1157  *
1158  * @param rOtherSet
1159  * Other IndexSet
1160  * @exception Exception
1161  * - cast failed (id 67)
1162  */
1163  virtual void EraseSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1164 
1165 
1166  /**
1167  * Restrict to specified subset.
1168  *
1169  * Erases any elements no in the specified set. This function
1170  * ignores the attributes of the other set and maintains the attributes
1171  * of the remaining elements in this set.
1172  *
1173  * @param rOtherSet
1174  * Elements to erase
1175  */
1176  void RestrictSet(const TransSet& rOtherSet);
1177 
1178 
1179  /**
1180  * Restrict to specified subset.
1181  *
1182  * This variant uses a runtime cast to access attributes.
1183  *
1184  * @param rOtherSet
1185  * Elements to erase
1186  */
1187  void RestrictSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet);
1188 
1189 
1190 
1191 
1192  /** resolve ambiguities from attribute interface ("using" wont do the job) */
1195  const Attr& Attribute(const Transition& rElem) const { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem); };
1196  void Attribute(const Transition& rElem, const Attr& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem,rAttr); };
1197  void Attribute(const Transition& rElem, const Type& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::Attribute(rElem,rAttr); };
1198  void AttributeTry(const Transition& rElem, const Type& rAttr) { return TAttrMap<Transition,Attr,TransSort::X1EvX2>::AttributeTry(rElem,rAttr); };
1199 
1200 
1201  /** @} doxygen group */
1202 
1203 
1204  protected:
1205 
1206  /**
1207  * Assign my members. Maintain attributes.
1208  *
1209  * @param rSource
1210  * Source to copy from
1211  */
1212  void DoAssign(const TaTransSet& rSource);
1213 
1214 };
1215 
1216 /** @} doxygen group*/
1217 
1218 
1219 /*
1220 *************************************************************************************************
1221 *************************************************************************************************
1222 * Implementation of transset without attributes
1223 *************************************************************************************************
1224 *************************************************************************************************
1225 */
1226 
1227 
1228 /* convenience access to relevant scopes */
1229 #define THIS TTransSet<Cmp>
1230 #define TEMP template<class Cmp>
1231 #define BASE TBaseSet<Transition,Cmp>
1232 
1233 // std faudes type
1235 
1236 // TTransSet(void)
1238 {
1239  FD_DC("TTransSet(" << this << ")::TTransSet()");
1240 }
1241 
1242 // TTransSet(othertransrel)
1243 //TEMP THIS::TTransSet(const TBaseSet<Transition,Cmp>& rOtherSet) :
1244  TEMP THIS::TTransSet(const TTransSet<Cmp>& rOtherSet) :
1245  BASE()
1246 {
1247  FD_DC("TTransSet(" << this << ")::TTransSet(rOtherSet "<< &rOtherSet <<")");
1248  Assign(rOtherSet);
1249 }
1250 
1251 // TTransSet(othertransrel othersort)
1252 TEMP template<class OtherCmp>
1253 THIS::TTransSet(const TTransSet<OtherCmp>& rOtherSet) :
1254  BASE()
1255 {
1256  FD_DC("TTransSet(" << this << ")::TTransSet(rOtherSet/ReSort "<< &rOtherSet <<")");
1257  rOtherSet.ReSort(*this);
1258 }
1259 
1260 // assignment (maintain attributes)
1261 TEMP void THIS::DoAssign(const TTransSet& rSourceSet) {
1262  FD_DC("TTransSet(" << this << ")::DoAssign(..)");
1263  // call base (incl attributes if the have identival type)
1264  BASE::DoAssign(rSourceSet);
1265 }
1266 
1267 // iterator Begin() const
1268 TEMP typename THIS::Iterator THIS::Begin(void) const {
1269  return BASE::Begin();
1270 }
1271 
1272 // iterator End() const
1273 TEMP typename THIS::Iterator THIS::End(void) const {
1274  return BASE::End();
1275 }
1276 
1277 
1278 // Convenience macro for order typecheck
1279 #define SORT_EXCEPTION { std::stringstream errstr; \
1280  errstr << "Transition set order mismatch " << std::endl; \
1281  throw Exception("TransSet::Iterator()", errstr.str(), 68); }
1282 
1283 
1284 // iterator Begin(x1) const
1285 TEMP typename THIS::Iterator THIS::Begin(Idx x1) const {
1286 #ifdef FAUDES_CHECKED
1287  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1288  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1290 #endif
1291  Transition tlx(x1,0,0);
1292  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1293 }
1294 
1295 // iterator End(x1) const
1296 TEMP typename THIS::Iterator THIS::End(Idx x1) const {
1297 #ifdef FAUDES_CHECKED
1298  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1299  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1301 #endif
1302  Transition tlx(x1+1,0,0);
1303  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1304 }
1305 
1306 // iterator Begin(x1,ev) const
1307 TEMP typename THIS::Iterator THIS::Begin(Idx x1, Idx ev) const {
1308 #ifdef FAUDES_CHECKED
1309  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1311 #endif
1312  Transition tlx(x1,ev,0);
1313  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1314 }
1315 
1316 // iterator End(x1,ev) const
1317 TEMP typename THIS::Iterator THIS::End(Idx x1, Idx ev) const {
1318 #ifdef FAUDES_CHECKED
1319  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1321 #endif
1322  Transition tlx(x1,ev+1, 0);
1323  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1324 }
1325 
1326 // iterator BeginByEv(ev) const
1327 TEMP typename THIS::Iterator THIS::BeginByEv(Idx ev) const {
1328 #ifdef FAUDES_CHECKED
1329  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1330  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1332 #endif
1333  Transition tlx(0,ev,0);
1334  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1335 }
1336 
1337 // iterator EndByEv(ev) const
1338 TEMP typename THIS::Iterator THIS::EndByEv(Idx ev) const {
1339 #ifdef FAUDES_CHECKED
1340  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1341  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1343 #endif
1344  Transition tlx(0,ev+1,0);
1345  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1346 }
1347 
1348 // iterator BeginByEvX1(ev,x1) const
1349 TEMP typename THIS::Iterator THIS::BeginByEvX1(Idx ev, Idx x1) const {
1350 #ifdef FAUDES_CHECKED
1351  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1353 #endif
1354  Transition tlx(x1,ev,0);
1355  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1356 }
1357 
1358 // iterator EndByEvX1(ev,x1) const
1359 TEMP typename THIS::Iterator THIS::EndByEvX1(Idx ev, Idx x1) const {
1360 #ifdef FAUDES_CHECKED
1361  if(typeid(Cmp)!=typeid(TransSort::EvX1X2))
1363 #endif
1364  Transition tlx(x1+1,ev,0);
1365  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1366 }
1367 
1368 // iterator BeginByEvX2(ev,x2) const
1369 TEMP typename THIS::Iterator THIS::BeginByEvX2(Idx ev, Idx x2) const {
1370 #ifdef FAUDES_CHECKED
1371  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1373 #endif
1374  Transition tlx(0,ev,x2);
1375  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1376 }
1377 
1378 // iterator EndByEvX2(ev,x2) const
1379 TEMP typename THIS::Iterator THIS::EndByEvX2(Idx ev, Idx x2) const {
1380 #ifdef FAUDES_CHECKED
1381  if(typeid(Cmp)!=typeid(TransSort::EvX2X1))
1383 #endif
1384  Transition tlx(0,ev,x2+1);
1385  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1386 }
1387 
1388 // iterator BeginByX2(x2) const
1389 TEMP typename THIS::Iterator THIS::BeginByX2(Idx x2) const {
1390 #ifdef FAUDES_CHECKED
1391  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1392  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1394 #endif
1395  Transition tlx(0,0,x2);
1396  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1397 }
1398 
1399 // iterator EndByX2(x2) const
1400 TEMP typename THIS::Iterator THIS::EndByX2(Idx x2) const {
1401 #ifdef FAUDES_CHECKED
1402  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1403  if(typeid(Cmp)!=typeid(TransSort::X2X1Ev))
1405 #endif
1406  Transition tlx(0,0,x2+1);
1407  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1408 }
1409 
1410 // iterator BeginByX2Ev(x2,ev) const
1411 TEMP typename THIS::Iterator THIS::BeginByX2Ev(Idx x2, Idx ev) const {
1412 #ifdef FAUDES_CHECKED
1413  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1415 #endif
1416  Transition tlx(0,ev,x2);
1417  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1418 }
1419 
1420 // iterator EndByX2Ev(x2,ev) const
1421 TEMP typename THIS::Iterator THIS::EndByX2Ev(Idx x2, Idx ev) const {
1422 #ifdef FAUDES_CHECKED
1423  if(typeid(Cmp)!=typeid(TransSort::X2EvX1))
1425 #endif
1426  Transition tlx(0,ev+1,x2);
1427  return THIS::ThisIterator(BASE::pSet->lower_bound(tlx));
1428 }
1429 
1430 // operator+
1431 TEMP THIS THIS::operator+ (const TTransSet<Cmp>& rOtherSet) const {
1432  TTransSet<Cmp> res(*this);
1433  res.InsertSet(rOtherSet);
1434  return res;
1435 }
1436 
1437 // operator-
1438 TEMP THIS THIS::operator- (const TTransSet<Cmp>& rOtherSet) const {
1439  TTransSet<Cmp> res(*this);
1440  res.EraseSet(rOtherSet);
1441  return res;
1442 }
1443 
1444 
1445 // operator*
1446 TEMP TTransSet<Cmp> THIS::operator* (const TTransSet<Cmp>& rOtherSet) const {
1447  TTransSet<Cmp> res(*this);
1448  res.RestrictSet(rOtherSet);
1449  return res;
1450 }
1451 
1452 
1453 // DoWrite(rw,label)
1454 TEMP void THIS::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const
1455 {
1456  (void) pContext;
1457  std::string label=rLabel;
1458  if(label=="") label=BASE::Name();
1459  rTw.WriteBegin(label);
1460  int oldcolumns = rTw.Columns();
1461  rTw.Columns(3);
1462 
1463  Iterator tit;
1464  for (tit = Begin(); tit != End(); ++tit) {
1465  rTw << tit->X1; rTw << tit->Ev; rTw << tit->X2;
1466  }
1467 
1468  rTw.WriteEnd(label);
1469  rTw.Columns(oldcolumns);
1470 }
1471 
1472 
1473 // Insert(transition)
1474 TEMP bool THIS::Insert(const Transition& t) {
1475  return BASE::Insert(t);
1476 }
1477 
1478 // Insert(x1,ev,x2)
1479 TEMP bool THIS::Insert(Idx x1, Idx ev, Idx x2) {
1480  FD_DC("TTransSet(" << this << ")::Insert(" << x1 << "-" << ev << "-" << x2 << ")");
1481  return BASE::Insert(Transition(x1, ev, x2));
1482 }
1483 
1484 // Inject(transition)
1485 TEMP typename THIS::Iterator THIS::Inject(const Iterator& pos, const Transition& t) {
1486  return BASE::Inject(pos,t);
1487 }
1488 
1489 // Inject(transition)
1490 TEMP void THIS::Inject(const Transition& t) {
1491  BASE::Inject(t);
1492 }
1493 
1494 
1495 // Erase(transition)
1496 TEMP bool THIS::Erase(const Transition& t) {
1497  FD_DC("TTransSet(" << this << ")::Erase(" << t.Str() << " [t])");
1498  return BASE::Erase(t);
1499 }
1500 
1501 // Erase(x1,ev,x2)
1502 TEMP bool THIS::Erase(Idx x1, Idx ev, Idx x2) {
1503  FD_DC("TTransSet(" << this << ")::Erase(" << x1 << "-" << ev << "-" << x2 << ")");
1504  return BASE::Erase(Transition(x1, ev, x2));
1505 }
1506 
1507 // Erase(it)
1508 TEMP typename THIS::Iterator THIS::Erase(const Iterator& it) {
1509  FD_DC("TTransSet(" << this << ")::Erase(" << this->Str(*it) << " [it])");
1510  return BASE::Erase(it);
1511 }
1512 
1513 // EraseByX1(x)
1514 TEMP void THIS::EraseByX1(Idx x1) {
1515  FD_DC("TTransSet(" << this << ")::EraseByX1(" << x1 << ")");
1516 #ifdef FAUDES_CHECKED
1517  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1518  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1520 #endif
1521  this->Detach();
1522  typename BASE::iterator lower, upper, it;
1523  Transition tl(x1,0,0);
1524  Transition tu(x1+1,0,0);
1525  lower = BASE::pSet->lower_bound(tl);
1526  upper = BASE::pSet->upper_bound(tu);
1527  if(this->AttributesSize()!=0)
1528  for(it=lower; it!=upper; ++it)
1529  BASE::ClrAttribute(*it);
1530  BASE::pSet->erase(lower, upper);
1531 }
1532 
1533 // EraseByX1Ev(x,e)
1534 TEMP void THIS::EraseByX1Ev(Idx x1, Idx ev) {
1535  FD_DC("TTransSet(" << this << ")::EraseByX1Ev(" << x1 << "," << ev << ")");
1536 #ifdef FAUDES_CHECKED
1537  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1539 #endif
1540  this->Detach();
1541  typename BASE::iterator lower, upper, it;
1542  Transition tl(x1,ev,0);
1543  Transition tu(x1,ev+1,0);
1544  lower = BASE::pSet->lower_bound(tl);
1545  upper = BASE::pSet->upper_bound(tu);
1546  if(this->AttributesSize()!=0)
1547  for(it=lower; it!=upper; ++it)
1548  BASE::ClrAttribute(*it);
1549  BASE::pSet->erase(lower, upper);
1550 }
1551 
1552 // EraseByX2(x)
1553 TEMP void THIS::EraseByX2(Idx x2) {
1554  FD_DC("TTransSet(" << this << ")::EraseByX2(" << x2 << ")");
1555  this->Detach();
1556  bool doattr = (this->AttributesSize()!=0);
1557  typename BASE::iterator it;
1558  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1559  if(it->X2 == x2) {
1560  if(doattr) BASE::ClrAttribute(*it);
1561  BASE::pSet->erase(it++);
1562  continue;
1563  }
1564  it++;
1565  }
1566 }
1567 
1568 // EraseByEv(ev)
1569 TEMP void THIS::EraseByEv(Idx ev) {
1570  FD_DC("TTransSet(" << this << ")::EraseByEv(" << ev << ")");
1571  this->Detach();
1572  bool doattr = (this->AttributesSize()!=0);
1573  typename BASE::iterator it;
1574  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1575  if (it->Ev == ev) {
1576  if(doattr) BASE::ClrAttribute(*it);
1577  BASE::pSet->erase(it++);
1578  continue;
1579  }
1580  it++;
1581  }
1582 }
1583 
1584 
1585 // EraseByX1OrX2(x)
1586 TEMP void THIS::EraseByX1OrX2(Idx x) {
1587  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(" << x << ")");
1588  this->Detach();
1589  bool doattr = (this->AttributesSize()!=0);
1590  typename BASE::iterator it;
1591  for(it = BASE::pSet->begin(); it != BASE::pSet->end();) {
1592  if ((it->X1 == x) || (it->X2 == x)) {
1593  if(doattr) BASE::ClrAttribute(*it);
1594  BASE::pSet->erase(it++);
1595  continue;
1596  }
1597  it++;
1598  }
1599  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(" << x << "): done");
1600 }
1601 
1602 
1603 // EraseByX1OrX2(xset)
1604 TEMP void THIS::EraseByX1OrX2(const StateSet& rStates) {
1605  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(#" << rStates.Size() <<")");
1606  this->Detach();
1607  bool doattr = (this->AttributesSize()!=0);
1608  typename BASE::iterator it=BASE::pSet->begin();
1609  while(it != BASE::pSet->end()) {
1610  if(!rStates.Exists(it->X1) && !rStates.Exists(it->X2)) { ++it; continue;}
1611  if(doattr) BASE::ClrAttribute(*it);
1612  BASE::pSet->erase(it++);
1613  }
1614  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(): done");
1615 }
1616 
1617 
1618 // RestrictStates(xset)
1619 TEMP void THIS::RestrictStates(const StateSet& rStates) {
1620  FD_DC("TTransSet(" << this << ")::RestrictByX1AndX2(#" << rStates.Size() <<")");
1621  this->Detach();
1622  bool doattr = (this->AttributesSize()!=0);
1623  typename BASE::iterator it;
1624  it = BASE::pSet->begin();
1625  while(it != BASE::pSet->end()) {
1626  if(rStates.Exists(it->X1) && rStates.Exists(it->X2)) { ++it; continue;}
1627  if(doattr) BASE::ClrAttribute(*it);
1628  BASE::pSet->erase(it++);
1629  }
1630  FD_DC("TTransSet(" << this << ")::EraseByX1OrX2(): done");
1631 }
1632 
1633 
1634 // RestrictEvents(eset)
1635 TEMP void THIS::RestrictEvents(const EventSet& rEvents) {
1636  FD_DC("TTransSet(" << this << ")::RestrictEvents(#" << rEvents.Size() <<")");
1637  this->Detach();
1638  bool doattr = (this->AttributesSize()!=0);
1639  typename BASE::iterator it;
1640  it = BASE::pSet->begin();
1641  while(it != BASE::pSet->end()) {
1642  if(rEvents.Exists(it->Ev)) { ++it; continue;}
1643  if(doattr) BASE::ClrAttribute(*it);
1644  BASE::pSet->erase(it++);
1645  }
1646  FD_DC("TTransSet(" << this << ")::RestrictEvents(): done");
1647 }
1648 
1649 
1650 // iterator Find(x1,ev,x2)
1651 TEMP typename THIS::Iterator THIS::Find(Idx x1, Idx ev, Idx x2) const {
1652  return BASE::Find(Transition(x1,ev,x2));
1653 }
1654 
1655 
1656 // iterator Find(t)
1657 TEMP typename THIS::Iterator THIS::Find(const Transition& t) const{
1658  return BASE::Find(t);
1659 }
1660 
1661 // Exists(t)
1662 TEMP bool THIS::Exists(const Transition& t) const {
1663  return BASE::Exists(t);
1664 }
1665 
1666 // Exists(x1, ev, x2)
1667 TEMP bool THIS::Exists(Idx x1, Idx ev, Idx x2) const {
1668  return BASE::Exists(Transition(x1,ev,x2));
1669 }
1670 
1671 // Exists(x)
1672 TEMP bool THIS::ExistsByX1OrX2(Idx x) const {
1673  typename BASE::iterator it;
1674  for(it = BASE::pSet->begin(); it != BASE::pSet->end(); ++it) {
1675  if ((it->X1 == x) || (it->X2 == x)) {
1676  return true;
1677  }
1678  }
1679  return false;
1680 }
1681 
1682 // ExistsByX1Ev(x,e)
1683 TEMP bool THIS::ExistsByX1Ev(Idx x1, Idx ev) const {
1684  FD_DC("TTransSet(" << this << ")::ExistsByX1Ev(" << x1 << "," << ev << ")");
1685 #ifdef FAUDES_CHECKED
1686  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1688 #endif
1689  this->Detach();
1690  typename BASE::iterator lower, upper, it;
1691  Transition tl(x1,ev,0);
1692  Transition tu(x1,ev+1,0);
1693  lower = BASE::pSet->lower_bound(tl);
1694  upper = BASE::pSet->upper_bound(tu);
1695  return lower != upper;
1696 }
1697 
1698 // ExistsByX1(x)
1699 TEMP bool THIS::ExistsByX1(Idx x1) const {
1700  FD_DC("TTransSet(" << this << ")::ExistsByX1(" << x1 << ")");
1701 #ifdef FAUDES_CHECKED
1702  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1703  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1705 #endif
1706  this->Detach();
1707  typename BASE::iterator lower, upper, it;
1708  Transition tl(x1,0,0);
1709  Transition tu(x1+1,0,0);
1710  lower = BASE::pSet->lower_bound(tl);
1711  upper = BASE::pSet->upper_bound(tu);
1712  return lower != upper;
1713 }
1714 
1715 
1716 // ReSort(res)
1717 TEMP template<class OtherCmp>
1718 void THIS::ReSort(TTransSet<OtherCmp>& res) const {
1719  Iterator it;
1720  res.Clear();
1721  for (it = Begin(); it != End(); ++it) {
1722  res.Insert(*it);
1723  }
1724 }
1725 
1726 // States()
1727 TEMP StateSet THIS::States(void) const {
1728  StateSet states;
1729  Iterator it;
1730  for (it=Begin(); it!=End(); ++it) {
1731  states.Insert(it->X1);
1732  states.Insert(it->X2);
1733  }
1734  return states;
1735 }
1736 
1737 // SuccessorStates(x1)
1738 TEMP StateSet THIS::SuccessorStates(Idx x1) const {
1739 #ifdef FAUDES_CHECKED
1740  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1741  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1743 #endif
1744  StateSet states;
1745  Iterator it = Begin(x1);
1746  Iterator it_end = End(x1);
1747  while (it != it_end) {
1748  states.Insert(it->X2);
1749  ++it;
1750  }
1751  return states;
1752 }
1753 
1754 // SuccessorStates(x1set)
1755 TEMP StateSet THIS::SuccessorStates(const StateSet& rX1Set) const {
1756 #ifdef FAUDES_CHECKED
1757  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1758  if(typeid(Cmp)!=typeid(TransSort::X1X2Ev))
1760 #endif
1761  StateSet states;
1762  StateSet::Iterator sit= rX1Set.Begin();
1763  StateSet::Iterator sit_end= rX1Set.End();
1764  for(;sit!=sit_end; ++sit) {
1765  Iterator tit = Begin(*sit);
1766  Iterator tit_end = End(*sit);
1767  while(tit!=tit_end) {
1768  states.Insert(tit->X2);
1769  ++tit;
1770  }
1771  }
1772  return states;
1773 }
1774 
1775 // SuccessorStates(x1, ev)
1776 TEMP StateSet THIS::SuccessorStates(Idx x1, Idx ev) const {
1777 #ifdef FAUDES_CHECKED
1778  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1780 #endif
1781  StateSet states;
1782  Iterator it = Begin(x1, ev);
1783  Iterator it_end = End(x1, ev);
1784  while (it != it_end) {
1785  states.Insert(it->X2);
1786  ++it;
1787  }
1788  return states;
1789 }
1790 
1791 // SuccessorStates(x1set, evset)
1792 TEMP StateSet THIS::SuccessorStates(const StateSet& rX1Set, const EventSet& rEvSet) const {
1793 #ifdef FAUDES_CHECKED
1794  if(typeid(Cmp)!=typeid(TransSort::X1EvX2))
1796 #endif
1797  StateSet states;
1798  if(rEvSet.Empty()) return states;
1799  StateSet::Iterator sit= rX1Set.Begin();
1800  StateSet::Iterator sit_end= rX1Set.End();
1801  for(;sit!=sit_end; ++sit) {
1802  EventSet::Iterator eit= rEvSet.Begin();
1803  EventSet::Iterator eit_end= rEvSet.End();
1804  Iterator tit = Begin(*sit,*eit);
1805  Iterator tit_end = End(*sit);
1806  while(tit!=tit_end) {
1807  // match
1808  if(tit->Ev == *eit) {
1809  states.Insert(tit->X2);
1810  ++tit;
1811  continue;
1812  }
1813  // tit behind
1814  if(tit->Ev < *eit) {
1815  ++tit;
1816  continue;
1817  }
1818  // tit upfront
1819  ++eit;
1820  if(eit==eit_end) break;
1821  }
1822  }
1823  return states;
1824 }
1825 
1826 // ActiveEvents(x1,pSymTab)
1827 TEMP EventSet THIS::ActiveEvents(Idx x1, SymbolTable* pSymTab) const {
1828  Iterator it = Begin(x1);
1829  Iterator it_end = End(x1);
1830  EventSet result;
1831  if(pSymTab!=NULL) result.SymbolTablep(pSymTab);
1832  for (; it != it_end; ++it) {
1833  result.Insert(it->Ev);
1834  }
1835  return result;
1836 }
1837 
1838 // Prettz printable sring
1839 TEMP std::string THIS::Str(const Transition& rTrans) const {
1840  return rTrans.Str();
1841 }
1842 
1843 
1844 
1845 #undef THIS
1846 #undef TEMP
1847 #undef BASE
1848 
1849 /*
1850 *************************************************************************************************
1851 *************************************************************************************************
1852 * Implementation of transset with attributes
1853 *************************************************************************************************
1854 *************************************************************************************************
1855 */
1856 
1857 
1858 /* convenience access to relevant scopes */
1859 #define THIS TaTransSet<Attr>
1860 #define TEMP template <class Attr>
1861 #define BASE TTransSet<TransSort::X1EvX2>
1862 #define ABASE TAttrMap<Transition,Attr,TransSort::X1EvX2>
1863 
1864 // std faudes type
1866 
1867 // TaTransSet(void)
1869  BASE(),
1870  ABASE(this)
1871 {
1872  FD_DC("TaTransSet(" << this << ")::TaTransSet()");
1873 }
1874 
1875 // TaTransSet(othertransrel)
1876 TEMP THIS::TaTransSet(const TaTransSet& rOtherSet) :
1877  BASE(),
1878  ABASE(this)
1879 {
1880  FD_DC("TaTransSet(" << this << ")::TaTransSet(rOtherSet "<< &rOtherSet <<")");
1881  DoAssign(rOtherSet);
1882 }
1883 
1884 
1885 // TaTransSet(othertransrel)
1886 TEMP THIS::TaTransSet(const BASE& rOtherSet) :
1887  BASE(),
1888  ABASE(this)
1889 {
1890  FD_DC("TaTransSet(" << this << ")::TaTransSet(rOtherSet "<< &rOtherSet <<")");
1891  Assign(rOtherSet);
1892 }
1893 
1894 
1895 // copy to known same attributes
1896 TEMP void THIS::DoAssign(const THIS& rSourceSet) {
1897  // call base incl attributes
1898  BASE::DoAssign(rSourceSet);
1899 }
1900 
1901 // Relaxed Assign()
1902 TEMP THIS& THIS::Assign(const TBaseSet<Transition,TransSort::X1EvX2>& rSourceSet) {
1903  FD_DC("TaTransSet(" << this << ")::Assign([v] " << &rSourceSet<<")");
1904 #ifdef FAUDES_CHECKED
1905  FD_DC("TaTransSet(" << this << ")::Assign(): src at " << &rSourceSet);
1906  FD_DC("TaTransSet(" << this << ")::Assign(): src type " << typeid(rSourceSet).name());
1907  FD_DC("TaTransSet(" << this << ")::Assign(): dst type " << typeid(*this).name());
1908  const TransSet* tset = dynamic_cast<const TransSet*>(&rSourceSet);
1909  if(!tset) {
1910  std::stringstream errstr;
1911  errstr << "cannot cast " << typeid(rSourceSet).name() << " to TransSet" << std::endl;
1912  throw Exception("TaTransSet::Assign", errstr.str(), 67);
1913  }
1914 #endif
1915  // call attribute smart base
1916  ABASE::AssignWithAttributes(rSourceSet);
1917  // done
1918  return *this;
1919 }
1920 
1921 
1922 // Insert(transition)
1923 TEMP bool THIS::Insert(const Transition& t) {
1924  FD_DC("TaTransSet(" << this << ")::Insert(" << t.Str() << ")");
1925  return ABASE::Insert(t);
1926 }
1927 
1928 // Insert(x1,ev,x2)
1929 TEMP bool THIS::Insert(Idx x1, Idx ev, Idx x2) {
1930  FD_DC("TaTransSet(" << this << ")::Insert(" << x1 << "-" << ev << "-" << x2 << ")");
1931  Transition t(x1, ev, x2);
1932  return ABASE::Insert(t);
1933 }
1934 
1935 // Insert(transition,attr)
1936 TEMP bool THIS::Insert(const Transition& t, const Attr& attr) {
1937  return ABASE::Insert(t,attr);
1938 }
1939 
1940 
1941 // InsertSet(set)
1942 TEMP void THIS::InsertSet(const TransSet& rOtherSet) {
1943  FD_DC("TaTransSet(" << this << ")::InsertSet( [a] " << &rOtherSet << ")");
1944  ABASE::InsertSet(rOtherSet);
1945 }
1946 
1947 // InsertSet(set)
1948 TEMP void THIS::InsertSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
1949 #ifdef FAUDES_CHECKED
1950  FD_DC("TaTransSet(" << this << ")::InsertSet(" << rOtherSet.ToString() << ")");
1951  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
1952  if(!tset) {
1953  std::stringstream errstr;
1954  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
1955  throw Exception("TaTransSet::InsertSet", errstr.str(), 67);
1956  }
1957 #endif
1958  ABASE::InsertSet(rOtherSet);
1959 }
1960 
1961 
1962 // Erase(transition)
1963 TEMP bool THIS::Erase(const Transition& t) {
1964  return ABASE::Erase(t);
1965 }
1966 
1967 // Erase(x1,ev,x2)
1968 TEMP bool THIS::Erase(Idx x1, Idx ev, Idx x2) {
1969  FD_DC("TaTransSet(" << this << ")::Erase(" << x1 << "-" << ev << "-" << x2 << ")");
1970  Transition t(x1, ev, x2);
1971  return ABASE::Erase(t);
1972 }
1973 
1974 // Erase(it)
1975 TEMP typename THIS::Iterator THIS::Erase(const Iterator& it) {
1976 #ifdef FAUDES_CHECKED
1977  if (it == End()) {
1978  std::stringstream errstr;
1979  errstr << "iterator out of range " << std::endl;
1980  throw Exception("TTransSet::Erase", errstr.str(), 69);
1981  }
1982 #endif
1983  return ABASE::Erase(it);
1984 }
1985 
1986 // EraseSet(set)
1987 TEMP void THIS::EraseSet(const TransSet& rOtherSet) {
1988  FD_DC("TaTransSet(" << this << ")::RestrictSet( [a] " << &rOtherSet << ")");
1989  ABASE::EraseSet(rOtherSet);
1990 }
1991 
1992 // EraseSet(set)
1993 TEMP void THIS::EraseSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
1994 #ifdef FAUDES_CHECKED
1995  FD_DC("TaTransSet(" << this << ")::EraseSet(" << rOtherSet.ToString() << ")");
1996  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
1997  if(!tset) {
1998  std::stringstream errstr;
1999  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2000  throw Exception("TaTransSet::EraseSet", errstr.str(), 67);
2001  }
2002 #endif
2003  ABASE::EraseSet(rOtherSet);
2004 }
2005 
2006 // RestrictSet(set)
2007 TEMP void THIS::RestrictSet(const TransSet& rOtherSet) {
2008  FD_DC("TaTransSet(" << this << ")::RestrictSet( [a] " << &rOtherSet << ")");
2009  ABASE::RestrictSet(rOtherSet);
2010 }
2011 
2012 
2013 // RestrictSet(set)
2014 TEMP void THIS::RestrictSet(const TBaseSet<Transition,TransSort::X1EvX2>& rOtherSet) {
2015 #ifdef FAUDES_CHECKED
2016  FD_DC("TaTransSet(" << this << ")::RestrictSet(" << rOtherSet.ToString() << ")");
2017  const TransSet* tset = dynamic_cast<const TransSet*>(&rOtherSet);
2018  if(!tset) {
2019  std::stringstream errstr;
2020  errstr << "cannot cast " << typeid(rOtherSet).name() << " to TransSet" << std::endl;
2021  throw Exception("TaTransSet::RestrictSet", errstr.str(), 67);
2022  }
2023 #endif
2024  ABASE::RestrictSet(rOtherSet);
2025 }
2026 
2027 
2028 
2029 #undef THIS
2030 #undef TEMP
2031 #undef BASE
2032 #undef ABASE
2033 
2034 #undef SORT_EXECPTION
2035 
2036 } // namespace faudes
2037 
2038 
2039 
2040 
2041 #endif
2042 
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: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)
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:396
STL style set template.
Definition: cfl_baseset.h:98
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:273
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:273
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:993
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:965
TTransSet< TransSort::X1EvX2 > TransSetX1EvX2
Type definition for default sorted TTransSet.
Definition: cfl_transset.h:959
bool Empty(void) const
Test whether if the TBaseSet is Empty.
Definition: cfl_baseset.h:1833
bool Exists(const T &rElem) const
Test existence of element.
Definition: cfl_baseset.h:2124
virtual void Clear(void)
Clear all set.
Definition: cfl_baseset.h:1911
TTransSet< TransSort::X1EvX2 > TransSet
Type definition for default sorted TTransSet.
Definition: cfl_transset.h:956
TTransSet< TransSort::X2EvX1 > TransSetX2EvX1
Type definition for x2, ev, x1 sorted TTransSet.
Definition: cfl_transset.h:968
Iterator End(void) const
Iterator to the end of set.
Definition: cfl_baseset.h:1905
TTransSet< TransSort::X1X2Ev > TransSetX1X2Ev
Type definition for x1, x2, ev sorted TTransSet.
Definition: cfl_transset.h:974
virtual void RestrictSet(const TBaseSet &rOtherSet)
Restrict elements given by other set.
Definition: cfl_baseset.h:2073
virtual void InsertSet(const TBaseSet &rOtherSet)
Insert elements given by rOtherSet.
Definition: cfl_baseset.h:1996
Iterator Begin(void) const
Iterator to the begin of set.
Definition: cfl_baseset.h:1900
TTransSet< TransSort::EvX1X2 > TransSetEvX1X2
Type definition for ev, x1, x2 sorted TTransSet.
Definition: cfl_transset.h:962
TTransSet< TransSort::X2X1Ev > TransSetX2X1Ev
Type definition for x2, x1, ev sorted TTransSet.
Definition: cfl_transset.h:971
virtual void EraseSet(const TBaseSet &rOtherSet)
Erase elements given by other set.
Definition: cfl_baseset.h:2051
Idx Size(void) const
Get Size of TBaseSet.
Definition: cfl_baseset.h:1828
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_utils.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.32f --- 2024.12.22 --- c++ api documentaion by doxygen