| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #pragma once |
| 4 | |
| 5 | // The InheritedUnit class wraps another Unit and delegates all operations to it. |
| 6 | #include "units/unit.hpp" |
| 7 | |
| 8 | class InheritedUnit : public IUnit |
| 9 | { |
| 10 | public: |
| 11 | explicit InheritedUnit(const std::string &id, std::shared_ptr<IUnit> childUnit); |
| 12 | |
| 13 | UnitType GetType() const override; |
| 14 | bool Start() override; |
| 15 | bool Stop() override; |
| 16 | const UnitStatus &GetStatus() const override; |
| 17 | std::vector<std::string> GetDependencies() const override; |
| 18 | std::vector<std::string> GetPartOf() const override; |
| 19 | std::optional<std::string> GetFailReason() const override; |
| 20 | std::string GetChildId() const; |
| 21 | std::string GetDescription() const override; |
| 22 | void AddDependency(const std::string &depName) override; |
| 23 | |
| 24 | private: |
| 25 | const std::shared_ptr<IUnit> childUnit_; |
| 26 | }; |
| 27 | |