diff options
-rw-r--r-- | slicer/slicer/modelPartsTypes.cpp | 9 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.h | 2 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.impl.h | 11 |
3 files changed, 10 insertions, 12 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp index a65d2e7..b34bbc8 100644 --- a/slicer/slicer/modelPartsTypes.cpp +++ b/slicer/slicer/modelPartsTypes.cpp @@ -271,6 +271,15 @@ namespace Slicer { } bool + ModelPartForOptionalBase::GetValue(ValueTarget && s) + { + if (this->hasModel()) { + return modelPart->GetValue(std::move(s)); + } + return false; + } + + bool ModelPartForOptionalBase::HasValue() const { return this->hasModel() && modelPart->HasValue(); diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index 430b72f..b30636e 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -106,6 +106,7 @@ namespace Slicer { bool OnChild(const SubPartHandler &, std::string_view name, const HookFilter & flt, MatchCase matchCase = MatchCase::Yes) override; void SetValue(ValueSource && s) override; + bool GetValue(ValueTarget && s) override; [[nodiscard]] bool HasValue() const override; [[nodiscard]] bool IsOptional() const override; [[nodiscard]] const Metadata & GetMetadata() const override; @@ -123,7 +124,6 @@ namespace Slicer { using element_type = Ice::optional<typename T::element_type>; explicit ModelPartForOptional(element_type * h); void Create() override; - bool GetValue(ValueTarget && s) override; [[nodiscard]] ModelPartType GetType() const override; protected: diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index 3fcc598..0342cb0 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -324,17 +324,6 @@ namespace Slicer { } template<typename T> - bool - ModelPartForOptional<T>::GetValue(ValueTarget && s) - { - BOOST_ASSERT(this->Model); - if (*this->Model) { - return modelPart->GetValue(std::move(s)); - } - return false; - } - - template<typename T> ModelPartType ModelPartForOptional<T>::GetType() const { |