#ifndef DGRIDD_CONFIG_H
|
#define DGRIDD_CONFIG_H
|
|
#include <string>
|
#include "dgrid.h"
|
|
#define DEFAULT_CONFIG_FILE "/etc/dgridd.conf"
|
|
namespace DGrid {
|
|
using std::string;
|
|
class Config {
|
private:
|
Config();
|
~Config();
|
static Config* _instance;
|
static NodeID _node_id;
|
|
public:
|
static Config* instance();
|
static void destroy_instance();
|
static NodeID node_id();
|
bool load(const std::string& fname);
|
|
std::string get_cluster_key() const;
|
std::string get(const std::string& key, const std::string& default_value = "") const;
|
uint16_t get(const std::string& key, const uint16_t value) const;
|
const std::vector<stringmap>& getnodes() const;
|
|
private:
|
void clear();
|
|
stringmap common;
|
std::vector<stringmap> nodes;
|
};
|
|
} // namespace DGrid
|
|
#endif // DGRIDD_CONFIG_H
|