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

libFAUDES 2.34e --- 2026.03.16 --- c++ api documentaion by doxygen