Matthew Barth | fd05d64 | 2019-11-14 15:01:57 -0600 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include <string> |
| 4 | #include <vector> |
| 5 | #include <memory> |
| 6 | |
| 7 | #include "config.h" |
| 8 | #include "rpolicy.hpp" |
| 9 | |
| 10 | namespace phosphor |
| 11 | { |
| 12 | namespace fan |
| 13 | { |
| 14 | namespace presence |
| 15 | { |
| 16 | |
| 17 | using policies = std::vector<std::unique_ptr<RedundancyPolicy>>; |
| 18 | |
| 19 | class 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 |