Patch Detail
Show a patch.
GET /api/1.1/patches/23186/?format=api
{ "id": 23186, "url": "https://patchwork.libcamera.org/api/1.1/patches/23186/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23186/", "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": "<20250417113539.1137936-3-barnabas.pocze@ideasonboard.com>", "date": "2025-04-17T11:35:39", "name": "[v1,3/3] libcamera: controls: Implement `swap()`", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d6b84a738adeaca6fc884f84e5763b3ca2018221", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23186/mbox/", "series": [ { "id": 5131, "url": "https://patchwork.libcamera.org/api/1.1/series/5131/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5131", "date": "2025-04-17T11:35:37", "name": "[v1,1/3] libcamera: controls: Give name to the union containing storage", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5131/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23186/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23186/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 21B2AC3284\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Apr 2025 11:35:51 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2DCA268AC0;\n\tThu, 17 Apr 2025 13:35:48 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E6E9C68AC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Apr 2025 13:35:43 +0200 (CEST)", "from pb-laptop.local (185.221.143.16.nat.pool.zt.hu\n\t[185.221.143.16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4AF1311E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Apr 2025 13:33:40 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OdA3h8Bw\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1744889620;\n\tbh=M06HT4DwU9iVSr+nbwhaqzltK+9vyl8VxWXUj7om2PU=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=OdA3h8Bw6+2yZh9it1vtPALfmdgomf3QTw0ZgC/Ay0ZLxBeTccwUt57REhxZYUtZR\n\tIostv5Fqu49D6aTz1++Ch82fI0czBZgNpa/Kq06bazAjrqVqGHt9hOGdr1l9Uuc0PI\n\tTJQ5A5fBWrw3z7tj4GBO6JNpeEgK/oVugHhqKS40=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v1 3/3] libcamera: controls: Implement `swap()`", "Date": "Thu, 17 Apr 2025 13:35:39 +0200", "Message-ID": "<20250417113539.1137936-3-barnabas.pocze@ideasonboard.com>", "X-Mailer": "git-send-email 2.49.0", "In-Reply-To": "<20250417113539.1137936-1-barnabas.pocze@ideasonboard.com>", "References": "<20250417113539.1137936-1-barnabas.pocze@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Implement both free and member function `swap()` for `ControlValue`.\nThe general `std::swap()` swaps two values by combining a move construction\nand two move assignments, but for `ControlValue` a simpler implementation\ncan be provided by just swapping the members.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n include/libcamera/controls.h | 24 ++++++++++++++++++++++++\n src/libcamera/controls.cpp | 15 +++++++++++++++\n 2 files changed, 39 insertions(+)", "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 86245e7a9..27b314dbc 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -261,6 +261,30 @@ public:\n \tvoid reserve(ControlType type, bool isArray = false,\n \t\t std::size_t numElements = 1);\n \n+\tvoid swap(ControlValue &other) noexcept\n+\t{\n+\t\t{\n+\t\t\tauto tmp = type_;\n+\t\t\ttype_ = other.type_;\n+\t\t\tother.type_ = tmp;\n+\t\t}\n+\n+\t\tstd::swap(isArray_, other.isArray_);\n+\n+\t\t{\n+\t\t\tauto tmp = numElements_;\n+\t\t\tnumElements_ = other.numElements_;\n+\t\t\tother.numElements_ = tmp;\n+\t\t}\n+\n+\t\tstd::swap(storage_, other.storage_);\n+\t}\n+\n+\tfriend void swap(ControlValue &a, ControlValue &b) noexcept\n+\t{\n+\t\ta.swap(b);\n+\t}\n+\n private:\n \tControlType type_ : 8;\n \tbool isArray_;\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 885287e71..c1ff60f39 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -411,6 +411,21 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen\n \t\tstorage_.external = new uint8_t[newSize];\n }\n \n+/**\n+ * \\fn ControlValue::swap(ControlValue &other) noexcept\n+ * \\brief Swap two control values\n+ *\n+ * This function swaps the contained value of \\a this with that of \\a other.\n+ */\n+\n+/**\n+ * \\fn ControlValue::swap(ControlValue &a, ControlValue &b) noexcept\n+ * \\brief Swap two control values\n+ *\n+ * This function swaps the contained value of \\a a with that of \\a b.\n+ * \\sa ControlValue::swap()\n+ */\n+\n /**\n * \\class ControlId\n * \\brief Control static metadata\n", "prefixes": [ "v1", "3/3" ] }