diff options
Diffstat (limited to 'include/libcamera/base/signal.h')
-rw-r--r-- | include/libcamera/base/signal.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/libcamera/base/signal.h b/include/libcamera/base/signal.h index c2521769..8d9f82f6 100644 --- a/include/libcamera/base/signal.h +++ b/include/libcamera/base/signal.h @@ -61,6 +61,25 @@ public: SignalBase::connect(new BoundMethodMember<T, R, Args...>(obj, nullptr, func)); } +#ifndef __DOXYGEN__ + template<typename T, typename Func, + typename std::enable_if_t<std::is_base_of<Object, T>::value> * = nullptr> + void connect(T *obj, Func func, ConnectionType type = ConnectionTypeAuto) + { + Object *object = static_cast<Object *>(obj); + SignalBase::connect(new BoundMethodFunctor<T, void, Func, Args...>(obj, object, func, type)); + } + + template<typename T, typename Func, + typename std::enable_if_t<!std::is_base_of<Object, T>::value> * = nullptr> +#else + template<typename T, typename Func> +#endif + void connect(T *obj, Func func) + { + SignalBase::connect(new BoundMethodFunctor<T, void, Func, Args...>(obj, nullptr, func)); + } + template<typename R> void connect(R (*func)(Args...)) { |