Configuration
 All Classes Files Functions Pages
ConfigurationInterface.h
Go to the documentation of this file.
1 
7 #ifndef O2_CONFIGURATION_CONFIGURATIONINTERFACE_H_
8 #define O2_CONFIGURATION_CONFIGURATIONINTERFACE_H_
9 
10 #include <string>
11 #include <unordered_map>
12 #include <boost/optional.hpp>
13 #include <boost/property_tree/ptree.hpp>
14 
15 namespace o2
16 {
17 namespace configuration
18 {
19 
20 using KeyValueMap = std::unordered_map<std::string, std::string>;
21 
29 {
30  public:
31  virtual ~ConfigurationInterface();
32 
36  virtual void putString(const std::string& path, const std::string& value) = 0;
37 
41  virtual boost::optional<std::string> getString(const std::string& path) = 0;
42 
47  template<typename T>
48  void put(const std::string& path, const T& value);
49 
53  virtual void putRecursive(const std::string& path, const boost::property_tree::ptree& tree);
54 
59  template<typename T>
60  T get(const std::string& path);
61 
65  template<typename T>
66  T get(const std::string& path, const T& defaultValue);
67 
72  virtual void setPrefix(const std::string& prefix) = 0;
73 
77  virtual KeyValueMap getRecursiveMap(const std::string& path = {}) = 0;
78 
82  virtual boost::property_tree::ptree getRecursive(const std::string& path = {}) = 0;
83 };
84 
85 } // namespace configuration
86 } // namespace o2
87 
88 #endif /* O2_CONFIGURATION_CONFIGURATIONINTERFACE_H_ */
virtual boost::optional< std::string > getString(const std::string &path)=0
void put(const std::string &path, const T &value)
Interface for configuration back ends.
Definition: ConfigurationInterface.h:28
virtual boost::property_tree::ptree getRecursive(const std::string &path={})=0
virtual void setPrefix(const std::string &prefix)=0
virtual void putString(const std::string &path, const std::string &value)=0
virtual void putRecursive(const std::string &path, const boost::property_tree::ptree &tree)
Definition: ConfigurationInterface.cxx:36
virtual KeyValueMap getRecursiveMap(const std::string &path={})=0