Message ID | 20200104050947.7673-8-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | 257bea076c5261059fc318cad101f2315634607b |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Thanks for your work. On 2020-01-04 07:09:40 +0200, Laurent Pinchart wrote: > 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> > --- > 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<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) > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
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<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)
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> --- Documentation/Doxyfile.in | 1 + include/libcamera/bound_method.h | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-)