ROOT  6.06/09
Reference Guide
TQObject.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id: 5d6810ad46b864564f576f88aa9b154789d91d48 $
2 // Author: Valeriy Onuchin & Fons Rademakers 15/10/2000
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 /** \class TQObject
13 This is the ROOT implementation of the Qt object communication
14 mechanism (see also http://www.troll.no/qt/metaobjects.html)
15 
16 Signals and slots are used for communication between objects.
17 When an object has changed in some way that might be interesting
18 for the outside world, it emits a signal to tell whoever is
19 listening. All slots that are connected to this signal will be
20 activated (called). It is even possible to connect a signal
21 directly to another signal (this will emit the second signal
22 immediately whenever the first is emitted.) There is no limitation
23 on the number of slots that can be connected to a signal.
24 The slots will be activated in the order they were connected
25 to the signal. This mechanism allows objects to be easily reused,
26 because the object that emits a signal does not need to know
27 to which objects the signals are connected.
28 Together, signals and slots make up a powerfull component
29 programming mechanism.
30 
31 ### Signals
32 
33 ~~~ {.cpp}
34  Destroyed()
35 ~~~
36 Signal emitted when object is destroyed.
37 This signal could be connected to some garbage-collector object.
38 
39 ~~~ {.cpp}
40  ChangedBy(const char *method_name)
41 ~~~
42 This signal is emitted when some important data members of
43 the object were changed. method_name parameter can be used
44 as an identifier of the modifier method.
45 
46 ~~~ {.cpp}
47  Message(const char *msg)
48 ~~~
49 
50 General purpose message signal
51 */
52 
53 #include "Varargs.h"
54 #include "TQObject.h"
55 #include "TQConnection.h"
56 #include "THashList.h"
57 #include "TPRegexp.h"
58 #include "TROOT.h"
59 #include "TClass.h"
60 #include "TSystem.h"
61 #include "TMethod.h"
62 #include "TBaseClass.h"
63 #include "TDataType.h"
64 #include "TInterpreter.h"
65 #include "TQClass.h"
66 #include "TError.h"
67 #include "Riostream.h"
68 #include "RQ_OBJECT.h"
69 #include "TVirtualMutex.h"
70 #include "Varargs.h"
71 #include "TInterpreter.h"
72 #include "RConfigure.h"
73 
74 void *gTQSender; // A pointer to the object that sent the last signal.
75  // Getting access to the sender might be practical
76  // when many signals are connected to a single slot.
77 
79 
80 
84 
85 ////////////////////////////////////////////////////////////////////////////////
86 /// Removes "const" words and blanks from full (with prototype)
87 /// method name and resolve any typedefs in the method signature.
88 /// If a null or empty string is passed in, an empty string
89 /// is returned.
90 ///
91 /// Example:
92 /// ~~~ {.cpp}
93 /// CompressName(" Draw(const char *, const char *,
94 /// Option_t * , Int_t , Int_t)");
95 /// ~~~
96 /// returns the string "Draw(char*,char*,char*,int,int)".
97 
98 TString TQObject::CompressName(const char *method_name)
99 {
100  TString res(method_name);
101  if (res.IsNull())
102  return res;
103 
104  {
105  static TVirtualMutex * lock = 0;
106  R__LOCKGUARD2(lock);
107 
108  static TPMERegexp *constRe = 0, *wspaceRe = 0;
109  if (constRe == 0) {
110  constRe = new TPMERegexp("(?<=\\(|\\s|,|&|\\*)const(?=\\s|,|\\)|&|\\*)", "go");
111  wspaceRe = new TPMERegexp("\\s+", "go");
112  }
113  constRe ->Substitute(res, "");
114  wspaceRe->Substitute(res, "");
115  }
116 
117  TStringToken methargs(res, "\\(|\\)", kTRUE);
118 
119  methargs.NextToken();
120  res = methargs;
121  res += "(";
122 
123  methargs.NextToken();
124  TStringToken arg(methargs, ",");
125  while (arg.NextToken())
126  {
127  Int_t pri = arg.Length() - 1;
128  Char_t prc = 0;
129  if (arg[pri] == '*' || arg[pri] == '&') {
130  prc = arg[pri];
131  arg.Remove(pri);
132  }
133  TDataType *dt = gROOT->GetType(arg.Data());
134  if (dt) {
135  res += dt->GetFullTypeName();
136  } else {
137  res += arg;
138  }
139  if (prc) res += prc;
140  if (!arg.AtEnd()) res += ",";
141  }
142  res += ")";
143  return res;
144 }
145 
146 namespace {
147 
148 ////////////////////////////////////////////////////////////////////////////////
149 /// Almost the same as TClass::GetMethodWithPrototype().
150 
151 TMethod *GetMethodWithPrototype(TClass *cl, const char *method,
152  const char *proto, Int_t &nargs)
153 {
154  nargs = 0;
155 
156  if (!gInterpreter || cl == 0) return 0;
157 
158  TMethod *m = cl->GetMethodWithPrototype(method,proto);
159  if (m) nargs = m->GetNargs();
160  return m;
161 }
162 
163 ////////////////////////////////////////////////////////////////////////////////
164 /// Almost the same as TClass::GetMethod().
165 
166 static TMethod *GetMethod(TClass *cl, const char *method, const char *params)
167 {
168  if (!gInterpreter || cl == 0) return 0;
169  return cl->GetMethod(method,params);
170 }
171 
172 }
173 
174 ////////////////////////////////////////////////////////////////////////////////
175 /// Checking of consitency of sender/receiver methods/arguments.
176 /// Returns -1 on error, otherwise number or arguments of signal function.
177 /// Static method.
178 
180  TClass *sender_class, const char *signal,
181  TClass *receiver_class, const char *slot)
182 {
183  char *signal_method = new char[strlen(signal)+1];
184  if (signal_method) strcpy(signal_method, signal);
185 
186  char *signal_proto;
187  char *tmp;
188 
189  if ((signal_proto = strchr(signal_method,'('))) {
190  // substitute first '(' symbol with '\0'
191  *signal_proto++ = '\0';
192  // substitute last ')' symbol with '\0'
193  if ((tmp = strrchr(signal_proto,')'))) *tmp = '\0';
194  }
195 
196  if (!signal_proto) signal_proto = (char*)""; // avoid zero strings
197 
198  // if delegation object TQObjSender is used get the real sender class
199  if (sender && sender_class == TQObjSender::Class()) {
200  sender_class = TClass::GetClass(sender->GetSenderClassName());
201  if (!sender_class) {
202  ::Error("TQObject::CheckConnectArgs", "for signal/slot consistency\n"
203  "checking need to specify class name as argument to "
204  "RQ_OBJECT macro");
205  delete [] signal_method;
206  return -1;
207  }
208  }
209 
210  Int_t nargs;
211  TMethod *signalMethod = GetMethodWithPrototype(sender_class,
212  signal_method,
213  signal_proto,
214  nargs);
215  if (!signalMethod) {
216  ::Error("TQObject::CheckConnectArgs", "signal %s::%s(%s) does not exist",
217  sender_class->GetName(), signal_method, signal_proto);
218  delete [] signal_method;
219  return -1;
220  }
221  Int_t nsigargs = nargs;
222 
223 #if defined(CHECK_COMMENT_STRING)
224  const char *comment = 0;
225  if (signalMethod != (TMethod *) -1) // -1 in case of interpreted class
226  comment = signalMethod->GetCommentString();
227 
228  if (!comment || !comment[0] || strstr(comment,"*SIGNAL")){
229  ::Error("TQObject::CheckConnectArgs",
230  "signal %s::%s(%s), to declare signal use comment //*SIGNAL*",
231  sender_class->GetName(), signal_method, signal_proto);
232  delete [] signal_method;
233  return -1;
234  }
235 #endif
236 
237  // cleaning
238  delete [] signal_method;
239 
240  char *slot_method = new char[strlen(slot)+1];
241  if (slot_method) strcpy(slot_method, slot);
242 
243  char *slot_proto;
244  char *slot_params = 0;
245 
246  if ((slot_proto = strchr(slot_method,'('))) {
247 
248  // substitute first '(' symbol with '\0'
249  *slot_proto++ = '\0';
250 
251  // substitute last ')' symbol with '\0'
252  if ((tmp = strrchr(slot_proto,')'))) *tmp = '\0';
253  }
254 
255  if (!slot_proto) slot_proto = (char*)""; // avoid zero strings
256  if ((slot_params = strchr(slot_proto,'='))) *slot_params = ' ';
257 
258  TFunction *slotMethod = 0;
259  if (!receiver_class) {
260  // case of slot_method is compiled/intrepreted function
261  slotMethod = gROOT->GetGlobalFunction(slot_method,0,kFALSE);
262  } else {
263  slotMethod = !slot_params ?
264  GetMethodWithPrototype(receiver_class,
265  slot_method,
266  slot_proto,
267  nargs) :
268  GetMethod(receiver_class,
269  slot_method, slot_params);
270  }
271 
272  if (!slotMethod) {
273  if (!slot_params) {
274  ::Error("TQObject::CheckConnectArgs", "slot %s(%s) does not exist",
275  receiver_class ? Form("%s::%s", receiver_class->GetName(),
276  slot_method) : slot_method, slot_proto);
277  } else {
278  ::Error("TQObject::CheckConnectArgs", "slot %s(%s) does not exist",
279  receiver_class ? Form("%s::%s", receiver_class->GetName(),
280  slot_method) : slot_method, slot_params);
281  }
282  delete [] slot_method;
283  return -1;
284  }
285 
286 #if defined(CHECK_ARGS_NUMBER)
287  if (slotMethod != (TMethod *) -1 && slotMethod->GetNargsOpt() >= 0 &&
288  nsigargs < (slotMethod->GetNargs() - slotMethod->GetNargsOpt())) {
289  ::Error("TQObject::CheckConnectArgs",
290  "inconsistency in numbers of arguments");
291  delete [] slot_method;
292  return -1;
293  }
294 #endif
295 
296  // cleaning
297  delete [] slot_method;
298 
299  return nsigargs;
300 }
301 
302 /** \class TQConnectionList
303  TQConnectionList is the named list of connections,
304  see also TQConnection class.
305 */
306 
307 class TQConnectionList : public TList {
308 
309 private:
310  Int_t fSignalArgs; // number of arguments in signal function
311 
312 public:
313  TQConnectionList(const char *name, Int_t nsigargs) : TList()
314  { fName = name; fSignalArgs = nsigargs; }
315  virtual ~TQConnectionList();
316 
317  Bool_t Disconnect(void *receiver=0, const char *slot_name=0);
318  Int_t GetNargs() const { return fSignalArgs; }
319  void ls(Option_t *option = "") const;
320 };
321 
322 ////////////////////////////////////////////////////////////////////////////////
323 /// Destructor.
324 
325 TQConnectionList::~TQConnectionList()
326 {
327  TIter next(this);
328  TQConnection *connection;
329 
330  while ((connection = (TQConnection*)next())) {
331  // remove this from feed back reference list
332  connection->Remove(this);
333  if (connection->IsEmpty()) delete connection;
334  }
335  Clear("nodelete");
336 }
337 
338 ////////////////////////////////////////////////////////////////////////////////
339 /// Remove connection from the list. For more info see
340 /// TQObject::Disconnect()
341 
342 Bool_t TQConnectionList::Disconnect(void *receiver, const char *slot_name)
343 {
344  TQConnection *connection = 0;
345  Bool_t return_value = kFALSE;
346 
347  TObjLink *lnk = FirstLink();
348  TObjLink *savlnk; // savlnk is used when link is deleted
349 
350  while (lnk) {
351  connection = (TQConnection*)lnk->GetObject();
352  const char *name = connection->GetName();
353  void *obj = connection->GetReceiver();
354 
355  if (!slot_name || !slot_name[0]
356  || !strcmp(name,slot_name)) {
357 
358  if (!receiver || (receiver == obj)) {
359  return_value = kTRUE;
360  savlnk = lnk->Next(); // keep next link ..
361  Remove(lnk);
362  lnk = savlnk; // current link == saved ...
363  connection->Remove(this); // remove back reference
364  if (connection->IsEmpty()) SafeDelete(connection);
365  continue; // .. continue from saved link
366  }
367  }
368  lnk = lnk->Next();
369  }
370  return return_value;
371 }
372 
373 ////////////////////////////////////////////////////////////////////////////////
374 /// List signal name and list all connections in this signal list.
375 
376 void TQConnectionList::ls(Option_t *option) const
377 {
378  std::cout << "TQConnectionList:" << "\t" << GetName() << std::endl;
379  ((TQConnectionList*)this)->R__FOR_EACH(TQConnection,Print)(option);
380 }
381 
382 
383 ////////////////////////////////////////////////////////////////////////////////
384 /// TQObject Constructor.
385 /// Comment:
386 /// - In order to minimize memory allocation fListOfSignals and
387 /// fListOfConnections are allocated only if it is neccesary
388 /// - When fListOfSignals/fListOfConnections are empty they will
389 /// be deleted
390 
392 {
393  fListOfSignals = 0;
394  fListOfConnections = 0;
396 }
397 
398 ////////////////////////////////////////////////////////////////////////////////
399 /// TQObject Destructor.
400 /// - delete all connections and signal list
401 
403 {
404  if (!gROOT) return;
405 
406  Destroyed(); // emit "Destroyed()" signal
407 
408  if (fListOfSignals) {
410  SafeDelete(fListOfSignals); // delete list of signals
411  }
412 
413  // loop over all connections and remove references to this object
414  if (fListOfConnections) {
415  TIter next_connection(fListOfConnections);
416  TQConnection *connection;
417 
418  while ((connection = (TQConnection*)next_connection())) {
419  TIter next_list(connection);
420  TQConnectionList *list;
421  while ((list = (TQConnectionList*)next_list())) {
422  list->Remove(connection);
423  if (list->IsEmpty()) SafeDelete(list);
424  }
425  }
427  }
428 }
429 
430 ////////////////////////////////////////////////////////////////////////////////
431 /// Returns pointer to list of signals of this class.
432 
434 {
435  TQClass *qcl = 0;
436 
437  qcl = dynamic_cast<TQClass*>(IsA());
438 
439  return qcl ? qcl->fListOfSignals : 0; //!!
440 }
441 
442 ////////////////////////////////////////////////////////////////////////////////
443 /// Collect class signal lists from class cls and all its
444 /// base-classes.
445 ///
446 /// The recursive traversal is not performed for classes not
447 /// deriving from TQClass.
448 
450 {
451  TQClass *qcl = dynamic_cast<TQClass*>(cls);
452  if (qcl)
453  {
454  if (qcl->fListOfSignals)
455  list.Add(qcl->fListOfSignals);
456 
457  // Descend into base-classes.
458  TIter next_base_class(cls->GetListOfBases());
459  TBaseClass *base;
460  while ((base = (TBaseClass*) next_base_class()))
461  {
462  CollectClassSignalLists(list, base->GetClassPointer());
463  }
464  }
465 }
466 
467 ////////////////////////////////////////////////////////////////////////////////
468 /// 1. If slot_name = 0 => makes signal defined by the signal_name
469 /// to be the first in the fListOfSignals, this decreases
470 /// the time for lookup.
471 /// 2. If slot_name != 0 => makes slot defined by the slot_name
472 /// to be executed first when signal_name is emitted.
473 /// Signal name is not compressed.
474 
475 void TQObject::HighPriority(const char *signal_name, const char *slot_name)
476 {
477  TQConnectionList *clist = (TQConnectionList*)
478  fListOfSignals->FindObject(signal_name);
479 
480  if (!clist) return; // not found
481  if (!slot_name) { // update list of signal lists
482  fListOfSignals->Remove(clist); // remove and add first
483  fListOfSignals->AddFirst(clist);
484  return;
485  } else { // slot_name != 0 , update signal list
486  TQConnection *con = (TQConnection*) clist->FindObject(slot_name);
487  if (!con) return; // not found
488  clist->Remove(con); // remove and add as first
489  clist->AddFirst(con);
490  }
491 }
492 
493 ////////////////////////////////////////////////////////////////////////////////
494 /// 1. If slot_name = 0 => makes signal defined by the signal_name
495 /// to be the last in the fListOfSignals, this increase the time
496 /// for lookup.
497 /// 2. If slot_name != 0 => makes slot defined by the slot_name
498 /// to be executed last when signal_name is emitted.
499 /// Signal name is not compressed.
500 
501 void TQObject::LowPriority(const char *signal_name, const char *slot_name)
502 {
503  TQConnectionList *clist = (TQConnectionList*)
504  fListOfSignals->FindObject(signal_name);
505 
506  if (!clist) return;
507  if (!slot_name) {
508  fListOfSignals->Remove(clist); // remove and add first
509  fListOfSignals->AddLast(clist);
510  return;
511  } else { // slot_name != 0 , update signal list
512  TQConnection *con = (TQConnection*) clist->FindObject(slot_name);
513  if (!con) return;
514  clist->Remove(con); // remove and add as last
515  clist->AddLast(con);
516  }
517 }
518 
519 ////////////////////////////////////////////////////////////////////////////////
520 /// Return true if there is any object connected to this signal.
521 /// Only checks for object signals.
522 
523 Bool_t TQObject::HasConnection(const char *signal_name) const
524 {
525  if (!fListOfSignals)
526  return kFALSE;
527 
528  TString signal = CompressName(signal_name);
529 
530  return (fListOfSignals->FindObject(signal) != 0);
531 }
532 
533 ////////////////////////////////////////////////////////////////////////////////
534 /// Return number of signals for this object.
535 /// Only checks for object signals.
536 
538 {
539  if (fListOfSignals)
540  return fListOfSignals->GetSize();
541  return 0;
542 }
543 
544 ////////////////////////////////////////////////////////////////////////////////
545 /// Return number of connections for this object.
546 
548 {
549  if (fListOfConnections)
550  return fListOfConnections->GetSize();
551  return 0;
552 }
553 
554 ////////////////////////////////////////////////////////////////////////////////
555 /// Acitvate signal without args.
556 /// Example:
557 /// theButton->Emit("Clicked()");
558 
559 void TQObject::Emit(const char *signal_name)
560 {
561  if (fSignalsBlocked || fgAllSignalsBlocked) return;
562 
563  TList classSigLists;
564  CollectClassSignalLists(classSigLists, IsA());
565 
566  if (classSigLists.IsEmpty() && !fListOfSignals)
567  return;
568 
569  TString signal = CompressName(signal_name);
570 
571  TQConnection *connection = 0;
572 
573  // execute class signals
574  TList *sigList;
575  TIter nextSigList(&classSigLists);
576  while ((sigList = (TList*) nextSigList()))
577  {
578  TIter nextcl((TQConnectionList*) sigList->FindObject(signal));
579  while ((connection = (TQConnection*)nextcl())) {
580  gTQSender = GetSender();
581  connection->ExecuteMethod();
582  }
583  }
584  if (!fListOfSignals)
585  return;
586 
587  // execute object signals
588  TIter next((TQConnectionList*) fListOfSignals->FindObject(signal));
589  while (fListOfSignals && (connection = (TQConnection*)next())) {
590  gTQSender = GetSender();
591  connection->ExecuteMethod();
592  }
593 }
594 
595 ////////////////////////////////////////////////////////////////////////////////
596 /// Activate signal with single parameter.
597 /// Example:
598 /// ~~~ {.cpp}
599 /// theButton->Emit("Clicked(int)",id)
600 /// ~~~
601 
602 void TQObject::Emit(const char *signal_name, Long_t param)
603 {
604  if (fSignalsBlocked || fgAllSignalsBlocked) return;
605 
606  TList classSigLists;
607  CollectClassSignalLists(classSigLists, IsA());
608 
609  if (classSigLists.IsEmpty() && !fListOfSignals)
610  return;
611 
612  TString signal = CompressName(signal_name);
613 
614  TQConnection *connection = 0;
615 
616  // execute class signals
617  TList *sigList;
618  TIter nextSigList(&classSigLists);
619  while ((sigList = (TList*) nextSigList()))
620  {
621  TIter nextcl((TQConnectionList*) sigList->FindObject(signal));
622  while ((connection = (TQConnection*)nextcl())) {
623  gTQSender = GetSender();
624  connection->ExecuteMethod(param);
625  }
626  }
627  if (!fListOfSignals)
628  return;
629 
630  // execute object signals
631  TIter next((TQConnectionList*) fListOfSignals->FindObject(signal));
632  while (fListOfSignals && (connection = (TQConnection*)next())) {
633  gTQSender = GetSender();
634  connection->ExecuteMethod(param);
635  }
636 }
637 
638 ////////////////////////////////////////////////////////////////////////////////
639 /// Activate signal with single parameter.
640 /// Example:
641 /// ~~~ {.cpp}
642 /// theButton->Emit("Progress(Long64_t)",processed)
643 /// ~~~
644 
645 void TQObject::Emit(const char *signal_name, Long64_t param)
646 {
647  if (fSignalsBlocked || fgAllSignalsBlocked) return;
648 
649  TList classSigLists;
650  CollectClassSignalLists(classSigLists, IsA());
651 
652  if (classSigLists.IsEmpty() && !fListOfSignals)
653  return;
654 
655  TString signal = CompressName(signal_name);
656 
657  TQConnection *connection = 0;
658 
659  // execute class signals
660  TList *sigList;
661  TIter nextSigList(&classSigLists);
662  while ((sigList = (TList*) nextSigList()))
663  {
664  TIter nextcl((TQConnectionList*) sigList->FindObject(signal));
665  while ((connection = (TQConnection*)nextcl())) {
666  gTQSender = GetSender();
667  connection->ExecuteMethod(param);
668  }
669  }
670  if (!fListOfSignals)
671  return;
672 
673  // execute object signals
674  TIter next((TQConnectionList*) fListOfSignals->FindObject(signal));
675  while (fListOfSignals && (connection = (TQConnection*)next())) {
676  gTQSender = GetSender();
677  connection->ExecuteMethod(param);
678  }
679 }
680 
681 ////////////////////////////////////////////////////////////////////////////////
682 /// Activate signal with single parameter.
683 /// Example:
684 /// ~~~ {.cpp}
685 /// theButton->Emit("Scale(float)",factor)
686 /// ~~~
687 
688 void TQObject::Emit(const char *signal_name, Double_t param)
689 {
690  if (fSignalsBlocked || fgAllSignalsBlocked) return;
691 
692  TList classSigLists;
693  CollectClassSignalLists(classSigLists, IsA());
694 
695  if (classSigLists.IsEmpty() && !fListOfSignals)
696  return;
697 
698  TString signal = CompressName(signal_name);
699 
700  TQConnection *connection = 0;
701 
702  // execute class signals
703  TList *sigList;
704  TIter nextSigList(&classSigLists);
705  while ((sigList = (TList*) nextSigList()))
706  {
707  TIter nextcl((TQConnectionList*) sigList->FindObject(signal));
708  while ((connection = (TQConnection*)nextcl())) {
709  gTQSender = GetSender();
710  connection->ExecuteMethod(param);
711  }
712  }
713  if (!fListOfSignals)
714  return;
715 
716  // execute object signals
717  TIter next((TQConnectionList*) fListOfSignals->FindObject(signal));
718  while (fListOfSignals && (connection = (TQConnection*)next())) {
719  gTQSender = GetSender();
720  connection->ExecuteMethod(param);
721  }
722 }
723 
724 ////////////////////////////////////////////////////////////////////////////////
725 /// Activate signal with parameter text string.
726 /// Example:
727 /// ~~~ {.cpp}
728 /// myObject->Emit("Error(char*)","Fatal error");
729 /// ~~~
730 
731 void TQObject::Emit(const char *signal_name, const char *params)
732 {
733  if (fSignalsBlocked || fgAllSignalsBlocked) return;
734 
735  TList classSigLists;
736  CollectClassSignalLists(classSigLists, IsA());
737 
738  if (classSigLists.IsEmpty() && !fListOfSignals)
739  return;
740 
741  TString signal = CompressName(signal_name);
742 
743  TQConnection *connection = 0;
744 
745  // execute class signals
746  TList *sigList;
747  TIter nextSigList(&classSigLists);
748  while ((sigList = (TList*) nextSigList()))
749  {
750  TIter nextcl((TQConnectionList*) sigList->FindObject(signal));
751  while ((connection = (TQConnection*)nextcl())) {
752  gTQSender = GetSender();
753  connection->ExecuteMethod(params);
754  }
755  }
756  if (!fListOfSignals)
757  return;
758 
759  // execute object signals
760  TIter next((TQConnectionList*) fListOfSignals->FindObject(signal));
761  while (fListOfSignals && (connection = (TQConnection*)next())) {
762  gTQSender = GetSender();
763  connection->ExecuteMethod(params);
764  }
765 }
766 
767 ////////////////////////////////////////////////////////////////////////////////
768 /// Emit a signal with a varying number of arguments,
769 /// paramArr is an array of the parameters.
770 /// Note: any parameter should be converted to long type.
771 /// Example:
772 /// ~~~ {.cpp}
773 /// TQObject *processor; // data processor
774 /// TH1F *hist; // filled with processor results
775 ///
776 /// processor->Connect("Evaluated(Float_t,Float_t)",
777 /// "TH1F",hist,"Fill12(Axis_t,Axis_t)");
778 ///
779 /// Long_t args[2];
780 /// args[0] = (Long_t)processor->GetValue(1);
781 /// args[1] = (Long_t)processor->GetValue(2);
782 ///
783 /// processor->Emit("Evaluated(Float_t,Float_t)",args);
784 /// ~~~
785 
786 void TQObject::Emit(const char *signal_name, Long_t *paramArr)
787 {
788  if (fSignalsBlocked || fgAllSignalsBlocked) return;
789 
790  TList classSigLists;
791  CollectClassSignalLists(classSigLists, IsA());
792 
793  if (classSigLists.IsEmpty() && !fListOfSignals)
794  return;
795 
796  TString signal = CompressName(signal_name);
797 
798  TQConnectionList *clist = 0;
799  TQConnection *connection = 0;
800 
801  // execute class signals
802  TList *sigList;
803  TIter nextSigList(&classSigLists);
804  while ((sigList = (TList*) nextSigList()))
805  {
806  clist = (TQConnectionList*) sigList->FindObject(signal);
807  TIter nextcl(clist);
808  while ((connection = (TQConnection*)nextcl())) {
809  gTQSender = GetSender();
810  connection->ExecuteMethod(paramArr, clist->GetNargs());
811  }
812  }
813  if (!fListOfSignals)
814  return;
815 
816  // execute object signals
817  clist = (TQConnectionList*) fListOfSignals->FindObject(signal);
818  TIter next(clist);
819  while (fListOfSignals && (connection = (TQConnection*)next())) {
820  gTQSender = GetSender();
821  connection->ExecuteMethod(paramArr, clist->GetNargs());
822  }
823 }
824 
825 ////////////////////////////////////////////////////////////////////////////////
826 /// Create connection between sender and receiver.
827 /// Receiver class needs to have a dictionary.
828 
830  const char *signal,
831  TClass *cl,
832  void *receiver,
833  const char *slot)
834 {
835  // sender should be TQObject
836  if (!sender->IsA()->InheritsFrom(TQObject::Class()))
837  return kFALSE;
838 
839  // remove "const" and strip blanks
840  TString signal_name = CompressName(signal);
841  TString slot_name = CompressName(slot);
842 
843  // check consitency of signal/slot methods/args
844  Int_t nsigargs;
845  if ((nsigargs = CheckConnectArgs(sender, sender->IsA(), signal_name, cl, slot_name)) == -1)
846  return kFALSE;
847 
848  if (!sender->fListOfSignals)
849  sender->fListOfSignals = new THashList();
850 
851  TQConnectionList *clist = (TQConnectionList*)
852  sender->fListOfSignals->FindObject(signal_name);
853 
854  if (!clist) {
855  clist = new TQConnectionList(signal_name, nsigargs);
856  sender->fListOfSignals->Add(clist);
857  }
858 
859  TIter next(clist);
860  TQConnection *connection = 0;
861 
862  while ((connection = (TQConnection*)next())) {
863  if (!strcmp(slot_name,connection->GetName()) &&
864  (receiver == connection->GetReceiver())) break;
865  }
866 
867  if (!connection)
868  connection = new TQConnection(cl, receiver, slot_name);
869 
870  // check to prevent multiple entries
871  if (!clist->FindObject(connection)) {
872  clist->Add(connection);
873  if (!connection->FindObject(clist)) connection->Add(clist);
874  sender->Connected(signal_name);
875  }
876 
877  return kTRUE;
878 }
879 
880 ////////////////////////////////////////////////////////////////////////////////
881 /// This method allows to make connection from any object
882 /// of the same class to the receiver object.
883 /// Receiver class needs to have a dictionary.
884 
885 Bool_t TQObject::ConnectToClass(const char *class_name,
886  const char *signal,
887  TClass *cl,
888  void *receiver,
889  const char *slot)
890 {
891  TClass *sender = TClass::GetClass(class_name);
892 
893  // sender class should be TQObject (i.e. TQClass)
894  if (!sender || !sender->IsA()->InheritsFrom(TQObject::Class()))
895  return kFALSE;
896 
897  TList *slist = ((TQClass*)sender)->fListOfSignals;
898  TString signal_name = CompressName(signal);
899  TString slot_name = CompressName(slot);
900 
901  // check consitency of signal/slot methods/args
902  Int_t nsigargs;
903  if ((nsigargs = CheckConnectArgs(0, sender, signal_name, cl, slot_name)) == -1)
904  return kFALSE;
905 
906  if (!slist)
907  ((TQClass*)sender)->fListOfSignals = slist = new THashList();
908 
909  TQConnectionList *clist = (TQConnectionList*) slist->FindObject(signal_name);
910 
911  if (!clist) {
912  clist = new TQConnectionList(signal_name, nsigargs);
913  slist->Add(clist);
914  }
915 
916  TQConnection *connection = 0;
917  TIter next(clist);
918 
919  while ((connection = (TQConnection*)next())) {
920  if (!strcmp(slot_name,connection->GetName()) &&
921  (receiver == connection->GetReceiver())) break;
922  }
923 
924  if (!connection)
925  connection = new TQConnection(cl, receiver, slot_name);
926 
927  // check to prevent multiple entries
928  if (!clist->FindObject(connection)) {
929  clist->Add(connection);
930  if (!connection->FindObject(clist)) connection->Add(clist);
931  ((TQClass*)sender)->Connected(signal_name);
932  }
933 
934  return kTRUE;
935 }
936 
937 ////////////////////////////////////////////////////////////////////////////////
938 /// Create connection between sender and receiver.
939 /// Signal and slot string must have a form:
940 /// "Draw(char*, Option_t* ,Int_t)"
941 /// All blanks and "const" words will be removed,
942 ///
943 /// cl != 0 - class name, it can be class with or
944 /// without dictionary, e.g interpreted class.
945 /// Example:
946 /// ~~~ {.cpp}
947 /// TGButton *myButton;
948 /// TH2F *myHist;
949 ///
950 /// TQObject::Connect(myButton,"Clicked()",
951 /// "TH2F", myHist,"Draw(Option_t*)");
952 /// ~~~
953 /// cl == 0 - corresponds to function (interpereted or global)
954 /// the name of the function is defined by the slot string,
955 /// parameter receiver should be 0.
956 /// Example:
957 /// ~~~ {.cpp}
958 /// TGButton *myButton;
959 /// TH2F *myHist;
960 ///
961 /// TQObject::Connect(myButton,"Clicked()",
962 /// 0, 0,"hsimple()");
963 /// ~~~
964 /// Warning:
965 /// If receiver is class not derived from TQObject and going to be
966 /// deleted, disconnect all connections to this receiver.
967 /// In case of class derived from TQObject it is done automatically.
968 
970  const char *signal,
971  const char *cl,
972  void *receiver,
973  const char *slot)
974 {
975  if (cl) {
976  TClass *rcv_cl = TClass::GetClass(cl);
977  if (rcv_cl) return ConnectToClass(sender, signal, rcv_cl, receiver, slot);
978  }
979 
980  // the following is the case of receiver class without dictionary
981  // e.g. interpreted class or function.
982 
983  // sender should be TQObject
984  if (!sender->IsA()->InheritsFrom(TQObject::Class()))
985  return kFALSE;
986 
987  // remove "const" and strip blanks
988  TString signal_name = CompressName(signal);
989  TString slot_name = CompressName(slot);
990 
991  // check consitency of signal/slot methods/args
992  Int_t nsigargs;
993  if ((nsigargs = CheckConnectArgs(sender, sender->IsA(), signal_name, 0, slot_name)) == -1)
994  return kFALSE;
995 
996  if (!sender->fListOfSignals) sender->fListOfSignals = new THashList();
997 
998  TQConnectionList *clist = (TQConnectionList*)
999  sender->fListOfSignals->FindObject(signal_name);
1000 
1001  if (!clist) {
1002  clist = new TQConnectionList(signal_name, nsigargs);
1003  sender->fListOfSignals->Add(clist);
1004  }
1005 
1006  TQConnection *connection = 0;
1007  TIter next(clist);
1008 
1009  while ((connection = (TQConnection*)next())) {
1010  if (!strcmp(slot_name,connection->GetName()) &&
1011  (receiver == connection->GetReceiver())) break;
1012  }
1013 
1014  if (!connection)
1015  connection = new TQConnection(cl, receiver, slot_name);
1016 
1017  // check to prevent multiple entries
1018  if (!clist->FindObject(connection)) {
1019  clist->Add(connection);
1020  if (!connection->FindObject(clist)) connection->Add(clist);
1021  sender->Connected(signal_name);
1022  }
1023 
1024  return kTRUE;
1025 }
1026 
1027 ////////////////////////////////////////////////////////////////////////////////
1028 /// This method allows to make a connection from any object
1029 /// of the same class to a single slot.
1030 /// Signal and slot string must have a form:
1031 /// "Draw(char*, Option_t* ,Int_t)"
1032 /// All blanks and "const" words will be removed,
1033 ///
1034 /// cl != 0 - class name, it can be class with or
1035 /// without dictionary, e.g interpreted class.
1036 /// Example:
1037 /// ~~~ {.cpp}
1038 /// TGButton *myButton;
1039 /// TH2F *myHist;
1040 ///
1041 /// TQObject::Connect("TGButton", "Clicked()",
1042 /// "TH2F", myHist, "Draw(Option_t*)");
1043 ///~~~
1044 /// cl == 0 - corresponds to function (interpereted or global)
1045 /// the name of the function is defined by the slot string,
1046 /// parameter receiver should be 0.
1047 /// Example:
1048 /// ~~~ {.cpp}
1049 /// TGButton *myButton;
1050 /// TH2F *myHist;
1051 ///
1052 /// TQObject::Connect("TGButton", "Clicked()",
1053 /// 0, 0, "hsimple()");
1054 /// ~~~
1055 /// Warning:
1056 ///
1057 /// If receiver class not derived from TQObject and going to be
1058 /// deleted, disconnect all connections to this receiver.
1059 /// In case of class derived from TQObject it is done automatically.
1060 
1061 Bool_t TQObject::Connect(const char *class_name,
1062  const char *signal,
1063  const char *cl,
1064  void *receiver,
1065  const char *slot)
1066 {
1067  if (cl) {
1068  TClass *rcv_cl = TClass::GetClass(cl);
1069  if (rcv_cl) return ConnectToClass(class_name, signal, rcv_cl, receiver,
1070  slot);
1071  }
1072 
1073  // the following is case of receiver class without dictionary
1074  // e.g. interpreted class or function.
1075 
1076  TClass *sender = TClass::GetClass(class_name);
1077 
1078  // sender class should be TQObject (i.e. TQClass)
1079  if (!sender || !sender->IsA()->InheritsFrom(TQObject::Class()))
1080  return kFALSE;
1081 
1082  TList *slist = ((TQClass*)sender)->fListOfSignals;
1083 
1084  TString signal_name = CompressName(signal);
1085  TString slot_name = CompressName(slot);
1086 
1087  // check consitency of signal/slot methods/args
1088  Int_t nsigargs;
1089  if ((nsigargs = CheckConnectArgs(0, sender, signal_name, 0, slot_name)) == -1)
1090  return kFALSE;
1091 
1092  if (!slist) {
1093  slist = ((TQClass*)sender)->fListOfSignals = new THashList();
1094  }
1095 
1096  TQConnectionList *clist = (TQConnectionList*)
1097  slist->FindObject(signal_name);
1098 
1099  if (!clist) {
1100  clist = new TQConnectionList(signal_name, nsigargs);
1101  slist->Add(clist);
1102  }
1103 
1104  TQConnection *connection = 0;
1105  TIter next(clist);
1106 
1107  while ((connection = (TQConnection*)next())) {
1108  if (!strcmp(slot_name,connection->GetName()) &&
1109  (receiver == connection->GetReceiver())) break;
1110  }
1111 
1112  if (!connection)
1113  connection = new TQConnection(cl, receiver, slot_name);
1114 
1115  // check to prevent multiple entries
1116  if (!clist->FindObject(connection)) {
1117  clist->Add(connection);
1118  if (!connection->FindObject(clist)) connection->Add(clist);
1119  ((TQClass*)sender)->Connected(signal_name);
1120  }
1121 
1122  return kTRUE;
1123 }
1124 
1125 ////////////////////////////////////////////////////////////////////////////////
1126 /// Non-static method is used to connect from the signal
1127 /// of this object to the receiver slot.
1128 ///
1129 /// Warning! No check on consistency of sender/receiver
1130 /// classes/methods.
1131 ///
1132 /// This method makes possible to have connection/signals from
1133 /// interpreted class. See also RQ_OBJECT.h.
1134 
1135 Bool_t TQObject::Connect(const char *signal,
1136  const char *receiver_class,
1137  void *receiver,
1138  const char *slot)
1139 {
1140  // remove "const" and strip blanks
1141  TString signal_name = CompressName(signal);
1142  TString slot_name = CompressName(slot);
1143 
1144  // check consitency of signal/slot methods/args
1145  TClass *cl = 0;
1146  if (receiver_class)
1147  cl = TClass::GetClass(receiver_class);
1148  Int_t nsigargs;
1149  if ((nsigargs = CheckConnectArgs(this, IsA(), signal_name, cl, slot_name)) == -1)
1150  return kFALSE;
1151 
1152  if (!fListOfSignals) fListOfSignals = new THashList();
1153 
1154  TQConnectionList *clist = (TQConnectionList*)
1155  fListOfSignals->FindObject(signal_name);
1156 
1157  if (!clist) {
1158  clist = new TQConnectionList(signal_name, nsigargs);
1159  fListOfSignals->Add(clist);
1160  }
1161 
1162  TIter next(clist);
1163  TQConnection *connection = 0;
1164 
1165  while ((connection = (TQConnection*)next())) {
1166  if (!strcmp(slot_name,connection->GetName()) &&
1167  (receiver == connection->GetReceiver())) break;
1168  }
1169 
1170  if (!connection)
1171  connection = new TQConnection(receiver_class, receiver, slot_name);
1172 
1173  // check to prevent multiple entries
1174  if (!clist->FindObject(connection)) {
1175  clist->Add(connection);
1176  if (!connection->FindObject(clist)) connection->Add(clist);
1177  Connected(signal_name);
1178  }
1179 
1180  return kTRUE;
1181 }
1182 
1183 ////////////////////////////////////////////////////////////////////////////////
1184 /// Disconnects signal in object sender from slot_method in
1185 /// object receiver. For objects derived from TQObject signal-slot
1186 /// connection is removed when either of the objects involved
1187 /// are destroyed.
1188 ///
1189 /// Disconnect() is typically used in three ways, as the following
1190 /// examples shows:
1191 ///
1192 /// - Disconnect everything connected to an object's signals:
1193 /// ~~~ {.cpp}
1194 /// Disconnect(myObject);
1195 /// ~~~
1196 /// - Disconnect everything connected to a signal:
1197 /// ~~~ {.cpp}
1198 /// Disconnect(myObject, "mySignal()");
1199 /// ~~~
1200 /// - Disconnect a specific receiver:
1201 /// ~~~ {.cpp}
1202 /// Disconnect(myObject, 0, myReceiver, 0);
1203 /// ~~~
1204 ///
1205 /// 0 may be used as a wildcard in three of the four arguments,
1206 /// meaning "any signal", "any receiving object" or
1207 /// "any slot in the receiving object", respectively.
1208 ///
1209 /// The sender has no default and may never be 0
1210 /// (you cannot disconnect signals from more than one object).
1211 ///
1212 /// If signal is 0, it disconnects receiver and slot_method
1213 /// from any signal. If not, only the specified signal is
1214 /// disconnected.
1215 ///
1216 /// If receiver is 0, it disconnects anything connected to signal.
1217 /// If not, slots in objects other than receiver are not
1218 /// disconnected
1219 ///
1220 /// If slot_method is 0, it disconnects anything that is connected
1221 /// to receiver. If not, only slots named slot_method will be
1222 /// disconnected, and all other slots are left alone.
1223 /// The slot_method must be 0 if receiver is left out, so you
1224 /// cannot disconnect a specifically-named slot on all objects.
1225 
1227  const char *signal,
1228  void *receiver,
1229  const char *slot)
1230 {
1231  Bool_t return_value = kFALSE;
1232  Bool_t next_return = kFALSE;
1233 
1234  if (!sender->GetListOfSignals()) return kFALSE;
1235 
1236  TString signal_name = CompressName(signal);
1237  TString slot_name = CompressName(slot);
1238 
1239  TQConnectionList *slist = 0;
1240  TIter next_signal(sender->GetListOfSignals());
1241 
1242  while ((slist = (TQConnectionList*)next_signal())) {
1243  if (!signal || signal_name.IsNull()) { // disconnect all signals
1244  next_return = slist->Disconnect(receiver,slot_name);
1245  return_value = return_value || next_return;
1246 
1247  if (slist->IsEmpty()) {
1248  sender->GetListOfSignals()->Remove(slist);
1249  SafeDelete(slist); // delete empty list
1250  }
1251  } else if (signal && !strcmp(signal_name,slist->GetName())) {
1252  next_return = slist->Disconnect(receiver,slot_name);
1253  return_value = return_value || next_return;
1254 
1255  if (slist->IsEmpty()) {
1256  sender->GetListOfSignals()->Remove(slist);
1257  SafeDelete(slist); // delete empty list
1258  break;
1259  }
1260  }
1261  }
1262 
1263  if (sender->GetListOfSignals() && sender->GetListOfSignals()->IsEmpty()) {
1264  SafeDelete(sender->fListOfSignals);
1265  }
1266 
1267  return return_value;
1268 }
1269 
1270 ////////////////////////////////////////////////////////////////////////////////
1271 /// Disconnects "class signal". The class is defined by class_name.
1272 /// See also Connect(class_name,signal,receiver,slot).
1273 
1274 Bool_t TQObject::Disconnect(const char *class_name,
1275  const char *signal,
1276  void *receiver,
1277  const char *slot)
1278 {
1279  TClass *sender = TClass::GetClass(class_name);
1280 
1281  // sender should be TQClass (which derives from TQObject)
1282  if (!sender->IsA()->InheritsFrom(TQObject::Class()))
1283  return kFALSE;
1284 
1285  TQClass *qcl = (TQClass*)sender; // cast TClass to TQClass
1286  return Disconnect(qcl, signal, receiver, slot);
1287 }
1288 
1289 ////////////////////////////////////////////////////////////////////////////////
1290 /// Disconnects signal of this object from slot of receiver.
1291 /// Equivalent to Disconnect(this, signal, receiver, slot)
1292 
1293 Bool_t TQObject::Disconnect(const char *signal,
1294  void *receiver,
1295  const char *slot)
1296 {
1297  return Disconnect(this, signal, receiver, slot);
1298 }
1299 
1300 ////////////////////////////////////////////////////////////////////////////////
1301 /// Stream an object of class TQObject.
1302 
1303 void TQObject::Streamer(TBuffer &R__b)
1304 {
1305  if (R__b.IsReading()) {
1306  // nothing to read
1307  } else {
1308  // nothing to write
1309  }
1310 }
1311 
1312 ////////////////////////////////////////////////////////////////////////////////
1313 /// Returns true if all signals are blocked.
1314 
1316 {
1317  return fgAllSignalsBlocked;
1318 }
1319 
1320 ////////////////////////////////////////////////////////////////////////////////
1321 /// Block or unblock all signals. Returns the previous block status.
1322 
1324 {
1326  fgAllSignalsBlocked = b;
1327  return ret;
1328 }
1329 
1330 ////////////////////////////////////////////////////////////////////////////////
1331 /// Global function which simplifies making connection in interpreted ROOT session
1332 ///
1333 /// ConnectCINT - connects to interpreter(CINT) command
1334 
1335 Bool_t ConnectCINT(TQObject *sender, const char *signal, const char *slot)
1336 {
1337  TString str = "ProcessLine(=";
1338  str += '"';
1339  str += slot;
1340  str += '"';
1341  str += ")";
1342  return TQObject::Connect(sender, signal, "TInterpreter",
1343  gInterpreter, str.Data());
1344 }
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3448
Bool_t AtEnd() const
Definition: TPRegexp.h:162
static Bool_t BlockAllSignals(Bool_t b)
Block or unblock all signals. Returns the previous block status.
Definition: TQObject.cxx:1323
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:404
TQObject()
TQObject Constructor.
Definition: TQObject.cxx:391
long long Long64_t
Definition: RtypesCore.h:69
static Int_t CheckConnectArgs(TQObject *sender, TClass *sender_class, const char *signal, TClass *receiver_class, const char *slot)
Checking of consitency of sender/receiver methods/arguments.
Definition: TQObject.cxx:179
Bool_t IsReading() const
Definition: TBuffer.h:81
Bool_t ConnectCINT(TQObject *sender, const char *signal, const char *slot)
Global function which simplifies making connection in interpreted ROOT session.
Definition: TQObject.cxx:1335
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Ssiz_t Length() const
Definition: TString.h:390
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
virtual void * GetSender()
Definition: TQObject.h:64
const char Option_t
Definition: RtypesCore.h:62
static const std::string comment("comment")
Int_t GetNargs() const
Number of function arguments.
Definition: TFunction.cxx:164
TList * fListOfSignals
Definition: TQObject.h:58
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
Definition: TDataType.cxx:175
virtual const char * GetSenderClassName() const
Definition: TQObject.h:65
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition: TList.cxx:92
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:53
This class implements a mutex interface.
Definition: TVirtualMutex.h:34
#define gROOT
Definition: TROOT.h:340
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
#define gInterpreter
Definition: TInterpreter.h:502
virtual void AddLast(TObject *obj)
Add object at the end of the list.
Definition: TList.cxx:136
const char * Data() const
Definition: TString.h:349
#define SafeDelete(p)
Definition: RConfig.h:436
void Class()
Definition: Class.C:29
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:36
Provides iteration through tokens of a given string.
Definition: TPRegexp.h:149
virtual Bool_t IsEmpty() const
Definition: TCollection.h:99
virtual Int_t NumberOfSignals() const
Return number of signals for this object.
Definition: TQObject.cxx:537
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
virtual const char * GetCommentString()
Returns a comment string from the class declaration.
Definition: TMethod.cxx:105
TList * GetListOfSignals() const
Definition: TQObject.h:94
void Error(const char *location, const char *msgfmt,...)
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:559
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:701
A doubly linked list.
Definition: TList.h:47
virtual Bool_t HasConnection(const char *signal_name) const
Return true if there is any object connected to this signal.
Definition: TQObject.cxx:523
Int_t GetNargsOpt() const
Number of function optional (default) arguments.
Definition: TFunction.cxx:174
TList * fListOfConnections
list of signals from this object
Definition: TQObject.h:59
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1135
static Bool_t fgAllSignalsBlocked
flag used for suppression of signals
Definition: TQObject.h:62
ClassImpQ(TQObject) ClassImpQ(TQObjSender) ClassImpQ(TQClass) TString TQObject
Removes "const" words and blanks from full (with prototype) method name and resolve any typedefs in t...
Definition: TQObject.cxx:81
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:46
TQConnection class is an internal class, used in the object communication mechanism.
Definition: TQConnection.h:46
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:674
TClass * IsA() const
const char * GetName() const
Returns name of connection (aka name of slot)
TMarker * m
Definition: textangle.C:8
static Bool_t ConnectToClass(TQObject *sender, const char *signal, TClass *receiver_class, void *receiver, const char *slot)
Create connection between sender and receiver.
Definition: TQObject.cxx:829
char * Form(const char *fmt,...)
friend class TQConnection
Definition: TQObject.h:55
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
void * gTQSender
Definition: TQObject.cxx:74
Bool_t IsNull() const
Definition: TString.h:387
virtual ~TQObject()
TQObject Destructor.
Definition: TQObject.cxx:402
void ExecuteMethod()
Apply slot-method to the fReceiver object without arguments.
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:35
static TString CompressName(const char *method_name)
Bool_t fSignalsBlocked
list of connections to this object
Definition: TQObject.h:60
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
long Long_t
Definition: RtypesCore.h:50
virtual void Destroyed()
Definition: TQObject.h:154
virtual Int_t GetSize() const
Definition: TCollection.h:95
void Print(std::ostream &os, const OptionType &opt)
double Double_t
Definition: RtypesCore.h:55
static Bool_t AreAllSignalsBlocked()
Returns true if all signals are blocked.
Definition: TQObject.cxx:1315
TMethod * GetMethod(const char *method, const char *params, Bool_t objectIsConst=kFALSE)
Find the best method (if there is one) matching the parameters.
Definition: TClass.cxx:4145
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1293
Bool_t NextToken()
Get the next token, it is stored in this TString.
Definition: TPRegexp.cxx:973
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2881
TList * GetListOfClassSignals() const
Returns pointer to list of signals of this class.
Definition: TQObject.cxx:433
#define name(a, b)
Definition: linkTestLib0.cpp:5
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
char Char_t
Definition: RtypesCore.h:29
virtual void Connected(const char *)
Definition: TQObject.h:151
virtual void Add(TObject *obj)
Definition: TList.h:81
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:103
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:40
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4579
virtual void LowPriority(const char *signal_name, const char *slot_name=0)
Definition: TQObject.cxx:501
Int_t Substitute(TString &s, const TString &r, Bool_t doDollarSubst=kTRUE)
Substitute matching part of s with r, dollar back-ref substitution is performed if doDollarSubst is t...
Definition: TPRegexp.cxx:870
virtual Int_t NumberOfConnections() const
Return number of connections for this object.
Definition: TQObject.cxx:547
const Bool_t kTRUE
Definition: Rtypes.h:91
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
Definition: TClass.cxx:4194
void CollectClassSignalLists(TList &list, TClass *cls)
Collect class signal lists from class cls and all its base-classes.
Definition: TQObject.cxx:449
void * GetReceiver() const
Definition: TQConnection.h:71
virtual void HighPriority(const char *signal_name, const char *slot_name=0)
Definition: TQObject.cxx:475