Show a patch.

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

{
    "id": 16603,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16603/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16603/",
    "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": "<20220713084317.24268-6-dse@thaumatec.com>",
    "date": "2022-07-13T08:43:11",
    "name": "[libcamera-devel,v2,05/11] ipa: module: Add getAlgorithm() method",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "11f005acea425b931dcfaad96e048bdcc59235d4",
    "submitter": {
        "id": 126,
        "url": "https://patchwork.libcamera.org/api/1.1/people/126/?format=api",
        "name": "Daniel Semkowicz",
        "email": "dse@thaumatec.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16603/mbox/",
    "series": [
        {
            "id": 3276,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3276/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3276",
            "date": "2022-07-13T08:43:06",
            "name": "ipa: rkisp1: Add autofocus algorithm",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3276/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16603/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16603/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 9322FBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Jul 2022 08:43:44 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 43B1363322;\n\tWed, 13 Jul 2022 10:43:44 +0200 (CEST)",
            "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E4A063317\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 10:43:42 +0200 (CEST)",
            "by mail-wr1-x42d.google.com with SMTP id v14so14473691wra.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 01:43:42 -0700 (PDT)",
            "from localhost.localdomain (ip092042140082.rev.nessus.at.\n\t[92.42.140.82]) by smtp.gmail.com with ESMTPSA id\n\tbg32-20020a05600c3ca000b003a04d19dab3sm5667468wmb.3.2022.07.13.01.43.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 13 Jul 2022 01:43:41 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657701824;\n\tbh=tePFJbqNxQG4rqyc5U31SCyuAbtuxBb9RDJ4Ws7GtgI=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=ATU5LOLO29+AZLbpDoBkOIyJrRRaMH+n5UnsDqCxLgLZiU3/TDYGh8ouJbU9JO+r1\n\tmdDLhGzgDRw+F1rSnCYxL9SWYELB5kONwoWidpcHSFXaEQamryRGUcpDSrV6Ae6e3r\n\tgQgN0UY7lw2sPEiVUqckD/ymSEPdVsTjL/5Lk0AuWOpVq3jtKkMZaqBXpfQy+/qgT5\n\t/qrqIv7S9GOp4hbo+l5ZsnTec7VSiZUfMxT66NaLp/xYqLP2WuE8n7mkzQwc4tVwU+\n\tPn+WniGgrxNxgd8JJbtRRE53QQ+5VOnatVMdw7xMGLIH6gc9lmuaZYf59lhZO2d/g6\n\tyfK4AIw+90NCg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=X7GLsLrVPX5OXkhXrPOHqOO0DAVsribVHxl4TC4vZMA=;\n\tb=ZZ5CBhwQawFHtX16y12lchrWFO8RUPBOZx4pRywl3ZIoS53/UHs5m9Qmn0GEdnCDm6\n\t+EYncmZ57x0wvjeJQlVo5sXukJCgDiu/QtwSl0EV2pynS+Eb5c2EEExTxwtOfOUa9wLB\n\tWhuRxhp4hZLibRa3KgTgH8hL5iWc6dHZHwaEjGyIEY+wSLDw+ckp22GBrg1Dbu0yqiuK\n\t8FSvoQbYF+Bx49p2J0XFbcDdaqxkWzFepsvISgohv+1wMiKWWLnh/DMZeA8g2LOgX7ZF\n\td+eru6Zd5eVb4y9D7nM5mOoJtXVFPKUUHSn3c/DI7sTXw1v1dg+Fh9HPVIFT9909uh9U\n\tzuxA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"ZZ5CBhwQ\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=X7GLsLrVPX5OXkhXrPOHqOO0DAVsribVHxl4TC4vZMA=;\n\tb=t1fb6KzRSUBjA0Lk2K7MKEGSOLoKBzoQvdPeEuZt8Bmk6G/uxKkaxa2PLSC2/n5ZnA\n\tUFMzXygi8ktbLWZkmcQ0PQ88sUi0TroVhdOYWxS5vwKvx+qesg1KxXhA1YpK1cy9GqMG\n\txL5T6KAMMRDysVF1nXiSxWhaJ6XLyp4KEIQ2ALVtpuxMWsd2wX9PuyLaP9qcKd38cbHu\n\t1u7OpabEJJpYpNWO74aTq5hE+mSoC62/TUOBjmp8SShP6md+soFHbwFXY94FFYtXET4F\n\thh5BTNYtAOWDRfCj57AuWrrTHjX39rpStkx2uAhvHR3blISlVzx8INdnDcYTG5++AV0I\n\tdWbw==",
        "X-Gm-Message-State": "AJIora+fF+4yeUhxFfrEd87e+4x/RvHSodzcCkQPcRlEsUrjl/gYfDgM\n\t9H4bfeHrC2xbMZ/KVHRDCxA3J3IT+7FEVQ==",
        "X-Google-Smtp-Source": "AGRyM1tVskmINzu3guNp1TFGe2rfjdThLbzDSzQRbGej+MsWh2cln3roVNIzjwfQXfpEWpxHZ8gXKA==",
        "X-Received": "by 2002:adf:ed10:0:b0:21d:a9a1:3526 with SMTP id\n\ta16-20020adfed10000000b0021da9a13526mr2064015wro.403.1657701822265; \n\tWed, 13 Jul 2022 01:43:42 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 13 Jul 2022 10:43:11 +0200",
        "Message-Id": "<20220713084317.24268-6-dse@thaumatec.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220713084317.24268-1-dse@thaumatec.com>",
        "References": "<20220713084317.24268-1-dse@thaumatec.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 05/11] ipa: module: Add getAlgorithm()\n\tmethod",
        "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>",
        "From": "Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Daniel Semkowicz <dse@thaumatec.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "This function allows to get pointer to the algorithm of specific type\nfrom the list of loaded algorithms.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n src/ipa/libipa/module.cpp |  7 +++++++\n src/ipa/libipa/module.h   | 17 +++++++++++++++++\n 2 files changed, 24 insertions(+)",
    "diff": "diff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp\nindex 77352104..7c0680fd 100644\n--- a/src/ipa/libipa/module.cpp\n+++ b/src/ipa/libipa/module.cpp\n@@ -83,6 +83,13 @@ namespace ipa {\n  * \\return The list of instantiated algorithms\n  */\n \n+/**\n+ * \\fn Module::getAlgorithm()\n+ * \\brief Find and return the algorithm of requested type\n+ * \\tparam AlgoType Algorithm type you want to retrieve\n+ * \\return Pointer to the algorithm if found, else nullptr\n+ */\n+\n /**\n  * \\fn Module::createAlgorithms()\n  * \\brief Create algorithms from YAML configuration data\ndiff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h\nindex 4149a353..c4974635 100644\n--- a/src/ipa/libipa/module.h\n+++ b/src/ipa/libipa/module.h\n@@ -10,6 +10,7 @@\n #include <list>\n #include <memory>\n #include <string>\n+#include <typeinfo>\n #include <vector>\n \n #include <libcamera/base/log.h>\n@@ -43,6 +44,22 @@ public:\n \t\treturn algorithms_;\n \t}\n \n+\ttemplate<typename AlgoType>\n+\tAlgoType *getAlgorithm() const\n+\t{\n+\t\tauto isSameType = [](const std::unique_ptr<Algorithm<Module>> &algoPtr) {\n+\t\t\treturn typeid(*algoPtr.get()) == typeid(AlgoType);\n+\t\t};\n+\n+\t\tauto result = std::find_if(begin(algorithms_), end(algorithms_), isSameType);\n+\n+\t\tif (result != std::end(algorithms_)) {\n+\t\t\treturn static_cast<AlgoType *>(result->get());\n+\t\t} else {\n+\t\t\treturn nullptr;\n+\t\t}\n+\t}\n+\n \tint createAlgorithms(Context &context, const YamlObject &algorithms)\n \t{\n \t\tconst auto &list = algorithms.asList();\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "05/11"
    ]
}