From patchwork Fri Nov 8 20:53:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2300 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 C12F46150A for ; Fri, 8 Nov 2019 21:54:23 +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 6A8FD2D1 for ; Fri, 8 Nov 2019 21:54:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1573246463; bh=e3dtX6ahdlkXeAiEXmFYjzT+E4GcwvbePsaDqt/KQZ0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JxQloEf7tcJ5an0vG9735jV+VS8yoLHlGnIqSB0ESH9Q4aBWpnTQd77urCKGUGu8g R203229ow3eunoG4Dcd+rTMd5f8RnucRtO/QnXHGGNbLGC+JLXz1H8TX4wAgR8ax13 /md91NmtupQsJa3irPk3/YWX6LYK9bT2cNFla8go= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 8 Nov 2019 22:53:49 +0200 Message-Id: <20191108205409.18845-5-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 04/24] libcamera: controls: Add operator== and operator!= to ControlRange 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:23 -0000 Allow comparision of control ranges by adding the required operators. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- include/libcamera/controls.h | 9 +++++++++ src/libcamera/controls.cpp | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 42e6df7e613d..19075858fbba 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -112,6 +112,15 @@ public: std::string toString() const; + bool operator==(const ControlRange &other) const + { + return min_ == other.min_ && max_ == other.max_; + } + bool operator!=(const ControlRange &other) const + { + return !(*this == other); + } + private: ControlValue min_; ControlValue max_; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 0c7cd449ad64..2c5c98633585 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -383,6 +383,17 @@ std::string ControlRange::toString() const return ss.str(); } +/** + * \fn bool ControlRange::operator==() + * \brief Compare ControlRange instances for equality + * \return True if the ranges have identical min and max, false otherwise + */ +/** + * \fn bool ControlRange::operator!=() + * \brief Compare ControlRange instances for non equality + * \return False if the ranges have identical min and max, true otherwise + */ + /** * \typedef ControlIdMap * \brief A map of numerical control ID to ControlId