Scheduler
configuration.h
Go to the documentation of this file.
1 
10 #ifndef CONFIGURATION_H
11 #define CONFIGURATION_H
12 
13 #include <fstream>
14 #include <iostream>
15 #include <string>
16 #include <vector>
17 #include <memory>
18 
19 namespace Utils
20 {
21 
22 class Configuration : public std::enable_shared_from_this<Configuration>
23 {
24 public:
25  Configuration(std::string file);
26  virtual ~Configuration();
27  virtual std::string getStringValue(std::string section, std::string key);
28  virtual std::vector<std::string> getStringList(std::string section, std::string key);
29  virtual double getDoubleValue(std::string section, std::string key);
30  virtual unsigned long long int getUnsignedLongLongIntValue(std::string section, std::string key); /*TODO: refactor all those functions into a template*/
31  virtual int getIntValue(std::string section, std::string key);
32  virtual bool getBoolValue(std::string section, std::string key, bool defaultValue);
35  std::string getFilePrefix();
36  std::string getName(){return filename;};
37 protected:
38  std::string filename;
39  std::ifstream stream;
40  static bool isNewSection(std::string line);
41  static bool isMatchingSection(std::string line, std::string section);
42  std::string stripDirectories(std::string);
43 };
44 
45 }
46 
47 #endif
line
Definition: bigtemp.py:6
std::ifstream stream
Definition: configuration.h:39
virtual unsigned long long int getUnsignedLongLongIntValue(std::string section, std::string key)
virtual int getIntValue(std::string section, std::string key)
std::string filename
Definition: configuration.h:36
std::string getFilePrefix()
returns the name of the configuration file stripped of any directory
virtual bool getBoolValue(std::string section, std::string key, bool defaultValue)
virtual double getDoubleValue(std::string section, std::string key)
std::string stripDirectories(std::string)
std::string getName()
Definition: configuration.h:36
virtual std::vector< std::string > getStringList(std::string section, std::string key)
static bool isMatchingSection(std::string line, std::string section)
Definition: context.h:16
virtual std::string getStringValue(std::string section, std::string key)
Configuration(std::string file)
static bool isNewSection(std::string line)