From patchwork Mon Oct 7 22:46:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2132 Return-Path: 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 B97B561974 for ; Tue, 8 Oct 2019 00:46:54 +0200 (CEST) Received: from pendragon.ideasonboard.com (modemcable118.64-20-96.mc.videotron.ca [96.20.64.118]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E33C3B2E for ; Tue, 8 Oct 2019 00:46:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1570488414; bh=eGDT+p+P9eWFHXkhfzy2lRVTXwioER1osC4I4X7MPno=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DHRnc7pAW25Wlz3CuQBVTSLknOclkgbfJNP+jYebBvUp51GD3xBfMf1WRXRQDD1Q5 d/lUJwGCNGBUqGehQcGn190oSjcnxRg0dRDwDNoYFtpYYeQBJDPb8woX8wIjapYnGy 2yDhHxLTMWhv3DolFqTPtiNpdEuIq9CKg3BFxKws= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 8 Oct 2019 01:46:37 +0300 Message-Id: <20191007224642.6597-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191007224642.6597-1-laurent.pinchart@ideasonboard.com> References: <20191007224642.6597-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/9] libcamera: controls: Make ControlList::find() protected 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: Mon, 07 Oct 2019 22:46:55 -0000 To prepare for Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- include/libcamera/controls.h | 3 ++- src/libcamera/controls.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index a5a6a135ec16..fc33f0762138 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -159,10 +159,11 @@ public: const ControlValue &get(const ControlId &id) const; void set(const ControlId &id, const ControlValue &value); -private: +protected: const ControlValue *find(const ControlId &id) const; ControlValue *find(const ControlId &id); +private: ControlValidator *validator_; ControlListMap controls_; }; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index e528dd80a2a7..afea09d6d7d7 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -515,6 +515,13 @@ void ControlList::set(const ControlId &id, const ControlValue &value) *val = value; } +/** + * \brief Find a control in the list + * \param[in] id The control ID + * + * \return The control value for the control \a id, or nullptr if no such + * control exists in the list + */ const ControlValue *ControlList::find(const ControlId &id) const { const auto iter = controls_.find(&id); @@ -528,6 +535,13 @@ const ControlValue *ControlList::find(const ControlId &id) const return &iter->second; } +/** + * \brief Find a control in the list + * \param[in] id The control ID + * + * \return The control value for the control \a id, or nullptr if no such + * control exists in the list + */ ControlValue *ControlList::find(const ControlId &id) { if (validator_ && !validator_->validate(id)) {