ARC SDK
ArcConfig.h
1 // -*- indent-tabs-mode: nil -*-
2 
3 #ifndef __ARC_CONFIG_H__
4 #define __ARC_CONFIG_H__
5 
6 #include <string>
7 #include <list>
8 #include <arc/XMLNode.h>
9 
10 namespace Arc {
11 
13 
25  class Config
26  : public XMLNode {
27  private:
28  std::string file_name_;
29  public:
31  Config() : XMLNode(NS(), "ArcConfig") {}
33  Config(const NS& ns)
34  : XMLNode(ns, "ArcConfig") {}
36  Config(const char *filename);
38  Config(const std::string& xml_str)
39  : XMLNode(xml_str) {}
41 
44  : XMLNode(xml) {}
46 
48  Config(XMLNode xml, const std::string& filename)
49  : XMLNode(xml) {
50  file_name_ = filename;
51  }
52  ~Config(void);
54  Config(long cfg_ptr_addr);
56  Config(const Config& cfg);
58 
59  void print(void);
61  bool parse(const char *filename);
63  const std::string& getFileName(void) const {
64  return file_name_;
65  }
67  void setFileName(const std::string& filename) {
68  file_name_ = filename;
69  }
71  void save(const char *filename);
72  };
73 
75 
80  class BaseConfig {
81  protected:
83  std::list<std::string> plugin_paths;
84  public:
86  std::string credential;
88  std::string key;
90  std::string cert;
92  std::string proxy;
94  std::string cafile;
96  std::string cadir;
100  BaseConfig();
101  virtual ~BaseConfig() {}
103  void AddPluginsPath(const std::string& path);
105  void AddCredential(const std::string& cred);
107  void AddPrivateKey(const std::string& path);
109  void AddCertificate(const std::string& path);
111  void AddProxy(const std::string& path);
113  void AddCAFile(const std::string& path);
115  void AddCADir(const std::string& path);
117  void AddOverlay(XMLNode cfg);
119  void GetOverlay(std::string fname);
121 
123  virtual XMLNode MakeConfig(XMLNode cfg) const;
124  };
125 
126 } // namespace Arc
127 
128 #endif /* __ARC_CONFIG_H__ */