From patchwork Sat Jan 4 05:09:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2502 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E6BDE60466 for ; Sat, 4 Jan 2020 06:10:04 +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 843C930F for ; Sat, 4 Jan 2020 06:10:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1578114604; bh=Gw7AjzkQmim4HYDBhzJyjHUFX8b21zk9VkxOsgqCxOc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fm7N/CvRMUVVbm0DChrzRRWMSxL973D84mwuUZGiShR5u+m6GtMx5UUm4sE/K3daQ sg72bVyA/R3ZJx6ViJ/GZ3PWifYf7qW1s7SL7m30PaUTo1BOHWTBuRRU8IRp5zo8/E E67pKSvOEKaJSiyRMv55GPfHgL3rx7mZpLBp6PbA= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jan 2020 07:09:39 +0200 Message-Id: <20200104050947.7673-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200104050947.7673-1-laurent.pinchart@ideasonboard.com> References: <20200104050947.7673-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/14] libcamera: bound_method: Move sequence and generator to BoundMethodBase 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, 04 Jan 2020 05:10:06 -0000 The sequence and generator member types of BoundMethodArgs are not dependent on the template arguments of BoundMethodArgs. To prepare for template specialization of BoundMethodArgs and avoid code duplication, move them to the BoundMethodBase class. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- include/libcamera/bound_method.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h index a1541212ff3d..9fd58c69a0e9 100644 --- a/include/libcamera/bound_method.h +++ b/include/libcamera/bound_method.h @@ -39,19 +39,6 @@ public: virtual void invokePack(void *pack) = 0; protected: - void activatePack(void *pack, bool deleteMethod); - - void *obj_; - Object *object_; - -private: - ConnectionType connectionType_; -}; - -template -class BoundMethodArgs : public BoundMethodBase -{ -private: #ifndef __DOXYGEN__ /* * This is a cheap partial implementation of std::integer_sequence<> @@ -71,10 +58,23 @@ private: }; #endif + void activatePack(void *pack, bool deleteMethod); + + void *obj_; + Object *object_; + +private: + ConnectionType connectionType_; +}; + +template +class BoundMethodArgs : public BoundMethodBase +{ +private: using PackType = std::tuple::type...>; template - void invokePack(void *pack, sequence) + void invokePack(void *pack, BoundMethodBase::sequence) { PackType *args = static_cast(pack); invoke(std::get(*args)...); @@ -87,7 +87,7 @@ public: void invokePack(void *pack) override { - invokePack(pack, typename generator::type()); + invokePack(pack, typename BoundMethodBase::generator::type()); } virtual void activate(Args... args, bool deleteMethod = false) = 0;