20 std::cerr <<
"[trivialParser] no value for "
33 std::ifstream
input (configFile.c_str ()) ;
36 if (linea.empty ())
continue ;
39 std::string valuestring (linea,linea.find (
'=', 0) + 1,
40 linea.size () - linea.find (
'=', 0) - 1) ;
42 double value = strtod ( valuestring.c_str (),
NULL ) ;
44 }
while (!
input.eof () ) ;
57 getline (input, singleLine,
'\n') ;
60 singleLine.find (
'#',0) != std::string::npos ||
61 singleLine.find (
'=',0) == std::string::npos ||
62 singleLine.size () < 3
76 std::cerr <<
"read parameters: " << std::endl ;
77 for (std::map<std::string, double>::const_iterator mapIT =
m_config.begin () ;
81 std::cerr << prefix << mapIT->first <<
" = " << mapIT->second <<
"\n" ;
92 while (word.find (
' ',0) != std::string::npos)
94 word.erase (word.find (
' ',0), 1) ;
std::map< std::string, double > m_config
container for the output
void print(std::string prefix="")
print the read params
static std::string const input
double getVal(std::string name)
return the value for that parameter
trivialParser(std::string configFile)
ctor
void parse(std::string configFile)
parse the cfg file
std::string getNextLine(std::ifstream &input)
returns the next not commented line
void eraseSpaces(std::string &word)
get rid of spaces