|
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::vector<std::string> listSpec, tmpListSpec, pathList;
814 std::list<std::string>::iterator itstr;
818 std::cout<< "Number of children: "<<size<<std::endl;
819 for( int i=0; i<size; i++)
822 capacity = mChildren[i]->TypeHioModule()[0] + capacity;
826 std::string cap = "SpecCB";
827 std::vector<std::string> allPath;
828 for ( int i=1; i<=capacity;i++)
831 loc_path = path+cap+ "/";
832 allPath.push_back(loc_path);
835 for ( int i=0; i<capacity;i++)
838 loc_path = allPath[i];
839 std::cout<< "Final path: "<<loc_path<<std::endl;
842 int size = tmpListSpec.size();
844 for( int i = 0; i<size; i++)
846 listSpec.push_back(tmpListSpec[i]);
848 tmpPath = loc_path+tmpListSpec[i]+ "/";
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::vector<std::string> folderContent;
996 std::string loc_path;
1001 int size = folderContent.size();
1003 for( int i=0; i<size; i++)
1004 if (folderContent[i]== "ioController.gen")
1015 std::string loc_path;
1017 loc_path = loc_path+ "ioController.gen";
1027 int capacity = mType[0];
1028 std::vector<std::string> folderContent;
1029 std::string cap, loc_path, sub_folder;
1032 for ( int i=1; i<=capacity; i++)
1037 for ( int i=0; i<5;i++)
1043 loc_path = "Data/Spec/SpecCB"+cap+ "/"+sub_folder+ "/";
1071 int* type = new int[5];
1072 for ( int i=0; i<=4; i++)
1082 std::cout<< "***********Capacity: "<<type.at(0)<< "******"<<std::endl;
1083 std::cout<< "*Take from left: "<<type.at(1)<< "* "<< " *Take from right: "<<type.at(2)<< "*"<<std::endl;
1084 std::cout<< "*Deliver to left: "<<type.at(3)<< "* "<< " *Deliver to right: "<<type.at(4)<< "*"<<std::endl;
1095 const std::vector<HioModule*>& rChildren,
1098 int size = rChildren.size();
1100 for ( int i =0; i < size; i++)
1102 rParentModule. InsChild(rChildren[i]);
1103 std::cout<< "insert #"<<i<< "- ModuleID: "<<rChildren[i]->Index();
1105 Id = pow(10, size-i-1)*rChildren[i]->Index()+Id;
1106 std::cout<< ".."<<Id<<std::endl;
1108 std::cout<< "Id set!"<<std::endl;
1113 int intId = int(Id);
1126 int loaded, fl, fr, tol, tor, i_lastState, index;
1127 std::string s_lastQy, s_lastQup, s_lastQue, s_lastState, s_lastQy_stby, s_newQy_stby;
1128 std::string s_lastQupFL, s_lastQupFR, s_lastQup2L, s_lastQup2R, s_newQy_FR, s_newQy_FL, s_newQy_2L, s_newQy_2R;
1130 s_lastQup = s_lastQupFL = s_lastQupFR = s_newQy_stby = "ErrQy";
1131 fl=fr=tol=tor=i_lastState=index=loaded=0;
1179 for( int i=0; i<mType[0]; i++)
1181 s_lastQy_stby = s_newQy_stby;
1188 s_lastQup2L = "ErrQy";
1190 s_lastQup2R = "ErrQy";
1210 s_lastState = s_newQy_FL;
1215 s_lastQy = s_lastState;
1222 rHioSpec. SetTransition(s_lastQy, "CBx_req_fl", s_lastState);
1223 s_lastQue = s_lastState;
1231 s_lastQy = s_lastState;
1242 s_lastQupFL = s_lastState;
1255 s_lastQupFL = "ErrQy";
1278 s_lastState = s_newQy_FR;
1283 s_lastQy = s_lastState;
1290 rHioSpec. SetTransition(s_lastQy, "CBx_req_fr", s_lastState);
1291 s_lastQue = s_lastState;
1299 s_lastQy = s_lastState;
1310 s_lastQupFR = s_lastState;
1322 s_lastQupFR = "ErrQy";
1328 if((s_lastQupFL != "ErrQy") ||(s_lastQupFR != "ErrQy"))
1332 s_newQy_stby = s_lastState;
1338 if(s_lastQupFL != "ErrQy")
1343 rHioSpec. SetTransition(s_lastQupFL, "CBx_stby", s_lastState);
1344 s_lastQy = s_lastState;
1350 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1351 s_lastQue = s_lastState;
1354 rHioSpec. SetTransition(s_lastQue, "CBx_pack", s_newQy_stby);
1361 if(s_lastQupFR != "ErrQy")
1366 rHioSpec. SetTransition(s_lastQupFR, "CBx_stby", s_lastState);
1367 s_lastQy = s_lastState;
1373 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1374 s_lastQue = s_lastState;
1377 rHioSpec. SetTransition(s_lastQue, "CBx_pack", s_newQy_stby);
1383 if((s_lastQupFL != "ErrQy") ||(s_lastQupFR != "ErrQy"))
1387 rHioSpec. SetTransition(s_newQy_stby, "CBx_busy", s_lastState);
1388 s_lastQup = s_lastState;
1390 rHioSpec. SetTransition(s_lastState, "CBx_stby", s_newQy_stby);
1402 s_newQy_2L = s_lastState;
1414 s_newQy_2R = s_lastState;
1421 if(tol<mType[3] && (fl !=0 ||fr !=0))
1426 if(s_lastQupFL != "ErrQy")
1432 s_lastQy = s_lastState;
1438 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1439 s_lastQue = s_lastState;
1451 if(s_lastQupFR != "ErrQy")
1457 s_lastQy = s_lastState;
1463 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1464 s_lastQue = s_lastState;
1479 rHioSpec. SetTransition(s_newQy_2L, "CBx_wpar_tl", s_lastState);
1480 s_lastQue = s_lastState;
1492 rHioSpec. SetTransition(s_lastQue, "CBx_pack", s_lastQy_stby);
1506 if(s_lastQupFL != "ErrQy")
1510 if(s_lastQupFR != "ErrQy")
1518 if(tor<mType[4] && (fl !=0 ||fr !=0))
1523 if(s_lastQupFL != "ErrQy")
1529 s_lastQy = s_lastState;
1535 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1536 s_lastQue = s_lastState;
1549 if(s_lastQupFR != "ErrQy")
1555 s_lastQy = s_lastState;
1561 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1562 s_lastQue = s_lastState;
1576 rHioSpec. SetTransition(s_newQy_2R, "CBx_wpar_tr", s_lastState);
1577 s_lastQue = s_lastState;
1589 rHioSpec. SetTransition(s_lastQue, "CBx_pack", s_lastQy_stby);
1603 if(s_lastQupFL != "ErrQy")
1607 if(s_lastQupFR != "ErrQy")
1618 s_newQy_FL = s_lastState;
1627 s_newQy_FR = s_lastState;
1633 if((s_lastQupFL != "ErrQy") && fl <mType[1])
1640 s_lastQy = s_lastState;
1646 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1647 s_lastQue = s_lastState;
1663 if((s_lastQupFL != "ErrQy") && fr <mType[2])
1670 s_lastQy = s_lastState;
1676 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fl", s_lastState);
1677 s_lastQue = s_lastState;
1695 if((s_lastQupFR != "ErrQy") && fl <mType[1])
1702 s_lastQy = s_lastState;
1708 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1709 s_lastQue = s_lastState;
1726 if((s_lastQupFR != "ErrQy") && fr <mType[2])
1733 s_lastQy = s_lastState;
1739 rHioSpec. SetTransition(s_lastQy, "CBx_wpar_fr", s_lastState);
1740 s_lastQue = s_lastState;
1772 if(index == mType[0])
1774 if(s_lastQup != "ErrQy")
1780 if(s_lastQupFL != "ErrQy")
1786 if(s_lastQupFR != "ErrQy")
1814 int i_lastState, fl, fr, tol, tor;
1815 i_lastState = fl = fr = tol = tor = 0;
1817 std::string s_lastState, s_lastQup, s_lastQy, s_newQy, s_return;
1818 s_lastState = s_lastQup = s_lastQy = s_newQy = s_return = "";
1848 for ( int i=0; i<mType[0]; i++)
1852 if(fl<mType[1] || fr<mType[2])
1856 s_newQy = s_lastState;
1902 s_return = s_lastQy;
1911 s_lastQup = s_lastState;
libFAUDES 2.24g
--- 2014.09.15
--- c++ api documentaion by doxygen
|