trivialParser

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
/**
   This parser is really fragile!!
 */

#ifndef trivialParser_h
#define trivialParser_h

#include <string>
#include <map>
#include <fstream>

class trivialParser {
public:
  //!ctor
  explicit trivialParser(std::string configFile);
  //! return the value for that parameter
  double getVal(std::string name);

private:
  //! container for the output
  std::map<std::string, double> m_config;

private:
  //! parse the cfg file
  void parse(std::string configFile);
  //! print the read params
  void print(std::string prefix = "");
  //! returns the next not commented line
  std::string getNextLine(std::ifstream& input);
  //! get rid of spaces
  void eraseSpaces(std::string& word);
};

#endif