blob: dcb1aa3fe429d1c66611de798a2f9dfa9783c844 [file] [log] [blame]
Matthew Barthfd05d642019-11-14 15:01:57 -06001#pragma once
2
3#include <string>
4#include <vector>
5#include <memory>
6
7#include "config.h"
8#include "rpolicy.hpp"
9
10namespace phosphor
11{
12namespace fan
13{
14namespace presence
15{
16
17using policies = std::vector<std::unique_ptr<RedundancyPolicy>>;
18
19class JsonConfig
20{
21 public:
22
23 JsonConfig() = delete;
24 JsonConfig(const JsonConfig&) = delete;
25 JsonConfig(JsonConfig&&) = delete;
26 JsonConfig& operator=(const JsonConfig&) = delete;
27 JsonConfig& operator=(JsonConfig&&) = delete;
28 ~JsonConfig() = default;
29
30 /**
31 * Constructor
32 * Parses and populates the fan presence policies from a json file
33 *
34 * @param[in] jsonFile - json configuration file
35 */
36 explicit JsonConfig(const std::string& jsonFile);
37
38 /**
39 * @brief Get the json config based fan presence policies
40 *
41 * @return - The fan presence policies
42 */
43 static const policies& get();
44
45 private:
46
47 /* Fan presence policies */
48 static policies _policies;
49};
50
51} // namespace presence
52} // namespace fan
53} // namespace phosphor