From 92f777d184bf908a8c2b1f5cd5f92e6fa70cb0d0 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 5 Feb 2020 01:27:32 -0500 Subject: [PATCH] Add configSwitch(), which is a quicker way to configure parameters with SwitchQuantitys. --- include/engine/Module.hpp | 7 +++++++ include/engine/ParamQuantity.hpp | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/engine/Module.hpp b/include/engine/Module.hpp index c17fd5db..9f48d41f 100644 --- a/include/engine/Module.hpp +++ b/include/engine/Module.hpp @@ -121,6 +121,13 @@ struct Module { return q; } + template + TSwitchQuantity* configSwitch(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::vector labels = {}) { + TSwitchQuantity* sq = configParam(paramId, minValue, maxValue, defaultValue, name); + sq->labels = labels; + return sq; + } + template TPortInfo* configInput(int portId, std::string name = "") { assert(portId < (int) inputs.size() && portId < (int) inputInfos.size()); diff --git a/include/engine/ParamQuantity.hpp b/include/engine/ParamQuantity.hpp index 440ba13f..153e8cc3 100644 --- a/include/engine/ParamQuantity.hpp +++ b/include/engine/ParamQuantity.hpp @@ -75,9 +75,6 @@ struct ParamQuantity : Quantity { struct SwitchQuantity : ParamQuantity { std::vector labels; - void setLabels(const std::vector& labels) { - this->labels = labels; - } std::string getDisplayValueString() override; void setDisplayValueString(std::string s) override; };