From d0cca54d4ae578801da7e261d3d9687bd0dd5cce Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 4 Jan 2020 00:23:42 +0200 Subject: libcamera: bound_method: Move sequence and generator to BoundMethodBase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Niklas Söderlund --- include/libcamera/bound_method.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h index a1541212..9fd58c69 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 -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 +class BoundMethodArgs : public BoundMethodBase +{ +private: using PackType = std::tuple::type...>; template - void invokePack(void *pack, sequence) + void invokePack(void *pack, BoundMethodBase::sequence) { PackType *args = static_cast(pack); invoke(std::get(*args)...); @@ -87,7 +87,7 @@ public: void invokePack(void *pack) override { - invokePack(pack, typename generator::type()); + invokePack(pack, typename BoundMethodBase::generator::type()); } virtual void activate(Args... args, bool deleteMethod = false) = 0; -- cgit v1.2.1