cfl_transset.cpp
Go to the documentation of this file.
1 /* cfl_transset.cpp -- store a set of transitions (transition relation) */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5  Copyright (C) 2006 Bernd Opitz
6  Exclusive copyright is granted to Klaus Schmidt
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
21 
22 
23 #include "cfl_transset.h"
24 
25 namespace faudes {
26 
27 
28 
29 
30 // apply a relabeling map to a TransSet
31 void ApplyRelabelMap(const RelabelMap& rMap, const TransSet& rSet, TransSet& rRes) {
32  TransSet& inselem = *rSet.New();
33  TransSet delelem;
34  NameSet::Iterator tit, tit_end;
35  TransSet::Iterator dit=rSet.Begin();
36  TransSet::Iterator dit_end=rSet.End();
37  for(;dit!=dit_end;++dit) {
38  if(!rMap.Exists(dit->Ev)) continue;
39  delelem.Insert(*dit);
40  const NameSet& target=rMap.Target(dit->Ev);
41  tit=target.Begin();
42  tit_end=target.End();
43  for(;tit!=tit_end;++tit) {
44  Transition trans=*dit;
45  AttributeVoid* attrp = rSet.Attribute(*dit).Copy();
46  trans.Ev= *tit;
47  inselem.Insert(trans);
48  inselem.Attribute(trans,*attrp);
49  delete attrp;
50  }
51  }
52  rRes.Assign(rSet);
53  rRes.EraseSet(delelem);
54  rRes.InsertSet(inselem);
55  delete &inselem;
56 }
57 
58 
59 
60 } //namespace
Classes Transition, TTransSet and TaTransSet.
bool Exists(const Idx &rIndex) const
const NameSet & Target(const Idx &rSrc) const
Iterator Begin(void) const
Iterator End(void) const
bool Insert(const Transition &rTransition)
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
Definition: cfl_transset.h:273
virtual Type & Assign(const Type &rSrc)
Definition: cfl_types.cpp:82
virtual Type * New(void) const
Definition: cfl_types.cpp:54
virtual Type * Copy(void) const
Definition: cfl_types.cpp:60
Iterator End(void) const
Definition: cfl_baseset.h:2098
virtual void InsertSet(const TBaseSet &rOtherSet)
Definition: cfl_baseset.h:2194
Iterator Begin(void) const
Definition: cfl_baseset.h:2093
virtual const AttributeVoid & Attribute(const T &rElem) const
Definition: cfl_baseset.h:2497
virtual void EraseSet(const TBaseSet &rOtherSet)
Definition: cfl_baseset.h:2249
void ApplyRelabelMap(const RelabelMap &rMap, const vGenerator &rGen, vGenerator &rRes)

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