From patchwork Fri Mar 6 15:59:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2979 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 97F9E60424 for ; Fri, 6 Mar 2020 17:00:16 +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 7193224B; Fri, 6 Mar 2020 17:00:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1583510416; bh=iy4JGQCx0rlLCHuusEvC2m0rR877q4nzbFbBRZOjQJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhhYYSH3Z99G3qZM9ieo5en++v8d0RDp+6gfJmEGu86tL5Nb7/uDccciq6sT5zrB5 FgzmmEWZGcl4YsgxRN2KFRPxUwUG06TW3SW3Mc2i/os4DPQt5DWuN9clmlE/bhli7w huFeDHwpCiPJvMvgK7sZ6Zv5eeehtXY94EvX9NS4= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 6 Mar 2020 17:59:37 +0200 Message-Id: <20200306160002.30549-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200306160002.30549-1-laurent.pinchart@ideasonboard.com> References: <20200306160002.30549-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 07/32] libcamera: controls: Reorder ControlValue methods 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, 06 Mar 2020 16:00:17 -0000 From: Jacopo Mondi Reorder functions in ControlValue class to group const methods together. Cosmetic change only. Signed-off-by: Jacopo Mondi Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/controls.h | 10 ++-- src/libcamera/controls.cpp | 94 ++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 458b84e8fa8c..9f8a9031bd74 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -33,11 +33,6 @@ public: ControlType type() const { return type_; } bool isNone() const { return type_ == ControlTypeNone; } - template - const T &get() const; - template - void set(const T &value); - std::string toString() const; bool operator==(const ControlValue &other) const; @@ -46,6 +41,11 @@ public: return !(*this == other); } + template + const T &get() const; + template + void set(const T &value); + private: ControlType type_; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 0031cd064da9..613e6d768c0f 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -112,6 +112,53 @@ ControlValue::ControlValue(int64_t value) * \return True if the value type is ControlTypeNone, false otherwise */ +/** + * \brief Assemble and return a string describing the value + * \return A string describing the ControlValue + */ +std::string ControlValue::toString() const +{ + switch (type_) { + case ControlTypeNone: + return ""; + case ControlTypeBool: + return bool_ ? "True" : "False"; + case ControlTypeInteger32: + return std::to_string(integer32_); + case ControlTypeInteger64: + return std::to_string(integer64_); + } + + return ""; +} + +/** + * \brief Compare ControlValue instances for equality + * \return True if the values have identical types and values, false otherwise + */ +bool ControlValue::operator==(const ControlValue &other) const +{ + if (type_ != other.type_) + return false; + + switch (type_) { + case ControlTypeBool: + return bool_ == other.bool_; + case ControlTypeInteger32: + return integer32_ == other.integer32_; + case ControlTypeInteger64: + return integer64_ == other.integer64_; + default: + return false; + } +} + +/** + * \fn bool ControlValue::operator!=() + * \brief Compare ControlValue instances for non equality + * \return False if the values have identical types and values, true otherwise + */ + /** * \fn template const T &ControlValue::get() const * \brief Get the control value @@ -175,53 +222,6 @@ void ControlValue::set(const int64_t &value) } #endif /* __DOXYGEN__ */ -/** - * \brief Assemble and return a string describing the value - * \return A string describing the ControlValue - */ -std::string ControlValue::toString() const -{ - switch (type_) { - case ControlTypeNone: - return ""; - case ControlTypeBool: - return bool_ ? "True" : "False"; - case ControlTypeInteger32: - return std::to_string(integer32_); - case ControlTypeInteger64: - return std::to_string(integer64_); - } - - return ""; -} - -/** - * \brief Compare ControlValue instances for equality - * \return True if the values have identical types and values, false otherwise - */ -bool ControlValue::operator==(const ControlValue &other) const -{ - if (type_ != other.type_) - return false; - - switch (type_) { - case ControlTypeBool: - return bool_ == other.bool_; - case ControlTypeInteger32: - return integer32_ == other.integer32_; - case ControlTypeInteger64: - return integer64_ == other.integer64_; - default: - return false; - } -} - -/** - * \fn bool ControlValue::operator!=() - * \brief Compare ControlValue instances for non equality - * \return False if the values have identical types and values, true otherwise - */ - /** * \class ControlId * \brief Control static metadata