Patch Detail
Show a patch.
GET /api/1.1/patches/2931/?format=api
{ "id": 2931, "url": "https://patchwork.libcamera.org/api/1.1/patches/2931/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2931/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "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-14-laurent.pinchart@ideasonboard.com>", "date": "2020-02-29T16:42:36", "name": "[libcamera-devel,13/31] libcamera: controls: Move ControlValue constructor to controls.h", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "1eac15c20b1e30da0f915aa0c505537e9d1815f3", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2931/mbox/", "series": [ { "id": 696, "url": "https://patchwork.libcamera.org/api/1.1/series/696/?format=api", "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/2931/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2931/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 B7A4A62796\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Feb 2020 17:43:26 +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 5289C33E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Feb 2020 17:43:26 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1582994606;\n\tbh=Ju4ChpgLD5KCr++ioggZpJWGE95fy+RCeo4LCssiYbY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=U0J6T09iDx+JZihNPoDWE877XtnjrO1egnRSr94O+WWEbPbKtF+/g/VJG1ZX5RClX\n\twTu4rSIUxb1w+7ybvbU8M2pgZcVtw/lBkBM0OMf6Wy56qV/DzEehVnucmpbEl6ebp8\n\tA4s+2NpoC8d68p0KFft1SnjNGWxQAyrhIzQe2yeI=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 29 Feb 2020 18:42:36 +0200", "Message-Id": "<20200229164254.23604-14-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 13/31] libcamera: controls: Move\n\tControlValue constructor to controls.h", "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:31 -0000" }, "content": "To avoid defining all specializations of the ControlValue constructor\nmanually, move the definition of those functions to controls.h. The\ndefault constructor is still kept in controls.cpp.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/controls.h | 10 +++++++---\n src/libcamera/controls.cpp | 27 +++------------------------\n 2 files changed, 10 insertions(+), 27 deletions(-)", "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 39e240438861..dfe69916cd64 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -55,9 +55,13 @@ class ControlValue\n {\n public:\n \tControlValue();\n-\tControlValue(bool value);\n-\tControlValue(int32_t value);\n-\tControlValue(int64_t value);\n+\n+\ttemplate<typename T>\n+\tControlValue(T value)\n+\t\t: type_(details::control_type<std::remove_cv_t<T>>::value)\n+\t{\n+\t\t*reinterpret_cast<T *>(&bool_) = value;\n+\t}\n \n \tControlType type() const { return type_; }\n \tbool isNone() const { return type_ == ControlTypeNone; }\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex f3d79785e6a8..5cc8ce2199d0 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -74,31 +74,10 @@ ControlValue::ControlValue()\n }\n \n /**\n- * \\brief Construct a Boolean ControlValue\n- * \\param[in] value Boolean value to store\n+ * \\fn template<typename T> T ControlValue::ControlValue(T value)\n+ * \\brief Construct a ControlValue of type T\n+ * \\param[in] value Initial value\n */\n-ControlValue::ControlValue(bool value)\n-\t: type_(ControlTypeBool), bool_(value)\n-{\n-}\n-\n-/**\n- * \\brief Construct an integer ControlValue\n- * \\param[in] value Integer value to store\n- */\n-ControlValue::ControlValue(int32_t value)\n-\t: type_(ControlTypeInteger32), integer32_(value)\n-{\n-}\n-\n-/**\n- * \\brief Construct a 64 bit integer ControlValue\n- * \\param[in] value Integer value to store\n- */\n-ControlValue::ControlValue(int64_t value)\n-\t: type_(ControlTypeInteger64), integer64_(value)\n-{\n-}\n \n /**\n * \\fn ControlValue::type()\n", "prefixes": [ "libcamera-devel", "13/31" ] }