diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-03 23:33:11 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-07 22:29:29 +0200 |
commit | 257bea076c5261059fc318cad101f2315634607b (patch) | |
tree | 156a0a6ca578a00c34eb5acff58c39a14186ef48 /include | |
parent | d0cca54d4ae578801da7e261d3d9687bd0dd5cce (diff) |
libcamera: bound_method: Store method arguments in a class
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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/bound_method.h | 21 |
1 files changed, 17 insertions, 4 deletions
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 @@ -68,16 +68,29 @@ private: }; template<typename... Args> +class BoundMethodPack +{ +public: + BoundMethodPack(const Args &... args) + : args_(args...) + { + } + + std::tuple<typename std::remove_reference<Args>::type...> args_; +}; + +template<typename... Args> class BoundMethodArgs : public BoundMethodBase { -private: - using PackType = std::tuple<typename std::remove_reference<Args>::type...>; +public: + using PackType = BoundMethodPack<Args...>; +private: template<int... S> void invokePack(void *pack, BoundMethodBase::sequence<S...>) { PackType *args = static_cast<PackType *>(pack); - invoke(std::get<S>(*args)...); + invoke(std::get<S>(args->args_)...); delete args; } @@ -98,7 +111,7 @@ template<typename T, typename... Args> class BoundMemberMethod : public BoundMethodArgs<Args...> { public: - using PackType = std::tuple<typename std::remove_reference<Args>::type...>; + using PackType = typename BoundMethodArgs<Args...>::PackType; BoundMemberMethod(T *obj, Object *object, void (T::*func)(Args...), ConnectionType type = ConnectionTypeAuto) |