Show a patch.

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

{
    "id": 24066,
    "url": "https://patchwork.libcamera.org/api/patches/24066/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24066/",
    "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": "<20250806154842.597155-3-barnabas.pocze@ideasonboard.com>",
    "date": "2025-08-06T15:48:42",
    "name": "[RFC,v1,3/3] utils: codegen: ipc: Generate templated constructor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7f134837d5b108396cd247918ab7a12c1a46368f",
    "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/24066/mbox/",
    "series": [
        {
            "id": 5359,
            "url": "https://patchwork.libcamera.org/api/series/5359/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5359",
            "date": "2025-08-06T15:48:40",
            "name": "[RFC,v1,1/3] utils: codegen: ipc: Put default values in declaration",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5359/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24066/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24066/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 9795FBDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Aug 2025 15:48:51 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8C76169224;\n\tWed,  6 Aug 2025 17:48:50 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CCA45691F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Aug 2025 17:48:46 +0200 (CEST)",
            "from pb-laptop.local (185.182.215.213.nat.pool.zt.hu\n\t[185.182.215.213])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 44D361249;\n\tWed,  6 Aug 2025 17:47:58 +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=\"Zdv3rygU\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1754495278;\n\tbh=wOy7DUm0AgjVIbGWO8WE6CzuWqdOtZjV2/exTN58kzA=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Zdv3rygUBhgLzjDXWD5J2aGepr+8YphOHQVGZLucf0Z2eeqicNjXqGNvCdocoLRhH\n\t8kZWX7zzTV3Gw1Szye+3144Z+gwjIqporxo9gJ1D8fCpKdKaAndO1OjLV0YMm6sYTi\n\tGjP8UTvzQLStEKi5eMcFM2SipQ3DLgZ2g2FU+tig=",
        "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>",
        "Subject": "[RFC PATCH v1 3/3] utils: codegen: ipc: Generate templated\n\tconstructor",
        "Date": "Wed,  6 Aug 2025 17:48:42 +0200",
        "Message-ID": "<20250806154842.597155-3-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.50.1",
        "In-Reply-To": "<20250806154842.597155-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20250806154842.597155-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>\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(-)",
    "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..0b5bbd933 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_constructible_v<{{field|name}}, T{{loop.index}}>> * = 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}} &&arg{{loop.index}}{{ \", \" 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}}>(arg{{loop.index}}))\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",
        "v1",
        "3/3"
    ]
}