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