Message ID | 20200104050947.7673-7-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | d0cca54d4ae578801da7e261d3d9687bd0dd5cce |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Thanks for your work. On 2020-01-04 07:09:39 +0200, Laurent Pinchart wrote: > 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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > 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<typename... Args> > -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<typename... Args> > +class BoundMethodArgs : public BoundMethodBase > +{ > +private: > using PackType = std::tuple<typename std::remove_reference<Args>::type...>; > > template<int... S> > - void invokePack(void *pack, sequence<S...>) > + void invokePack(void *pack, BoundMethodBase::sequence<S...>) > { > PackType *args = static_cast<PackType *>(pack); > invoke(std::get<S>(*args)...); > @@ -87,7 +87,7 @@ public: > > void invokePack(void *pack) override > { > - invokePack(pack, typename generator<sizeof...(Args)>::type()); > + invokePack(pack, typename BoundMethodBase::generator<sizeof...(Args)>::type()); > } > > virtual void activate(Args... args, bool deleteMethod = false) = 0; > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
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<typename... Args> -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<typename... Args> +class BoundMethodArgs : public BoundMethodBase +{ +private: using PackType = std::tuple<typename std::remove_reference<Args>::type...>; template<int... S> - void invokePack(void *pack, sequence<S...>) + void invokePack(void *pack, BoundMethodBase::sequence<S...>) { PackType *args = static_cast<PackType *>(pack); invoke(std::get<S>(*args)...); @@ -87,7 +87,7 @@ public: void invokePack(void *pack) override { - invokePack(pack, typename generator<sizeof...(Args)>::type()); + invokePack(pack, typename BoundMethodBase::generator<sizeof...(Args)>::type()); } virtual void activate(Args... args, bool deleteMethod = false) = 0;
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 <laurent.pinchart@ideasonboard.com> --- include/libcamera/bound_method.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)