Skip to content
Snippets Groups Projects
Commit cc0fc03a authored by Bertrand Bellenot's avatar Bertrand Bellenot
Browse files

From Vassil: Add some comments in the new Signal/Slot interfaces

parent b867a718
No related branches found
No related tags found
No related merge requests found
...@@ -98,6 +98,9 @@ public: ...@@ -98,6 +98,9 @@ public:
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Emit a signal with a varying number of arguments. /// Emit a signal with a varying number of arguments.
/// ///
/// Note: EmitVA(signal_name, const char*) is very different from
/// Emit(signal_name, const char*). EmitVA does not support argument lists.
///
template <typename... T> void EmitVA(const char *signal_name, Int_t /* nargs */, const T&... params) template <typename... T> void EmitVA(const char *signal_name, Int_t /* nargs */, const T&... params)
{ {
// Activate signal with variable argument list. // Activate signal with variable argument list.
......
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
#include "TList.h" #include "TList.h"
/// Mediates the link between the signal and the slot. It decouples the setting of
/// arguments and sending a signal.
///
/// There are three different modes in argument setting required by TQObject's Emit/EmitVA:
/// setting integral types, setting array types and setting const char*.
class TVirtualQConnection : public TList { class TVirtualQConnection : public TList {
protected: protected:
virtual void SetArg(Long_t) = 0; virtual void SetArg(Long_t) = 0;
...@@ -56,11 +61,17 @@ protected: ...@@ -56,11 +61,17 @@ protected:
} }
public: public:
virtual void SendSignal() = 0; virtual void SendSignal() = 0;
/// Unpacks the template parameter type and sets arguments of integral and array (scalar) type.
///
template <typename... T> void SetArgs(const T&... args) template <typename... T> void SetArgs(const T&... args)
{ {
SetArgsImpl(args...); SetArgsImpl(args...);
} }
// We need a separate overload to allow users to set the argument size of the array.
/// Sets an array of arguments passed as a pointer type and size. If nargs is not specified
/// the number of arguments expected by the slot is used.
///
void SetArgs(const Long_t* argArray, Int_t nargs = -1) void SetArgs(const Long_t* argArray, Int_t nargs = -1)
{ {
SetArg(argArray, nargs); SetArg(argArray, nargs);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment