| 1 | #include "units/inherited.hpp" |
|---|---|
| 2 | |
| 3 | #include "unit.hpp" |
| 4 | |
| 5 | #include <memory> |
| 6 | #include <string> |
| 7 | |
| 8 | InheritedUnit::InheritedUnit(const std::string &id, std::shared_ptr<IUnit> baseUnit) |
| 9 | : IUnit(id), // |
| 10 | childUnit_(std::move(baseUnit)) // |
| 11 | { |
| 12 | } |
| 13 | |
| 14 | std::optional<std::string> InheritedUnit::GetFailReason() const |
| 15 | { |
| 16 | return childUnit_->GetFailReason(); |
| 17 | } |
| 18 | |
| 19 | std::vector<std::string> InheritedUnit::GetPartOf() const |
| 20 | { |
| 21 | return childUnit_->GetPartOf(); |
| 22 | } |
| 23 | |
| 24 | std::vector<std::string> InheritedUnit::GetDependencies() const |
| 25 | { |
| 26 | return childUnit_->GetDependencies(); |
| 27 | } |
| 28 | |
| 29 | const UnitStatus &InheritedUnit::GetStatus() const |
| 30 | { |
| 31 | return childUnit_->GetStatus(); |
| 32 | } |
| 33 | |
| 34 | bool InheritedUnit::Stop() |
| 35 | { |
| 36 | return childUnit_->Stop(); |
| 37 | } |
| 38 | |
| 39 | bool InheritedUnit::Start() |
| 40 | { |
| 41 | return childUnit_->Start(); |
| 42 | } |
| 43 | |
| 44 | UnitType InheritedUnit::GetType() const |
| 45 | { |
| 46 | return UnitType::Inherited; |
| 47 | } |
| 48 | |
| 49 | std::string InheritedUnit::GetChildId() const |
| 50 | { |
| 51 | return childUnit_->id; |
| 52 | } |
| 53 | |
| 54 | std::string InheritedUnit::GetDescription() const |
| 55 | { |
| 56 | return childUnit_->GetDescription(); |
| 57 | } |
| 58 | |
| 59 | void InheritedUnit::AddDependency(const std::string &depName) |
| 60 | { |
| 61 | childUnit_->AddDependency(depName); |
| 62 | } |
| 63 |