-#ifndef __DALI_SIGNAL_H__
-#define __DALI_SIGNAL_H__
+#ifndef DALI_SIGNAL_H
+#define DALI_SIGNAL_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
/**
- * The class should implement Dali::ConnectionTrackerInterface, or inherit from Dali::ConnectionTracker.
+ * @brief The class should implement Dali::ConnectionTrackerInterface, or inherit from Dali::ConnectionTracker.
+ *
* This enforces automatic disconnection when an object is destroyed, so you don't have
* to manually disconnect from signals.
*
* }
* }
* @endcode
+ * @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>
#include <dali/public-api/signals/callback.h>
#include <dali/public-api/signals/signal-slot-connections.h>
#include <dali/public-api/signals/slot-delegate.h>
-#include <dali/public-api/signals/base-signal.h>
namespace Dali
{
* ...
* };
* @endcode
+ * @SINCE_1_0.0
*/
-template< typename _Signature >
+template<typename _Signature>
class Signal
{
};
-/**
- * @brief A template for Signals with no parameters or return value.
- */
-template <>
-class Signal< void () >
+class SignalMixin
{
public:
-
/**
- * @brief Default constructor.
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Query whether there are any connected slots.
+ * @brief Queries whether there are any connected slots.
*
- * @return True if there are any slots connected to the signal.
+ * @SINCE_1_0.0
+ * @return True if there are any slots connected to the signal
*/
bool Empty() const
{
- return mImpl.Empty();
+ return mImpl ? mImpl->Empty() : true;
}
/**
- * @brief Query the number of slots.
+ * @brief Queries the number of slots.
*
- * @return The number of slots connected to this signal.
+ * @SINCE_1_0.0
+ * @return The number of slots connected to this signal
*/
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 Connect a function.
+ * @brief Connects a function.
*
- * @param[in] func The function to connect.
+ * @SINCE_1_0.0
+ * @param[in] func The function to connect
*/
- void Connect( void (*func)() )
+ void Connect(void (*func)())
{
- mImpl.OnConnect( MakeCallback( func ) );
+ Impl().OnConnect(MakeCallback(func));
}
/**
- * @brief Disconnect a function.
+ * @brief Disconnects a function.
*
- * @param[in] func The function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] func The function to disconnect
*/
- void Disconnect( void (*func)() )
+ void Disconnect(void (*func)())
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, void (X::*func)() )
+ void Connect(X* obj, void (X::*func)())
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, void (X::*func)() )
+ void Disconnect(X* obj, void (X::*func)())
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, void (X::*func)() )
+ void Connect(SlotDelegate<X>& delegate, void (X::*func)())
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, void (X::*func)() )
+ void Disconnect(SlotDelegate<X>& delegate, void (X::*func)())
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
- * @brief Connect a function object.
+ * @brief Connects a function object.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] func The function object to copy.
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctor0< X >( func ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctor0<X>(func));
}
/**
- * @brief Connect a function object using FunctorDelegate.
+ * @brief Connects a function object using FunctorDelegate.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken).
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegate0( delegate ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegate0(delegate));
}
/**
- * @brief Emit the signal.
+ * @brief Emits the signal.
+ * @SINCE_1_0.0
*/
void Emit()
{
- mImpl.Emit();
+ Impl().Emit();
}
-
-private:
-
- Signal( const Signal& ); ///< undefined copy constructor, signals don't support copying.
- Signal& operator=( const Signal& ); ///< undefined assignment operator
-
-private:
-
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< The base signal implementation
};
/**
* @brief A template for Signals with no parameters and a return value.
+ * @SINCE_1_0.0
*/
-template < typename Ret >
-class Signal< Ret() >
+template<typename Ret>
+class Signal<Ret()> : public SignalMixin
{
public:
-
- /**
- * @brief Default constructor.
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- */
- ~Signal()
- {
- }
-
/**
- * @brief Query whether there are any connected slots.
+ * @brief Connects a function.
*
- * @return True if there are any slots connected to the signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to connect
*/
- bool Empty() const
+ void Connect(Ret (*func)())
{
- return mImpl.Empty();
+ Impl().OnConnect(MakeCallback(func));
}
/**
- * @brief Query the number of slots.
+ * @brief Disconnects a function.
*
- * @return The number of slots connected to this signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to disconnect
*/
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
- * @brief Connect a function.
- *
- * @param[in] func The function to connect.
- */
- void Connect( Ret (*func)() )
+ void Disconnect(Ret (*func)())
{
- mImpl.OnConnect( MakeCallback( func ) );
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
- * @brief Disconnect a function.
+ * @brief Connects a member function.
*
- * @param[in] func The function to disconnect.
- */
- void Disconnect( Ret (*func)() )
- {
- mImpl.OnDisconnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Connect a member function.
- *
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, Ret (X::*func)() )
+ void Connect(X* obj, Ret (X::*func)())
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, Ret (X::*func)() )
+ void Disconnect(X* obj, Ret (X::*func)())
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, Ret (X::*func)() )
+ void Connect(SlotDelegate<X>& delegate, Ret (X::*func)())
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ Impl().OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, Ret (X::*func)() )
+ void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)())
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ Impl().OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
- * @brief Connect a function object.
+ * @brief Connects a function object.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] func The function object to copy.
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorReturn0< X, Ret >( func ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctorReturn0<X, Ret>(func));
}
/**
- * @brief Connect a function object using FunctorDelegate.
+ * @brief Connects a function object using FunctorDelegate.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken).
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegateReturn0< Ret >( delegate ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegateReturn0<Ret>(delegate));
}
/**
- * @brief Emit the signal.
+ * @brief Emits the signal.
*
- * @return The value returned by the last callback, or a default constructed value if no callbacks are connected.
+ * @SINCE_1_0.0
+ * @return The value returned by the last callback, or a default constructed value if no callbacks are connected
*/
Ret Emit()
{
- return mImpl.EmitReturn< Ret >();
+ return Impl().template EmitReturn<Ret>();
}
-
-private:
-
- Signal( const Signal& ); ///< undefined copy constructor, signals don't support copying.
- Signal& operator=( const Signal& ); ///< undefined assignment operator
-
-private:
-
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @brief A template for Signals with 1 parameter.
+ * @SINCE_1_0.0
*/
-template < typename Arg0 >
-class Signal< void ( Arg0 ) >
+template<typename Arg0>
+class Signal<void(Arg0)> : public SignalMixin
{
public:
-
- /**
- * @brief Default constructor.
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- */
- ~Signal()
- {
- }
-
/**
- * @brief Query whether there are any connected slots.
+ * @brief Connects a function.
*
- * @return True if there are any slots connected to the signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to connect
*/
- bool Empty() const
+ void Connect(void (*func)(Arg0 arg0))
{
- return mImpl.Empty();
+ Impl().OnConnect(MakeCallback(func));
}
/**
- * @brief Query the number of slots.
+ * @brief Disconnects a function.
*
- * @return The number of slots connected to this signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to disconnect
*/
- std::size_t GetConnectionCount() const
+ void Disconnect(void (*func)(Arg0 arg0))
{
- return mImpl.GetConnectionCount();
- }
- /**
- * @brief Connect a function.
- *
- * @param[in] func The function to connect.
- */
- void Connect( void (*func)( Arg0 arg0 ) )
- {
- mImpl.OnConnect( MakeCallback( func ) );
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
- * @brief Disconnect a function.
+ * @brief Connects a member function.
*
- * @param[in] func The function to disconnect.
- */
- void Disconnect( void (*func)( Arg0 arg0 ) )
- {
- mImpl.OnDisconnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Connect a member function.
- *
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, void (X::*func)( Arg0 arg0 ) )
+ void Connect(X* obj, void (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, void (X::*func)( Arg0 arg0 ) )
+ void Disconnect(X* obj, void (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0 ) )
+ 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));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0 ) )
+ 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));
}
/**
- * @brief Connect a function object.
+ * @brief Connects a function object.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] func The function object to copy.
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctor1< X, Arg0 >( func ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctor1<X, Arg0>(func));
}
/**
- * @brief Connect a function object using FunctorDelegate.
+ * @brief Connects a function object using FunctorDelegate.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken).
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegate1< Arg0 >( delegate ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegate1<Arg0>(delegate));
}
/**
- * @brief Emit the signal.
+ * @brief Emits the signal.
*
- * @param[in] arg0 The first value to pass to callbacks.
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first value to pass to callbacks
*/
- void Emit( Arg0 arg0 )
+ void Emit(Arg0 arg0)
{
- mImpl.Emit< Arg0 >( arg0 );
+ Impl().template Emit<Arg0>(arg0);
}
-
-private:
-
- Signal( const Signal& ); ///< undefined copy constructor, signals don't support copying.
- Signal& operator=( const Signal& ); ///< undefined assignment operator
-
-private:
-
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @brief A template for Signals with 1 parameter and a return value.
+ * @SINCE_1_0.0
*/
-template < typename Ret, typename Arg0 >
-class Signal< Ret( Arg0 ) >
+template<typename Ret, typename Arg0>
+class Signal<Ret(Arg0)> : public SignalMixin
{
public:
-
- /**
- * @brief Default constructor.
- */
- Signal()
- {
- }
-
/**
- * @brief Non-virtual destructor.
- */
- ~Signal()
- {
- }
-
- /**
- * @brief Query whether there are any connected slots.
+ * @brief Connects a function.
*
- * @return True if there are any slots connected to the signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to connect
*/
- bool Empty() const
+ void Connect(Ret (*func)(Arg0 arg0))
{
- return mImpl.Empty();
+ Impl().OnConnect(MakeCallback(func));
}
/**
- * @brief Query the number of slots.
+ * @brief Disconnects a function.
*
- * @return The number of slots connected to this signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to disconnect
*/
- std::size_t GetConnectionCount() const
+ void Disconnect(Ret (*func)(Arg0 arg0))
{
- return mImpl.GetConnectionCount();
- }
- /**
- * @brief Connect a function.
- *
- * @param[in] func The function to connect.
- */
- void Connect( Ret (*func)( Arg0 arg0 ) )
- {
- mImpl.OnConnect( MakeCallback( func ) );
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
- * @brief Disconnect a function.
+ * @brief Connects a member function.
*
- * @param[in] func The function to disconnect.
- */
- void Disconnect( Ret (*func)( Arg0 arg0 ) )
- {
- mImpl.OnDisconnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Connect a member function.
- *
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, Ret (X::*func)( Arg0 arg0 ) )
+ void Connect(X* obj, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, Ret (X::*func)( Arg0 arg0 ) )
+ void Disconnect(X* obj, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0 ) )
+ 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));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0 ) )
+ 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));
}
/**
- * @brief Connect a function object.
+ * @brief Connects a function object.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] func The function object to copy.
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ 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));
}
/**
- * @brief Connect a function object using FunctorDelegate.
+ * @brief Connects a function object using FunctorDelegate.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken).
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegateReturn1< Arg0, Ret >( delegate ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegateReturn1<Arg0, Ret>(delegate));
}
/**
- * @brief Emit the signal.
+ * @brief Emits the signal.
*
- * @param[in] arg0 The first value to pass to callbacks.
- * @return The value returned by the last callback, or a default constructed value if no callbacks are connected.
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first value to pass to callbacks
+ * @return The value returned by the last callback, or a default constructed value if no callbacks are connected
*/
- Ret Emit( Arg0 arg0 )
+ Ret Emit(Arg0 arg0)
{
- return mImpl.EmitReturn< Ret,Arg0 >(arg0);
+ return Impl().template EmitReturn<Ret, Arg0>(arg0);
}
-
-private:
-
- Signal( const Signal& ); ///< undefined copy constructor, signals don't support copying.
- Signal& operator=( const Signal& ); ///< undefined assignment operator
-
-private:
-
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @brief A template for Signals with 2 parameters.
*
+ * @SINCE_1_0.0
*/
-template < typename Arg0, typename Arg1 >
-class Signal< void ( Arg0, Arg1 ) >
+template<typename Arg0, typename Arg1>
+class Signal<void(Arg0, Arg1)> : public SignalMixin
{
public:
-
- /**
- * @brief Default constructor.
- *
- */
- Signal()
- {
- }
-
/**
- * @brief Non-virtual destructor.
+ * @brief Connects a function.
*
+ * @SINCE_1_0.0
+ * @param[in] func The function to connect
*/
- ~Signal()
+ void Connect(void (*func)(Arg0 arg0, Arg1 arg1))
{
+ Impl().OnConnect(MakeCallback(func));
}
/**
- * @brief Query whether there are any connected slots.
+ * @brief Disconnects a function.
*
- * @return True if there are any slots connected to the signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to disconnect
*/
- bool Empty() const
+ void Disconnect(void (*func)(Arg0 arg0, Arg1 arg1))
{
- return mImpl.Empty();
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
- * @brief Query the number of slots.
- *
- * @return The number of slots connected to this signal.
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
- * @brief Connect a function.
+ * @brief Connects a member function.
*
- * @param[in] func The function to connect.
- */
- void Connect( void (*func)( Arg0 arg0, Arg1 arg1 ) )
- {
- mImpl.OnConnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Disconnect a function.
- *
- * @param[in] func The function to disconnect.
- */
- void Disconnect( void (*func)( Arg0 arg0, Arg1 arg1 ) )
- {
- mImpl.OnDisconnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Connect a member function.
- *
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, void (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Connect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, void (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Disconnect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ 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));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ 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));
}
/**
- * @brief Connect a function object.
+ * @brief Connects a function object.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] func The function object to copy.
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ 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));
}
/**
- * @brief Connect a function object using FunctorDelegate.
+ * @brief Connects a function object using FunctorDelegate.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken).
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegate2< Arg0, Arg1 >( delegate ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegate2<Arg0, Arg1>(delegate));
}
/**
- * @brief Emit the signal.
+ * @brief Emits the signal.
*
- * @param[in] arg0 The first value to pass to callbacks.
- * @param[in] arg1 The second value to pass to callbacks.
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first value to pass to callbacks
+ * @param[in] arg1 The second value to pass to callbacks
*/
- void Emit( Arg0 arg0, Arg1 arg1 )
+ void Emit(Arg0 arg0, Arg1 arg1)
{
- mImpl.Emit< Arg0,Arg1 >( arg0, arg1 );
+ Impl().template Emit<Arg0, Arg1>(arg0, arg1);
}
-
-private:
-
- Signal( const Signal& ); ///< undefined copy constructor, signals don't support copying.
- Signal& operator=( const Signal& ); ///< undefined assignment operator
-
-private:
-
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @brief A template for Signals with 2 parameters and a return value.
+ * @SINCE_1_0.0
*/
-template < typename Ret, typename Arg0, typename Arg1 >
-class Signal< Ret( Arg0, Arg1 ) >
+template<typename Ret, typename Arg0, typename Arg1>
+class Signal<Ret(Arg0, Arg1)> : public SignalMixin
{
public:
-
- /**
- * @brief Default constructor.
- */
- Signal()
- {
- }
-
/**
- * @brief Non-virtual destructor.
+ * @brief Connects a function.
+ * @SINCE_1_0.0
+ * @param[in] func The function to connect
*/
- ~Signal()
+ void Connect(Ret (*func)(Arg0 arg0, Arg1 arg1))
{
+ Impl().OnConnect(MakeCallback(func));
}
/**
- * @brief Query whether there are any connected slots.
+ * @brief Disconnects a function.
*
- * @return True if there are any slots connected to the signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to disconnect
*/
- bool Empty() const
+ void Disconnect(Ret (*func)(Arg0 arg0, Arg1 arg1))
{
- return mImpl.Empty();
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
- * @brief Query the number of slots.
+ * @brief Connects a member function.
*
- * @return The number of slots connected to this signal.
- */
- std::size_t GetConnectionCount() const
- {
- return mImpl.GetConnectionCount();
- }
- /**
- * @brief Connect a function.
- * @param[in] func The function to connect.
- */
- void Connect( Ret (*func)( Arg0 arg0, Arg1 arg1 ) )
- {
- mImpl.OnConnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Disconnect a function.
- *
- * @param[in] func The function to disconnect.
- */
- void Disconnect( Ret (*func)( Arg0 arg0, Arg1 arg1 ) )
- {
- mImpl.OnDisconnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Connect a member function.
- *
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, Ret (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Connect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ Impl().OnConnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, Ret (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Disconnect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ Impl().OnDisconnect(obj, MakeCallback(obj, func));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ 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));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ 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));
}
/**
- * @brief Connect a function object.
+ * @brief Connects a function object.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] func The function object to copy.
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ 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));
}
/**
- * @brief Connect a function object using FunctorDelegate.
+ * @brief Connects a function object using FunctorDelegate.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken).
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegateReturn2< Arg0, Arg1, Ret >( delegate ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegateReturn2<Arg0, Arg1, Ret>(delegate));
}
/**
- * @brief Emit the signal.
+ * @brief Emits the signal.
*
- * @param[in] arg0 The first value to pass to callbacks.
- * @param[in] arg1 The second value to pass to callbacks.
- * @return The value returned by the last callback, or a default constructed value if no callbacks are connected.
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first value to pass to callbacks
+ * @param[in] arg1 The second value to pass to callbacks
+ * @return The value returned by the last callback, or a default constructed value if no callbacks are connected
*/
- Ret Emit( Arg0 arg0, Arg1 arg1 )
+ Ret Emit(Arg0 arg0, Arg1 arg1)
{
- return mImpl.EmitReturn< Ret,Arg0,Arg1 >( arg0, arg1 );
+ return Impl().template EmitReturn<Ret, Arg0, Arg1>(arg0, arg1);
}
-
-private:
-
- Signal( const Signal& ); ///< undefined copy constructor, signals don't support copying.
- Signal& operator=( const Signal& ); ///< undefined assignment operator
-
-private:
-
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @brief A template for Signals with 3 parameters.
+ * @SINCE_1_0.0
*/
-template < typename Arg0, typename Arg1, typename Arg2 >
-class Signal< void ( Arg0, Arg1, Arg2 ) >
+template<typename Arg0, typename Arg1, typename Arg2>
+class Signal<void(Arg0, Arg1, Arg2)> : public SignalMixin
{
public:
-
- /**
- * @brief Default constructor.
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- */
- ~Signal()
- {
- }
-
/**
- * @brief Query whether there are any connected slots.
+ * @brief Connects a function.
*
- * @return True if there are any slots connected to the signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to connect
*/
- bool Empty() const
+ void Connect(void (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- return mImpl.Empty();
+ Impl().OnConnect(MakeCallback(func));
}
/**
- * @brief Query the number of slots.
+ * @brief Disconnects a function.
*
- * @return The number of slots connected to this signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to disconnect
*/
- std::size_t GetConnectionCount() const
+ void Disconnect(void (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- return mImpl.GetConnectionCount();
- }
- /**
- * @brief Connect a function.
- *
- * @param[in] func The function to connect.
- */
- void Connect( void (*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
- {
- mImpl.OnConnect( MakeCallback( func ) );
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
- * @brief Disconnect a function.
+ * @brief Connects a member function.
*
- * @param[in] func The function to disconnect.
- */
- void Disconnect( void (*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
- {
- mImpl.OnDisconnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Connect a member function.
- *
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, void (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ 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));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, void (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ 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));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ 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));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ 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));
}
/**
- * @brief Connect a function object.
+ * @brief Connects a function object.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] func The function object to copy.
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ 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));
}
/**
- * @brief Connect a function object using FunctorDelegate.
+ * @brief Connects a function object using FunctorDelegate.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken).
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegate3< Arg0, Arg1, Arg2 >( delegate ) );
+ Impl().OnConnect(connectionTracker, new CallbackFunctorDelegate3<Arg0, Arg1, Arg2>(delegate));
}
/**
- * @brief Emit the signal.
+ * @brief Emits the signal.
*
- * @param[in] arg0 The first value to pass to callbacks.
- * @param[in] arg1 The second value to pass to callbacks.
- * @param[in] arg2 The third value to pass to callbacks.
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first value to pass to callbacks
+ * @param[in] arg1 The second value to pass to callbacks
+ * @param[in] arg2 The third value to pass to callbacks
*/
- void Emit( Arg0 arg0, Arg1 arg1, Arg2 arg2 )
+ void Emit(Arg0 arg0, Arg1 arg1, Arg2 arg2)
{
- mImpl.Emit< Arg0,Arg1,Arg2 >( arg0, arg1, arg2 );
+ Impl().template Emit<Arg0, Arg1, Arg2>(arg0, arg1, arg2);
}
-
-private:
-
- Signal( const Signal& ); ///< undefined copy constructor, signals don't support copying.
- Signal& operator=( const Signal& ); ///< undefined assignment operator
-
-private:
-
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
* @brief A template for Signals with 2 parameters and a return value.
+ * @SINCE_1_0.0
*/
-template < typename Ret, typename Arg0, typename Arg1, typename Arg2 >
-class Signal< Ret( Arg0, Arg1, Arg2 ) >
+template<typename Ret, typename Arg0, typename Arg1, typename Arg2>
+class Signal<Ret(Arg0, Arg1, Arg2)> : public SignalMixin
{
public:
-
- /**
- * @brief Default constructor.
- */
- Signal()
- {
- }
-
- /**
- * @brief Non-virtual destructor.
- */
- ~Signal()
- {
- }
-
/**
- * @brief Query whether there are any connected slots.
+ * @brief Connects a function.
*
- * @return True if there are any slots connected to the signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to connect
*/
- bool Empty() const
+ void Connect(Ret (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- return mImpl.Empty();
+ Impl().OnConnect(MakeCallback(func));
}
/**
- * @brief Query the number of slots.
+ * @brief Disconnects a function.
*
- * @return The number of slots connected to this signal.
+ * @SINCE_1_0.0
+ * @param[in] func The function to disconnect
*/
- std::size_t GetConnectionCount() const
+ void Disconnect(Ret (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- return mImpl.GetConnectionCount();
+ Impl().OnDisconnect(MakeCallback(func));
}
/**
- * @brief Connect a function.
+ * @brief Connects a member function.
*
- * @param[in] func The function to connect.
- */
- void Connect( Ret (*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
- {
- mImpl.OnConnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Disconnect a function.
- *
- * @param[in] func The function to disconnect.
- */
- void Disconnect( Ret (*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
- {
- mImpl.OnDisconnect( MakeCallback( func ) );
- }
-
- /**
- * @brief Connect a member function.
- *
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, Ret (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ 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));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] obj An object which must implement the ConnectionTrackerInterface.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] obj An object which must implement the ConnectionTrackerInterface
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, Ret (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ 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));
}
/**
- * @brief Connect a member function.
+ * @brief Connects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to connect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ 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));
}
/**
- * @brief Disconnect a member function.
+ * @brief Disconnects a member function.
*
- * @param[in] delegate A slot delegate.
- * @param[in] func The member function to disconnect.
+ * @SINCE_1_0.0
+ * @param[in] delegate A slot delegate
+ * @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ 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));
}
/**
- * @brief Connect a function object.
+ * @brief Connects a function object.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] func The function object to copy.
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ 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));
}
/**
- * @brief Connect a function object using FunctorDelegate.
+ * @brief Connects a function object using FunctorDelegate.
*
- * @param[in] connectionTracker A connection tracker which can be used to disconnect.
- * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken).
+ * @SINCE_1_0.0
+ * @param[in] connectionTracker A connection tracker which can be used to disconnect
+ * @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ 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));
}
/**
- * @brief Emit the signal.
+ * @brief Emits the signal.
*
- * @param[in] arg0 The first value to pass to callbacks.
- * @param[in] arg1 The second value to pass to callbacks.
- * @param[in] arg2 The third value to pass to callbacks.
- * @return The value returned by the last callback, or a default constructed value if no callbacks are connected.
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first value to pass to callbacks
+ * @param[in] arg1 The second value to pass to callbacks
+ * @param[in] arg2 The third value to pass to callbacks
+ * @return The value returned by the last callback, or a default constructed value if no callbacks are connected
*/
- Ret Emit( Arg0 arg0, Arg1 arg1, Arg2 arg2 )
+ Ret Emit(Arg0 arg0, Arg1 arg1, Arg2 arg2)
{
- return mImpl.EmitReturn< Ret,Arg0,Arg1,Arg2 >( arg0, arg1, arg2 );
+ return Impl().template EmitReturn<Ret, Arg0, Arg1, Arg2>(arg0, arg1, arg2);
}
-
-private:
-
- Signal( const Signal& ); ///< undefined copy constructor, signals don't support copying.
- Signal& operator=( const Signal& ); ///< undefined assignment operator
-
-private:
-
- // Use composition instead of inheritance (virtual methods don't mix well with templates)
- BaseSignal mImpl; ///< Implementation
};
/**
*/
} // namespace Dali
-#endif // __DALI_SIGNAL_H__
+#endif // DALI_SIGNAL_H