Logo ROOT  
Reference Guide
TQConnection.cxx
Go to the documentation of this file.
1// @(#)root/base:$Id$
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 TQConnection
13\ingroup Base
14
15TQConnection class is an internal class, used in the object
16communication mechanism.
17
18TQConnection:
19 - is a list of signal_lists containing pointers
20 to this connection
21 - receiver is the object to which slot-method is applied
22*/
23
24#include "TQConnection.h"
25#include "TROOT.h"
26#include "TRefCnt.h"
27#include "TClass.h"
28#include "TMethod.h"
29#include "TMethodArg.h"
30#include "TDataType.h"
31#include "TInterpreter.h"
32#include <iostream>
33#include "TVirtualMutex.h"
34#include "THashTable.h"
35#include "strlcpy.h"
36
38
39char *gTQSlotParams; // used to pass string parameter
40
41/** \class TQSlot
42Slightly modified TMethodCall class used in the object communication mechanism.
43*/
44
45class TQSlot : public TObject, public TRefCnt {
46
47protected:
48 CallFunc_t *fFunc; // CINT method invocation environment
49 ClassInfo_t *fClass; // CINT class for fFunc
50 TFunction *fMethod; // slot method or global function
51 Longptr_t fOffset; // offset added to object pointer
52 TString fName; // full name of method
53 Int_t fExecuting; // true if one of this slot's ExecuteMethod methods is being called
54public:
55 TQSlot(TClass *cl, const char *method, const char *funcname);
56 TQSlot(const char *class_name, const char *funcname);
57 virtual ~TQSlot();
58
59 Bool_t CheckSlot(Int_t nargs) const;
60 Longptr_t GetOffset() const { return fOffset; }
61 CallFunc_t *StartExecuting();
62 CallFunc_t *GetFunc() const { return fFunc; }
63 void EndExecuting();
64
65 const char *GetName() const {
66 return fName.Data();
67 }
68
69 Int_t GetMethodNargs() { return fMethod->GetNargs(); }
70
71 void ExecuteMethod(void *object, Int_t nargs, va_list ap) = delete;
72 void ExecuteMethod(void *object);
73 void ExecuteMethod(void *object, Long_t param);
74 void ExecuteMethod(void *object, Long64_t param);
75 void ExecuteMethod(void *object, Double_t param);
76 void ExecuteMethod(void *object, const char *params);
77 void ExecuteMethod(void *object, Longptr_t *paramArr, Int_t nparam = -1);
78 void Print(Option_t *opt = "") const;
79 void ls(Option_t *opt = "") const {
80 Print(opt);
81 }
82
84 return fExecuting > 0;
85 }
86};
87
88
89////////////////////////////////////////////////////////////////////////////////
90/// Create the method invocation environment. Necessary input
91/// information: the class, full method name with prototype
92/// string of the form: method(char*,int,float).
93/// To initialize class method with default arguments, method
94/// string with default parameters should be of the form:
95///
96/// method(=\"ABC\",1234,3.14) (!! parameter string should
97/// consists of '=').
98///
99/// To execute the method call TQSlot::ExecuteMethod(object,...).
100
101TQSlot::TQSlot(TClass *cl, const char *method_name,
102 const char *funcname) : TObject(), TRefCnt()
103{
104 fFunc = nullptr;
105 fClass = nullptr;
106 fOffset = 0;
107 fMethod = nullptr;
108 fName = "";
109 fExecuting = 0;
110
111 // cl==0, is the case of interpreted function.
112
113 fName = method_name;
114
115 auto len = strlen(method_name) + 1;
116 char *method = new char[len];
117 if (method)
118 strlcpy(method, method_name, len);
119
120 char *proto;
121 char *tmp;
122 char *params = nullptr;
123
124 // separate method and prototype strings
125
126 if ((proto = strchr(method, '('))) {
127
128 // substitute first '(' symbol with '\0'
129 *proto++ = '\0';
130
131 // last ')' symbol with '\0'
132 if ((tmp = strrchr(proto, ')'))) * tmp = '\0';
133 if ((params = strchr(proto, '='))) * params = ' ';
134 }
135
138
139 // initiate class method (function) with proto
140 // or with default params
141
142 if (cl) {
143 if (params) {
144 gCling->CallFunc_SetFunc(fFunc, cl->GetClassInfo(), method, params, &fOffset);
145 fMethod = cl->GetMethod(method, params);
146 } else {
148 fMethod = cl->GetMethodWithPrototype(method, proto);
149 }
150 } else {
152 if (params) {
153 gCling->CallFunc_SetFunc(fFunc, fClass, (char *)funcname, params, &fOffset);
154 fMethod = gROOT->GetGlobalFunction(funcname, params, kFALSE);
155 } else {
156 gCling->CallFunc_SetFuncProto(fFunc, fClass, (char *)funcname, proto, &fOffset);
157 fMethod = gROOT->GetGlobalFunctionWithPrototype(funcname, proto, kFALSE);
158 }
159 }
160
161 // cleaning
162 delete [] method;
163}
164
165////////////////////////////////////////////////////////////////////////////////
166/// Create the method invocation environment. Necessary input
167/// information: the name of class (could be interpreted class),
168/// full method name with prototype or parameter string
169/// of the form: method(char*,int,float).
170/// To initialize class method with default arguments, method
171/// string with default parameters should be of the form:
172///
173/// method(=\"ABC\",1234,3.14) (!! parameter string should
174/// consists of '=').
175///
176/// To execute the method call TQSlot::ExecuteMethod(object,...).
177
178TQSlot::TQSlot(const char *class_name, const char *funcname) :
179 TObject(), TRefCnt()
180{
181 fFunc = nullptr;
182 fClass = nullptr;
183 fOffset = 0;
184 fMethod = nullptr;
185 fName = funcname;
186 fExecuting = 0;
187
188 auto len = strlen(funcname) + 1;
189 char *method = new char[len];
190 if (method)
191 strlcpy(method, funcname, len);
192
193 char *proto;
194 char *tmp;
195 char *params = nullptr;
196
197 // separate method and prototype strings
198
199 if ((proto = strchr(method, '('))) {
200 *proto++ = '\0';
201 if ((tmp = strrchr(proto, ')'))) * tmp = '\0';
202 if ((params = strchr(proto, '='))) * params = ' ';
203 }
204
208
210 TClass *cl = nullptr;
211
212 if (class_name) {
213 gCling->ClassInfo_Init(fClass, class_name); // class
214 cl = TClass::GetClass(class_name);
215 }
216
217 if (params) {
218 gCling->CallFunc_SetFunc(fFunc, fClass, method, params, &fOffset);
219 if (cl)
220 fMethod = cl->GetMethod(method, params);
221 else
222 fMethod = gROOT->GetGlobalFunction(method, params, kTRUE);
223 } else {
225 if (cl)
226 fMethod = cl->GetMethodWithPrototype(method, proto);
227 else
228 fMethod = gROOT->GetGlobalFunctionWithPrototype(method, proto, kTRUE);
229 }
230
231 delete [] method;
232}
233
234////////////////////////////////////////////////////////////////////////////////
235/// TQSlot dtor.
236
238{
239 // don't delete executing environment of a slot that is being executed
240 if (!fExecuting) {
243 }
244}
245
246////////////////////////////////////////////////////////////////////////////////
247/// ExecuteMethod the method (with preset arguments) for
248/// the specified object.
249
250inline void TQSlot::ExecuteMethod(void *object)
251{
252 ExecuteMethod(object, (Longptr_t*)nullptr, 0);
253
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// Return true if the method is valid and the number of arguments is
258/// acceptable.
259
260inline Bool_t TQSlot::CheckSlot(Int_t nargs) const
261{
262 if (!fMethod) {
263 Error("ExecuteMethod", "method %s not found,"
264 "\n(note: interpreted methods are not supported with varargs)",
265 fName.Data());
266 return kFALSE;
267 }
268
269 if (nargs < fMethod->GetNargs() - fMethod->GetNargsOpt() ||
270 nargs > fMethod->GetNargs()) {
271 Error("ExecuteMethod", "nargs (%d) not consistent with expected number of arguments ([%d-%d])",
272 nargs, fMethod->GetNargs() - fMethod->GetNargsOpt(),
273 fMethod->GetNargs());
274 return kFALSE;
275 }
276
277 return kTRUE;
278}
279
280////////////////////////////////////////////////////////////////////////////////
281/// Mark the slot as executing.
282
284 fExecuting++;
285 return fFunc;
286}
287
288////////////////////////////////////////////////////////////////////////////////
289/// Mark the slot as no longer executing and cleanup if need be.
290
292 fExecuting--;
295}
296
297////////////////////////////////////////////////////////////////////////////////
298/// ExecuteMethod the method for the specified object and
299/// with single argument value.
300
301inline void TQSlot::ExecuteMethod(void *object, Long_t param)
302{
303 ExecuteMethod(object, (Longptr_t *)&param, 1);
304}
305
306////////////////////////////////////////////////////////////////////////////////
307/// ExecuteMethod the method for the specified object and
308/// with single argument value.
309
310inline void TQSlot::ExecuteMethod(void *object, Long64_t param)
311{
312 Longptr_t *arg = reinterpret_cast<Longptr_t *>(&param);
313 ExecuteMethod(object, arg, 1);
314}
315
316////////////////////////////////////////////////////////////////////////////////
317/// ExecuteMethod the method for the specified object and
318/// with single argument value.
319
320inline void TQSlot::ExecuteMethod(void *object, Double_t param)
321{
322 Longptr_t *arg = reinterpret_cast<Longptr_t *>(&param);
323 ExecuteMethod(object, arg, 1);
324}
325
326////////////////////////////////////////////////////////////////////////////////
327/// ExecuteMethod the method for the specified object and text param.
328
329inline void TQSlot::ExecuteMethod(void *object, const char *param)
330{
331 Longptr_t arg = reinterpret_cast<Longptr_t>(param);
332 ExecuteMethod(object, &arg, 1);
333}
334
335////////////////////////////////////////////////////////////////////////////////
336/// ExecuteMethod the method for the specified object and with
337/// several argument values.
338/// ParamArr is an array containing the function argument values.
339/// If nparam = -1 then paramArr must contain values for all function
340/// arguments, otherwise Nargs-NargsOpt <= nparam <= Nargs, where
341/// Nargs is the number of all arguments and NargsOpt is the number
342/// of default arguments.
343
344inline void TQSlot::ExecuteMethod(void *object, Longptr_t *paramArr, Int_t nparam)
345{
346 void *address = nullptr;
348 if (paramArr) gCling->CallFunc_SetArgArray(fFunc, paramArr, nparam);
349 if (object) address = (void *)((Longptr_t)object + fOffset);
350 fExecuting++;
351 gCling->CallFunc_Exec(fFunc, address);
352 fExecuting--;
355}
356
357////////////////////////////////////////////////////////////////////////////////
358/// Print info about slot.
359
361{
362 std::cout << IsA()->GetName() << "\t" << GetName() << "\t"
363 << "Number of Connections = " << References() << std::endl;
364}
365
366////////////////////////////////////////////////////////////////////////////////
367
369private:
371public:
373 fTable = new THashTable(50);
374 }
375 virtual ~TQSlotPool() {
376 fTable->Clear("nodelete");
377 }
378
379 TQSlot *New(const char *class_name, const char *funcname);
380 TQSlot *New(TClass *cl, const char *method, const char *func);
381 void Free(TQSlot *slot);
382};
383
384////////////////////////////////////////////////////////////////////////////////
385/// Create new slot or return already existing one.
386
387TQSlot *TQSlotPool::New(const char *class_name, const char *funcname)
388{
389 TString name = class_name;
390 name += "::";
391 name += funcname;
392
393 TQSlot *slot = (TQSlot *)fTable->FindObject(name.Data());
394
395 if (!slot) {
396 slot = new TQSlot(class_name, funcname);
397 fTable->Add(slot);
398 }
399 slot->AddReference();
400 return slot;
401}
402
403////////////////////////////////////////////////////////////////////////////////
404/// Create new slot or return already existing one.
405
406TQSlot *TQSlotPool::New(TClass *cl, const char *method, const char *func)
407{
409
410 if (cl) {
411 name = cl->GetName();
412 name += "::";
413 name += method;
414 } else {
415 name = "::";
416 name += func;
417 }
418
419 TQSlot *slot = (TQSlot *)fTable->FindObject(name.Data());
420
421 if (!slot) {
422 slot = new TQSlot(cl, method, func);
423 fTable->Add(slot);
424 }
425 slot->AddReference();
426 return slot;
427}
428
429////////////////////////////////////////////////////////////////////////////////
430/// Delete slot if there is no reference to it.
431
433{
434 slot->RemoveReference(); // decrease references to slot
435
436 if (slot->References() <= 0) {
437 fTable->Remove(slot);
438 if (!slot->IsExecuting()) SafeDelete(slot);
439 }
440}
441
442static TQSlotPool gSlotPool; // global pool of slots
443
444void TQConnection::SetArg(const Longptr_t *params, Int_t nparam/* = -1*/) {
445 if (nparam == -1)
446 nparam = fSlot->GetMethodNargs();
447
448 // FIXME: Why TInterpreter needs non-const SetArgArray. TClingCallFunc
449 // doesn't modify the value.
450 gInterpreter->CallFunc_SetArgArray(fSlot->GetFunc(), const_cast<Longptr_t*>(params), nparam);
451}
452
453
454////////////////////////////////////////////////////////////////////////////////
455/// TQConnection ctor.
456/// cl != 0 - connection to object == receiver of class == cl
457/// and method == method_name
458/// cl == 0 - connection to function with name == method_name
459
460TQConnection::TQConnection(TClass *cl, void *receiver, const char *method_name)
461 : TQObject()
462{
463 const char *funcname = nullptr;
464 fReceiver = receiver; // fReceiver is pointer to receiver
465
466 if (!cl) {
467 Error("SetFCN", "Not used anymore.");
468 /*
469 funcname = gCling->Getp2f2funcname(fReceiver);
470 if (!funcname)
471 Warning("TQConnection", "%s cannot be compiled", method_name);
472 */
473 }
474
475 if (cl) fClassName = cl->GetName();
476 fSlot = gSlotPool.New(cl, method_name, funcname);
477}
478
479////////////////////////////////////////////////////////////////////////////////
480/// TQConnection ctor.
481/// Creates connection to method of class specified by name,
482/// it could be interpreted class and with method == funcname.
483
484TQConnection::TQConnection(const char *class_name, void *receiver,
485 const char *funcname) : TQObject()
486{
487 fClassName = class_name;
488 fSlot = gSlotPool.New(class_name, funcname); // new slot-method
489 fReceiver = receiver; // fReceiver is pointer to receiver
490}
491
492////////////////////////////////////////////////////////////////////////////////
493/// Copy constructor. Ignore connections to this TQConnections
494
496{
498 fSlot = con.fSlot;
500 fReceiver = con.fReceiver;
501}
502
503////////////////////////////////////////////////////////////////////////////////
504/// TQConnection dtor.
505/// - remove this connection from all signal lists
506/// - we do not delete fSlot if it has other connections,
507/// TQSlot::fCounter > 0 .
508
510{
511 TIter next(this);
512 TList *list;
513
514 while ((list = (TList *)next())) {
515 list->Remove(this);
516 if (list->IsEmpty()) delete list; // delete empty list
517 }
518 Clear("nodelete");
519
520 if (!fSlot) return;
522}
523
524////////////////////////////////////////////////////////////////////////////////
525/// Returns name of connection (aka name of slot)
526
527const char *TQConnection::GetName() const
528{
529 return fSlot->GetName();
530}
531
532////////////////////////////////////////////////////////////////////////////////
533/// Signal Destroyed tells that connection is destroyed.
534
536{
537 MakeZombie();
538 Emit("Destroyed()");
539}
540
541////////////////////////////////////////////////////////////////////////////////
542/// List TQConnection full method name and list all signals
543/// connected to this connection.
544
545void TQConnection::ls(Option_t *option) const
546{
547 std::cout << "\t" << IsA()->GetName() << "\t" << GetName() << std::endl;
548 ((TQConnection *)this)->R__FOR_EACH(TList, ls)(option);
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// Print TQConnection full method name and print all
553/// signals connected to this connection.
554
556{
558 std::cout << IsA()->GetName() << "\t" << fReceiver << "\t" << GetName() << std::endl;
559}
560
561////////////////////////////////////////////////////////////////////////////////
562/// Apply slot-method to the fReceiver object without arguments.
563
565{
566 // This connection might be deleted in result of the method execution
567 // (for example in case of a Disconnect). Hence we do not assume
568 // the object is still valid on return.
569 TQSlot *s = fSlot;
571 if (s->References() <= 0) delete s;
572}
573
574////////////////////////////////////////////////////////////////////////////////
575/// Apply slot-method to the fReceiver object with
576/// single argument value.
577
579{
580 // This connection might be deleted in result of the method execution
581 // (for example in case of a Disconnect). Hence we do not assume
582 // the object is still valid on return.
583 TQSlot *s = fSlot;
585 if (s->References() <= 0) delete s;
586}
587
588////////////////////////////////////////////////////////////////////////////////
589/// Apply slot-method to the fReceiver object with
590/// single argument value.
591
593{
594 // This connection might be deleted in result of the method execution
595 // (for example in case of a Disconnect). Hence we do not assume
596 // the object is still valid on return.
597 TQSlot *s = fSlot;
599 if (s->References() <= 0) delete s;
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Apply slot-method to the fReceiver object with
604/// single argument value.
605
607{
608 // This connection might be deleted in result of the method execution
609 // (for example in case of a Disconnect). Hence we do not assume
610 // the object is still valid on return.
611 TQSlot *s = fSlot;
613 if (s->References() <= 0) delete s;
614}
615
616////////////////////////////////////////////////////////////////////////////////
617/// Apply slot-method to the fReceiver object with variable
618/// number of argument values.
619
621{
622 // This connection might be deleted in result of the method execution
623 // (for example in case of a Disconnect). Hence we do not assume
624 // the object is still valid on return.
625 TQSlot *s = fSlot;
626 fSlot->ExecuteMethod(fReceiver, params, nparam);
627 if (s->References() <= 0) delete s;
628}
629
630////////////////////////////////////////////////////////////////////////////////
631/// Apply slot-method to the fReceiver object and
632/// with string parameter.
633
634void TQConnection::ExecuteMethod(const char *param)
635{
636 // This connection might be deleted in result of the method execution
637 // (for example in case of a Disconnect). Hence we do not assume
638 // the object is still valid on return.
639 TQSlot *s = fSlot;
641 if (s->References() <= 0) delete s;
642}
643
644////////////////////////////////////////////////////////////////////////////////
645/// Return true if the underlying method is value and the number of argument
646/// is compatible.
647
649 return fSlot->CheckSlot(nargs);
650}
651
652////////////////////////////////////////////////////////////////////////////////
653/// Return the object address to be passed to the function.
654
656 if (fReceiver) return (void *)((Longptr_t)fReceiver + fSlot->GetOffset());
657 else return nullptr;
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// Lock the interpreter and mark the slot as executing.
662
663CallFunc_t *TQConnection::LockSlot() const {
665 return fSlot->StartExecuting();
666}
667
668////////////////////////////////////////////////////////////////////////////////
669/// Unlock the interpreter and mark the slot as no longer executing.
670
672 s->EndExecuting();
673 if (s->References() <= 0) delete s;
675}
676
677CallFunc_t* TQConnection::GetSlotCallFunc() const {
678 return fSlot->GetFunc();
679}
#define SafeDelete(p)
Definition: RConfig.hxx:534
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:80
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
char name[80]
Definition: TGX11.cxx:110
R__EXTERN TVirtualMutex * gInterpreterMutex
Definition: TInterpreter.h:44
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:563
#define gInterpreter
Definition: TInterpreter.h:562
char * gTQSlotParams
static TQSlotPool gSlotPool
#define ClassImpQ(name)
Definition: TQObject.h:282
#define gROOT
Definition: TROOT.h:404
#define R__LOCKGUARD(mutex)
const char * proto
Definition: civetweb.c:16604
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
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:4404
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:4449
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:430
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:2955
virtual Bool_t IsEmpty() const
Definition: TCollection.h:188
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
Int_t GetNargsOpt() const
Number of function optional (default) arguments.
Definition: TFunction.cxx:175
Int_t GetNargs() const
Number of function arguments.
Definition: TFunction.cxx:165
THashTable implements a hash table to store TObject's.
Definition: THashTable.h:35
TObject * Remove(TObject *obj)
Remove object from the hashtable.
Definition: THashTable.cxx:417
void Add(TObject *obj)
Add object to the hash table.
Definition: THashTable.cxx:92
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashTable.cxx:238
void Clear(Option_t *option="")
Remove all objects from the table.
Definition: THashTable.cxx:167
virtual void CallFunc_IgnoreExtraArgs(CallFunc_t *, bool) const
Definition: TInterpreter.h:327
virtual void ClassInfo_Delete(ClassInfo_t *) const
Definition: TInterpreter.h:403
virtual void CallFunc_SetFuncProto(CallFunc_t *, ClassInfo_t *, const char *, const char *, Longptr_t *, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
Definition: TInterpreter.h:393
virtual void CallFunc_Exec(CallFunc_t *, void *) const
Definition: TInterpreter.h:317
virtual CallFunc_t * CallFunc_Factory() const
Definition: TInterpreter.h:324
virtual ClassInfo_t * ClassInfo_Factory(Bool_t=kTRUE) const =0
virtual void CallFunc_SetFunc(CallFunc_t *, ClassInfo_t *, const char *, const char *, bool, Longptr_t *) const
Definition: TInterpreter.h:390
virtual void CallFunc_SetArgArray(CallFunc_t *, Longptr_t *, Int_t) const
Definition: TInterpreter.h:332
virtual void ClassInfo_Init(ClassInfo_t *, const char *) const
Definition: TInterpreter.h:416
virtual void CallFunc_Delete(CallFunc_t *) const
Definition: TInterpreter.h:316
A doubly linked list.
Definition: TList.h:44
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:822
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:402
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
@ kNotDeleted
object has not been deleted
Definition: TObject.h:78
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
void MakeZombie()
Definition: TObject.h:49
TQConnection class is an internal class, used in the object communication mechanism.
Definition: TQConnection.h:37
void * GetSlotAddress() const
Return the object address to be passed to the function.
virtual CallFunc_t * GetSlotCallFunc() const override
void ExecuteMethod()
Apply slot-method to the fReceiver object without arguments.
void UnLockSlot(TQSlot *) const
Unlock the interpreter and mark the slot as no longer executing.
void * fReceiver
Definition: TQConnection.h:40
virtual void PrintCollectionHeader(Option_t *option) const override
Print TQConnection full method name and print all signals connected to this connection.
CallFunc_t * LockSlot() const
Lock the interpreter and mark the slot as executing.
void Destroyed() override
Signal Destroyed tells that connection is destroyed.
virtual void SetArg(Long_t param) override
Definition: TQConnection.h:53
TString fClassName
Definition: TQConnection.h:41
Bool_t CheckSlot(Int_t nargs) const
Return true if the underlying method is value and the number of argument is compatible.
TQSlot * fSlot
Definition: TQConnection.h:39
const char * GetName() const override
Returns name of connection (aka name of slot)
virtual ~TQConnection()
TQConnection dtor.
void ls(Option_t *option="") const override
List TQConnection full method name and list all signals connected to this connection.
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition: TQObject.h:48
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
TQSlot * New(const char *class_name, const char *funcname)
Create new slot or return already existing one.
THashTable * fTable
virtual ~TQSlotPool()
void Free(TQSlot *slot)
Delete slot if there is no reference to it.
Slightly modified TMethodCall class used in the object communication mechanism.
Int_t fExecuting
TQSlot(TClass *cl, const char *method, const char *funcname)
Create the method invocation environment.
CallFunc_t * fFunc
Longptr_t GetOffset() const
void EndExecuting()
Mark the slot as no longer executing and cleanup if need be.
void Print(Option_t *opt="") const
Print info about slot.
Bool_t IsExecuting() const
Longptr_t fOffset
const char * GetName() const
Returns name of object.
TFunction * fMethod
CallFunc_t * StartExecuting()
Mark the slot as executing.
TString fName
virtual ~TQSlot()
TQSlot dtor.
Int_t GetMethodNargs()
ClassInfo_t * fClass
CallFunc_t * GetFunc() const
void ls(Option_t *opt="") const
The ls function lists the contents of a class on stdout.
void ExecuteMethod(void *object, Int_t nargs, va_list ap)=delete
Bool_t CheckSlot(Int_t nargs) const
Return true if the method is valid and the number of arguments is acceptable.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2803
Definitions for TRefCnt, base class for reference counted objects.
Definition: TRefCnt.h:27
void AddReference()
Definition: TRefCnt.h:40
UInt_t RemoveReference()
Definition: TRefCnt.h:41
UInt_t References() const
Definition: TRefCnt.h:38
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
virtual Int_t UnLock()=0
virtual Int_t Lock()=0
void Print(std::ostream &os, const OptionType &opt)
static constexpr double s