23 std::string& rReportStr)
25 FD_DF(
"IsHioPlantForm("<< rHioPlant.
Name() <<
",...)");
33 rErrEvSet.
Name(
"rErrEvSet");
36 rErrTrSet.
Name(
"rErrTrSet");
39 rErrStSet.
Name(
"rErrStSet");
48 bool finalResult =
true;
50 bool localResult =
true;
62 EventSet::Iterator evit;
63 StateSet::Iterator sit;
67 rReportStr.append(
"#########################################################\n");
68 rReportStr.append(
"########## IsHioPlantForm("+rHioPlant.
Name()+
",...) - test results:\n");
73 rReportStr.append(
"##### fail: generator is not deterministic!\n");
74 if(initStates.
Size()>1) {
75 rErrStSet = initStates;
76 rReportStr.append(
"##### (amongst others, there is more than one initial state)\n");
81 rReportStr.append(
"#####\n");
87 rReportStr.append(
"########## Condition (i):\n");
91 rReportStr.append(
"##### fail: empty YP alphabet.\n");
96 rReportStr.append(
"##### fail: empty UP alphabet.\n");
101 rReportStr.append(
"##### fail: empty YE alphabet.\n");
106 rReportStr.append(
"##### fail: empty UE alphabet.\n");
119 if(!rErrEvSet.
Empty()){
120 rReportStr.append(
"##### fail: found events with missing or ambiguous attribute, see rErrEvSet:\n");
121 rReportStr.append(rErrEvSet.
ToString()+
"\n");
122 rReportStr.append(
"##### Condition (i) failed.\n");
123 rReportStr.append(
"########## Termination due to crucial failure. ##########\n");
124 rReportStr.append(
"#########################################################\n");
127 if(localResult) rReportStr.append(
"##### Condition (i) passed.\n");
128 else rReportStr.append(
"##### Condition (i) failed.\n");
129 rReportStr.append(
"#####\n");
135 rReportStr.append(
"########## Condition (ii):\n");
138 for(sit = accessibleStates.
Begin(); sit != accessibleStates.
End(); ++sit) {
143 bool goodState =
true;
147 if(activeEv.
Empty()) {
155 evit = activeEv.
Begin();
156 isY = rHioPlant.
IsY(*evit);
157 isUp = rHioPlant.
IsUp(*evit);
158 isUe = rHioPlant.
IsUe(*evit);
160 for(; evit != activeEv.
End(); evit++) {
161 if( (isY && !rHioPlant.
IsY(*evit)) ||
162 (isUp && !rHioPlant.
IsUp(*evit)) ||
163 (isUe && !rHioPlant.
IsUe(*evit)) ) {
176 if(!goodState)
continue;
194 if(localResult) rReportStr.append(
"##### Condition (ii) passed.\n");
197 rReportStr.append(
"##### fail: found states with undecidable attribute:\n");
198 rReportStr.append(locErrStSet.
ToString()+
"\n");
200 rReportStr.append(
"##### Condition (ii) failed.\n");
201 rReportStr.append(
"########## Termination due to crucial failure. ##########\n");
202 rReportStr.append(
"###################### No success. ######################\n");
203 rReportStr.append(
"#########################################################\n");
206 rReportStr.append(
"#####\n");
212 rReportStr.append(
"########## Condition (iii):\n");
215 if(!(initStates <= rQYpYe)) {
216 rReportStr.append(
"##### fail: some init state(s) is (are) not a QYpYe-state:\n");
217 locErrStSet=initStates-rQYpYe;
219 rReportStr.append(locErrStSet.
ToString()+
"\n");
224 if(localResult) rReportStr.append(
"##### Condition (iii) passed.\n");
225 else rReportStr.append(
"##### Condition (iii) failed.\n");
226 rReportStr.append(
"#####\n");
233 rReportStr.append(
"########## Condition (iv):\n");
237 for(sit = rQYpYe.
Begin(); sit != rQYpYe.
End(); ++sit) {
240 if( (rHioPlant.
IsYp(tit->Ev) && !(rQUp.
Exists(tit->X2) || rQUe.
Exists(tit->X2)))) {
250 if(localResult) rReportStr.append(
"##### Condition (iv) passed.\n");
252 rReportStr.append(
"##### fail: found YP- or YE-transitions leading to wrong states:\n");
253 rReportStr.append(locErrTrSet.
ToString()+
"\n");
255 rReportStr.append(
"##### Condition (iv) failed.\n");
257 rReportStr.append(
"#####\n");
263 rReportStr.append(
"########## Condition (v):\n");
266 for(sit = rQUp.
Begin(); sit != rQUp.
End(); ++sit) {
268 if(!rQYpYe.
Exists(tit->X2)) {
277 if(localResult) rReportStr.append(
"##### Condition (v) passed.\n");
279 rReportStr.append(
"##### fail: found UP-transitions leading to wrong states:\n");
280 rReportStr.append(locErrTrSet.
ToString()+
"\n");
282 rReportStr.append(
"##### Condition (v) failed.\n");
284 rReportStr.append(
"#####\n");
290 rReportStr.append(
"########## Condition (vi):\n");
293 for(sit = rQUe.
Begin(); sit != rQUe.
End(); ++sit) {
295 if(!rQYpYe.
Exists(tit->X2)) {
304 if(localResult) rReportStr.append(
"##### Condition (vi) passed.\n");
306 rReportStr.append(
"##### fail: found UE-transitions leading to wrong states:\n");
307 rReportStr.append(locErrTrSet.
ToString()+
"\n");
309 rReportStr.append(
"##### Condition (vi) failed.\n");
311 rReportStr.append(
"#####\n");
317 rReportStr.append(
"########## Condition (vii):\n");
320 for(sit = rQUp.
Begin(); sit != rQUp.
End(); ++sit) {
330 if(localResult) rReportStr.append(
"##### Condition (vii) passed.\n");
332 rReportStr.append(
"##### fail: found QUp-states with inactive UP-events:\n");
333 rReportStr.append(locErrStSet.
ToString()+
"\n");
335 rReportStr.append(
"##### Condition (vii) failed.\n");
337 rReportStr.append(
"#####\n");
343 rReportStr.append(
"########## Condition (viii):\n");
346 for(sit = rQUe.
Begin(); sit != rQUe.
End(); ++sit) {
356 if(localResult) rReportStr.append(
"##### Condition (viii) passed.\n");
358 rReportStr.append(
"##### fail: found QUe-states with inactive UE-events:\n");
359 rReportStr.append(locErrStSet.
ToString()+
"\n");
361 rReportStr.append(
"##### Condition (viii) failed.\n");
363 rReportStr.append(
"#####\n");
391 rReportStr.append(
"########## Condition (x):\n");
396 rReportStr.append(
"##### warning: non-accessible states have been removed.\n");
397 rReportStr.append(
"##### Condition (x) repaired.\n");
399 else rReportStr.append(
"##### Condition (x) passed.\n");
406 rReportStr.append(
"##################### Final result: #####################\n");
408 rReportStr.append(
"############## Generator is in HioPlantForm. ##############\n");
409 rReportStr.append(
"#########################################################\n");
413 rReportStr.append(
"############ Generator is NOT in HioPlantForm. ###########\n");
414 rReportStr.append(
"#########################################################\n");
429 return IsHioPlantForm(rHioPlant, QYpYe, QUp, QUe, ErrEvSet, ErrTrSet, ErrStSet,rReportStr);
439 std::string ReportStr;
441 return IsHioPlantForm(rHioPlant, QYpYe, QUp, QUe, ErrEvSet, ErrTrSet, ErrStSet,ReportStr);
#define FD_DF(message)
Debug: optional report on user functions.
Idx Insert(void)
Insert new index to set.
Set of indices with symbolic names.
bool IsUp(Idx index) const
Is event Up-event(by index)
void SetQYpYe(Idx index)
Mark state as QYpYe-state (by index)
EventSet EEvents(void) const
Get EventSet with E-events.
bool IsUe(Idx index) const
Is event Ue-event (by index)
bool IsY(Idx index) const
Is event Y-event? (by index)
void SetQUe(Idx index)
Mark state as QUe-state (by index)
EventSet UeEvents(void) const
Get EventSet with Ue-events.
EventSet UpEvents(void) const
Get EventSet with Up-events.
bool IsYp(Idx index) const
Is event Yp-event(by index)
EventSet PEvents(void) const
Get EventSet with P-events.
void SetQUp(Idx index)
Mark state as QUp-state (by index)
EventSet YpEvents(void) const
Get EventSet with Yp-events.
EventSet YeEvents(void) const
Get EventSet with Ye-events.
bool Insert(const Transition &rTransition)
Add a Transition.
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
Iterator on transition.
const TaEventSet< EventAttr > & Alphabet(void) const
Return const reference to alphabet.
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const
Write configuration data to a string.
EventSet ActiveEventSet(Idx x1) const
Return active event set at state x1.
const StateSet & InitStates(void) const
Const ref to initial states.
TransSet::Iterator TransRelBegin(void) const
Iterator to Begin() of transition relation.
bool Accessible(void)
Make generator accessible.
bool IsAccessible(void) const
Check if generator is accessible.
StateSet AccessibleSet(void) const
Compute set of accessible states.
void Name(const std::string &rName)
Set the generator's name.
TransSet::Iterator TransRelEnd(void) const
Iterator to End() of transition relation.
bool IsDeterministic(void) const
Check if generator is deterministic.
bool Empty(void) const
Test whether if the TBaseSet is Empty.
bool Exists(const T &rElem) const
Test existence of element.
virtual void Clear(void)
Clear all set.
Iterator End(void) const
Iterator to the end of set.
virtual void InsertSet(const TBaseSet &rOtherSet)
Insert elements given by rOtherSet.
Iterator Begin(void) const
Iterator to the begin of set.
const std::string & Name(void) const
Return name of TBaseSet.
Idx Size(void) const
Get Size of TBaseSet.
Generator with I/O-plant attributes.
libFAUDES resides within the namespace faudes.
void HioStatePartition(HioConstraint &rHioConstraint)
Function definition for run-time interface.
bool IsHioPlantForm(HioPlant &rHioPlant, StateSet &rQYpYe, StateSet &rQUp, StateSet &rQUe, EventSet &rErrEvSet, TransSet &rErrTrSet, StateSet &rErrStSet, std::string &rReportStr)
IsHioPlantForm: check if rHioPlant is in I/O-plant form and assign state attributes.