From 257bea076c5261059fc318cad101f2315634607b Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 3 Jan 2020 23:33:11 +0200 Subject: libcamera: bound_method: Store method arguments in a class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/libcamera/bound_method.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h index 9fd58c69..d194cd41 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) -- cgit v1.2.1