From patchwork Sat Jan 4 05:09:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2503 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 54ED060611 for ; Sat, 4 Jan 2020 06:10:05 +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 DD165A49 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=1578114605; bh=GvbqXLdTNKKtZYcODnXfBEUFpkLPY3uJAlu3ak0e4NU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SXfSVyY7I6VtCu20luHhuCrvoIkNDgUelmWMac2W2hvaZ78gsCp1++OG9XqsLaNSD HEgxjQaEUJDgDb3CvHl+5T38zVOp08XDLWXUo7UAebL+4zUQYjpAcpxdYKm+39txV8 mYSDuPtRTYrSnuBIzls2sl9R2vcJ6YLchcOUmfXw= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jan 2020 07:09:40 +0200 Message-Id: <20200104050947.7673-8-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 07/14] libcamera: bound_method: Store method arguments in a class 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 Create a new BoundMethodPack class to replace the PackType type alias. This will allow adding additional fields to the arguments pack, when adding support for propagation of bound method return values. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- Documentation/Doxyfile.in | 1 + include/libcamera/bound_method.h | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in index 840c1b4c76c5..9e5efae33919 100644 --- a/Documentation/Doxyfile.in +++ b/Documentation/Doxyfile.in @@ -873,6 +873,7 @@ EXCLUDE_PATTERNS = EXCLUDE_SYMBOLS = libcamera::BoundMemberMethod \ libcamera::BoundMethodArgs \ libcamera::BoundMethodBase \ + libcamera::BoundMethodPack \ libcamera::BoundStaticMethod \ libcamera::SignalBase \ std::* diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h index 9fd58c69a0e9..d194cd4133bb 100644 --- a/include/libcamera/bound_method.h +++ b/include/libcamera/bound_method.h @@ -67,17 +67,30 @@ private: ConnectionType connectionType_; }; +template +class BoundMethodPack +{ +public: + BoundMethodPack(const Args &... args) + : args_(args...) + { + } + + std::tuple::type...> args_; +}; + template class BoundMethodArgs : public BoundMethodBase { -private: - using PackType = std::tuple::type...>; +public: + using PackType = BoundMethodPack; +private: template void invokePack(void *pack, BoundMethodBase::sequence) { PackType *args = static_cast(pack); - invoke(std::get(*args)...); + invoke(std::get(args->args_)...); delete args; } @@ -98,7 +111,7 @@ template class BoundMemberMethod : public BoundMethodArgs { public: - using PackType = std::tuple::type...>; + using PackType = typename BoundMethodArgs::PackType; BoundMemberMethod(T *obj, Object *object, void (T::*func)(Args...), ConnectionType type = ConnectionTypeAuto)