From patchwork Fri Nov 8 20:53: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: 2305 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 DCB7E61518 for ; Fri, 8 Nov 2019 21:54:25 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 170EA31D; Fri, 8 Nov 2019 21:54:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1573246465; bh=0Ef+VMEo12M3yvF5ZfP5KQ4/VIdqLLwg5eVgLy7S4KY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOr02YPEp2ANx4kr8nbPn0K77tDfmwuzwM/L4mF62bbsg7j527pd2eI9iqI4Ysip3 46slNV25RQZZ1Mp4uKjF0zNc9UCH35xDvP1w4EPqNL4h/rQDxgg9157Cew2JCPeyZM Dmthr/yTvBRRvAkOaGN1Rs7CbzzEX8Mz1Tkyh7Bg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 8 Nov 2019 22:53:54 +0200 Message-Id: <20191108205409.18845-10-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191108205409.18845-1-laurent.pinchart@ideasonboard.com> References: <20191108205409.18845-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 09/24] libcamera: controls: Store reference to the InfoMap 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: Fri, 08 Nov 2019 20:54:26 -0000 From: Jacopo Mondi Store a reference to the ControlInfoMap used to create a ControlList and provide an operation to retrieve it. This will be used to implement serialization of ControlList. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- include/libcamera/controls.h | 4 ++++ src/libcamera/controls.cpp | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index b35e006bc046..baca684444a7 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -232,12 +232,16 @@ public: const ControlValue &get(unsigned int id) const; void set(unsigned int id, const ControlValue &value); + const ControlInfoMap *infoMap() const { return infoMap_; } + private: const ControlValue *find(unsigned int id) const; ControlValue *find(unsigned int id); ControlValidator *validator_; const ControlIdMap *idmap_; + const ControlInfoMap *infoMap_; + ControlListMap controls_; }; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 178ce3d99bce..eae0250a92e3 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -595,7 +595,7 @@ void ControlInfoMap::generateIdmap() * be used directly by application. */ ControlList::ControlList() - : validator_(nullptr), idmap_(nullptr) + : validator_(nullptr), idmap_(nullptr), infoMap_(nullptr) { } @@ -609,7 +609,7 @@ ControlList::ControlList() * argument. */ ControlList::ControlList(const ControlIdMap &idmap, ControlValidator *validator) - : validator_(validator), idmap_(&idmap) + : validator_(validator), idmap_(&idmap), infoMap_(nullptr) { } @@ -619,7 +619,7 @@ ControlList::ControlList(const ControlIdMap &idmap, ControlValidator *validator) * \param[in] validator The validator (may be null) */ ControlList::ControlList(const ControlInfoMap &info, ControlValidator *validator) - : validator_(validator), idmap_(&info.idmap()) + : validator_(validator), idmap_(&info.idmap()), infoMap_(&info) { } @@ -769,6 +769,16 @@ void ControlList::set(unsigned int id, const ControlValue &value) *val = value; } +/** + * \fn ControlList::infoMap() + * \brief Retrieve the ControlInfoMap used to construct the ControlList + * + * \return The ControlInfoMap used to construct the ControlList. ControlList + * instances constructed with ControlList() or + * ControlList(const ControlIdMap &idmap, ControlValidator *validator) have no + * associated ControlInfoMap, nullptr is returned in that case. + */ + const ControlValue *ControlList::find(unsigned int id) const { const auto iter = controls_.find(id);