|
Go to the documentation of this file.
42 for ( int i=0; i<5; i++)
150 for ( int i=0; i<=4; i++)
167 std::string HioPlantFile = path+ "plant.gen";
174 tReader.ReadBegin( "Type");
175 while(tReader.Peek(token)) {
180 myType = tReader.ReadString();
185 for( int i=0 ;i<=4;i++)
187 char tmpChar = myType.at(i);
188 std::stringstream Str;
197 std::string LpFile = path+ "constrP.gen";
202 std::string LeFile = path+ "constrE.gen";
213 std::string EnvFile = path+ "environment.gen";
226 StateSet::Iterator sit;
227 EventSet::Iterator evit;
229 std::string toSet = "CB"+toSeti+ "_";
240 if( oldName.find(toSet, 0) != std::string::npos )
242 std::cout<< "At least one event already converted";
273 std::string oldName = rOldGen. EventName(tit->Ev);
274 int loc1 = oldName.find( "_", 0);
275 std::string newName = oldName.erase(0,loc1+1);
276 newName = toSet + oldName;
294 EventSet::Iterator evit;
296 StateSet::Iterator sit;
298 std::string toSet = "CB"+toSeti+ "_";
304 std::string oldName = rOldHioPlant. Alphabet().SymbolicName(*evit);
307 if( oldName.find(toSet, 0) != std::string::npos )
309 std::cout<< "At least one event already converted";
310 rResGen = rOldHioPlant;
320 for(evit = newAlph. Begin(); evit != newAlph. End(); ++evit)
326 for(evit = newAlph. Begin(); evit != newAlph. End(); ++evit)
332 for(evit = newAlph. Begin(); evit != newAlph. End(); ++evit)
338 for(evit = newAlph. Begin(); evit != newAlph. End(); ++evit)
359 std::string oldName = rOldHioPlant. EventName(tit->Ev);
360 int loc1 = oldName.find( "_", 0);
361 std::string newName = oldName.erase(0,loc1+1);
362 newName = toSet + oldName;
379 EventSet::Iterator evit;
381 std::string toSet = "CB"+toSeti+ "_";
384 for (evit = rOldAlph. Begin(); evit != rOldAlph. End(); ++evit)
389 if( oldName.find(toSet, 0) != std::string::npos )
391 std::cout<< "At least one event already converted";
398 for (evit = rOldAlph. Begin(); evit != rOldAlph. End(); ++evit)
401 int loc1 = oldName.find( "_", 0);
402 std::string newName1 = oldName.erase(0,loc1+1);
403 std::string newName = toSet + oldName;
420 EventSet::Iterator evit;
421 StateSet::Iterator sit;
430 std::string toRepl_left, toRepl_right, toRepl_ext;
434 if (rHioModule1-> Xpos() <= rHioModule2-> Xpos())
437 leftId = rHioModule1-> Index();
440 rightId = rHioModule2-> Index();
449 leftId = rHioModule2-> Index();
452 rightId = rHioModule1-> Index();
463 std::string oldName = rHioEnvX. Alphabet().SymbolicName(*evit);
466 if( oldName.find(toRepl_ext, 0) != std::string::npos )
468 std::cout<< "At least one event already converted";
479 for (evit = tmpAlph. Begin(); evit != tmpAlph. End(); ++evit)
485 std::string::size_type loc1 = eventName.find( "CBx_", 0);
486 if (loc1 != std::string::npos)
488 eventName.erase(0, 4);
489 std::string newEvent = toRepl_left+eventName;
491 if(rHioEnvX. IsYe(*evit))
503 std::string::size_type loc2 = eventName.find( "CBy_", 0);
504 if (loc2 != std::string::npos)
506 eventName.erase(0, 4);
507 std::string newEvent = toRepl_right+eventName;
508 if(rHioEnvX. IsYe(*evit))
521 std::string::size_type loc3 = eventName.find( "CBxy_", 0);
522 if (loc3 != std::string::npos)
524 eventName.erase(0, 5);
525 std::string newEvent = toRepl_ext+eventName;
526 if(rHioEnvX. IsYl(*evit))
560 std::string eventName = rHioEnvX. EventName(tit->Ev);
563 std::string::size_type loc1 = eventName.find( "CBx_", 0);
564 if (loc1 != std::string::npos)
566 eventName.erase(0, 4);
567 std::string newEvent = toRepl_left+eventName;
568 eventName = newEvent;
573 std::string::size_type loc2 = eventName.find( "CBy_", 0);
574 if (loc2 != std::string::npos)
576 eventName.erase(0, 4);
577 std::string newEvent = toRepl_right+eventName;
578 eventName = newEvent;
583 std::string::size_type loc3 = eventName.find( "CBxy_", 0);
584 if (loc3 != std::string::npos)
586 eventName.erase(0, 5);
587 std::string newEvent = toRepl_ext+eventName;
588 eventName = newEvent;
611 EventSet::Iterator evit;
612 StateSet::Iterator sit;
615 tmpAlph = rHioController. Alphabet();
620 std::string toRepl_left, toRepl_right, toRepl_ext;
625 if (rHioModule1-> Xpos() <= rHioModule2-> Xpos())
628 leftId = rHioModule1-> Index();
631 rightId = rHioModule2-> Index();
640 leftId = rHioModule2-> Index();
643 rightId = rHioModule1-> Index();
654 std::string oldName = rHioController. Alphabet().SymbolicName(*evit);
657 if( oldName.find(toRepl_ext, 0) != std::string::npos )
659 std::cout<< "At least one event already converted";
660 rResEnv = rHioController;
670 for (evit = tmpAlph. Begin(); evit != tmpAlph. End(); ++evit)
676 std::string::size_type loc1 = eventName.find( "CBx_", 0);
677 if (loc1 != std::string::npos)
679 eventName.erase(0, 4);
680 std::string newEvent = toRepl_left+eventName;
686 std::string::size_type loc2 = eventName.find( "CBy_", 0);
687 if (loc2 != std::string::npos)
689 eventName.erase(0, 4);
690 std::string newEvent = toRepl_right+eventName;
696 std::string::size_type loc3 = eventName.find( "CBxy_", 0);
697 if (loc3 != std::string::npos)
699 eventName.erase(0, 5);
700 std::string newEvent = toRepl_ext+eventName;
727 std::string eventName = rHioController. EventName(tit->Ev);
730 std::string::size_type loc1 = eventName.find( "CBx_", 0);
731 if (loc1 != std::string::npos)
733 eventName.erase(0, 4);
734 std::string newEvent = toRepl_left+eventName;
735 eventName = newEvent;
740 std::string::size_type loc2 = eventName.find( "CBy_", 0);
741 if (loc2 != std::string::npos)
743 eventName.erase(0, 4);
744 std::string newEvent = toRepl_right+eventName;
745 eventName = newEvent;
750 std::string::size_type loc3 = eventName.find( "CBxy_", 0);
751 if (loc3 != std::string::npos)
753 eventName.erase(0, 5);
754 std::string newEvent = toRepl_ext+eventName;
755 eventName = newEvent;
808 const std::string path)
812 std::string loc_path = "";
813 std::set<std::string> tmpSpecSet;
814 std::vector<std::string> listSpec, pathList;
815 std::list<std::string>::iterator itstr;
819 std::cout<< "Number of children: "<<size<<std::endl;
820 for( int i=0; i<size; i++)
823 capacity = mChildren[i]->TypeHioModule()[0] + capacity;
827 std::string cap = "SpecCB";
828 std::vector<std::string> allPath;
829 for ( int i=1; i<=capacity;i++)
832 loc_path = path+cap+ "/";
833 allPath.push_back(loc_path);
836 for ( int i=0; i<capacity;i++)
839 loc_path = allPath[i];
840 std::cout<< "Final path: "<<loc_path<<std::endl;
843 std::set< std::string >:: iterator fit=tmpSpecSet.begin();
844 for(; fit!=tmpSpecSet.end(); fit++)
846 listSpec.push_back(*fit);
848 tmpPath = loc_path+*fit+ "/";
849 pathList.push_back(tmpPath);
853 std::cout<< "There are "<<listSpec.size()<< " spec. available"<<std::endl;
854 size = listSpec.size();
855 for( int i=0; i<size;i++)
857 std::cout<< "Option: "<<i+1<< ":"<<listSpec[i]<<std::endl;
889 std::string loc_path, choice;
891 loc_path = MyPath()+ "ioController.gen";
892 tmpHioController. Read(loc_path.c_str());
893 tmpHioController. SWrite();
894 std::cout<< "Controller found..! Accept(Y)? / New controller(N)?"<<std::endl;
897 if(choice == "y" || choice == "Y")
906 std::cout<< "Controller NOT found..!"<<std::endl;
909 std::cout.flush()<< "Starting IOShuffle...1"<<std::endl;
912 std::cout.flush()<< " ...done!"<<std::endl;
939 std::cout<< "**********************//////\\\\\\*******************"<<std::endl;
940 std::cout<< "Everything went fine so far...startig HIO_SYNTHESIS..."<<std::endl;
941 std::cout<< "**********************\\\\\\//////*******************"<<std::endl;
962 EventSet::Iterator evit;
965 for(evit = Yc. Begin(); evit != Yc. End(); ++evit)
968 for(evit = Uc. Begin(); evit != Uc. End(); ++evit)
972 for(evit = Yp. Begin(); evit != Yp. End(); ++evit)
975 for(evit = Up. Begin(); evit != Up. End(); ++evit)
978 std::cout.flush()<< "...Done"<<std::endl;
995 std::set<std::string> folderContent;
996 std::string loc_path;
1001 std::set< std::string >:: iterator fit=folderContent.begin();
1002 for(; fit!=folderContent.end(); fit++)
1003 if (*fit== "ioController.gen")
1014 std::string loc_path;
1016 loc_path = loc_path+ "ioController.gen";
1026 int capacity = mType[0];
1027 std::vector<std::string> folderContent;
1028 std::string cap, loc_path, sub_folder;
1031 for ( int i=1; i<=capacity; i++)
1036 for ( int i=0; i<5;i++)
1042 loc_path = "Data/Spec/SpecCB"+cap+ "/"+sub_folder+ "/";
1070 int* type = new int[5];
1071 for ( int i=0; i<=4; i++)
1081 std::cout<< "***********Capacity: "<<type.at(0)<< "******"<<std::endl;
1082 std::cout<< "*Take from left: "<<type.at(1)<< "* "<< " *Take from right: "<<type.at(2)<< "*"<<std::endl;
1083 std::cout<< "*Deliver to left: "<<type.at(3)<< "* "<< " *Deliver to right: "<<type.at(4)<< "*"<<std::endl;
1094 const std::vector<HioModule*>& rChildren,
1097 int size = rChildren.size();
1099 for ( int i =0; i < size; i++)
1101 rParentModule. InsChild(rChildren[i]);
1102 std::cout<< "insert #"<<i<< "- ModuleID: "<<rChildren[i]->Index();
1104 Id = pow(10, size-i-1)*rChildren[i]->Index()+Id;
1105 std::cout<< ".."<<Id<<std::endl;
1107 std::cout<< "Id set!"<<std::endl;
1112 int intId = int(Id);
1125 int loaded, fl, fr, tol, tor, i_lastState, index;
1126 std::string s_lastQy, s_lastQup, s_lastQue, s_lastState, s_lastQy_stby, s_newQy_stby;
1127 std::string s_lastQupFL, s_lastQupFR, s_lastQup2L, s_lastQup2R, s_newQy_FR, s_newQy_FL, s_newQy_2L, s_newQy_2R;
1129 s_lastQup = s_lastQupFL = s_lastQupFR = s_newQy_stby = "ErrQy";
1130 fl=fr=tol=tor=i_lastState=index=loaded=0;
1178 for( int i=0; i<mType[0]; i++)
1180 s_lastQy_stby = s_newQy_stby;
1187 s_lastQup2L = "ErrQy";
1189 s_lastQup2R = "ErrQy";
1209 s_lastState = s_newQy_FL;
1214 s_lastQy = s_lastState;
1221 rHioSpec. SetTransition(s_lastQy, "CBx_req_fl", s_lastState);
1222 s_lastQue = s_lastState;
1230 s_lastQy = s_lastState;
1241 s_lastQupFL = s_lastState;
1254 s_lastQupFL = "ErrQy";
1277 s_lastState = s_newQy_FR;
1282 s_lastQy = s_lastState;
1289 rHioSpec. SetTransition(s_lastQy, "CBx_req_fr", s_lastState);
1290 s_lastQue = s_lastState;
1298 s_lastQy = s_lastState;
1309 s_lastQupFR = s_lastState;
1321 s_lastQupFR = "ErrQy";
1327 if((s_lastQupFL != "ErrQy") ||(s_lastQupFR != "ErrQy"))
1331 s_newQy_stby = s_lastState;
1337 if(s_lastQupFL != "ErrQy")
1342 rHioSpec. SetTransition(s_lastQupFL, "CBx_stby", s_lastState);
1343 s_lastQy = s_lastState;
1349 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1350 s_lastQue = s_lastState;
1353 rHioSpec. SetTransition(s_lastQue, "CBx_pack", s_newQy_stby);
1360 if(s_lastQupFR != "ErrQy")
1365 rHioSpec. SetTransition(s_lastQupFR, "CBx_stby", s_lastState);
1366 s_lastQy = s_lastState;
1372 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1373 s_lastQue = s_lastState;
1376 rHioSpec. SetTransition(s_lastQue, "CBx_pack", s_newQy_stby);
1382 if((s_lastQupFL != "ErrQy") ||(s_lastQupFR != "ErrQy"))
1386 rHioSpec. SetTransition(s_newQy_stby, "CBx_busy", s_lastState);
1387 s_lastQup = s_lastState;
1389 rHioSpec. SetTransition(s_lastState, "CBx_stby", s_newQy_stby);
1401 s_newQy_2L = s_lastState;
1413 s_newQy_2R = s_lastState;
1420 if(tol<mType[3] && (fl !=0 ||fr !=0))
1425 if(s_lastQupFL != "ErrQy")
1431 s_lastQy = s_lastState;
1437 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1438 s_lastQue = s_lastState;
1450 if(s_lastQupFR != "ErrQy")
1456 s_lastQy = s_lastState;
1462 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1463 s_lastQue = s_lastState;
1478 rHioSpec. SetTransition(s_newQy_2L, "CBx_wpar_tl", s_lastState);
1479 s_lastQue = s_lastState;
1491 rHioSpec. SetTransition(s_lastQue, "CBx_pack", s_lastQy_stby);
1505 if(s_lastQupFL != "ErrQy")
1509 if(s_lastQupFR != "ErrQy")
1517 if(tor<mType[4] && (fl !=0 ||fr !=0))
1522 if(s_lastQupFL != "ErrQy")
1528 s_lastQy = s_lastState;
1534 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1535 s_lastQue = s_lastState;
1548 if(s_lastQupFR != "ErrQy")
1554 s_lastQy = s_lastState;
1560 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1561 s_lastQue = s_lastState;
1575 rHioSpec. SetTransition(s_newQy_2R, "CBx_wpar_tr", s_lastState);
1576 s_lastQue = s_lastState;
1588 rHioSpec. SetTransition(s_lastQue, "CBx_pack", s_lastQy_stby);
1602 if(s_lastQupFL != "ErrQy")
1606 if(s_lastQupFR != "ErrQy")
1617 s_newQy_FL = s_lastState;
1626 s_newQy_FR = s_lastState;
1632 if((s_lastQupFL != "ErrQy") && fl <mType[1])
1639 s_lastQy = s_lastState;
1645 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1646 s_lastQue = s_lastState;
1662 if((s_lastQupFL != "ErrQy") && fr <mType[2])
1669 s_lastQy = s_lastState;
1675 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1676 s_lastQue = s_lastState;
1694 if((s_lastQupFR != "ErrQy") && fl <mType[1])
1701 s_lastQy = s_lastState;
1707 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1708 s_lastQue = s_lastState;
1725 if((s_lastQupFR != "ErrQy") && fr <mType[2])
1732 s_lastQy = s_lastState;
1738 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1739 s_lastQue = s_lastState;
1771 if(index == mType[0])
1773 if(s_lastQup != "ErrQy")
1779 if(s_lastQupFL != "ErrQy")
1785 if(s_lastQupFR != "ErrQy")
1813 int i_lastState, fl, fr, tol, tor;
1814 i_lastState = fl = fr = tol = tor = 0;
1816 std::string s_lastState, s_lastQup, s_lastQy, s_newQy, s_return;
1817 s_lastState = s_lastQup = s_lastQy = s_newQy = s_return = "";
1847 for ( int i=0; i<mType[0]; i++)
1851 if(fl<mType[1] || fr<mType[2])
1855 s_newQy = s_lastState;
1901 s_return = s_lastQy;
1910 s_lastQup = s_lastState;
libFAUDES 2.28c
--- 2016.09.30
--- c++ api documentaion by doxygen
|