Show a patch.

GET /api/patches/24141/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 24141,
    "url": "https://patchwork.libcamera.org/api/patches/24141/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24141/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20250815123138.2213654-3-barnabas.pocze@ideasonboard.com>",
    "date": "2025-08-15T12:31:38",
    "name": "[RFC,v2,3/3] utils: codegen: ipc: Generate templated constructor",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "21848dafd93be0adaf9bd39158b3249df134a9d7",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24141/mbox/",
    "series": [
        {
            "id": 5384,
            "url": "https://patchwork.libcamera.org/api/series/5384/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5384",
            "date": "2025-08-15T12:31:36",
            "name": "[RFC,v2,1/3] utils: codegen: ipc: Put default values in declaration",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5384/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24141/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24141/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 3D3C5C3295\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Aug 2025 12:31:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CDD7B6925F;\n\tFri, 15 Aug 2025 14:31:46 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5AA0B61443\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Aug 2025 14:31:43 +0200 (CEST)",
            "from pb-laptop.local (185.221.141.188.nat.pool.zt.hu\n\t[185.221.141.188])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5D7106A8;\n\tFri, 15 Aug 2025 14:30:48 +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=\"jtE2w+SH\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755261048;\n\tbh=eChmiVSgIH2h0YYqRMrCyKfGiAnQdeqwwBcOWSwAYHk=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=jtE2w+SH6XkvUNh1FsQWUAEkbfLMRqOP5X3fkneIL0QyYSMgRkdQJZoJZFdIVQ8hW\n\thd9yO0yO7jOo5bs6K0iow5yyqNfCclrIoWZASNv3CekSa1iTQKN0dwwo48Pu/P8qk6\n\tA+tMgoPrxoqQoDumSzepFn8ZViq2/jw12lOshuxQ=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org,\n\tPaul Elder <paul.elder@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Subject": "[RFC PATCH v2 3/3] utils: codegen: ipc: Generate templated\n\tconstructor",
        "Date": "Fri, 15 Aug 2025 14:31:38 +0200",
        "Message-ID": "<20250815123138.2213654-3-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.50.1",
        "In-Reply-To": "<20250815123138.2213654-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20250815123138.2213654-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": "Forcing the \"non-pod\" members to be initialized from `const T&` is not the\nideal solution because it disallows e.g. move constructors. So generate a\ntemplated constructor, which members to be initialized more freely, e.g.\nusing move constructors.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nchanges in v2:\n\t* use `std::is_convertible_v` to avoid accidental use of explicit\n\t  constructors/conversion operators\n---\n .../libcamera_templates/core_ipa_interface.h.tmpl |  2 ++\n .../libcamera_templates/definition_functions.tmpl | 15 +++++++++++----\n .../module_ipa_interface.h.tmpl                   |  2 ++\n 3 files changed, 15 insertions(+), 4 deletions(-)\n\n--\n2.50.1",
    "diff": "diff --git a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\nindex 3942e5708..93f988cd9 100644\n--- a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\n+++ b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\n@@ -16,6 +16,8 @@\n\n {% if has_map %}#include <map>{% endif %}\n {% if has_string %}#include <string>{% endif %}\n+#include <type_traits>\n+#include <utility>\n {% if has_array %}#include <vector>{% endif %}\n\n #include <libcamera/controls.h>\ndiff --git a/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl b/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl\nindex 3a57a3c2c..dec25558f 100644\n--- a/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl\n+++ b/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl\n@@ -28,14 +28,21 @@ public:\n #ifndef __DOXYGEN__\n \t{{struct.mojom_name}}() = default;\n\n+\ttemplate<\n+\t{%- for field in struct.fields %}\n+\t\ttypename T{{loop.index}} = {{field|name}},\n+\t{%- endfor %}\n+\t{%- for field in struct.fields %}\n+\t\tstd::enable_if_t<std::is_convertible_v<T{{loop.index}}&&, {{field|name}}>> * = nullptr{{\",\" if not loop.last}}\n+\t{%- endfor %}\n+\t>\n \t{{struct.mojom_name}}(\n {%- for field in struct.fields -%}\n-{{\"const \" if not field|is_pod}}{{field|name}} {{\"&\" if not field|is_pod}}_{{field.mojom_name}}{{\", \" if not loop.last}}\n+\t\tT{{loop.index}} &&_{{field.mojom_name}}{{ \", \" if not loop.last }}\n {%- endfor -%}\n )\n-\t\t:\n-{%- for field in struct.fields -%}\n-{{\" \" if loop.first}}{{field.mojom_name}}(_{{field.mojom_name}}){{\", \" if not loop.last}}\n+{%- for field in struct.fields %}\n+\t\t{{\": \" if loop.first else \", \"}}{{field.mojom_name}}(std::forward<T{{loop.index}}>(_{{field.mojom_name}}))\n {%- endfor %}\n \t{\n \t}\ndiff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl\nindex 5d70ea6a2..3913eb1fb 100644\n--- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl\n+++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl\n@@ -16,6 +16,8 @@\n\n {% if has_map %}#include <map>{% endif %}\n {% if has_string %}#include <string>{% endif %}\n+#include <type_traits>\n+#include <utility>\n {% if has_array %}#include <vector>{% endif %}\n\n #include <libcamera/base/flags.h>\n",
    "prefixes": [
        "RFC",
        "v2",
        "3/3"
    ]
}