54 TQSlot(
TClass *cl,
const char *method,
const char *funcname);
55 TQSlot(
const char *class_name,
const char *funcname);
59 Long_t GetOffset()
const {
return fOffset; }
60 CallFunc_t *StartExecuting();
61 CallFunc_t *GetFunc()
const {
return fFunc; }
64 const char *GetName()
const {
70 void ExecuteMethod(
void *
object,
Int_t nargs, va_list ap) =
delete;
71 void ExecuteMethod(
void *
object);
72 void ExecuteMethod(
void *
object,
Long_t param);
73 void ExecuteMethod(
void *
object,
Long64_t param);
74 void ExecuteMethod(
void *
object,
Double_t param);
75 void ExecuteMethod(
void *
object,
const char *params);
76 void ExecuteMethod(
void *
object,
Long_t *paramArr,
Int_t nparam = -1);
77 void Print(
Option_t *opt =
"")
const;
82 Bool_t IsExecuting()
const {
83 return fExecuting > 0;
100TQSlot::TQSlot(
TClass *cl,
const char *method_name,
114 char *method =
new char[strlen(method_name) + 1];
115 if (method) strcpy(method, method_name);
123 if ((
proto = strchr(method,
'('))) {
129 if ((tmp = strrchr(
proto,
')'))) * tmp =
'\0';
130 if ((params = strchr(
proto,
'='))) * params =
' ';
151 fMethod =
gROOT->GetGlobalFunction(funcname, params,
kFALSE);
175TQSlot::TQSlot(
const char *class_name,
const char *funcname) :
185 char *method =
new char[strlen(funcname) + 1];
186 if (method) strcpy(method, funcname);
194 if ((
proto = strchr(method,
'('))) {
196 if ((tmp = strrchr(
proto,
')'))) * tmp =
'\0';
197 if ((params = strchr(
proto,
'='))) * params =
' ';
219 fMethod =
gROOT->GetGlobalFunction(method, params,
kTRUE);
247inline void TQSlot::ExecuteMethod(
void *
object)
249 ExecuteMethod(
object, (
Long_t*)
nullptr, 0);
260 Error(
"ExecuteMethod",
"method %s not found,"
261 "\n(note: interpreted methods are not supported with varargs)",
266 if (nargs < fMethod->GetNargs() - fMethod->GetNargsOpt() ||
267 nargs > fMethod->GetNargs()) {
268 Error(
"ExecuteMethod",
"nargs (%d) not consistent with expected number of arguments ([%d-%d])",
269 nargs, fMethod->GetNargs() - fMethod->GetNargsOpt(),
270 fMethod->GetNargs());
280CallFunc_t *TQSlot::StartExecuting() {
288void TQSlot::EndExecuting() {
290 if (!TestBit(kNotDeleted) && !fExecuting)
298inline void TQSlot::ExecuteMethod(
void *
object,
Long_t param)
300 ExecuteMethod(
object, ¶m, 1);
308inline void TQSlot::ExecuteMethod(
void *
object,
Long64_t param)
311 ExecuteMethod(
object, arg, 1);
319inline void TQSlot::ExecuteMethod(
void *
object,
Double_t param)
322 ExecuteMethod(
object, arg, 1);
329inline void TQSlot::ExecuteMethod(
void *
object,
const char *param)
332 ExecuteMethod(
object, &arg, 1);
345inline void TQSlot::ExecuteMethod(
void *
object,
Long_t *paramArr,
Int_t nparam)
350 if (
object) address = (
void *)((
Long_t)
object + fOffset);
354 if (!TestBit(kNotDeleted) && !fExecuting)
363 std::cout << IsA()->GetName() <<
"\t" << GetName() <<
"\t"
364 <<
"Number of Connections = " << References() << std::endl;
376 virtual ~TQSlotPool() {
377 fTable->
Clear(
"nodelete");
380 TQSlot *New(
const char *class_name,
const char *funcname);
381 TQSlot *New(
TClass *cl,
const char *method,
const char *func);
382 void Free(TQSlot *slot);
388TQSlot *TQSlotPool::New(
const char *class_name,
const char *funcname)
397 slot =
new TQSlot(class_name, funcname);
400 slot->AddReference();
407TQSlot *TQSlotPool::New(
TClass *cl,
const char *method,
const char *func)
423 slot =
new TQSlot(cl, method, func);
426 slot->AddReference();
433void TQSlotPool::Free(TQSlot *slot)
435 slot->RemoveReference();
437 if (slot->References() <= 0) {
447 nparam =
fSlot->GetMethodNargs();
464 const char *funcname = 0;
468 Error(
"SetFCN",
"Not used anymore.");
500 fSlot->AddReference();
515 while ((list = (
TList *)next())) {
517 if (list->
IsEmpty())
delete list;
530 return fSlot->GetName();
548 std::cout <<
"\t" << IsA()->GetName() <<
"\t" <<
GetName() << std::endl;
559 std::cout << IsA()->GetName() <<
"\t" <<
fReceiver <<
"\t" <<
GetName() << std::endl;
572 if (s->References() <= 0)
delete s;
586 if (s->References() <= 0)
delete s;
600 if (s->References() <= 0)
delete s;
614 if (s->References() <= 0)
delete s;
628 if (s->References() <= 0)
delete s;
642 if (s->References() <= 0)
delete s;
650 return fSlot->CheckSlot(nargs);
666 return fSlot->StartExecuting();
674 if (s->References() <= 0)
delete s;
679 return fSlot->GetFunc();
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
R__EXTERN TVirtualMutex * gInterpreterMutex
R__EXTERN TInterpreter * gCling
static TQSlotPool gSlotPool
#define R__LOCKGUARD(mutex)
TClass instances represent classes, structs and namespaces in the ROOT type system.
TMethod * GetMethod(const char *method, const char *params, Bool_t objectIsConst=kFALSE)
Find the best method (if there is one) matching the parameters.
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
ClassInfo_t * GetClassInfo() const
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.
virtual Bool_t IsEmpty() const
Global functions class (global functions are obtained from CINT).
Int_t GetNargs() const
Number of function arguments.
THashTable implements a hash table to store TObject's.
TObject * Remove(TObject *obj)
Remove object from the hashtable.
void Add(TObject *obj)
Add object to the hash table.
TObject * FindObject(const char *name) const
Find object using its name.
void Clear(Option_t *option="")
Remove all objects from the table.
virtual void CallFunc_SetFunc(CallFunc_t *, ClassInfo_t *, const char *, const char *, bool, Long_t *) const
virtual void CallFunc_IgnoreExtraArgs(CallFunc_t *, bool) const
virtual void CallFunc_SetFuncProto(CallFunc_t *, ClassInfo_t *, const char *, const char *, Long_t *, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
virtual void ClassInfo_Delete(ClassInfo_t *) const
virtual void CallFunc_Exec(CallFunc_t *, void *) const
virtual CallFunc_t * CallFunc_Factory() const
virtual ClassInfo_t * ClassInfo_Factory(Bool_t=kTRUE) const =0
virtual void CallFunc_SetArgArray(CallFunc_t *, Long_t *, Int_t) const
virtual void ClassInfo_Init(ClassInfo_t *, const char *) const
virtual void CallFunc_Delete(CallFunc_t *) const
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
TQConnection class is an internal class, used in the object communication mechanism.
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.
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
Bool_t CheckSlot(Int_t nargs) const
Return true if the underlying method is value and the number of argument is compatible.
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....
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definitions for TRefCnt, base class for reference counted objects.
const char * Data() const