| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "core/exportable.h" |
| 7 | #include "core/importable.h" |
| 8 | #include "core/item.h" |
| 9 | |
| 10 | class ICommandQueue; |
| 11 | |
| 12 | class IControl |
| 13 | : public Item |
| 14 | , public Importable |
| 15 | , public Exportable |
| 16 | { |
| 17 | public: |
| 18 | class Importer : public Importable::Importer |
| 19 | { |
| 20 | public: |
| 21 | virtual bool provideActive() const = 0; |
| 22 | }; |
| 23 | |
| 24 | class Exporter : public Exportable::Exporter |
| 25 | { |
| 26 | public: |
| 27 | virtual void takeActive(bool active) = 0; |
| 28 | }; |
| 29 | |
| 30 | virtual void preInit(ICommandQueue &ctlCmds) = 0; |
| 31 | virtual void postInit(ICommandQueue &ctlCmds) = 0; |
| 32 | virtual void init() = 0; |
| 33 | |
| 34 | virtual bool active() const = 0; |
| 35 | virtual void activate(bool active) = 0; |
| 36 | |
| 37 | /// Cleans the control unconditionally on the next clean method |
| 38 | /// call, independently of its previous active state. |
| 39 | virtual void cleanOnce() = 0; |
| 40 | |
| 41 | virtual void clean(ICommandQueue &ctlCmds) = 0; |
| 42 | virtual void sync(ICommandQueue &ctlCmds) = 0; |
| 43 | |
| 44 | virtual ~IControl() = default; |
| 45 | }; |