| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "exportable.h" |
| 7 | #include "importable.h" |
| 8 | #include "item.h" |
| 9 | #include <string> |
| 10 | #include <unordered_map> |
| 11 | #include <unordered_set> |
| 12 | #include <utility> |
| 13 | #include <vector> |
| 14 | |
| 15 | class ICommandQueue; |
| 16 | |
| 17 | class ISysComponent |
| 18 | : public Item |
| 19 | , public Importable |
| 20 | , public Exportable |
| 21 | { |
| 22 | public: |
| 23 | class Importer : public Importable::Importer |
| 24 | { |
| 25 | public: |
| 26 | virtual bool provideActive() const = 0; |
| 27 | }; |
| 28 | |
| 29 | class Exporter : public Exportable::Exporter |
| 30 | { |
| 31 | public: |
| 32 | virtual void takeActive(bool active) = 0; |
| 33 | }; |
| 34 | |
| 35 | virtual bool active() const = 0; |
| 36 | virtual void activate(bool active) = 0; |
| 37 | |
| 38 | /// @return unique key generated for this system component |
| 39 | virtual std::string const &key() const = 0; |
| 40 | |
| 41 | /// @return component information as a pair of the component name and |
| 42 | /// a vector of pairs of key and info values. |
| 43 | virtual std::pair<std::string, std::vector<std::pair<std::string, std::string>>> |
| 44 | componentInfo() const = 0; |
| 45 | |
| 46 | virtual void init() = 0; |
| 47 | virtual void preInit(ICommandQueue &ctlCmds) = 0; |
| 48 | virtual void postInit(ICommandQueue &ctlCmds) = 0; |
| 49 | virtual void sync(ICommandQueue &ctlCmds) = 0; |
| 50 | virtual void updateSensors( |
| 51 | std::unordered_map<std::string, std::unordered_set<std::string>> const |
| 52 | &ignored) = 0; |
| 53 | |
| 54 | virtual ~ISysComponent() = default; |
| 55 | }; |