11 #ifndef FAUDES_HIO_PLANT_H
12 #define FAUDES_HIO_PLANT_H
46 template <
class GlobalAttr,
class StateAttr,
class EventAttr,
class TransAttr>
191 void SetYp(
const std::string& rName);
215 void SetUp(
const std::string& rName);
245 bool IsYp(
const std::string& rName)
const;
267 bool IsUp(
const std::string& rName)
const;
341 void SetYe(
const std::string& rName);
365 void SetUe(
const std::string& rName);
395 bool IsYe(
const std::string& rName)
const;
417 bool IsUe(
const std::string& rName)
const;
457 bool IsY(
const std::string& rName)
const;
487 bool IsU(
const std::string& rName)
const;
517 bool IsP(
const std::string& rName)
const;
547 bool IsE(
const std::string& rName)
const;
703 bool IsQUp(
const std::string& rName)
const;
779 bool IsQUe(
const std::string& rName)
const;
855 bool IsErr(
const std::string& rName)
const;
883 #define THIS THioPlant<GlobalAttr, StateAttr, EventAttr, TransAttr>
884 #define BASE TaGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
885 #define TEMP template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
890 FD_DG(
"HioPlant(" <<
this <<
")::HioPlant()");
895 FD_DG(
"HioPlant(" <<
this <<
")::HioPlant(rOtherGen)");
900 FD_DG(
"HioPlant(" <<
this <<
")::HioPlant(rOtherGen)");
910 ) :
BASE(rOtherGen) {
911 FD_DG(
"HioPlant(" <<
this <<
")::HioPlant(rOtherGen)");
919 TEMP THIS::THioPlant(
const std::string& rFileName) :
BASE(rFileName) {
920 FD_DG(
"HioPlant(" <<
this <<
")::HioPlant(rFilename) : done");
928 res->EventSymbolTablep(BASE::mpEventSymbolTable);
929 res->mStateNamesEnabled=BASE::mStateNamesEnabled;
935 return new THIS(*
this);
941 THIS res= BASE::NewAGen();
950 EventAttr attr=BASE::EventAttribute(index);
955 TEMP bool THIS::IsY(
const std::string& rName)
const {
956 EventAttr attr=BASE::EventAttribute(rName);
962 EventAttr attr=BASE::EventAttribute(index);
967 TEMP bool THIS::IsU(
const std::string& rName)
const {
968 EventAttr attr=BASE::EventAttribute(rName);
974 FD_DG(
"HioPlant(" <<
this <<
")::YEvents()");
976 EventSet::Iterator it;
977 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
978 if(IsY(*it)) res.
Insert(*it);
985 FD_DG(
"HioPlant(" <<
this <<
")::UEvents()");
987 EventSet::Iterator it;
988 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
989 if(IsU(*it)) res.
Insert(*it);
998 FD_DG(
"HioPlant(" <<
this <<
")::InsYpEvent(" << index <<
")");
1002 BASE::InsEvent(index,attr);
1006 TEMP Idx THIS::InsYpEvent(
const std::string& rName) {
1007 FD_DG(
"HioPlant(" <<
this <<
")::InsYpEvent(" << rName <<
")");
1011 return BASE::InsEvent(rName,attr);
1016 FD_DG(
"HioPlant(" <<
this <<
")::InsUpEvent(" << index <<
")");
1020 BASE::InsEvent(index,attr);
1024 TEMP Idx THIS::InsUpEvent(
const std::string& rName) {
1025 FD_DG(
"HioPlant(" <<
this <<
")::InsUpEvent(" << rName <<
")");
1029 return BASE::InsEvent(rName,attr);
1034 FD_DG(
"HioPlant(" <<
this <<
")::SetYp(" << index <<
")");
1035 EventAttr attr=BASE::EventAttribute(index);
1038 BASE::pAlphabet->Attribute(index,attr);
1042 TEMP void THIS::SetYp(
const std::string& rName) {
1043 FD_DG(
"HioPlant(" <<
this <<
")::SetYp(" << rName <<
")");
1044 Idx index = BASE::EventIndex(rName);
1050 FD_DG(
"HioPlant(" <<
this <<
")::SetYp(rEvents)");
1051 EventSet::Iterator it;
1052 for(it=rEvents.
Begin(); it!=rEvents.
End(); it++) {
1059 FD_DG(
"HioPlant(" <<
this <<
")::SetUp(" << index <<
")");
1060 EventAttr attr=BASE::EventAttribute(index);
1063 BASE::pAlphabet->Attribute(index,attr);
1067 TEMP void THIS::SetUp(
const std::string& rName) {
1068 FD_DG(
"HioPlant(" <<
this <<
")::SetUp(" << rName <<
")");
1069 Idx index = BASE::EventIndex(rName);
1075 FD_DG(
"HioPlant(" <<
this <<
")::SetUp(rEvents)");
1076 EventSet::Iterator it;
1077 for(it=rEvents.
Begin(); it!=rEvents.
End(); it++) {
1084 EventAttr attr=BASE::EventAttribute(index);
1085 return (attr.IsY() && attr.IsP());
1089 TEMP bool THIS::IsYp(
const std::string& rName)
const {
1090 EventAttr attr=BASE::EventAttribute(rName);
1091 return (attr.IsY() && attr.IsP());
1096 EventAttr attr=BASE::EventAttribute(index);
1097 return (attr.IsU() && attr.IsP());
1101 TEMP bool THIS::IsUp(
const std::string& rName)
const {
1102 EventAttr attr=BASE::EventAttribute(rName);
1103 return (attr.IsU() && attr.IsP());
1108 FD_DG(
"HioPlant(" <<
this <<
")::YpEvents()");
1110 EventSet::Iterator it;
1111 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1112 if(IsYp(*it)) res.
Insert(*it);
1119 FD_DG(
"HioPlant(" <<
this <<
")::UpEvents()");
1121 EventSet::Iterator it;
1122 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1123 if(IsUp(*it)) res.
Insert(*it);
1132 FD_DG(
"HioPlant(" <<
this <<
")::InsYeEvent(" << index <<
")");
1136 BASE::InsEvent(index,attr);
1140 TEMP Idx THIS::InsYeEvent(
const std::string& rName) {
1141 FD_DG(
"HioPlant(" <<
this <<
")::InsYeEvent(" << rName <<
")");
1145 return BASE::InsEvent(rName,attr);
1150 FD_DG(
"HioPlant(" <<
this <<
")::InsUeEvent(" << index <<
")");
1154 BASE::InsEvent(index,attr);
1158 TEMP Idx THIS::InsUeEvent(
const std::string& rName) {
1159 FD_DG(
"HioPlant(" <<
this <<
")::InsUeEvent(" << rName <<
")");
1163 return BASE::InsEvent(rName,attr);
1168 FD_DG(
"HioPlant(" <<
this <<
")::SetYe(" << index <<
")");
1169 EventAttr attr=BASE::EventAttribute(index);
1172 BASE::pAlphabet->Attribute(index,attr);
1176 TEMP void THIS::SetYe(
const std::string& rName) {
1177 FD_DG(
"HioPlant(" <<
this <<
")::SetYe(" << rName <<
")");
1178 Idx index = BASE::EventIndex(rName);
1184 FD_DG(
"HioPlant(" <<
this <<
")::SetYe(rEvents)");
1185 EventSet::Iterator it;
1186 for(it=rEvents.
Begin(); it!=rEvents.
End(); it++) {
1193 FD_DG(
"HioPlant(" <<
this <<
")::SetUe(" << index <<
")");
1194 EventAttr attr=BASE::EventAttribute(index);
1197 BASE::pAlphabet->Attribute(index,attr);
1201 TEMP void THIS::SetUe(
const std::string& rName) {
1202 FD_DG(
"HioPlant(" <<
this <<
")::SetUe(" << rName <<
")");
1203 Idx index = BASE::EventIndex(rName);
1209 FD_DG(
"HioPlant(" <<
this <<
")::SetUe(rEvents)");
1210 EventSet::Iterator it;
1211 for(it=rEvents.
Begin(); it!=rEvents.
End(); it++) {
1218 EventAttr attr=BASE::EventAttribute(index);
1219 return (attr.IsY() && attr.IsE());
1223 TEMP bool THIS::IsYe(
const std::string& rName)
const {
1224 EventAttr attr=BASE::EventAttribute(rName);
1225 return (attr.IsY() && attr.IsE());
1230 EventAttr attr=BASE::EventAttribute(index);
1231 return (attr.IsU() && attr.IsE());
1235 TEMP bool THIS::IsUe(
const std::string& rName)
const {
1236 EventAttr attr=BASE::EventAttribute(rName);
1237 return (attr.IsU() && attr.IsE());
1242 FD_DG(
"HioPlant(" <<
this <<
")::YeEvents()");
1244 EventSet::Iterator it;
1245 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1246 if(IsYe(*it)) res.
Insert(*it);
1253 FD_DG(
"HioPlant(" <<
this <<
")::UeEvents()");
1255 EventSet::Iterator it;
1256 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1257 if(IsUe(*it)) res.
Insert(*it);
1266 EventAttr attr=BASE::EventAttribute(index);
1271 TEMP bool THIS::IsP(
const std::string& rName)
const {
1272 EventAttr attr=BASE::EventAttribute(rName);
1278 EventAttr attr=BASE::EventAttribute(index);
1283 TEMP bool THIS::IsE(
const std::string& rName)
const {
1284 EventAttr attr=BASE::EventAttribute(rName);
1290 FD_DG(
"HioPlant(" <<
this <<
")::PEvents()");
1292 EventSet::Iterator it;
1293 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1294 if(IsP(*it)) res.
Insert(*it);
1301 FD_DG(
"HioPlant(" <<
this <<
")::EEvents()");
1303 EventSet::Iterator it;
1304 for(it=BASE::AlphabetBegin(); it!=BASE::AlphabetEnd(); it++) {
1305 if(IsE(*it)) res.
Insert(*it);
1318 FD_DG(
"HioPlant(" <<
this <<
")::SetQYpYe(" << index <<
")");
1319 StateAttr attr=BASE::StateAttribute(index);
1328 BASE::pStates->Attribute(index,attr);
1332 TEMP void THIS::SetQYpYe(
const std::string& rName) {
1333 FD_DG(
"HioPlant(" <<
this <<
")::SetQYpYe(" << rName <<
")");
1334 Idx index = BASE::StateIndex(rName);
1340 FD_DG(
"HioPlant(" <<
this <<
")::SetQYpYe(rStates)");
1341 StateSet::Iterator sit;
1342 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
1349 FD_DG(
"HioPlant(" <<
this <<
")::ClrQYpYe(" << index <<
")");
1350 StateAttr attr=BASE::StateAttribute(index);
1354 BASE::pStates->Attribute(index,attr);
1358 TEMP void THIS::ClrQYpYe(
const std::string& rName) {
1359 FD_DG(
"HioPlant(" <<
this <<
")::ClrQYpYe(" << rName <<
")");
1360 Idx index = BASE::StateIndex(rName);
1366 FD_DG(
"HioPlant(" <<
this <<
")::ClrQYpYe(rStates)");
1367 StateSet::Iterator sit;
1368 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
1375 StateAttr attr=BASE::StateAttribute(index);
1376 return attr.IsQY() && attr.IsQP() && attr.IsQE();
1380 TEMP bool THIS::IsQYpYe(
const std::string& rName)
const {
1381 Idx index = BASE::StateIndex(rName);
1382 return IsQYpYe(index);
1387 FD_DG(
"HioPlant(" <<
this <<
")::QYpYeStates()");
1389 StateSet::Iterator sit;
1390 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) {
1391 if(IsQYpYe(*sit)) res.
Insert(*sit);
1399 FD_DG(
"HioPlant(" <<
this <<
")::SetQUp(" << index <<
")");
1400 StateAttr attr=BASE::StateAttribute(index);
1409 BASE::pStates->Attribute(index,attr);
1413 TEMP void THIS::SetQUp(
const std::string& rName) {
1414 FD_DG(
"HioPlant(" <<
this <<
")::SetQUp(" << rName <<
")");
1415 Idx index = BASE::StateIndex(rName);
1421 FD_DG(
"HioPlant(" <<
this <<
")::SetQUp(rStates)");
1422 StateSet::Iterator sit;
1423 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
1430 FD_DG(
"HioPlant(" <<
this <<
")::ClrQUp(" << index <<
")");
1431 StateAttr attr=BASE::StateAttribute(index);
1434 BASE::pStates->Attribute(index,attr);
1438 TEMP void THIS::ClrQUp(
const std::string& rName) {
1439 FD_DG(
"HioPlant(" <<
this <<
")::ClrQUp(" << rName <<
")");
1440 Idx index = BASE::StateIndex(rName);
1446 FD_DG(
"HioPlant(" <<
this <<
")::ClrQUp(rStates)");
1447 StateSet::Iterator sit;
1448 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
1455 StateAttr attr=BASE::StateAttribute(index);
1456 return attr.IsQU() && attr.IsQP();
1460 TEMP bool THIS::IsQUp(
const std::string& rName)
const {
1461 Idx index = BASE::StateIndex(rName);
1462 return IsQUp(index);
1467 FD_DG(
"HioPlant(" <<
this <<
")::QUpStates()");
1469 StateSet::Iterator sit;
1470 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) {
1471 if(IsQUp(*sit)) res.
Insert(*sit);
1481 FD_DG(
"HioPlant(" <<
this <<
")::SetQUe(" << index <<
")");
1482 StateAttr attr=BASE::StateAttribute(index);
1491 BASE::pStates->Attribute(index,attr);
1495 TEMP void THIS::SetQUe(
const std::string& rName) {
1496 FD_DG(
"HioPlant(" <<
this <<
")::SetQUe(" << rName <<
")");
1497 Idx index = BASE::StateIndex(rName);
1503 FD_DG(
"HioPlant(" <<
this <<
")::SetQUe(rStates)");
1504 StateSet::Iterator sit;
1505 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
1512 FD_DG(
"HioPlant(" <<
this <<
")::ClrQUe(" << index <<
")");
1513 StateAttr attr=BASE::StateAttribute(index);
1516 BASE::pStates->Attribute(index,attr);
1520 TEMP void THIS::ClrQUe(
const std::string& rName) {
1521 FD_DG(
"HioPlant(" <<
this <<
")::ClrQUe(" << rName <<
")");
1522 Idx index = BASE::StateIndex(rName);
1528 FD_DG(
"HioPlant(" <<
this <<
")::ClrQUe(rStates)");
1529 StateSet::Iterator sit;
1530 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
1537 StateAttr attr=BASE::StateAttribute(index);
1538 return attr.IsQU() && attr.IsQE();
1542 TEMP bool THIS::IsQUe(
const std::string& rName)
const {
1543 Idx index = BASE::StateIndex(rName);
1544 return IsQUe(index);
1549 FD_DG(
"HioPlant(" <<
this <<
")::QUeStates()");
1551 StateSet::Iterator sit;
1552 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) {
1553 if(IsQUe(*sit)) res.
Insert(*sit);
1560 FD_DG(
"HioPlant(" <<
this <<
")::SetErr(" << index <<
")");
1561 StateAttr attr=BASE::StateAttribute(index);
1563 BASE::pStates->Attribute(index,attr);
1567 TEMP void THIS::SetErr(
const std::string& rName) {
1568 FD_DG(
"HioPlant(" <<
this <<
")::SetErr(" << rName <<
")");
1569 Idx index = BASE::StateIndex(rName);
1575 FD_DG(
"HioPlant(" <<
this <<
")::SetErr(rStates)");
1576 StateSet::Iterator sit;
1577 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
1584 FD_DG(
"HioPlant(" <<
this <<
")::ClrErr(" << index <<
")");
1585 StateAttr attr=BASE::StateAttribute(index);
1587 BASE::pStates->Attribute(index,attr);
1591 TEMP void THIS::ClrErr(
const std::string& rName) {
1592 FD_DG(
"HioPlant(" <<
this <<
")::ClrErr(" << rName <<
")");
1593 Idx index = BASE::StateIndex(rName);
1599 FD_DG(
"HioPlant(" <<
this <<
")::ClrErr(rStates)");
1600 StateSet::Iterator sit;
1601 for(sit=rStates.
Begin(); sit!=rStates.
End(); sit++) {
1608 StateAttr attr=BASE::StateAttribute(index);
1609 return attr.IsErr();
1613 TEMP bool THIS::IsErr(
const std::string& rName)
const {
1614 Idx index = BASE::StateIndex(rName);
1615 return IsErr(index);
1620 FD_DG(
"HioPlant(" <<
this <<
")::ErrStates()");
1622 StateSet::Iterator sit;
1623 for(sit=BASE::StatesBegin(); sit!=BASE::StatesEnd(); sit++) {
1624 if(IsErr(*sit)) res.
Insert(*sit);
1675 std::string& rReportStr);
1742 std::string& rReportStr);
bool Insert(const Idx &rIndex)
bool IsE(const std::string &rName) const
void SetUp(const EventSet &rEvents)
bool IsUp(Idx index) const
void ClrQUp(const StateSet &rStates)
bool IsQUp(const std::string &rName) const
void SetQYpYe(const StateSet &rStates)
void SetYp(const EventSet &rEvents)
void SetQUe(const std::string &rName)
void SetErr(const std::string &rName)
virtual bool UpdateAttributes(void)
bool IsP(const std::string &rName) const
void SetQYpYe(const std::string &rName)
EventSet EEvents(void) const
bool IsUe(Idx index) const
bool IsY(Idx index) const
Idx InsYeEvent(const std::string &rName)
Idx InsUpEvent(const std::string &rName)
THioPlant NewHioPlant(void) const
void ClrQUe(const std::string &rName)
void ClrErr(const StateSet &rStates)
StateSet ErrStates(void) const
THioPlant(const Generator &rOtherGen)
void SetUe(const EventSet &rEvents)
bool IsP(Idx index) const
void SetYe(const EventSet &rEvents)
EventSet YEvents(void) const
EventSet UeEvents(void) const
void SetUe(const std::string &rName)
bool IsErr(Idx index) const
bool IsUp(const std::string &rName) const
bool IsQUe(const std::string &rName) const
void ClrQUp(const std::string &rName)
Idx InsUeEvent(const std::string &rName)
virtual THioPlant * Copy(void) const
bool IsYp(const std::string &rName) const
void InsYpEvent(Idx index)
void InsUeEvent(Idx index)
StateSet QUpStates(void) const
Idx InsYpEvent(const std::string &rName)
void SetQUe(const StateSet &rStates)
bool IsQYpYe(Idx index) const
bool IsUe(const std::string &rName) const
EventSet UpEvents(void) const
StateSet QUeStates(void) const
void InsUpEvent(Idx index)
void ClrErr(const std::string &rName)
bool IsQUe(Idx index) const
bool IsQUp(Idx index) const
void SetQUp(const std::string &rName)
void SetUp(const std::string &rName)
bool IsQYpYe(const std::string &rName) const
void ClrQUe(const StateSet &rStates)
THioPlant(const THioPlant &rOtherGen)
void InsYeEvent(Idx index)
bool IsU(const std::string &rName) const
void ClrQYpYe(const StateSet &rStates)
void SetYp(const std::string &rName)
bool IsYp(Idx index) const
void SetQUp(const StateSet &rStates)
bool IsYe(Idx index) const
StateSet QYpYeStates(void) const
EventSet UEvents(void) const
void SetYe(const std::string &rName)
EventSet PEvents(void) const
THioPlant(const std::string &rFileName)
void SetErr(const StateSet &rStates)
virtual THioPlant * New(void) const
bool IsErr(const std::string &rName) const
EventSet YpEvents(void) const
bool IsU(Idx index) const
bool IsYe(const std::string &rName) const
bool IsY(const std::string &rName) const
EventSet YeEvents(void) const
THioPlant(const Generator &rOtherGen, const EventSet &rYp, const EventSet &rUp, const EventSet &rYe, const EventSet &rUe)
bool IsE(Idx index) const
void ClrQYpYe(const std::string &rName)
Iterator Begin(void) const
void HioStatePartition(HioConstraint &rHioConstraint)
THioPlant< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid > HioPlant
bool IsHioPlantForm(HioPlant &rHioPlant, StateSet &rQYpYe, StateSet &rQUp, StateSet &rQUe, EventSet &rErrEvSet, TransSet &rErrTrSet, StateSet &rErrStSet, std::string &rReportStr)