From 23785e88be173be9956f7c59619bc156e9c60723 Mon Sep 17 00:00:00 2001 From: Owen Green Date: Mon, 1 Jun 2020 22:59:18 +0100 Subject: [PATCH] Constrain params before constructing clients --- include/FluidSCWrapper.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/FluidSCWrapper.hpp b/include/FluidSCWrapper.hpp index 6838dce..93a1734 100644 --- a/include/FluidSCWrapper.hpp +++ b/include/FluidSCWrapper.hpp @@ -595,7 +595,7 @@ struct LifetimePolicy { FloatControlsIter controlsReader{unit->mInBuf + Wrapper::ControlOffset(unit),Wrapper::ControlSize(unit)}; auto params = typename Wrapper::ParamSetType{Client::getParameterDescriptors()}; - Wrapper::setParams(unit, params, controlsReader); + Wrapper::setParams(unit, params, controlsReader,true); Client client{params}; new (static_cast(unit)) Wrapper(std::move(controlsReader), std::move(client), std::move(params)); } @@ -631,7 +631,7 @@ struct LifetimePolicy std::cout << "ERROR: ID " << uid << "is already being used by the cache" << std::endl; return; } - Wrapper::setParams(unit, entry.params,controlsReader); + Wrapper::setParams(unit, entry.params,controlsReader,true); new (static_cast(unit)) Wrapper{std::move(controlsReader),std::move(client),std::move(params)}; static_cast(unit)->uid = uid; entry.leased = true; @@ -698,8 +698,10 @@ struct LifetimePolicy FloatControlsIter controlsReader{unit->mInBuf + Wrapper::ControlOffset(unit),Wrapper::ControlSize(unit)}; auto params = typename Client::ParamSetType{Client::getParameterDescriptors()}; - Wrapper::setParams(unit, params,controlsReader); + Wrapper::setParams(unit, params,controlsReader,true); + auto& name = params.template get<0>(); + auto client = Client{params}; auto clientRef = SharedType::lookup(name);