{"id":2190,"url":"https://patchwork.libcamera.org/api/1.1/patches/2190/?format=json","web_url":"https://patchwork.libcamera.org/patch/2190/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191013232755.3292-9-laurent.pinchart@ideasonboard.com>","date":"2019-10-13T23:27:54","name":"[libcamera-devel,08/10] libcamera: v4l2_controls: Derive V4L2ControlInfoMap from ControlInfoMap","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"d33dcd7c10ccd18e2036e5194eaf9068782ed219","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2190/mbox/","series":[{"id":534,"url":"https://patchwork.libcamera.org/api/1.1/series/534/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=534","date":"2019-10-13T23:27:46","name":"Merge V4L2ControlInfoMap and ControlInfoMap","version":1,"mbox":"https://patchwork.libcamera.org/series/534/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2190/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2190/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D6BE61971\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2019 01:28:05 +0200 (CEST)","from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1943B80B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2019 01:28:05 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571009285;\n\tbh=wKnuwDnnphu8EA/z0eb2NMwskL1qBamB2RGEB0mKBt0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=H88eo5nAvmMtPNvaV9P+O77LGhHkmhAHhz7mmOkAiyeAyjxmf8ndUGmggZRlsDvQJ\n\tTUUABznJBWj0CA8TvELfz9xS+X/oNvYfANrTtAS63kXmsS7qoTnmXbdf1ChAQBZH/3\n\tNJ0IkZer1JEdCHGoIb1tR8vyUGjiyjjw9/zsG62U=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 14 Oct 2019 02:27:54 +0300","Message-Id":"<20191013232755.3292-9-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20191013232755.3292-1-laurent.pinchart@ideasonboard.com>","References":"<20191013232755.3292-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 08/10] libcamera: v4l2_controls: Derive\n\tV4L2ControlInfoMap from ControlInfoMap","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":"Sun, 13 Oct 2019 23:28:06 -0000"},"content":"Replace the std::map<> used as the base type for V4L2ControlInfoMap by\nControlInfoMap, which is an alias for an std::unsorted_map<> with the\nsame key and value types. This shortens the code.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/v4l2_controls.h | 34 +++++++++++++--------------\n src/libcamera/v4l2_controls.cpp       |  6 ++---\n src/libcamera/v4l2_device.cpp         |  2 +-\n 3 files changed, 21 insertions(+), 21 deletions(-)","diff":"diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\nindex 7d3528b07f94..c427b845d8b4 100644\n--- a/src/libcamera/include/v4l2_controls.h\n+++ b/src/libcamera/include/v4l2_controls.h\n@@ -31,27 +31,27 @@ public:\n \tV4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);\n };\n \n-class V4L2ControlInfoMap : private std::map<const ControlId *, ControlRange>\n+class V4L2ControlInfoMap : private ControlInfoMap\n {\n public:\n-\tV4L2ControlInfoMap &operator=(std::map<const ControlId *, ControlRange> &&info);\n+\tV4L2ControlInfoMap &operator=(ControlInfoMap &&info);\n \n-\tusing std::map<const ControlId *, ControlRange>::key_type;\n-\tusing std::map<const ControlId *, ControlRange>::mapped_type;\n-\tusing std::map<const ControlId *, ControlRange>::value_type;\n-\tusing std::map<const ControlId *, ControlRange>::size_type;\n-\tusing std::map<const ControlId *, ControlRange>::iterator;\n-\tusing std::map<const ControlId *, ControlRange>::const_iterator;\n+\tusing ControlInfoMap::key_type;\n+\tusing ControlInfoMap::mapped_type;\n+\tusing ControlInfoMap::value_type;\n+\tusing ControlInfoMap::size_type;\n+\tusing ControlInfoMap::iterator;\n+\tusing ControlInfoMap::const_iterator;\n \n-\tusing std::map<const ControlId *, ControlRange>::begin;\n-\tusing std::map<const ControlId *, ControlRange>::cbegin;\n-\tusing std::map<const ControlId *, ControlRange>::end;\n-\tusing std::map<const ControlId *, ControlRange>::cend;\n-\tusing std::map<const ControlId *, ControlRange>::at;\n-\tusing std::map<const ControlId *, ControlRange>::empty;\n-\tusing std::map<const ControlId *, ControlRange>::size;\n-\tusing std::map<const ControlId *, ControlRange>::count;\n-\tusing std::map<const ControlId *, ControlRange>::find;\n+\tusing ControlInfoMap::begin;\n+\tusing ControlInfoMap::cbegin;\n+\tusing ControlInfoMap::end;\n+\tusing ControlInfoMap::cend;\n+\tusing ControlInfoMap::at;\n+\tusing ControlInfoMap::empty;\n+\tusing ControlInfoMap::size;\n+\tusing ControlInfoMap::count;\n+\tusing ControlInfoMap::find;\n \n \tmapped_type &at(unsigned int key);\n \tconst mapped_type &at(unsigned int key) const;\ndiff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\nindex e27c70eeec87..e783457caf94 100644\n--- a/src/libcamera/v4l2_controls.cpp\n+++ b/src/libcamera/v4l2_controls.cpp\n@@ -140,7 +140,7 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n  */\n \n /**\n- * \\brief Move assignment operator from plain map\n+ * \\brief Move assignment operator from a ControlInfoMap\n  * \\param[in] info The control info map\n  *\n  * Populate the map by replacing its contents with those of \\a info using move\n@@ -150,9 +150,9 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n  *\n  * \\return The populated V4L2ControlInfoMap\n  */\n-V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(std::map<const ControlId *, ControlRange> &&info)\n+V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(ControlInfoMap &&info)\n {\n-\tstd::map<const ControlId *, ControlRange>::operator=(std::move(info));\n+\tControlInfoMap::operator=(std::move(info));\n \n \tidmap_.clear();\n \tfor (const auto &ctrl : *this)\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 47999e70073c..06155eb51c03 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -342,7 +342,7 @@ int V4L2Device::ioctl(unsigned long request, void *argp)\n  */\n void V4L2Device::listControls()\n {\n-\tstd::map<const ControlId *, ControlRange> ctrls;\n+\tControlInfoMap ctrls;\n \tstruct v4l2_query_ext_ctrl ctrl = {};\n \n \t/* \\todo Add support for menu and compound controls. */\n","prefixes":["libcamera-devel","08/10"]}