diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-09-08 01:26:52 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-09-08 01:26:52 +0100 |
commit | 1100e24acb3141d63956055ac1a83ff973458572 (patch) | |
tree | 67c267f151ea0994d7492b337fcec3ed971f0d29 | |
parent | No need to delete move/copy for ModelPart (diff) | |
download | slicer-1100e24acb3141d63956055ac1a83ff973458572.tar.bz2 slicer-1100e24acb3141d63956055ac1a83ff973458572.tar.xz slicer-1100e24acb3141d63956055ac1a83ff973458572.zip |
ModelPartForOptionalBase::GetValue need not be a template
-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 { |