| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "core/profilepartxmlparser.h" |
| 7 | #include "cpufreqprofilepart.h" |
| 8 | #include <optional> |
| 9 | #include <string> |
| 10 | |
| 11 | class CPUFreqXMLParser final |
| 12 | : public ProfilePartXMLParser |
| 13 | , public CPUFreqProfilePart::Exporter |
| 14 | , public CPUFreqProfilePart::Importer |
| 15 | { |
| 16 | public: |
| 17 | CPUFreqXMLParser() noexcept; |
| 18 | |
| 19 | std::unique_ptr<Exportable::Exporter> factory( |
| 20 | IProfilePartXMLParserProvider const &profilePartParserProvider) override; |
| 21 | std::unique_ptr<Exportable::Exporter> initializer() override; |
| 22 | |
| 23 | std::optional<std::reference_wrapper<Exportable::Exporter>> |
| 24 | provideExporter(Item const &i) override; |
| 25 | std::optional<std::reference_wrapper<Importable::Importer>> |
| 26 | provideImporter(Item const &i) override; |
| 27 | |
| 28 | void takeActive(bool active) override; |
| 29 | bool provideActive() const override; |
| 30 | |
| 31 | void takeCPUFreqScalingGovernor(std::string const &governor) override; |
| 32 | std::string const &provideCPUFreqScalingGovernor() const override; |
| 33 | |
| 34 | void takeCPUFreqEPPHint(std::optional<std::string> const &hint) override; |
| 35 | std::optional<std::string> const &provideCPUFreqEPPHint() const override; |
| 36 | |
| 37 | void appendTo(pugi::xml_node &parentNode) override; |
| 38 | |
| 39 | protected: |
| 40 | void resetAttributes() override; |
| 41 | void loadPartFrom(pugi::xml_node const &parentNode) override; |
| 42 | |
| 43 | private: |
| 44 | class Initializer; |
| 45 | |
| 46 | std::string const id_; |
| 47 | |
| 48 | bool active_; |
| 49 | bool activeDefault_; |
| 50 | |
| 51 | std::string scalingGovernor_; |
| 52 | std::string scalingGovernorDefault_; |
| 53 | |
| 54 | std::optional<std::string> eppHint_; |
| 55 | std::optional<std::string> eppHintDefault_; |
| 56 | |
| 57 | static bool const registered_; |
| 58 | }; |