From patchwork Mon Apr 21 15:35:56 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: 23195 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 DC1F6C331F for ; Mon, 21 Apr 2025 15:36:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9F90C68AD6; Mon, 21 Apr 2025 17:36:08 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RAQezxr4"; 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 5BC5168ABA for ; Mon, 21 Apr 2025 17:36:01 +0200 (CEST) Received: from pb-laptop.local (185.221.143.16.nat.pool.zt.hu [185.221.143.16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C27036D6 for ; Mon, 21 Apr 2025 17:33:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1745249634; bh=/HpccjLfFl/rXKy0yW2JbUFdz0Ez1+VbSg6Whi5yDc4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RAQezxr4xEKSsmksYmiHOlf5FprRHMMSCpTzA1f/nb4tWyh/LSF5Hqq9evkil1ZMV ip8e3mrWa7SZSs02+KyxQGsxOgV18cPVEOC07taTN4FDCdr95xcvofn4907nkG9cRf huj2o6iaF4xaVqykobUnlzCOqmvv/wIIqVdaYJ8A= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v2 5/5] libcamera: controls: Add rvalue overload for `ControlList::set()` Date: Mon, 21 Apr 2025 17:35:56 +0200 Message-ID: <20250421153556.171192-6-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250421153556.171192-1-barnabas.pocze@ideasonboard.com> References: <20250421153556.171192-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 an overload of `ControlList::set()` that takes the `ControlValue` argument as an rvalue reference, therefore enabling the use of move assignment. Signed-off-by: Barnabás Pőcze --- include/libcamera/controls.h | 1 + src/libcamera/controls.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 62ee5ebd6..611252f20 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -516,6 +516,7 @@ public: const ControlValue &get(unsigned int id) const; void set(unsigned int id, const ControlValue &value); + void set(unsigned int id, ControlValue &&value); 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 ae54f8c77..c22c6bdb9 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -1189,6 +1189,18 @@ void ControlList::set(unsigned int id, const ControlValue &value) *val = value; } +/** + * \copydoc ControlList::set(unsigned int, const ControlValue &) + */ +void ControlList::set(unsigned int id, ControlValue &&value) +{ + ControlValue *val = find(id); + if (!val) + return; + + *val = std::move(value); +} + /** * \fn ControlList::infoMap() * \brief Retrieve the ControlInfoMap used to construct the ControlList