From patchwork Sat Feb 29 16:42: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: 2932 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 18BFD627AA for ; Sat, 29 Feb 2020 17:43:27 +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 A68A7A28 for ; Sat, 29 Feb 2020 17:43:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1582994606; bh=kcM3gADstjTOGmi790G+bL0EPl9Pw37NnY1W7LB3//Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WgDiDtP/Xco5ikT/+mOsFLZyWo9JhC7Se++tWdBqGooMD7GVhF/8rtNhAS9Zlealk /JqR/lCGlfQ9vfMt0R/s47HNG9ueB8Cg1DCnD/161IR9oxRz3JuwW2H1Z3QEBOTIAn jZfxrfRBVcOe0qZXTqOhgtos1n4EXMqnVgDMRMvg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 29 Feb 2020 18:42:37 +0200 Message-Id: <20200229164254.23604-15-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200229164254.23604-1-laurent.pinchart@ideasonboard.com> References: <20200229164254.23604-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 14/31] 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: Sat, 29 Feb 2020 16:43:31 -0000 To avoid defining all specializations of the Control constructor manually, move the definition of those functions to controls.h. 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