Commit 4b39c3fe authored by maximilianlohoefer's avatar maximilianlohoefer
Browse files

Fix to runner_pt. Did not compile without MCL_POS.


git-svn-id: https://svn.rwth-aachen.de/repos/sw440870_load_leveller/trunk@43 36cca2a8-63f0-4188-8a56-663e3b0d1cf3
parent 07e90136
...@@ -62,6 +62,7 @@ bool parser :: read_file(std::string input) ...@@ -62,6 +62,7 @@ bool parser :: read_file(std::string input)
} }
} }
file.close(); file.close();
readVals.clear();
return true; return true;
} }
...@@ -69,7 +70,11 @@ std::string parser::return_value_of(std::string name) ...@@ -69,7 +70,11 @@ std::string parser::return_value_of(std::string name)
{ {
std::map<std::string,std::string>::iterator it; std::map<std::string,std::string>::iterator it;
it=vars.find(name); it=vars.find(name);
if(it!=vars.end()) return (*it).second; if(it!=vars.end())
{
readVals.push_back(name);
return (*it).second;
}
else { else {
std::cerr << "#PARSER: NO VARIABLE WITH NAME " << name << " FOUND!" << std::endl; std::cerr << "#PARSER: NO VARIABLE WITH NAME " << name << " FOUND!" << std::endl;
return ""; return "";
...@@ -80,7 +85,10 @@ std::string parser::value_or_default(std::string name, std::string defa) ...@@ -80,7 +85,10 @@ std::string parser::value_or_default(std::string name, std::string defa)
{ {
std::map<std::string,std::string>::iterator it; std::map<std::string,std::string>::iterator it;
it=vars.find(name); it=vars.find(name);
if(it!=vars.end()) return (*it).second; if(it!=vars.end()) {
readVals.push_back(name);
return (*it).second;
}
else return defa; else return defa;
} }
...@@ -145,3 +153,23 @@ void parser :: get_all_with_one_from_specified_array(std::string sfai, int fai, ...@@ -145,3 +153,23 @@ void parser :: get_all_with_one_from_specified_array(std::string sfai, int fai,
} }
} }
std::vector<std::string> parser::unused_parameters() {
std::vector<std::string> unused;
std::vector<std::string>::iterator re;
for (std::map<std::string, std::string>::iterator va = vars.begin(); va != vars.end(); ++va) {
for (re = readVals.begin(); re != readVals.end(); ++re) {
if (va->first == (*re))
break;
}
unused.push_back(va->first);
}
for (std::map<std::string, std::vector<std::string> >::iterator va = arrs.begin(); va != arrs.end(); ++va) {
for (re = readVals.begin(); re != readVals.end(); ++re) {
if (va->first == (*re))
break;
}
unused.push_back(va->first);
}
return unused;
}
...@@ -47,6 +47,7 @@ class parser ...@@ -47,6 +47,7 @@ class parser
if(it != vars.end()) { if(it != vars.end()) {
buffer << vars[name]; buffer << vars[name];
buffer >> ret; buffer >> ret;
readVals.push_back(name);
return ret; return ret;
} else { } else {
std::cerr<<"#PARSER: NO VARIABLE WITH NAME "<<name<<" FOUND!"<< std::endl; std::cerr<<"#PARSER: NO VARIABLE WITH NAME "<<name<<" FOUND!"<< std::endl;
...@@ -72,6 +73,7 @@ class parser ...@@ -72,6 +73,7 @@ class parser
if(it != vars.end()) { if(it != vars.end()) {
buffer << vars[name]; buffer << vars[name];
buffer >> ret; buffer >> ret;
readVals.push_back(name);
return ret; return ret;
} else return defa; } else return defa;
}; };
...@@ -102,17 +104,21 @@ class parser ...@@ -102,17 +104,21 @@ class parser
buffer>>tmp; buffer>>tmp;
ret.push_back(tmp); ret.push_back(tmp);
} }
readVals.push_back(name);
return ret; return ret;
}; };
template <class Type> template <class Type>
std::vector< Type > vector(std::string name) {return return_vector<Type>(name);} std::vector< Type > vector(std::string name) {return return_vector<Type>(name);}
std::vector<std::string> unused_parameters();
private: private:
std::string notfine, comment, array; std::string notfine, comment, array;
std::map<std::string,std::string> vars; std::map<std::string,std::string> vars;
std::map<std::string,std::vector<std::string> > arrs; std::map<std::string,std::vector<std::string> > arrs;
std::vector<std::string> readVals;
}; };
......
...@@ -318,13 +318,14 @@ void runner_pt :: M_report_acc_ratio() { ...@@ -318,13 +318,14 @@ void runner_pt :: M_report_acc_ratio() {
afile << "\n"; afile << "\n";
afile.close(); afile.close();
} }
#ifdef MCL_POS
void runner_pt::M_report_pt_positions() { void runner_pt::M_report_pt_positions() {
std::ofstream afile(positionsfile.c_str(), std::ios::out | std::ios::app); std::ofstream afile(positionsfile.c_str(), std::ios::out | std::ios::app);
afile << pt_position_order.str(); afile << pt_position_order.str();
afile.close(); afile.close();
pt_position_order.str(""); pt_position_order.str("");
} }
#endif
void runner_pt :: M_global_update() void runner_pt :: M_global_update()
{ {
......
...@@ -80,7 +80,9 @@ class runner_pt ...@@ -80,7 +80,9 @@ class runner_pt
void M_update(int); void M_update(int);
void M_report(); void M_report();
void M_report_acc_ratio(); void M_report_acc_ratio();
#ifdef MCL_POS
void M_report_pt_positions(); void M_report_pt_positions();
#endif
void M_global_update(); void M_global_update();
// slave stuff // slave stuff
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment