{"id":2927,"url":"https://patchwork.libcamera.org/api/1.1/patches/2927/?format=json","web_url":"https://patchwork.libcamera.org/patch/2927/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200229164254.23604-10-laurent.pinchart@ideasonboard.com>","date":"2020-02-29T16:42:32","name":"[libcamera-devel,09/31] libcamera: controls: Decouple control and value type in ControlList::set()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d56685bff3cff57f6730cde32825477c05f0ba37","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2927/mbox/","series":[{"id":696,"url":"https://patchwork.libcamera.org/api/1.1/series/696/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=696","date":"2020-02-29T16:42:23","name":"libcamera: Add support for array controls","version":1,"mbox":"https://patchwork.libcamera.org/series/696/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2927/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2927/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 62BBA62787\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Feb 2020 17:43:25 +0100 (CET)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0217F33E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Feb 2020 17:43:24 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1582994605;\n\tbh=yILmkhNrTwHmEcsjNAazHHfb3IUGlKb786I96spDtdI=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=DKjyIwRfOwo7dCn8k0hyPD63igLed/MFwCijiGE0VJX+Rrd9rsQd6UuAapm/7m5iB\n\tQNcWW+7B/aN3ENA3fkaoGnK60iIFaTsAJJHsKb4t57yh/fkoDQUiRkzIMwWzenGfCB\n\tJBRVFkHMTvCfmw9fiZRqDv84eLiyoD/VSmSLqD4E=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 29 Feb 2020 18:42:32 +0200","Message-Id":"<20200229164254.23604-10-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.24.1","In-Reply-To":"<20200229164254.23604-1-laurent.pinchart@ideasonboard.com>","References":"<20200229164254.23604-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 09/31] libcamera: controls: Decouple\n\tcontrol and value type in ControlList::set()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sat, 29 Feb 2020 16:43:25 -0000"},"content":"The ControlList::set() method takes a reference to a Control<T>, and\nrequires the value to be a reference to T. This prevents the set()\nmethod to be used with value types that are convertible to T,\nand in particular with std::array or std::vector values types when the\nControl type will be a Span<> to support compound controls.\n\nFix this by decoupling the control type and value type in the template\nparameters. The compiler will still catch invalid conversions, including\ncases where constructor a T from the value type is explicit.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/controls.h | 4 ++--\n src/libcamera/controls.cpp   | 2 +-\n 2 files changed, 3 insertions(+), 3 deletions(-)","diff":"diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 9f8a9031bd74..9d93064c11b2 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -223,8 +223,8 @@ public:\n \t\treturn val->get<T>();\n \t}\n \n-\ttemplate<typename T>\n-\tvoid set(const Control<T> &ctrl, const T &value)\n+\ttemplate<typename T, typename V>\n+\tvoid set(const Control<T> &ctrl, const V &value)\n \t{\n \t\tControlValue *val = find(ctrl.id());\n \t\tif (!val)\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex f632d60adc8b..a136ebd2653b 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -735,7 +735,7 @@ bool ControlList::contains(unsigned int id) const\n  */\n \n /**\n- * \\fn template<typename T> void ControlList::set(const Control<T> &ctrl, const T &value)\n+ * \\fn template<typename T, typename V> void ControlList::set(const Control<T> &ctrl, const V &value)\n  * \\brief Set the control \\a ctrl value to \\a value\n  * \\param[in] ctrl The control\n  * \\param[in] value The control value\n","prefixes":["libcamera-devel","09/31"]}