* @SINCE_1_0.0
*/
+// EXTERNAL_INCLUDES
+#include <memory>
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/signals/base-signal.h>
{
};
-/**
- * @brief A template for Signals with no parameters or return value.
- * @SINCE_1_0.0
- */
-template<>
-class Signal<void()>
+class SignalMixin
{
public:
/**
- * @brief Default constructor.
- * @SINCE_1_0.0
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- * @SINCE_1_0.0
- */
- ~Signal()
- {
- }
-
- /**
* @brief Queries whether there are any connected slots.
*
* @SINCE_1_0.0
*/
bool Empty() const
{
- return mImpl.Empty();
+ return mImpl ? mImpl->Empty() : true;
}
/**
*/
std::size_t GetConnectionCount() const
{
- return mImpl.GetConnectionCount();
+ return mImpl ? mImpl->GetConnectionCount() : 0;
}
+protected:
+ BaseSignal& Impl()
+ {
+ if(!mImpl)
+ {
+ mImpl = std::make_unique<BaseSignal>();
+ }
+ return *mImpl;
+ }
+
+private:
+ std::unique_ptr<BaseSignal> mImpl;
+};
+
+/**
+ * @brief A template for Signals with no parameters or return value.
+ * @SINCE_1_0.0
+ */
+template<>
+class Signal<void()> : public SignalMixin
+{
+public:
/**
* @brief Connects a function.
*
*/
void Connect(void (*func)())
{
- mImpl.OnConnect(MakeCallback(func));
+ Impl().OnConnect(MakeCallback(func));
}
/**
*/
void Disconnect(void (*func)())
{
- mImpl.OnDisconnect(MakeCallback(func));
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
template<class X>
void Connect(X* obj, void (X::*func)())
{
- mImpl.OnConnect(obj, MakeCallback(obj, func));
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Disconnect(X* obj, void (X::*func)())
{
- mImpl.OnDisconnect(obj, MakeCallback(obj, func));
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Connect(SlotDelegate<X>& delegate, void (X::*func)())
{
- mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Disconnect(SlotDelegate<X>& delegate, void (X::*func)())
{
- mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctor0<X>(func));
+ Impl().OnConnect(connectionTracker, new CallbackFunctor0<X>(func));
}
/**
*/
void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegate0(delegate));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegate0(delegate));
}
/**
*/
void Emit()
{
- mImpl.Emit();
+ Impl().Emit();
}
-
-private:
- Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
-
-private:
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< The base signal implementation
};
/**
* @SINCE_1_0.0
*/
template<typename Ret>
-class Signal<Ret()>
+class Signal<Ret()> : public SignalMixin
{
public:
/**
- * @brief Default constructor.
- * @SINCE_1_0.0
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- * @SINCE_1_0.0
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Queries whether there are any connected slots.
- *
- * @SINCE_1_0.0
- * @return True if there are any slots connected to the signal
- */
- bool Empty() const
- {
- return mImpl.Empty();
- }
-
- /**
- * @brief Queries the number of slots.
- *
- * @SINCE_1_0.0
- * @return The number of slots connected to this signal
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
* @brief Connects a function.
*
* @SINCE_1_0.0
*/
void Connect(Ret (*func)())
{
- mImpl.OnConnect(MakeCallback(func));
+ Impl().OnConnect(MakeCallback(func));
}
/**
*/
void Disconnect(Ret (*func)())
{
- mImpl.OnDisconnect(MakeCallback(func));
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
template<class X>
void Connect(X* obj, Ret (X::*func)())
{
- mImpl.OnConnect(obj, MakeCallback(obj, func));
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Disconnect(X* obj, Ret (X::*func)())
{
- mImpl.OnDisconnect(obj, MakeCallback(obj, func));
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Connect(SlotDelegate<X>& delegate, Ret (X::*func)())
{
- mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)())
{
- mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorReturn0<X, Ret>(func));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorReturn0<X, Ret>(func));
}
/**
*/
void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegateReturn0<Ret>(delegate));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegateReturn0<Ret>(delegate));
}
/**
*/
Ret Emit()
{
- return mImpl.EmitReturn<Ret>();
+ return Impl().EmitReturn<Ret>();
}
-
-private:
- Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
-
-private:
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @SINCE_1_0.0
*/
template<typename Arg0>
-class Signal<void(Arg0)>
+class Signal<void(Arg0)> : public SignalMixin
{
public:
/**
- * @brief Default constructor.
- * @SINCE_1_0.0
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- * @SINCE_1_0.0
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Queries whether there are any connected slots.
- *
- * @SINCE_1_0.0
- * @return True if there are any slots connected to the signal
- */
- bool Empty() const
- {
- return mImpl.Empty();
- }
-
- /**
- * @brief Queries the number of slots.
- *
- * @SINCE_1_0.0
- * @return The number of slots connected to this signal
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
* @brief Connects a function.
*
* @SINCE_1_0.0
*/
void Connect(void (*func)(Arg0 arg0))
{
- mImpl.OnConnect(MakeCallback(func));
+ Impl().OnConnect(MakeCallback(func));
}
/**
*/
void Disconnect(void (*func)(Arg0 arg0))
{
- mImpl.OnDisconnect(MakeCallback(func));
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
template<class X>
void Connect(X* obj, void (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect(obj, MakeCallback(obj, func));
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Disconnect(X* obj, void (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect(obj, MakeCallback(obj, func));
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Connect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Disconnect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctor1<X, Arg0>(func));
+ Impl().OnConnect(connectionTracker, new CallbackFunctor1<X, Arg0>(func));
}
/**
*/
void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegate1<Arg0>(delegate));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegate1<Arg0>(delegate));
}
/**
*/
void Emit(Arg0 arg0)
{
- mImpl.Emit<Arg0>(arg0);
+ Impl().Emit<Arg0>(arg0);
}
-
-private:
- Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
-
-private:
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @SINCE_1_0.0
*/
template<typename Ret, typename Arg0>
-class Signal<Ret(Arg0)>
+class Signal<Ret(Arg0)> : public SignalMixin
{
public:
/**
- * @brief Default constructor.
- * @SINCE_1_0.0
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- * @SINCE_1_0.0
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Queries whether there are any connected slots.
- *
- * @SINCE_1_0.0
- * @return True if there are any slots connected to the signal
- */
- bool Empty() const
- {
- return mImpl.Empty();
- }
-
- /**
- * @brief Queries the number of slots.
- *
- * @SINCE_1_0.0
- * @return The number of slots connected to this signal
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
* @brief Connects a function.
*
* @SINCE_1_0.0
*/
void Connect(Ret (*func)(Arg0 arg0))
{
- mImpl.OnConnect(MakeCallback(func));
+ Impl().OnConnect(MakeCallback(func));
}
/**
*/
void Disconnect(Ret (*func)(Arg0 arg0))
{
- mImpl.OnDisconnect(MakeCallback(func));
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
template<class X>
void Connect(X* obj, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect(obj, MakeCallback(obj, func));
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Disconnect(X* obj, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect(obj, MakeCallback(obj, func));
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Connect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorReturn1<X, Arg0, Ret>(func));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorReturn1<X, Arg0, Ret>(func));
}
/**
*/
void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegateReturn1<Arg0, Ret>(delegate));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegateReturn1<Arg0, Ret>(delegate));
}
/**
*/
Ret Emit(Arg0 arg0)
{
- return mImpl.EmitReturn<Ret, Arg0>(arg0);
+ return Impl().EmitReturn<Ret, Arg0>(arg0);
}
-
-private:
- Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
-
-private:
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @SINCE_1_0.0
*/
template<typename Arg0, typename Arg1>
-class Signal<void(Arg0, Arg1)>
+class Signal<void(Arg0, Arg1)> : public SignalMixin
{
public:
/**
- * @brief Default constructor.
- *
- * @SINCE_1_0.0
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- *
- * @SINCE_1_0.0
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Queries whether there are any connected slots.
- *
- * @SINCE_1_0.0
- * @return True if there are any slots connected to the signal
- */
- bool Empty() const
- {
- return mImpl.Empty();
- }
-
- /**
- * @brief Queries the number of slots.
- *
- * @SINCE_1_0.0
- * @return The number of slots connected to this signal
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
* @brief Connects a function.
*
* @SINCE_1_0.0
*/
void Connect(void (*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect(MakeCallback(func));
+ Impl().OnConnect(MakeCallback(func));
}
/**
*/
void Disconnect(void (*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect(MakeCallback(func));
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
template<class X>
void Connect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect(obj, MakeCallback(obj, func));
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Disconnect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect(obj, MakeCallback(obj, func));
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Connect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Disconnect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctor2<X, Arg0, Arg1>(func));
+ Impl().OnConnect(connectionTracker, new CallbackFunctor2<X, Arg0, Arg1>(func));
}
/**
*/
void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegate2<Arg0, Arg1>(delegate));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegate2<Arg0, Arg1>(delegate));
}
/**
*/
void Emit(Arg0 arg0, Arg1 arg1)
{
- mImpl.Emit<Arg0, Arg1>(arg0, arg1);
+ Impl().Emit<Arg0, Arg1>(arg0, arg1);
}
-
-private:
- Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
-
-private:
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @SINCE_1_0.0
*/
template<typename Ret, typename Arg0, typename Arg1>
-class Signal<Ret(Arg0, Arg1)>
+class Signal<Ret(Arg0, Arg1)> : public SignalMixin
{
public:
/**
- * @brief Default constructor.
- * @SINCE_1_0.0
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- * @SINCE_1_0.0
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Queries whether there are any connected slots.
- *
- * @SINCE_1_0.0
- * @return True if there are any slots connected to the signal
- */
- bool Empty() const
- {
- return mImpl.Empty();
- }
-
- /**
- * @brief Queries the number of slots.
- *
- * @SINCE_1_0.0
- * @return The number of slots connected to this signal
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
* @brief Connects a function.
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
void Connect(Ret (*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect(MakeCallback(func));
+ Impl().OnConnect(MakeCallback(func));
}
/**
*/
void Disconnect(Ret (*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect(MakeCallback(func));
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
template<class X>
void Connect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect(obj, MakeCallback(obj, func));
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Disconnect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect(obj, MakeCallback(obj, func));
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Connect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorReturn2<X, Arg0, Arg1, Ret>(func));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorReturn2<X, Arg0, Arg1, Ret>(func));
}
/**
*/
void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegateReturn2<Arg0, Arg1, Ret>(delegate));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegateReturn2<Arg0, Arg1, Ret>(delegate));
}
/**
*/
Ret Emit(Arg0 arg0, Arg1 arg1)
{
- return mImpl.EmitReturn<Ret, Arg0, Arg1>(arg0, arg1);
+ return Impl().EmitReturn<Ret, Arg0, Arg1>(arg0, arg1);
}
-
-private:
- Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
-
-private:
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @SINCE_1_0.0
*/
template<typename Arg0, typename Arg1, typename Arg2>
-class Signal<void(Arg0, Arg1, Arg2)>
+class Signal<void(Arg0, Arg1, Arg2)> : public SignalMixin
{
public:
/**
- * @brief Default constructor.
- * @SINCE_1_0.0
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- * @SINCE_1_0.0
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Queries whether there are any connected slots.
- *
- * @SINCE_1_0.0
- * @return True if there are any slots connected to the signal
- */
- bool Empty() const
- {
- return mImpl.Empty();
- }
-
- /**
- * @brief Queries the number of slots.
- *
- * @SINCE_1_0.0
- * @return The number of slots connected to this signal
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
* @brief Connects a function.
*
* @SINCE_1_0.0
*/
void Connect(void (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect(MakeCallback(func));
+ Impl().OnConnect(MakeCallback(func));
}
/**
*/
void Disconnect(void (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect(MakeCallback(func));
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
template<class X>
void Connect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect(obj, MakeCallback(obj, func));
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Disconnect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect(obj, MakeCallback(obj, func));
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Connect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Disconnect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctor3<X, Arg0, Arg1, Arg2>(func));
+ Impl().OnConnect(connectionTracker, new CallbackFunctor3<X, Arg0, Arg1, Arg2>(func));
}
/**
*/
void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegate3<Arg0, Arg1, Arg2>(delegate));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegate3<Arg0, Arg1, Arg2>(delegate));
}
/**
*/
void Emit(Arg0 arg0, Arg1 arg1, Arg2 arg2)
{
- mImpl.Emit<Arg0, Arg1, Arg2>(arg0, arg1, arg2);
+ Impl().Emit<Arg0, Arg1, Arg2>(arg0, arg1, arg2);
}
-
-private:
- Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
-
-private:
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @SINCE_1_0.0
*/
template<typename Ret, typename Arg0, typename Arg1, typename Arg2>
-class Signal<Ret(Arg0, Arg1, Arg2)>
+class Signal<Ret(Arg0, Arg1, Arg2)> : public SignalMixin
{
public:
/**
- * @brief Default constructor.
- * @SINCE_1_0.0
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- * @SINCE_1_0.0
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Queries whether there are any connected slots.
- *
- * @SINCE_1_0.0
- * @return True if there are any slots connected to the signal
- */
- bool Empty() const
- {
- return mImpl.Empty();
- }
-
- /**
- * @brief Queries the number of slots.
- *
- * @SINCE_1_0.0
- * @return The number of slots connected to this signal
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
-
- /**
* @brief Connects a function.
*
* @SINCE_1_0.0
*/
void Connect(Ret (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect(MakeCallback(func));
+ Impl().OnConnect(MakeCallback(func));
}
/**
*/
void Disconnect(Ret (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect(MakeCallback(func));
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
template<class X>
void Connect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect(obj, MakeCallback(obj, func));
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Disconnect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect(obj, MakeCallback(obj, func));
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
template<class X>
void Connect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
template<class X>
void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorReturn3<X, Arg0, Arg1, Arg2, Ret>(func));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorReturn3<X, Arg0, Arg1, Arg2, Ret>(func));
}
/**
*/
void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegateReturn3<Arg0, Arg1, Arg2, Ret>(delegate));
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegateReturn3<Arg0, Arg1, Arg2, Ret>(delegate));
}
/**
*/
Ret Emit(Arg0 arg0, Arg1 arg1, Arg2 arg2)
{
- return mImpl.EmitReturn<Ret, Arg0, Arg1, Arg2>(arg0, arg1, arg2);
+ return Impl().EmitReturn<Ret, Arg0, Arg1, Arg2>(arg0, arg1, arg2);
}
-
-private:
- Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
-
-private:
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**