ROOT  6.06/09
Reference Guide
TQObjectEmitVA.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Philippe Canal 09/2014
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TQObjectEmitVA
13 #define ROOT_TQObjectEmitVA
14 
15 // TQObject::EmitVA is implemented in its own header to break the
16 // circular dependency between TQObject and TQConnection.
17 
18 #ifndef ROOT_TQObject
19 #include "TQObject.h"
20 #endif
21 #ifndef ROOT_TQConnection
22 #include "TQConnection.h"
23 #endif
24 
25 template <typename... T> inline
26 void TQObject::EmitVA(const char *signal_name, Int_t /* nargs */, const T&... params)
27 {
28  // Activate signal with variable argument list.
29  // For internal use and for var arg EmitVA() in RQ_OBJECT.h.
30 
31  if (fSignalsBlocked || fgAllSignalsBlocked) return;
32 
33  TList classSigLists;
34  CollectClassSignalLists(classSigLists, IsA());
35 
36  if (classSigLists.IsEmpty() && !fListOfSignals)
37  return;
38 
39  TString signal = CompressName(signal_name);
40 
41  TQConnection *connection = 0;
42 
43  // execute class signals
44  TList *sigList;
45  TIter nextSigList(&classSigLists);
46  while ((sigList = (TList*) nextSigList()))
47  {
48  TIter nextcl((TList*) sigList->FindObject(signal));
49  while ((connection = (TQConnection*)nextcl())) {
50  gTQSender = GetSender();
51  connection->ExecuteMethod(params...);
52  }
53  }
54  if (!fListOfSignals)
55  return;
56 
57  // execute object signals
59  while (fListOfSignals && (connection = (TQConnection*)next())) {
60  gTQSender = GetSender();
61  connection->ExecuteMethod(params...);
62  }
63 }
64 
65 #endif
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
virtual void * GetSender()
Definition: TQObject.h:64
R__EXTERN void * gTQSender
Definition: TQObject.h:49
double T(double x)
Definition: ChebyshevPol.h:34
void EmitVA(const char *signal_name, Int_t, const T &...params)
TList * fListOfSignals
Definition: TQObject.h:58
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
virtual Bool_t IsEmpty() const
Definition: TCollection.h:99
A doubly linked list.
Definition: TList.h:47
static Bool_t fgAllSignalsBlocked
flag used for suppression of signals
Definition: TQObject.h:62
TQConnection class is an internal class, used in the object communication mechanism.
Definition: TQConnection.h:46
TClass * IsA() const
void ExecuteMethod()
Apply slot-method to the fReceiver object without arguments.
static TString CompressName(const char *method_name)
Bool_t fSignalsBlocked
list of connections to this object
Definition: TQObject.h:60
void CollectClassSignalLists(TList &list, TClass *cls)
Collect class signal lists from class cls and all its base-classes.
Definition: TQObject.cxx:449