| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "core/profilepart.h" |
| 7 | #include "pmpowerstate.h" |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | namespace AMD { |
| 12 | |
| 13 | class PMPowerStateProfilePart final |
| 14 | : public ProfilePart |
| 15 | , public AMD::PMPowerState::Importer |
| 16 | { |
| 17 | public: |
| 18 | class Importer : public IProfilePart::Importer |
| 19 | { |
| 20 | public: |
| 21 | virtual std::string const &providePMPowerStateMode() const = 0; |
| 22 | }; |
| 23 | |
| 24 | class Exporter : public IProfilePart::Exporter |
| 25 | { |
| 26 | public: |
| 27 | virtual void takePMPowerStateMode(std::string const &mode) = 0; |
| 28 | }; |
| 29 | |
| 30 | PMPowerStateProfilePart() noexcept; |
| 31 | |
| 32 | std::unique_ptr<Exportable::Exporter> |
| 33 | factory(IProfilePartProvider const &profilePartProvider) override; |
| 34 | std::unique_ptr<Exportable::Exporter> initializer() override; |
| 35 | |
| 36 | std::string const &ID() const final override; |
| 37 | |
| 38 | std::optional<std::reference_wrapper<Importable::Importer>> |
| 39 | provideImporter(Item const &i) override; |
| 40 | |
| 41 | bool provideActive() const override; |
| 42 | std::string const &providePMPowerStateMode() const override; |
| 43 | |
| 44 | protected: |
| 45 | void importProfilePart(IProfilePart::Importer &i) override; |
| 46 | void exportProfilePart(IProfilePart::Exporter &e) const override; |
| 47 | std::unique_ptr<IProfilePart> cloneProfilePart() const override; |
| 48 | |
| 49 | private: |
| 50 | void mode(std::string const &mode); |
| 51 | |
| 52 | class Initializer; |
| 53 | |
| 54 | std::string const id_; |
| 55 | std::string mode_; |
| 56 | std::vector<std::string> modes_; |
| 57 | |
| 58 | static bool const registered_; |
| 59 | }; |
| 60 | |
| 61 | } // namespace AMD |