From 1100e24acb3141d63956055ac1a83ff973458572 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 8 Sep 2023 01:26:52 +0100 Subject: ModelPartForOptionalBase::GetValue need not be a template --- slicer/slicer/modelPartsTypes.cpp | 9 +++++++++ slicer/slicer/modelPartsTypes.h | 2 +- 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 @@ -270,6 +270,15 @@ namespace Slicer { } } + bool + ModelPartForOptionalBase::GetValue(ValueTarget && s) + { + if (this->hasModel()) { + return modelPart->GetValue(std::move(s)); + } + return false; + } + bool ModelPartForOptionalBase::HasValue() const { 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; 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 @@ -323,17 +323,6 @@ namespace Slicer { } } - template - bool - ModelPartForOptional::GetValue(ValueTarget && s) - { - BOOST_ASSERT(this->Model); - if (*this->Model) { - return modelPart->GetValue(std::move(s)); - } - return false; - } - template ModelPartType ModelPartForOptional::GetType() const -- cgit v1.2.3