From patchwork Tue Jul 19 21:33:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16696 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CD32FBE173 for ; Tue, 19 Jul 2022 21:33:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 049E363312; Tue, 19 Jul 2022 23:33:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658266435; bh=d7N6GiwgiM2ATu82McMNeRHJeJNGhk3rw/CPJAFEId8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=iGHLKOShMzl85MT8wPZ7XRYXxjNifKz4JpPB/nqNh9MNVyUUk2ZRVF+JCD/7465KY gZ+xBC5caq6HoTXN96RmQTNK0om9YnkcVxQSJnm3mdqJYhLfG+4mOniPAVTDHdjUZm ZTLu3l482wv1o5M+w4GawBaDu518fd3MZEZ+9hZOBbdJW+j2MiJYbfgkDiSbo4Jsvr mJsOwdfGhDgmBE9EQWtr8Yi7kXSWt7qZgKtP/DrCAQ3DzYaPnG+mzL9NbRjJWAJErO gBGcTdJ4jqo5Ls6igTVkfylMtoCw6jL1cdYtjkFv16AYgcpIJe8Iiil5HipsITeY4J F/FXyLlMPE3Ug== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A8D076048A for ; Tue, 19 Jul 2022 23:33:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tIvWxNfD"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 32A88896; Tue, 19 Jul 2022 23:33:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1658266432; bh=d7N6GiwgiM2ATu82McMNeRHJeJNGhk3rw/CPJAFEId8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tIvWxNfDBGhBULfowpFRFQmRXpFYn4U1lKHTPHBt0GGiPwfBvJ7r3cVq8VAHOT/jl 1XryiBW4AwyjA0EsFFcZz9zuq2cP9sO84A2dex/ShfUancIrwL6oY2fXLv/fpZwgfC 3nlUXGNOlBt+PsYgUuhtpH2w0oeTZdxaRRZYQVmk= To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Jul 2022 00:33:14 +0300 Message-Id: <20220719213314.11717-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220719213314.11717-1-laurent.pinchart@ideasonboard.com> References: <20220719210258.5602-1-laurent.pinchart@ideasonboard.com> <20220719213314.11717-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/2] libcamera: controls: Drop ControlList::contains() 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The ControlList::contains(const ControlId &id) function isn't used, as it has been replaced by usage of the get() function. Document get as being the preferred way to check for the presence of a control in a ControlList, and drop the contains() function. Signed-off-by: Laurent Pinchart --- include/libcamera/controls.h | 1 - src/libcamera/controls.cpp | 15 ++++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 192be78434dc..85a56e621561 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -370,7 +370,6 @@ public: void clear() { controls_.clear(); } void merge(const ControlList &source); - bool contains(const ControlId &id) const; bool contains(unsigned int id) const; template diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 20c27e65e725..df1f0d94c2e6 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -931,17 +931,6 @@ void ControlList::merge(const ControlList &source) } } -/** - * \brief Check if the list contains a control with the specified \a id - * \param[in] id The control ID - * - * \return True if the list contains a matching control, false otherwise - */ -bool ControlList::contains(const ControlId &id) const -{ - return controls_.find(id.id()) != controls_.end(); -} - /** * \brief Check if the list contains a control with the specified \a id * \param[in] id The control numerical ID @@ -958,6 +947,10 @@ bool ControlList::contains(unsigned int id) const * \brief Get the value of control \a ctrl * \param[in] ctrl The control * + * Beside getting the value of a control, this function can also be used to + * check if a control is present in the ControlList by converting the returned + * std::optional to bool (or calling its has_value() function). + * * \return A std::optional containing the control value, or std::nullopt if * the control \a ctrl is not present in the list */