From patchwork Fri Mar 6 15:59:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2986 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 53DC460424 for ; Fri, 6 Mar 2020 17:00:21 +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 E3A7E1265 for ; Fri, 6 Mar 2020 17:00:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1583510421; bh=ZlztJ5jHqC8Ob6WTYkXDBjBUwm3pr78ZBGAobchiMNs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dDXtDkxFVoox3rLyU6cwyjI3ptXtJw7Id0P/VhSVJgoKIV8BzwkzqQ0E3zI+2gxn1 fzsqfysv+F1cGMBHrVHUt9E1Mj/fZgzX7uXzc8ztSFA5XKN91F1qnE97YmHHeHrD5U goUIbG3+qioiDwvrvb7WYOX7ARoVQIRj85R0uPec= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 6 Mar 2020 17:59:44 +0200 Message-Id: <20200306160002.30549-15-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 14/32] libcamera: controls: Move Control constructor to controls.h 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:21 -0000 To avoid defining all specializations of the Control constructor manually, move the definition of those functions to controls.h and turn them into a single template function. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/controls.h | 5 ++++- src/libcamera/controls.cpp | 26 -------------------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index dfe69916cd64..6f0ebf4f3ca5 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -146,7 +146,10 @@ class Control : public ControlId public: using type = T; - Control(unsigned int id, const char *name); + Control(unsigned int id, const char *name) + : ControlId(id, name, details::control_type>::value) + { + } private: Control(const Control &) = delete; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 5cc8ce2199d0..76230a052de1 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -249,32 +249,6 @@ bool ControlValue::operator==(const ControlValue &other) const * \brief The Control template type T */ -#ifndef __DOXYGEN__ -template<> -Control::Control(unsigned int id, const char *name) - : ControlId(id, name, ControlTypeNone) -{ -} - -template<> -Control::Control(unsigned int id, const char *name) - : ControlId(id, name, ControlTypeBool) -{ -} - -template<> -Control::Control(unsigned int id, const char *name) - : ControlId(id, name, ControlTypeInteger32) -{ -} - -template<> -Control::Control(unsigned int id, const char *name) - : ControlId(id, name, ControlTypeInteger64) -{ -} -#endif /* __DOXYGEN__ */ - /** * \class ControlRange * \brief Describe the limits of valid values for a Control