27 #ifndef FAUDES_MTCGENERATOR_H
28 #define FAUDES_MTCGENERATOR_H
52 template <
class GlobalAttr,
class StateAttr,
class EventAttr,
class TransAttr>
208 Idx InsColoredState(
const std::string& rStateName,
const std::string& rColorName);
227 Idx InsColoredState(
const std::string& rStateName,
Idx colorIndex);
241 Idx InsColoredState(
const std::string& rStateName,
const ColorSet& rColors);
271 Idx InsColor(
Idx stateIndex,
const std::string& rColorName);
288 void InsColor(
Idx stateIndex,
Idx colorIndex);
306 void InsColors(
Idx stateIndex,
const ColorSet& rColors);
323 void DelColor(
Idx stateIndex,
const std::string& rColorName);
340 void DelColor(
Idx stateIndex,
Idx colorIndex);
348 void DelColor(
const std::string& rColorName);
356 void DelColor(
Idx colorIndex);
371 void ClrColors(
Idx stateIndex);
378 void ClearStateAttributes();
394 void Colors(
ColorSet& rColors)
const;
435 StateSet ColoredStates(
const std::string& rColorName)
const;
462 bool ExistsColor(
Idx colorIndex)
const;
478 bool ExistsColor(
const std::string& rColorName)
const;
497 bool ExistsColor(
Idx stateIndex,
Idx colorIndex)
const;
505 bool IsColored(
void)
const;
521 bool IsColored(
Idx stateIndex)
const;
534 void DelColorName(
Idx colorIndex);
542 void CheckSymbolTable(
Idx colorIndex);
553 void CheckSymbolTable(
ColorSet& rColors);
563 std::string ColorName(
Idx colorIndex)
const;
573 Idx ColorIndex(
const std::string& rColorName)
const;
590 virtual void DotWrite(
const std::string& rFileName)
const;
600 std::string CStr(
Idx index)
const;
613 StateSet StronglyCoaccessibleSet(
void)
const;
654 StateSet StronglyTrimSet(
void)
const;
706 void NewColorSymbolTable();
715 std::map<Idx,ColorSet> StateColorMap(
void)
const;
752 #ifdef FAUDES_COMPATIBILITY
757 #define THIS TmtcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
758 #define BASE TcGenerator<GlobalAttr, StateAttr, EventAttr, TransAttr>
759 #define TEMP template<class GlobalAttr, class StateAttr, class EventAttr, class TransAttr>
802 FD_DG(
"MtcSystem(" <<
this <<
")::MtcSystem()");
808 FD_DG(
"MtcSystem(" <<
this <<
")::MtcSystem(rOtherGen)");
817 FD_DG(
"MtcSystem(" <<
this <<
")::MtcSystem(rOtherGen)");
823 TEMP THIS::TmtcGenerator(
const std::string& rFileName) :
BASE() {
824 FD_DG(
"MtcSystem(" <<
this <<
")::MtcSystem(" << rFileName <<
")");
826 BASE::Read(rFileName);
834 res->EventSymbolTablep(BASE::mpEventSymbolTable);
835 res->mStateNamesEnabled=BASE::mStateNamesEnabled;
836 res->mReindexOnWrite=BASE::mReindexOnWrite;
838 res->ColorSymbolTable(GlobalColorSymbolTablep());
856 FD_DG(
"MtcSystem(" <<
this <<
")::DoAssign(gen&)");
858 BASE::DoAssign(rSrc);
880 FD_DG(
"TmtcGenerator(" <<
this <<
")::Assign([type] " << &rSrc <<
")");
882 if(&rSrc==
static_cast<Type*
>(
this))
return *
this;
903 return mpColorSymbolTable;
908 mpColorSymbolTable=pSymTab;
917 TEMP Idx THIS::InsColoredState(
const std::string& rStateName,
const std::string& rColorName) {
918 FD_DG(
"MtcSystem(" <<
this <<
")::InsColoredState(rStateName, colorName)");
921 #ifdef FAUDES_CHECKED
923 index = BASE::InsState(rStateName);
926 std::stringstream errstr;
927 errstr <<
"Name \"" << rStateName <<
"\" already exists" << std::endl;
928 throw Exception(
"MtcSystem::InsColoredState(rStateName, rColorName)", errstr.str(), 104);
931 attr = BASE::StateAttributep(index);
934 std::stringstream errstr;
935 errstr <<
"Index " << index <<
" not member of set" << std::endl;
936 throw Exception(
"MtcSystem::InsColoredState(stateIndex, colorIndex)", errstr.str(), 200);
939 attr->Colors().Insert(rColorName);
942 std::stringstream errstr;
943 errstr <<
"Name already exists / invalid name: " << rColorName << std::endl;
944 throw Exception(
"MtcSystem::InsColoredState(stateIndex, rColorName)", errstr.str(), 104);
947 index = BASE::InsState(rStateName);
948 attr = Attributep(index);
949 attr->Colors().Insert(rColorName);
955 TEMP Idx THIS::InsColoredState(
const std::string& rStateName,
const Idx colorIndex) {
956 Idx index = BASE::InsState(rStateName);
957 StateAttr *attr = BASE::StateAttributep(index);
958 #ifdef FAUDES_CHECKED
960 attr->Colors().Insert(colorIndex);
963 std::stringstream errstr;
964 errstr <<
"Color index " << colorIndex <<
" not known to symbol table" << std::endl;
965 throw Exception(
"MtcSystem::InsColoredState(rStateName, colorIndex)", errstr.str(), 200);
968 attr->Colors().Insert(colorIndex);
974 TEMP Idx THIS::InsColoredState(
const std::string& rStateName,
const ColorSet& rColors) {
975 Idx index = BASE::InsState(rStateName);
976 InsColors(index, rColors);
982 Idx index = BASE::InsState();
983 InsColors(index, rColors);
988 TEMP Idx THIS::InsColor(
Idx stateIndex,
const std::string& rColorName) {
991 #ifdef FAUDES_CHECKED
993 attr = BASE::StateAttributep(stateIndex);
996 std::stringstream errstr;
997 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
998 throw Exception(
"MtcSystem::InsColor(stateIndex, colorIndex)", errstr.str(), 200);
1001 index = attr->Colors().Insert(rColorName);
1004 std::stringstream errstr;
1005 errstr <<
"Name already exists / invalid name: " << rColorName << std::endl;
1006 throw Exception(
"MtcSystem::InsColor(stateIndex, rColorName)", errstr.str(), 104);
1009 attr = Attributep(stateIndex);
1010 index = attr->Colors().Insert(rColorName);
1018 #ifdef FAUDES_CHECKED
1020 attr = BASE::StateAttributep(stateIndex);
1023 std::stringstream errstr;
1024 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
1025 throw Exception(
"MtcSystem::InsColor(stateIndex, colorIndex)", errstr.str(), 200);
1028 attr->Colors().Insert(colorIndex);
1031 std::stringstream errstr;
1032 errstr <<
"Color index " << colorIndex <<
" not known to symbol table" << std::endl;
1033 throw Exception(
"MtcSystem::InsColor(stateIndex, colorIndex)", errstr.str(), 200);
1036 attr = Attributep(stateIndex);
1037 attr->Colors().Insert(colorIndex);
1043 #ifdef FAUDES_CHECKED
1045 std::stringstream errstr;
1046 errstr <<
"Symbol table mismatch" << std::endl;
1047 throw Exception(
"MtcSystem::InsColors(stateIndex, rColors)", errstr.str(), 88);
1051 #ifdef FAUDES_CHECKED
1053 attr = BASE::StateAttributep(stateIndex);
1056 std::stringstream errstr;
1057 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
1058 throw Exception(
"MtcSystem::InsColors(stateIndex, rColors)", errstr.str(), 200);
1061 attr->Colors().InsertSet(rColors);
1064 std::stringstream errstr;
1065 errstr <<
"Symbol table mismach" << std::endl;
1066 throw Exception(
"MtcSystem::InsColors(stateIndex, rColors)", errstr.str(), 200);
1069 attr = Attributep(stateIndex);
1070 attr->Colors().InsertSet(rColors);
1075 TEMP void THIS::DelColor(
Idx stateIndex,
const std::string& rColorName) {
1078 #ifdef FAUDES_CHECKED
1080 attr = BASE::StateAttributep(stateIndex);
1083 std::stringstream errstr;
1084 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
1085 throw Exception(
"MtcSystem::DelColor(stateIndex, rColorName)", errstr.str(), 200);
1087 index = ColorIndex(rColorName);
1089 attr->Colors().Erase(index);
1092 std::stringstream errstr;
1093 errstr <<
"Color name \"" << rColorName <<
"\" not found in NameSet" << std::endl;
1094 throw Exception(
"MtcSystem::DelColor(stateIndex, rColorName)", errstr.str(), 202);
1097 attr = Attributep(stateIndex);
1098 index = ColorIndex(rColorName);
1099 attr->Colors().Erase(index);
1101 CheckSymbolTable(index);
1108 #ifdef FAUDES_CHECKED
1110 attr = BASE::StateAttributep(stateIndex);
1113 std::stringstream errstr;
1114 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
1115 throw Exception(
"MtcSystem::DelColor(stateIndex, colorIndex)", errstr.str(), 200);
1118 attr = BASE::StateAttributep(stateIndex);
1120 res = attr->Colors().Erase(colorIndex);
1122 std::stringstream errstr;
1123 errstr <<
"Color index " << colorIndex <<
" not found in generator" << std::endl;
1124 throw Exception(
"MtcSystem::DelColor(stateIndex, colorIndex)", errstr.str(), 205);
1126 CheckSymbolTable(colorIndex);
1130 TEMP void THIS::DelColor(
const std::string& rColorName) {
1131 StateSet::Iterator lit;
1134 Idx index = ColorIndex(rColorName);
1136 for (lit = BASE::pStates->Begin(); lit != BASE::pStates->End(); lit++) {
1137 attr = BASE::StateAttributep(*lit);
1138 attr->Colors().Erase(index);
1140 CheckSymbolTable(index);
1145 StateSet::Iterator lit;
1147 for (lit = BASE::pStates->Begin(); lit != BASE::pStates->End(); lit++) {
1148 attr = BASE::StateAttributep(*lit);
1149 attr->Colors().Erase(colorIndex);
1151 CheckSymbolTable(colorIndex);
1157 ColorSet::Iterator cit;
1158 ColorSet delColors(mpColorSymbolTable);
1159 #ifdef FAUDES_CHECKED
1161 attr = BASE::StateAttributep(stateIndex);
1164 std::stringstream errstr;
1165 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
1166 throw Exception(
"MtcSystem::ClrColors(stateIndex)", errstr.str(), 200);
1169 attr = BASE::StateAttributep(stateIndex);
1172 attr->Colors().Clear();
1173 CheckSymbolTable(delColors);
1178 ColorSymbolTablep()->ClrEntry(colorIndex);
1183 #ifdef FAUDES_CHECKED
1185 std::stringstream errstr;
1186 errstr <<
"Symbol table mismatch" << std::endl;
1187 throw Exception(
"MtcSystem::Colors", errstr.str(), 88);
1190 StateSet::Iterator lit;
1191 for (lit = BASE::pStates->Begin(); lit != BASE::pStates->End(); lit++) {
1192 const StateAttr& attr = BASE::pStates->Attribute(*lit);
1199 StateSet::Iterator lit;
1200 ColorSet colors(mpColorSymbolTable);
1201 for (lit = BASE::pStates->Begin(); lit != BASE::pStates->End(); lit++) {
1202 const StateAttr& attr = BASE::pStates->Attribute(*lit);
1210 const StateAttr* attrp;
1211 #ifdef FAUDES_CHECKED
1213 attrp = &BASE::pStates->
Attribute(stateIndex);
1216 std::stringstream errstr;
1217 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
1218 throw Exception(
"MtcSystem::Colors(stateIndex)", errstr.str(), 200);
1221 attrp = &BASE::pStates->Attribute(stateIndex);
1223 return attrp->Colors();
1227 TEMP void THIS::CheckSymbolTable(
Idx colorIndex) {
1229 ColorSet colors(mpColorSymbolTable);
1231 if (!colors.
Exists(colorIndex))
1232 DelColorName(colorIndex);
1238 #ifdef FAUDES_CHECKED
1240 std::stringstream errstr;
1241 errstr <<
"Symbol table mismatch" << std::endl;
1242 throw Exception(
"MtcSystem::CheckSymbolTable", errstr.str(), 88);
1246 ColorSet colors(mpColorSymbolTable);
1249 ColorSet::Iterator cit;
1250 for(cit = rColors.
Begin(); cit != rColors.
End(); cit++) {
1252 if(!colors.
Exists(*cit)) DelColorName(*cit);
1258 TEMP bool THIS::ExistsColor(
Idx colorIndex)
const {
1259 StateSet::Iterator lit;
1260 for (lit = BASE::StatesBegin(); lit != BASE::StatesEnd(); lit++) {
1261 if (ExistsColor(*lit, colorIndex))
return true;
1267 TEMP bool THIS::ExistsColor(
const std::string& rColorName)
const {
1268 Idx colorIndex = ColorIndex(rColorName);
1269 #ifdef FAUDES_CHECKED
1270 if (colorIndex == 0) {
1271 std::stringstream errstr;
1272 errstr <<
"Color name \"" << rColorName <<
"\" not found in symbol table " << std::endl;
1273 throw Exception(
"MtcSystem::ExistsColor(rColorName)", errstr.str(), 202);
1276 return ExistsColor(colorIndex);
1280 TEMP std::string THIS::ColorName(
Idx colorIndex)
const {
1281 return ColorSymbolTablep()->Symbol(colorIndex);
1285 TEMP Idx THIS::ColorIndex(
const std::string& rColorName)
const {
1286 return ColorSymbolTablep()->Index(rColorName);
1291 return ColorName(index);
1295 TEMP bool THIS::ExistsColor(
Idx stateIndex,
Idx colorIndex)
const {
1296 #ifdef FAUDES_CHECKED
1298 return BASE::pStates->Attribute(stateIndex).Colors().Exists(colorIndex);
1301 std::stringstream errstr;
1302 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
1303 throw Exception(
"MtcSystem::ExistsColor(stateIndex, colorIndex)", errstr.str(), 200);
1306 return BASE::pStates->Attribute(stateIndex).Colors().Exists(colorIndex);
1311 TEMP void THIS::DotWrite(
const std::string& rFileName)
const {
1312 FD_DG(
"TmtcGenerator(" <<
this <<
")::DotWrite(" << rFileName <<
")");
1314 StateSet::Iterator it;
1315 BASE::SetMinStateIndexMap();
1318 std::ofstream stream;
1319 stream.exceptions(std::ios::badbit|std::ios::failbit);
1320 stream.open(rFileName.c_str());
1321 stream <<
"// dot output generated by libFAUDES TmtcGenerator" << std::endl;
1322 stream <<
"digraph \"" << BASE::Name() <<
"\" {" << std::endl;
1323 stream <<
" rankdir=LR" << std::endl;
1324 stream <<
" node [shape=circle];" << std::endl;
1325 stream << std::endl;
1326 stream <<
" // initial states" << std::endl;
1328 for (it = BASE::InitStatesBegin(); it != BASE::InitStatesEnd(); ++it) {
1329 std::string xname= BASE::StateName(*it);
1330 if(xname==
"") xname=
ToStringInteger(
static_cast<long int>(BASE::MinStateIndex(*it)));
1331 stream <<
" dot_dummyinit_" << i <<
" [shape=none, label=\"\" ];" << std::endl;
1332 stream <<
" dot_dummyinit_" << i <<
" -> \"" << xname <<
"\";" << std::endl;
1335 stream << std::endl;
1338 stream <<
" // uncolored states" << std::endl;
1339 for (it = BASE::pStates->Begin(); it != BASE::pStates->End(); ++it) {
1341 const StateAttr& attr = BASE::StateAttribute(*it);
1343 if (!attr.IsDefault()) {
1344 coloredStates.
Insert(*it, attr);
1347 std::string xname=BASE::StateName(*it);
1349 stream <<
" \"" << xname <<
"\";" << std::endl;
1354 std::vector<std::string> ColorVector;
1355 ColorVector.push_back(
"blue");
1356 ColorVector.push_back(
"red");
1357 ColorVector.push_back(
"magenta");
1358 ColorVector.push_back(
"green");
1359 ColorVector.push_back(
"darkorange");
1360 ColorVector.push_back(
"cyan");
1361 ColorVector.push_back(
"navy");
1362 ColorVector.push_back(
"brown");
1363 ColorVector.push_back(
"green4");
1364 ColorVector.push_back(
"yellow");
1365 ColorVector.push_back(
"darkviolet");
1366 ColorVector.push_back(
"firebrick");
1367 ColorVector.push_back(
"greenyellow");
1368 ColorVector.push_back(
"peru");
1369 ColorVector.push_back(
"skyblue");
1370 ColorVector.push_back(
"darkgreen");
1371 ColorVector.push_back(
"violetred");
1372 ColorVector.push_back(
"lightsalmon");
1373 ColorVector.push_back(
"seagreen");
1374 ColorVector.push_back(
"saddlebrown");
1375 ColorVector.push_back(
"slateblue");
1376 ColorVector.push_back(
"thistle");
1377 ColorVector.push_back(
"turquoise4");
1378 ColorVector.push_back(
"gold2");
1379 ColorVector.push_back(
"sandybrown");
1380 ColorVector.push_back(
"aquamarine3");
1381 ColorVector.push_back(
"darkolivegreen");
1382 ColorVector.push_back(
"yellow4");
1384 stream << std::endl;
1385 stream <<
" // colored states" << std::endl;
1387 for (it = coloredStates.
Begin(); it != coloredStates.
End(); it++) {
1389 std::string xname=BASE::StateName(*it);
1390 if(xname==
"") xname=
ToStringInteger(
static_cast<long int>(BASE::MinStateIndex(*it)));
1391 const StateAttr& attr = coloredStates.
Attribute(*it);
1392 if (attr.Colors().Size() > 1) {
1393 for(ColorSet::Iterator cit = attr.ColorsBegin(); cit != attr.ColorsEnd(); cit++) {
1394 stream <<
" subgraph cluster_" << clustNr++ <<
" {color=" << ColorVector.at(*cit-1) <<
";" << std::endl;
1397 stream <<
" \"" << xname <<
"\" " << std::endl <<
" ";
1398 for (
int i=0; i<count; i++) {
1401 stream << std::endl;
1403 else if (attr.Colors().Size() == 1) {
1404 ColorSet::Iterator cit;
1405 if ((cit = attr.ColorsBegin()) != attr.ColorsEnd())
1406 stream <<
" \"" << xname <<
"\" " <<
"[color=" << ColorVector.at(*cit-1) <<
"]" << std::endl;
1409 stream << std::endl;
1412 stream <<
" // marked states" << std::endl;
1413 for (it = BASE::MarkedStatesBegin(); it != BASE::MarkedStatesEnd(); ++it) {
1414 std::string xname= BASE::StateName(*it);
1415 if(xname==
"") xname=
ToStringInteger(
static_cast<long int>(BASE::MinStateIndex(*it)));
1416 stream <<
" \"" << xname <<
"\";" << std::endl;
1421 stream << std::endl;
1422 stream <<
" // transition relation" << std::endl;
1423 for (tit = BASE::TransRelBegin(); tit != BASE::TransRelEnd(); ++tit) {
1424 std::string x1name= BASE::StateName(tit->X1);
1426 std::string x2name= BASE::StateName(tit->X2);
1428 stream <<
" \"" << x1name <<
"\" -> \"" << x2name <<
"\" [label=\"" << BASE::EventName(tit->Ev) <<
"\"];" << std::endl;
1430 stream <<
"}" << std::endl;
1433 catch (std::ios::failure&) {
1434 throw Exception(
"TaGenerator::DotWrite",
1435 "Exception opening/writing dotfile \""+rFileName+
"\"", 3);
1437 BASE::ClearMinStateIndexMap();
1442 typename std::map<Idx,ColorSet>
1443 THIS::StateColorMap(
void)
const {
1444 StateSet::Iterator lit;
1445 std::map<Idx,ColorSet> map;
1446 StateSet cstates = ColoredStates();
1447 for (lit = cstates.
Begin(); lit != cstates.
End(); lit++) {
1448 map.insert(std::make_pair(*lit, Colors(*lit)));
1449 FD_DF(
"make_pair(" <<
ToStringInteger(*lit) <<
", " << (THIS::Colors(*lit).ToString()) <<
")");
1456 StateSet::Iterator lit;
1458 for (lit = BASE::StatesBegin(); lit != BASE::StatesEnd(); lit++) {
1459 if(ExistsColor(*lit, colorIndex)) coloredStates.
Insert(*lit);
1461 return coloredStates;
1466 Idx colorIndex = ColorIndex(rColorName);
1467 return ColoredStates(colorIndex);
1472 StateSet::Iterator lit;
1474 for(lit = BASE::StatesBegin(); lit != BASE::StatesEnd(); lit++) {
1475 if(IsColored(*lit)) coloredStates.
Insert(*lit);
1477 return coloredStates;
1482 StateSet::Iterator lit;
1484 for (lit = BASE::StatesBegin(); lit != BASE::StatesEnd(); lit++) {
1485 if (!IsColored(*lit)) uncoloredStates.
Insert(*lit);
1487 return uncoloredStates;
1491 TEMP bool THIS::IsColored(
void)
const {
1492 StateSet::Iterator lit;
1493 for(lit = BASE::StatesBegin(); lit != BASE::StatesEnd(); lit++) {
1494 if(IsColored(*lit))
return true;
1501 #ifdef FAUDES_CHECKED
1503 return !BASE::pStates->Attribute(stateIndex).Colors().Empty();
1506 std::stringstream errstr;
1507 errstr <<
"State index " << stateIndex <<
" not member of set" << std::endl;
1508 throw Exception(
"MtcSystem::IsColored(stateIndex)", errstr.str(), 200);
1511 return !BASE::pStates->Attribute(stateIndex).Colors().Empty();
1517 StateSet stronglyCoac, notStronglyCoac;
1519 stronglyCoac = BASE::States();
1522 ColorSet::Iterator cit = colors.
Begin();
1523 ColorSet::Iterator cit_end = colors.
End();
1525 for (; cit != cit_end; cit++) {
1527 StateSet states = ColoredStates(*cit);
1530 tmp2 = stronglyCoac * tmp1;
1531 stronglyCoac = tmp2;
1534 return stronglyCoac;
1538 StateSet stronglyCoacSet = StronglyCoaccessibleSet();
1539 StateSet notStronglyCoac = BASE::States() - stronglyCoacSet;
1540 BASE::DelStates(notStronglyCoac);
1541 return (StronglyCoaccessibleSet() == BASE::States());
1545 return (StronglyCoaccessibleSet() == BASE::States());
1550 FD_DF(
"TmtcGenerator::StronglyTrimSet: trim states: "
1551 <<
StateSet(BASE::AccessibleSet() * StronglyCoaccessibleSet()).ToString());
1552 return BASE::AccessibleSet() * StronglyCoaccessibleSet();
1560 FD_DF(
"TmtcGenerator::StronglyTrim: trim states: " << (THIS::mpStates->ToString()));
1561 if (accessiblebool && coaccessiblebool) {
1562 FD_DF(
"TmtcGenerator::StronglyTrim: generator is trim");
1565 FD_DF(
"TmtcGenerator::StronglyTrim: generator is not trim");
1572 FD_DF(
"TmtcGenerator::IsStronglyTrim: generator is strongly trim");
1576 FD_DF(
"TmtcGenerator::IsStronglyTrim: generator is not strongly trim");
1582 TEMP void THIS::NewColorSymbolTable() {
1584 StateSet::Iterator lit;
1587 StateSet coloredStates = ColoredStates();
1588 coloredStates.
Write();
1593 for (lit = coloredStates.
Begin(); lit != coloredStates.
End(); lit++) {
1595 attr = BASE::pStates->Attributep(*lit);
1596 ColorSet::Iterator cit, cit_end;
1597 cit_end = attr->ColorsEnd();
1599 for (cit = attr->ColorsBegin(); cit != cit_end; cit++) {
1600 #ifdef FAUDES_CHECKED
1603 tmp->
InsEntry(*cit, attr->Colors().SymbolicName(*cit));
1606 std::stringstream errstr;
1607 errstr <<
"Could not insert index \"" << *cit <<
"\" and symbol \"" <<
1608 attr->Colors().SymbolicName(*cit) <<
"\" to symbol table" << std::endl;
1609 throw Exception(
"MtcSystem::NewColorSymbolTable()", errstr.str(), 44);
1612 tmp->
InsEntry(*cit, attr->Colors().SymbolicName(*cit));
1616 mpColorSymbolTable = tmp;
1617 attr->ColorSymTab(tmp);
1622 TEMP void THIS::ClearStateAttributes() {
1624 BASE::ClearStateAttributes();
1631 std::set<Idx> colcount;
1632 StateSet::Iterator sit;
1633 for(sit = BASE::StatesBegin(); sit != BASE::StatesEnd(); sit++) {
1634 colcount.insert(Colors(*sit).Size());
1637 std::multiset<Idx>::iterator cit;
1638 std::stringstream countstr;
1639 for(cit = colcount.begin(); cit != colcount.end(); cit++) {
1640 countstr << *cit <<
" ";
1643 BASE::DoSWrite(rTw);
#define FD_DG(message)
Debug: optional report on generator operations.
#define FD_DF(message)
Debug: optional report on user functions.
Container for colors: this is a NameSet with its own static symboltable.
static SymbolTable * StaticSymbolTablep(void)
Get pointer to static ColorSymbolTable.
Idx Insert(void)
Insert new index to set.
bool Exists(const Idx &rIndex) const
Test existence of index.
virtual void InsertSet(const NameSet &rOtherSet)
Inserts all elements of rOtherSet.
SymbolTable * SymbolTablep(void) const
Get Pointer mpSymbolTable.
A SymbolTable associates sybolic names with indices.
Idx InsEntry(Idx index, const std::string &rName)
Add new entry (aka symbolic name and index) to symboltable,.
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
Iterator on transition.
Idx Insert(void)
Insert new index to set using default attribute.
const Attr & Attribute(const Idx &rElem) const
Generator with controllability attributes.
Allows to create colored marking generators (CMGs) as the common five tupel consisting of alphabet,...
SymbolTable * ColorSymbolTablep(void) const
Get Pointer to ColorSymbolTable currently used by this MtcSystem.
void NewColorSymbolTable()
Insert a new local color symbol table.
~TmtcGenerator(void)
Destructor for MtcSystem.
SymbolTable * GlobalColorSymbolTablep(void) const
Get Pointer to global ColorSymbolTable.
virtual TmtcGenerator & Assign(const Type &rSrc)
Assignment.
void DoAssign(const TmtcGenerator &rSrc)
Assignment.
SymbolTable * mpColorSymbolTable
Pointer to currently used symbol table.
void ColorSymbolTable(SymbolTable *pSymTab)
Set ColorSymbolTable to be used by this MtcSystem.
A TokenWriter writes sequential tokens to a file, a string or stdout.
void WriteComment(const std::string &rComment)
Write comment in faudes format.
Base class of all libFAUDES objects that participate in the run-time interface.
void Write(const Type *pContext=0) const
Write configuration data to console.
Base class of all FAUDES generators.
void ClearMarkedStates(void)
Clear all marked states.
void InjectMarkedStates(const StateSet &rNewMarkedStates)
Replace mMarkedStates with StateSet given as parameter without consistency checks.
StateSet CoaccessibleSet(void) const
Compute set of Coaccessible states.
Includes all libFAUDES headers, no plugins.
Iterator End(void) const
Iterator to the end of set.
Iterator Begin(void) const
Iterator to the begin of set.
virtual const AttributeVoid & Attribute(const T &rElem) const
Attribute access.
bool IsStronglyTrim(const MtcSystem &rGen)
RTI wrapper function.
void StronglyTrim(MtcSystem &rGen)
RTI wrapper function.
bool IsAccessible(const vGenerator &rGen)
RTI wrapper function.
void StronglyCoaccessible(MtcSystem &rGen)
RTI wrapper function.
bool IsStronglyCoaccessible(const MtcSystem &rGen)
RTI wrapper function.
void Accessible(vGenerator &rGen)
RTI wrapper function.
Color attributes for states.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
TmtcGenerator< AttributeVoid, AttributeColoredState, AttributeCFlags, AttributeVoid > mtcGenerator
Compatibility: pre 2.20b used mtcGenerator as C++ class name.
TmtcGenerator< AttributeVoid, AttributeColoredState, AttributeCFlags, AttributeVoid > MtcSystem
std::string ToStringInteger(Int number)
integer to string