| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "icontrol.h" |
| 7 | |
| 8 | class Control : public IControl |
| 9 | { |
| 10 | public: |
| 11 | Control(bool active = true, bool forceClean = false) noexcept; |
| 12 | |
| 13 | bool active() const final override; |
| 14 | void activate(bool active) override; |
| 15 | |
| 16 | void cleanOnce() override; |
| 17 | |
| 18 | void importWith(Importable::Importer &i) final override; |
| 19 | void exportWith(Exportable::Exporter &e) const final override; |
| 20 | |
| 21 | void clean(ICommandQueue &ctlCmds) final override; |
| 22 | void sync(ICommandQueue &ctlCmds) final override; |
| 23 | |
| 24 | protected: |
| 25 | virtual void importControl(IControl::Importer &i) = 0; |
| 26 | virtual void exportControl(IControl::Exporter &e) const = 0; |
| 27 | |
| 28 | virtual void cleanControl(ICommandQueue &ctlCmds) = 0; |
| 29 | virtual void syncControl(ICommandQueue &ctlCmds) = 0; |
| 30 | |
| 31 | bool dirty() const; |
| 32 | void dirty(bool isDirty); |
| 33 | |
| 34 | protected: |
| 35 | bool active_; |
| 36 | bool forceClean_; |
| 37 | bool dirty_{false}; |
| 38 | }; |