| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "isysmodel.h" |
| 7 | #include <memory> |
| 8 | #include <string> |
| 9 | #include <utility> |
| 10 | #include <vector> |
| 11 | |
| 12 | class ISWInfo; |
| 13 | class ISysComponent; |
| 14 | |
| 15 | class SysModel final : public ISysModel |
| 16 | { |
| 17 | public: |
| 18 | SysModel(std::shared_ptr<ISWInfo> swInfo, |
| 19 | std::vector<std::unique_ptr<ISysComponent>> &&components) noexcept; |
| 20 | |
| 21 | void init() override; |
| 22 | void preInit(ICommandQueue &ctlCmds) override; |
| 23 | void postInit(ICommandQueue &ctlCmds) override; |
| 24 | void sync(ICommandQueue &ctlCmds) override; |
| 25 | void updateSensors( |
| 26 | std::unordered_map<std::string, std::unordered_set<std::string>> const |
| 27 | &ignored) override; |
| 28 | |
| 29 | std::vector<std::pair<std::string, std::vector<std::pair<std::string, std::string>>>> |
| 30 | info() const override; |
| 31 | |
| 32 | std::string const &ID() const override; |
| 33 | void importWith(Importable::Importer &i) override; |
| 34 | void exportWith(Exportable::Exporter &e) const override; |
| 35 | |
| 36 | private: |
| 37 | std::pair<std::string, std::vector<std::pair<std::string, std::string>>> |
| 38 | softwareInfo() const; |
| 39 | |
| 40 | std::string const id_; |
| 41 | std::shared_ptr<ISWInfo> const swInfo_; |
| 42 | std::vector<std::unique_ptr<ISysComponent>> const components_; |
| 43 | }; |