From patchwork Sun Oct 13 23:27:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2190 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D6BE61971 for ; Mon, 14 Oct 2019 01:28:05 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1943B80B for ; Mon, 14 Oct 2019 01:28:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1571009285; bh=wKnuwDnnphu8EA/z0eb2NMwskL1qBamB2RGEB0mKBt0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=H88eo5nAvmMtPNvaV9P+O77LGhHkmhAHhz7mmOkAiyeAyjxmf8ndUGmggZRlsDvQJ TUUABznJBWj0CA8TvELfz9xS+X/oNvYfANrTtAS63kXmsS7qoTnmXbdf1ChAQBZH/3 NJ0IkZer1JEdCHGoIb1tR8vyUGjiyjjw9/zsG62U= From: Laurent Pinchart 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 Subject: [libcamera-devel] [PATCH 08/10] libcamera: v4l2_controls: Derive V4L2ControlInfoMap from ControlInfoMap X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 23:28:06 -0000 Replace the std::map<> used as the base type for V4L2ControlInfoMap by ControlInfoMap, which is an alias for an std::unsorted_map<> with the same key and value types. This shortens the code. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/include/v4l2_controls.h | 34 +++++++++++++-------------- src/libcamera/v4l2_controls.cpp | 6 ++--- src/libcamera/v4l2_device.cpp | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h index 7d3528b07f94..c427b845d8b4 100644 --- a/src/libcamera/include/v4l2_controls.h +++ b/src/libcamera/include/v4l2_controls.h @@ -31,27 +31,27 @@ public: V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl); }; -class V4L2ControlInfoMap : private std::map +class V4L2ControlInfoMap : private ControlInfoMap { public: - V4L2ControlInfoMap &operator=(std::map &&info); + V4L2ControlInfoMap &operator=(ControlInfoMap &&info); - using std::map::key_type; - using std::map::mapped_type; - using std::map::value_type; - using std::map::size_type; - using std::map::iterator; - using std::map::const_iterator; + using ControlInfoMap::key_type; + using ControlInfoMap::mapped_type; + using ControlInfoMap::value_type; + using ControlInfoMap::size_type; + using ControlInfoMap::iterator; + using ControlInfoMap::const_iterator; - using std::map::begin; - using std::map::cbegin; - using std::map::end; - using std::map::cend; - using std::map::at; - using std::map::empty; - using std::map::size; - using std::map::count; - using std::map::find; + using ControlInfoMap::begin; + using ControlInfoMap::cbegin; + using ControlInfoMap::end; + using ControlInfoMap::cend; + using ControlInfoMap::at; + using ControlInfoMap::empty; + using ControlInfoMap::size; + using ControlInfoMap::count; + using ControlInfoMap::find; mapped_type &at(unsigned int key); const mapped_type &at(unsigned int key) const; diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp index e27c70eeec87..e783457caf94 100644 --- a/src/libcamera/v4l2_controls.cpp +++ b/src/libcamera/v4l2_controls.cpp @@ -140,7 +140,7 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl) */ /** - * \brief Move assignment operator from plain map + * \brief Move assignment operator from a ControlInfoMap * \param[in] info The control info map * * Populate the map by replacing its contents with those of \a info using move @@ -150,9 +150,9 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl) * * \return The populated V4L2ControlInfoMap */ -V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(std::map &&info) +V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(ControlInfoMap &&info) { - std::map::operator=(std::move(info)); + ControlInfoMap::operator=(std::move(info)); idmap_.clear(); for (const auto &ctrl : *this) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 47999e70073c..06155eb51c03 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -342,7 +342,7 @@ int V4L2Device::ioctl(unsigned long request, void *argp) */ void V4L2Device::listControls() { - std::map ctrls; + ControlInfoMap ctrls; struct v4l2_query_ext_ctrl ctrl = {}; /* \todo Add support for menu and compound controls. */