14 #ifndef FAUDES_TP_TPARALLEL_H
15 #define FAUDES_TP_TPARALLEL_H
23 #define TEMP template < \
24 class GlobalAttr1, class StateAttr1, class EventAttr1, class TransAttr1, \
25 class GlobalAttr2, class StateAttr2, class EventAttr2, class TransAttr2, \
26 class GlobalAttrR, class StateAttrR, class EventAttrR, class TransAttrR >
28 #define TGEN1 TtGenerator<GlobalAttr1,StateAttr1,EventAttr1,TransAttr1>
29 #define TGEN2 TtGenerator<GlobalAttr2,StateAttr2,EventAttr2,TransAttr2>
30 #define TGENR TtGenerator<GlobalAttrR,StateAttrR,EventAttrR,TransAttrR>
75 std::map< std::pair<Idx,Idx>,
Idx>& rReverseCompositionMap,
91 std::map< std::pair<Idx,Idx>,
Idx> rcmap;
99 std::map< std::pair<Idx,Idx>,
Idx>& rReverseCompositionMap,
102 FD_DF(
"TParallel(" << &rGen1 <<
"," << &rGen2 <<
")");
105 Parallel( rGen1, rGen2, rReverseCompositionMap, rResGen);
110 FD_DF(
"TParallel(" << &rGen1 <<
"," << &rGen2 <<
"): clocks:" << clocks12.
ToString());
111 FD_DF(
"TParallel(" << &rGen1 <<
"," << &rGen2 <<
"): clocks:" << rGen1.Clocks().ToString());
112 rResGen.InjectClocks(clocks12);
114 std::map< std::pair<Idx,Idx>,
Idx>::const_iterator rcit;
115 for(rcit=rReverseCompositionMap.begin(); rcit!=rReverseCompositionMap.end(); rcit++) {
116 Idx x1=rcit->first.first;
117 Idx x2=rcit->first.second;
118 Idx x12=rcit->second;
119 if(!rResGen.ExistsState(x12))
continue;
121 invariant12 << rGen1.Invariant(x1);
122 invariant12 << rGen2.Invariant(x2);
123 FD_DF(
"TParallel(" << &rGen1 <<
"," << &rGen2 <<
"): invariant " << x1 <<
"|" << x2
125 rResGen.Invariant(x12,invariant12);
128 std::map< Idx, std::pair<Idx,Idx> > compositionmap;
129 for(rcit=rReverseCompositionMap.begin(); rcit!=rReverseCompositionMap.end(); rcit++)
130 compositionmap[rcit->second]=rcit->first;
133 for(tit=rResGen.TransRelBegin(); tit!=rResGen.TransRelEnd(); tit++) {
138 if(rGen1.ExistsEvent(tit->Ev)) {
140 t1.
X1=compositionmap[tit->X1].first;
142 t1.
X2=compositionmap[tit->X2].first;
143 FD_DF(
"TParallel(" << &rGen1 <<
"," << &rGen2 <<
"): guard/resets in Gen1 for " << t1.
Str());
144 guard.
Insert(rGen1.Guard(t1));
148 if(rGen2.ExistsEvent(tit->Ev)) {
150 t2.
X1=compositionmap[tit->X1].second;
152 t2.
X2=compositionmap[tit->X2].second;
153 FD_DF(
"TParallel(" << &rGen1 <<
"," << &rGen2 <<
"): guard/resets in Gen2 for " << t2.
Str());
154 guard.
Insert(rGen2.Guard(t2));
157 FD_DF(
"TParallel(" << &rGen1 <<
"," << &rGen2 <<
"): guard " << tit->Str()
159 rResGen.Guard(*tit,guard);
160 FD_DF(
"TParallel(" << &rGen1 <<
"," << &rGen2 <<
"): resets " << tit->Str()
162 rResGen.Resets(*tit,resets);
164 FD_DF(
"TParallel: done ");
#define FD_DF(message)
Debug: optional report on user functions.
Container class to model a set of clocks.
virtual void InsertSet(const NameSet &rOtherSet)
Inserts all elements of rOtherSet.
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
Iterator on transition.
A TimeConstraint is a set of elementary clock constraints.
std::string ToString(void) const
Write to a std::string.
Iterator Insert(const ElemConstraint &rElemConstr)
Adds an elementary clock constraint to the time constraint.
Triple (X1,Ev,X2) to represent current state, event and next state.
std::string Str(void) const
Pretty print to string.
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const
Write configuration data to a string.
void Parallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Parallel composition.
void TParallel(const TGEN1 &rGen1, const TGEN2 &rGen2, TGENR &rResGen)
Parallel composition of timed generators.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
Timed generator class TtGenerator.