hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Config.h
Go to the documentation of this file.
1 #ifndef CONFIG_H
2 #define CONFIG_H
3 
4 #include <string.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <vector>
8 
9 class Config
10 {
11 public:
12  Config(char *fName);
13  ~Config();
14 
15  void getAsString (const char *sectionName, const char *paramName, char *&value, const char *defValue);
16  void getAsInt (const char *sectionName, const char *paramName, int &value, int defValue);
17  void getAsUnsigned (const char *sectionName, const char *paramName, unsigned int &value, unsigned int defValue);
18  void getAsInt64 (const char *sectionName, const char *paramName, u_int64_t &value, u_int64_t defValue);
19  void getAsBool (const char *sectionName, const char *paramName, bool & value, bool defValue);
20  void getAsDouble (const char *sectionName, const char *paramName, double & value, double defValue);
21  void readSection (const char *sectionName, char **&values, int &size);
22  bool isConfigExist();
23  void print();
24 
25 private:
26  bool configExist;
27  std::vector < char *>code;
28  std::vector < char *>codeVal;
29 
30  void createRecord(std::vector < char >*sectionName,
31  std::vector < char >*paramName,
32  std::vector < char >*paramValue);
33  int getIndex(char *value);
34  bool findSection(const char *codeValue, const char *sectionName, int &pos);
35 };
36 
37 #endif