Show a patch.

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

{
    "id": 2027,
    "url": "https://patchwork.libcamera.org/api/patches/2027/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2027/",
    "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": "<20190927024417.725906-4-niklas.soderlund@ragnatech.se>",
    "date": "2019-09-27T02:44:07",
    "name": "[libcamera-devel,v3,03/13] libcamera: controls: Allow read only access to control values",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "963441c0f3629ed0cc262ad91e8265929de64298",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2027/mbox/",
    "series": [
        {
            "id": 508,
            "url": "https://patchwork.libcamera.org/api/series/508/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=508",
            "date": "2019-09-27T02:44:04",
            "name": "libcamera: ipa: Add basic IPA support",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/508/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2027/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2027/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE73F61917\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Sep 2019 04:45:26 +0200 (CEST)",
            "from bismarck.berto.se (unknown [84.172.88.101])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid cc9cfc69-e0d0-11e9-bdc3-005056917a89;\n\tFri, 27 Sep 2019 04:45:00 +0200 (CEST)"
        ],
        "X-Halon-ID": "cc9cfc69-e0d0-11e9-bdc3-005056917a89",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 27 Sep 2019 04:44:07 +0200",
        "Message-Id": "<20190927024417.725906-4-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20190927024417.725906-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190927024417.725906-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 03/13] libcamera: controls: Allow read\n\tonly access to control values",
        "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": "Fri, 27 Sep 2019 02:45:27 -0000"
    },
    "content": "Allow the control values in a ControlList to be examined from a const\nenvironment.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/controls.h |  1 +\n src/libcamera/controls.cpp   | 35 +++++++++++++++++++++++++++++++++++\n 2 files changed, 36 insertions(+)",
    "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex fbb3a62274c64259..eee5ef87b8fd2633 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -124,6 +124,7 @@ public:\n \tvoid clear() { controls_.clear(); }\n \n \tControlValue &operator[](ControlId id);\n+\tconst ControlValue &operator[](ControlId id) const;\n \tControlValue &operator[](const ControlInfo *info) { return controls_[info]; }\n \n \tvoid update(const ControlList &list);\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 44cb09d9102d93f6..6271a0bd7518dda5 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -523,6 +523,41 @@ ControlValue &ControlList::operator[](ControlId id)\n \treturn controls_[&iter->second];\n }\n \n+/**\n+ * \\brief Access the control specified by \\a id\n+ * \\param[in] id The control ID\n+ *\n+ * This method returns a const reference to the control identified by \\a id. If\n+ * no such controls is present in the list, a const reference to an empty\n+ * control value is returned.\n+ *\n+ * The behaviour is undefined if the control \\a id is not supported by the\n+ * camera that the ControlList refers to.\n+ *\n+ * \\return A const reference to the value of the control identified by \\a id\n+ */\n+const ControlValue &ControlList::operator[](ControlId id) const\n+{\n+\tconst ControlInfoMap &controls = camera_->controls();\n+\tstatic ControlValue empty;\n+\n+\tconst auto camctrl = controls.find(id);\n+\tif (camctrl == controls.end()) {\n+\t\tLOG(Controls, Error)\n+\t\t\t<< \"Camera \" << camera_->name()\n+\t\t\t<< \" does not support control \" << id;\n+\t\treturn empty;\n+\t}\n+\n+\tconst auto ctrl = controls_.find(&camctrl->second);\n+\tif (ctrl == controls_.end()) {\n+\t\tLOG(Controls, Error) << \"list does not have control \" << id;\n+\t\treturn empty;\n+\t}\n+\n+\treturn ctrl->second;\n+}\n+\n /**\n  * \\fn ControlList::operator[](const ControlInfo *info)\n  * \\brief Access or insert the control specified by \\a info\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "03/13"
    ]
}