10 #ifndef CLASS_CHANNELFILE
11 #define CLASS_CHANNELFILE
30 this->setExtras(extras);
33 vector<Package> simulate(vector<Package> list){
40 if(this->getExtras().size()==0){
41 cout <<
"File hasn't especific\n";
44 string file = this->getExtras()[0];
46 fp.open(file.c_str());
49 string line, delimiter=
" ";
51 while(getline(fp, line)){
52 array.push_back(line);
54 for (
int i = 0; i < array.size(); i++)
56 string s = array.at(i);
59 pos = s.find(delimiter);
60 token = s.substr(0, pos);
61 int element = atoi(token.c_str());
62 s.erase(0, pos + delimiter.length());
63 pos = s.find(delimiter);
64 token = s.substr(0, pos);
65 int opc = atoi(token.c_str());
67 list = deletePackageById(element,list);
78 vector<Package> deletePackageById(
int ID, vector<Package> list){
85 for (
int i = 0; i < list.size(); i++)
87 if(list[i].getID()==ID){
88 list.erase(list.begin()+i);
Clase que representa el Simulador utilizando Un Fichero.
Clase Abstracta que representa el Simulador de pérdida de paquetes.