From patchwork Wed Sep 24 12:47:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 24450 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 07F24C32A9 for ; Wed, 24 Sep 2025 12:47:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 210D96B611; Wed, 24 Sep 2025 14:47:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PAaLgTt3"; dkim-atps=neutral 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 86FB76B5F8 for ; Wed, 24 Sep 2025 14:47:17 +0200 (CEST) Received: from pb-laptop.local (185.221.140.70.nat.pool.zt.hu [185.221.140.70]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9B6761E35; Wed, 24 Sep 2025 14:45:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1758717953; bh=Tk9V+4Yr8AFkD+oqP8mCtSO86gr9R9B0KISNqioEJRs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PAaLgTt3nnpTLZKBfescI6ryK+kHOZ2sUuGfdslldFdCev6xiH/yj5y7783YSKDYj DzX1mB0Wr/XdfTimz8QEr6XNhBiujkwU9nvF74vCTwR16CIIIduOne2B21y0Jfa/U0 V+855xQkmboNCuV8nUTt7X0fe64g2w16uQKSH42Y= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org, Kieran Bingham Subject: [RFC PATCH v1 4/7] libcamera: controls: ControlList: Add `erase()` Date: Wed, 24 Sep 2025 14:47:09 +0200 Message-ID: <20250924124713.3361707-5-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250924124713.3361707-1-barnabas.pocze@ideasonboard.com> References: <20250924124713.3361707-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add two `erase()` functions that can be used to remove elements from a `ControlList` instance. Signed-off-by: Barnabás Pőcze --- include/libcamera/controls.h | 3 +++ src/libcamera/controls.cpp | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 5d4a53c46..9045caff7 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -470,6 +470,9 @@ public: const ControlValue &get(unsigned int id) const; void set(unsigned int id, const ControlValue &value); + bool erase(unsigned int id); + bool erase(const ControlId &ctrl) { return erase(ctrl.id()); } + const ControlInfoMap *infoMap() const { return infoMap_; } const ControlIdMap *idMap() const { return idmap_; } diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 54cd3b703..83f8bf056 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -1156,6 +1156,23 @@ void ControlList::set(unsigned int id, const ControlValue &value) *val = value; } +/** + * \brief Remove the value of control \a id + * \param[in] id The control ID + * \return \a true if \a id was present, \a false otherwise + */ +bool ControlList::erase(unsigned int id) +{ + return controls_.erase(id); +} + +/** + * \fn ControlList::erase(const ControlId &ctrl) + * \brief Remove the value of control \a ctrl + * \param[in] ctrl The control + * \return \a true if \a ctrl was present, \a false otherwise + */ + /** * \fn ControlList::infoMap() * \brief Retrieve the ControlInfoMap used to construct the ControlList