Show a patch.

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

{
    "id": 2004,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2004/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2004/",
    "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": "<20190924172503.30864-6-jacopo@jmondi.org>",
    "date": "2019-09-24T17:24:47",
    "name": "[libcamera-devel,05/21] libcamera: controls: Make ControlInfoMap a class",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2891a999dbddf3553a1fa3701a0e725100ab2ffa",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2004/mbox/",
    "series": [
        {
            "id": 506,
            "url": "https://patchwork.libcamera.org/api/1.1/series/506/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=506",
            "date": "2019-09-24T17:24:42",
            "name": "Implement control serialization",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/506/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2004/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2004/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C338D62378\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Sep 2019 19:23:31 +0200 (CEST)",
            "from uno.homenet.telecomitalia.it\n\t(host89-248-dynamic.45-213-r.retail.telecomitalia.it [213.45.248.89])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 5B78560005\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Sep 2019 17:23:31 +0000 (UTC)"
        ],
        "X-Originating-IP": "213.45.248.89",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 24 Sep 2019 19:24:47 +0200",
        "Message-Id": "<20190924172503.30864-6-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20190924172503.30864-1-jacopo@jmondi.org>",
        "References": "<20190924172503.30864-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 05/21] libcamera: controls: Make\n\tControlInfoMap a class",
        "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": "Tue, 24 Sep 2019 17:23:31 -0000"
    },
    "content": "Make a class out of ControlInfoMap to be able to serialize its content.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/controls.h        | 24 +++++++++-\n src/libcamera/controls.cpp          | 68 ++++++++++++++++++++++++++++-\n src/libcamera/pipeline/uvcvideo.cpp |  4 +-\n src/libcamera/pipeline/vimc.cpp     |  4 +-\n 4 files changed, 92 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 8a7ddc510497..79731c4932ae 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -42,7 +42,29 @@ private:\n \tconst struct ControlMetadata *meta_;\n };\n \n-using ControlInfoMap = std::unordered_map<ControlId, ControlInfo>;\n+class ControlInfoMap\n+{\n+private:\n+\tusing InfoMap = std::unordered_map<ControlId, ControlInfo>;\n+\n+public:\n+\tusing iterator = InfoMap::iterator;\n+\tusing const_iterator = InfoMap::const_iterator;\n+\n+\titerator begin() { return map_.begin(); }\n+\titerator end() { return map_.end(); }\n+\tconst_iterator begin() const { return map_.begin(); }\n+\tconst_iterator end() const { return map_.end(); }\n+\n+\titerator find(ControlId id) { return map_.find(id); }\n+\tconst_iterator find(ControlId id) const { return map_.find(id); }\n+\n+\tvoid emplace(const ControlId id, const DataValue &min,\n+\t\t     const DataValue &max);\n+\n+private:\n+\tInfoMap map_;\n+};\n \n using ControlValue = DataValue;\n \ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex ee19eb6dc014..ec7ac7ba9ed6 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -169,10 +169,76 @@ std::string ControlInfo::toString() const\n }\n \n /**\n- * \\typedef ControlInfoMap\n+ * \\class ControlInfoMap\n  * \\brief A map of ControlId to ControlInfo\n  */\n \n+/**\n+ * \\typedef ControlInfoMap::iterator\n+ * \\brief Iterator for the controls contained within the list\n+ */\n+\n+/**\n+ * \\typedef ControlInfoMap::const_iterator\n+ * \\brief Const iterator for the controls contained within the list\n+ */\n+\n+/**\n+ * \\fn iterator ControlInfoMap::begin()\n+ * \\brief Retrieve an iterator to the first Control in the list\n+ * \\return An iterator to the first Control in the list\n+ */\n+\n+/**\n+ * \\fn const_iterator ControlInfoMap::begin() const\n+ * \\brief Retrieve a const_iterator to the first Control in the list\n+ * \\return A const_iterator to the first Control in the list\n+ */\n+\n+/**\n+ * \\fn iterator ControlInfoMap::end()\n+ * \\brief Retrieve an iterator pointing to the past-the-end control in the list\n+ * \\return An iterator to the element following the last control in the list\n+ */\n+\n+/**\n+ * \\fn const_iterator ControlInfoMap::end() const\n+ * \\brief Retrieve a const iterator pointing to the past-the-end control in the\n+ * list\n+ * \\return A const iterator to the element following the last control in the\n+ * list\n+ */\n+\n+/**\n+ * \\fn iterator ControlInfoMap::find(ControlId id)\n+ * \\brief Find ControlInfo with \\a id\n+ * \\param id The control identifier\n+ * \\return An interator to the ControlInfo with key \\a id or the\n+ * past-the-end iterator if no element with key \\a id exists\n+ */\n+\n+/**\n+ * \\fn const_iterator ControlInfoMap::find(ControlId id) const\n+ * \\brief Find ControlInfo with \\a id\n+ * \\param id The control identifier\n+ * \\return A const interator to the ControlInfo with key \\a id or the\n+ * past-the-end iterator if no element with key \\a id exists\n+ */\n+\n+/**\n+ * \\brief Insert a new element in the map constructed in-place\n+ * \\param[in] id The control ID\n+ * \\param[in] min The control minimum value\n+ * \\param[in] max The control maximum value\n+ */\n+void ControlInfoMap::emplace(const ControlId id, const DataValue &min,\n+\t\t\t     const DataValue &max)\n+{\n+\tmap_.emplace(std::piecewise_construct,\n+\t\t     std::forward_as_tuple(id),\n+\t\t     std::forward_as_tuple(id, min, max));\n+}\n+\n /**\n  * \\typedef ControlValue\n  * \\brief A control value stored in the ControlList class\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 8965210550d2..02455d1ac675 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -374,9 +374,7 @@ int UVCCameraData::init(MediaEntity *entity)\n \t\t\tcontinue;\n \t\t}\n \n-\t\tcontrolInfo_.emplace(std::piecewise_construct,\n-\t\t\t\t     std::forward_as_tuple(id),\n-\t\t\t\t     std::forward_as_tuple(id, info.min(), info.max()));\n+\t\tcontrolInfo_.emplace(id, info.min(), info.max());\n \t}\n \n \treturn 0;\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex f26a91f86ec1..5515704df14c 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -443,9 +443,7 @@ int VimcCameraData::init(MediaDevice *media)\n \t\t\tcontinue;\n \t\t}\n \n-\t\tcontrolInfo_.emplace(std::piecewise_construct,\n-\t\t\t\t     std::forward_as_tuple(id),\n-\t\t\t\t     std::forward_as_tuple(id, info.min(), info.max()));\n+\t\tcontrolInfo_.emplace(id, info.min(), info.max());\n \t}\n \n \treturn 0;\n",
    "prefixes": [
        "libcamera-devel",
        "05/21"
    ]
}