From a4a65f23dcbaf5161cb05509b2b65fe29bb3cdd8 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 18 Oct 2026 14:56:14 +0200 Subject: [PATCH] Parameters: need to apply the scale when construct a Parameter ...since we do not check beforehand what value was specified; it seems preferable to do this ''in the parameter implementation'', as the builder can be expected to get a broad API, while the ParamData is the natural place to enforce an invariant --- src/lib/par/disposition.hpp | 4 ++-- src/lib/par/parameter.hpp | 2 +- tests/lib/par/parameter-test.cpp | 3 +++ wiki/thinkPad.ichthyo.mm | 25 ++++++++++++++++++++++--- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/lib/par/disposition.hpp b/src/lib/par/disposition.hpp index cff29e64b..ae96f11e8 100644 --- a/src/lib/par/disposition.hpp +++ b/src/lib/par/disposition.hpp @@ -104,8 +104,8 @@ namespace par { Provision* src_; public: - ParamData (VAL initVal, Scale scale) - : val_{std::move (initVal)} + ParamData (VAL const& initVal, Scale scale) + : val_{scale.conform(initVal)} , src_{nullptr} { Disposition::markBaseDomain(); diff --git a/src/lib/par/parameter.hpp b/src/lib/par/parameter.hpp index e166929db..95c778839 100644 --- a/src/lib/par/parameter.hpp +++ b/src/lib/par/parameter.hpp @@ -106,7 +106,7 @@ namespace par { { using ImplPackage = ParamData; //////////////////////////////////////////TICKET #1197 : remove the necessity to inject the CopySupportMarker ImplPackage* typeTag{nullptr}; - Parameter resParam{typeTag, std::move (initVal_), std::move (scale_)}; + Parameter resParam{typeTag, initVal_, std::move (scale_)}; return resParam; } diff --git a/tests/lib/par/parameter-test.cpp b/tests/lib/par/parameter-test.cpp index 904d7c66f..c8cbabd50 100644 --- a/tests/lib/par/parameter-test.cpp +++ b/tests/lib/par/parameter-test.cpp @@ -99,8 +99,11 @@ namespace test{ Parameter ps = Parameter::forValue(123.45f) .maxVal (23.55) .build(); + CHECK (roughEQ (23.55 , ps.getVal())); ps.setVal (100); CHECK (roughEQ (23.55 , ps.getVal())); + ps.setVal ( 23); + CHECK (roughEQ (23.0 , ps.getVal())); /////////////////////////////////////////////////////////////////////////////OOO (End) Prototyping 10/2026 Parameter p2 = Parameter::from(p1) diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 112dad725..14bcaa558 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -88155,6 +88155,9 @@ Prop.1: dist%3 1 2 0 1 2 0 + + + @@ -88293,12 +88296,24 @@ Prop.1: dist%3 1 2 0 1 2 0 - + + + + - + + + - + + + + + + + + @@ -88308,6 +88323,10 @@ Prop.1: dist%3 1 2 0 1 2 0 + + + +