#define __DALI_BASE_SIGNAL_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
#include <dali/public-api/signals/connection-tracker-interface.h>
#include <dali/public-api/signals/signal-slot-connections.h>
-namespace Dali DALI_IMPORT_API
+namespace Dali
{
+/**
+ * @addtogroup dali_core_signals
+ * @{
+ */
/**
- * @brief Implementation class for Dali::SignalV2%s.
+ * @brief Implementation class for Dali::Signal.
*
* A slot can be connected to many signals
* A signal can be connected to many slots
* <tr><td> %Callback 2 </td><td> Slot Observer 2 </td></tr>
* </table>
*
- * When the connection tracker is destroyed, SlotDisconnected() is called on every slot observer ( signal )
- * Signals implement the Slot Observer interface, to be told when a slot has disconnected
- * Connection tracker implements the Signal Observer interface, to be told when a signal has disconnected (died)
+ * When the connection tracker is destroyed, SlotDisconnected() is called on every slot observer ( signal ).
+ * Signals implement the Slot Observer interface, to be told when a slot has disconnected.
+ * Connection tracker implements the Signal Observer interface, to be told when a signal has disconnected (died).
*
+ * @SINCE_1_0.0
*/
-class BaseSignal : public SlotObserver
+class DALI_CORE_API BaseSignal : public SlotObserver
{
public:
/**
* @brief Constructor.
+ * @SINCE_1_0.0
*/
BaseSignal();
/**
* @brief Virtual destructor.
+ * @SINCE_1_0.0
*/
virtual ~BaseSignal();
/**
- * @brief Query whether there are any connected slots.
+ * @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;
/**
- * @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;
/**
* @brief Used to guard against nested Emit() calls.
+ * @SINCE_1_0.0
*/
struct EmitGuard
{
/**
- * @brief Create the guard.
+ * @brief Creates the guard.
*
- * @param[in,out] flag This flag will be set to true during Emit() calls.
+ * @SINCE_1_0.0
+ * @param[in,out] flag This flag will be set to true during Emit() calls
*/
EmitGuard( bool& flag );
/**
* @brief Non-virtual destructor.
*
+ * @SINCE_1_0.0
*/
~EmitGuard();
/**
- * @brief Determine if an error occured.
+ * @brief Determines if an error occurred.
*
+ * @SINCE_1_0.0
* @return True if an error occurred i.e. if Emit() was called during Emit()
*/
bool ErrorOccurred();
};
/**
- * @brief Emit a signal with no parameters.
+ * @brief Emits a signal with no parameters.
*
+ * @SINCE_1_0.0
* @pre Cannot be called from inside the same Signal's Emit methods.
*/
void Emit();
/**
- * @brief Emit a signal with no parameters.
+ * @brief Emits a signal with no parameters.
*
+ * @SINCE_1_0.0
+ * @return The value returned by the last callback
* @pre Cannot be called from inside the same Signal's Emit methods.
- * @return The value returned by the last callback.
*/
template< typename Ret >
Ret EmitReturn()
}
/**
- * @brief Emit a signal with 1 parameter.
+ * @brief Emits a signal with 1 parameter.
*
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first parameter
* @pre Cannot be called from inside the same Signal's Emit methods.
- * @param[in] arg0 The first parameter.
*/
template< typename Arg0 >
void Emit( Arg0 arg0 )
}
/**
- * @brief Emit a signal with 1 parameter.
+ * @brief Emits a signal with 1 parameter.
*
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first parameter
+ * @return The value returned by the last callback
* @pre Cannot be called from inside the same Signal's Emit methods.
- * @param[in] arg0 The first parameter.
- * @return The value returned by the last callback.
*/
template< typename Ret, typename Arg0 >
Ret EmitReturn( Arg0 arg0 )
}
/**
- * @brief Emit a signal with 2 parameters.
+ * @brief Emits a signal with 2 parameters.
*
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first parameter
+ * @param[in] arg1 The second parameter
* @pre Cannot be called from inside the same Signal's Emit methods.
- * @param[in] arg0 The first parameter.
- * @param[in] arg1 The second parameter.
*/
template< typename Arg0, typename Arg1 >
void Emit( Arg0 arg0, Arg1 arg1 )
}
/**
- * @brief Emit a signal with 2 parameters.
+ * @brief Emits a signal with 2 parameters.
*
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first parameter
+ * @param[in] arg1 The second parameter
+ * @return The value returned by the last callback
* @pre Cannot be called from inside the same Signal's Emit methods.
- * @param[in] arg0 The first parameter.
- * @param[in] arg1 The second parameter.
- * @return The value returned by the last callback.
*/
template< typename Ret, typename Arg0, typename Arg1 >
Ret EmitReturn( Arg0 arg0, Arg1 arg1 )
}
/**
- * @brief Emit a signal with 3 parameters.
+ * @brief Emits a signal with 3 parameters.
*
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first parameter
+ * @param[in] arg1 The second parameter
+ * @param[in] arg2 The third parameter
* @pre Cannot be called from inside the same Signal's Emit methods.
- * @param[in] arg0 The first parameter.
- * @param[in] arg1 The second parameter.
- * @param[in] arg2 The third parameter.
*/
template< typename Arg0, typename Arg1, typename Arg2 >
void Emit( Arg0 arg0, Arg1 arg1, Arg2 arg2 )
}
/**
- * @brief Emit a signal with 3 parameters.
+ * @brief Emits a signal with 3 parameters.
*
+ * @SINCE_1_0.0
+ * @param[in] arg0 The first parameter
+ * @param[in] arg1 The second parameter
+ * @param[in] arg2 The third parameter
+ * @return The value returned by the last callback
* @pre Cannot be called from inside the same Signal's Emit methods.
- * @param[in] arg0 The first parameter.
- * @param[in] arg1 The second parameter.
- * @param[in] arg2 The third parameter.
- * @return The value returned by the last callback.
*/
template< typename Ret, typename Arg0, typename Arg1, typename Arg2 >
Ret EmitReturn( Arg0 arg0, Arg1 arg1, Arg2 arg2 )
// Connect / Disconnect function for use by Signal implementations
/**
- * @brief Called by Signal implementations, when the user calls Signal.Connect( ... )
+ * @brief Called by Signal implementations, when the user calls Signal.Connect( ... ).
*
- * @param[in] callback A newly allocated callback object (takes ownership).
+ * @SINCE_1_0.0
+ * @param[in] callback A newly allocated callback object (takes ownership)
*/
void OnConnect( CallbackBase* callback );
/**
- * @brief Called by Signal implementations, when the user calls Signal.Disconnect( ... )
+ * @brief Called by Signal implementations, when the user calls Signal.Disconnect( ... ).
*
- * @param[in] callback A newly allocated callback object (takes ownership).
+ * @SINCE_1_0.0
+ * @param[in] callback A newly allocated callback object (takes ownership)
*/
void OnDisconnect( CallbackBase* callback );
/**
- * @brief Called by Signal implementations, when the user calls Signal.Connect( ... )
+ * @brief Called by Signal implementations, when the user calls Signal.Connect( ... ).
*
- * @param[in] tracker The connection tracker.
- * @param[in] callback A newly allocated callback object (takes ownership).
+ * @SINCE_1_0.0
+ * @param[in] tracker The connection tracker
+ * @param[in] callback A newly allocated callback object (takes ownership)
*/
void OnConnect( ConnectionTrackerInterface* tracker, CallbackBase* callback );
/**
- * @brief Called by Signal implementations, when the user calls Signal.Disconnect( ... )
+ * @brief Called by Signal implementations, when the user calls Signal.Disconnect( ... ).
*
- * @param[in] tracker The connection tracker.
- * @param[in] callback A newly allocated callback object (takes ownership).
+ * @SINCE_1_0.0
+ * @param[in] tracker The connection tracker
+ * @param[in] callback A newly allocated callback object (takes ownership)
*/
void OnDisconnect( ConnectionTrackerInterface* tracker, CallbackBase* callback );
/**
* @brief Returns a callback given an index in to the connection array.
*
- * @param[in] connectionIndex The index of the callback.
- * @return The callback, or NULL if the connection has been deleted.
+ * @SINCE_1_0.0
+ * @param[in] connectionIndex The index of the callback
+ * @return The callback, or NULL if the connection has been deleted
*/
CallbackBase* GetCallback( std::size_t connectionIndex ) const;
/**
* @brief Helper to find whether a callback is connected.
*
- * @param[in] callback The call back object.
- * @return A valid index if the callback is connected.
+ * @SINCE_1_0.0
+ * @param[in] callback The call back object
+ * @return A valid index if the callback is connected
*/
int FindCallback( CallbackBase* callback );
/**
* @brief Deletes a connection object from the list of connections.
*
- * @param[in] connectionIndex The index of the callback.
+ * @SINCE_1_0.0
+ * @param[in] connectionIndex The index of the callback
*/
void DeleteConnection( std::size_t connectionIndex );
/**
* @brief Helper to remove NULL items from mSignalConnections, which is only safe at the end of Emit()
* i.e. not from methods which can be called during a signal Emit(), such as Disconnect().
+ * @SINCE_1_0.0
*/
void CleanupConnections();
- BaseSignal( const BaseSignal& ); ///< undefined copy constructor, signals don't support copying.
- BaseSignal& operator=( const BaseSignal& ); ///< undefined assignment operator
+ BaseSignal( const BaseSignal& ); ///< undefined copy constructor, signals don't support copying. @SINCE_1_0.0
+ BaseSignal& operator=( const BaseSignal& ); ///< undefined assignment operator @SINCE_1_0.0
private:
bool mEmittingFlag; ///< Used to guard against nested Emit() calls
};
+/**
+ * @}
+ */
} // namespace Dali
#endif // __DALI_BASE_SIGNAL_H__