forked from dase/CLAIMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.h
78 lines (67 loc) · 2.1 KB
/
Config.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Config.h
*
* Created on: Apr 4, 2014
* Author: wangli
*/
#ifndef CONFIG_H_
#define CONFIG_H_
#include <string>
#include <libconfig.h++>
/**
* This class maintains all the parameter values, which are specified in "config" file.
* In the debug version, in the initialization phase, default values are usded in case
* that the value is not given in "config" file.
*/
class Config {
public:
static Config* getInstance();
void print_configure()const;
virtual ~Config();
private:
Config();
void initialize();
/**
* Get the configured string value specified by "attribute_name". Return "default_vale"
* if the "attribute_name" is not found in the configure file.
*/
std::string getString(std::string attribute_name, std::string default_value);
/**
* Get the configured integer value specified by "attribute_name". Return "default_vale"
* if the "attribute_name" is not found in the configure file.
*/
int getInt(std::string attribute_name, int default_value);
/**
* Get the configured boolean value specified by "attribute_name". Return "default_vale"
* if the "attribute_name" is not found in the configure file.
* true=1, false=0.
*/
bool getBoolean(std::string attribute_name, bool defalut_value);
static void setConfigFile(std::string file_name);
public:
static std::string config_file;
/**
* parameter values.
* Note: these values are static, so that they can be accessed directly, like Config::data_dir.
* Static value must be defined in *.cpp file, otherwise compiler will complain.
*/
static std::string data_dir;
static int max_degree_of_parallelism;
static int initial_degree_of_parallelism;
static bool enable_expander_adaptivity;
static int expander_adaptivity_check_frequency;
static int scan_batch;
static std::string hdfs_master_ip;
static int hdfs_master_port;
static std::string logfile;
static bool master;
static bool local_disk_mode;
static bool pipelined_exchange;
static int client_listener_port;
static bool enable_codegen;
static std::string catalog_file;
private:
static Config* instance_;
libconfig::Config cfg;
};
#endif /* CONFIG_H_ */