72 #include "RConfigure.h"
108 static TPMERegexp *constRe = 0, *wspaceRe = 0;
110 constRe =
new TPMERegexp(
"(?<=\\(|\\s|,|&|\\*)const(?=\\s|,|\\)|&|\\*)",
"go");
114 wspaceRe->Substitute(res,
"");
129 if (arg[pri] ==
'*' || arg[pri] ==
'&') {
140 if (!arg.
AtEnd()) res +=
",";
151 TMethod *GetMethodWithPrototype(
TClass *cl,
const char *method,
152 const char *proto,
Int_t &nargs)
180 TClass *sender_class,
const char *signal,
181 TClass *receiver_class,
const char *slot)
183 char *signal_method =
new char[strlen(signal)+1];
184 if (signal_method) strcpy(signal_method, signal);
189 if ((signal_proto = strchr(signal_method,
'('))) {
191 *signal_proto++ =
'\0';
193 if ((tmp = strrchr(signal_proto,
')'))) *tmp =
'\0';
196 if (!signal_proto) signal_proto = (
char*)
"";
202 ::Error(
"TQObject::CheckConnectArgs",
"for signal/slot consistency\n"
203 "checking need to specify class name as argument to "
205 delete [] signal_method;
211 TMethod *signalMethod = GetMethodWithPrototype(sender_class,
216 ::Error(
"TQObject::CheckConnectArgs",
"signal %s::%s(%s) does not exist",
217 sender_class->
GetName(), signal_method, signal_proto);
218 delete [] signal_method;
221 Int_t nsigargs = nargs;
223 #if defined(CHECK_COMMENT_STRING)
225 if (signalMethod != (
TMethod *) -1)
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;
238 delete [] signal_method;
240 char *slot_method =
new char[strlen(slot)+1];
241 if (slot_method) strcpy(slot_method, slot);
244 char *slot_params = 0;
246 if ((slot_proto = strchr(slot_method,
'('))) {
249 *slot_proto++ =
'\0';
252 if ((tmp = strrchr(slot_proto,
')'))) *tmp =
'\0';
255 if (!slot_proto) slot_proto = (
char*)
"";
256 if ((slot_params = strchr(slot_proto,
'='))) *slot_params =
' ';
259 if (!receiver_class) {
261 slotMethod =
gROOT->GetGlobalFunction(slot_method,0,
kFALSE);
263 slotMethod = !slot_params ?
264 GetMethodWithPrototype(receiver_class,
269 slot_method, 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);
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);
282 delete [] slot_method;
286 #if defined(CHECK_ARGS_NUMBER)
289 ::Error(
"TQObject::CheckConnectArgs",
290 "inconsistency in numbers of arguments");
291 delete [] slot_method;
297 delete [] slot_method;
307 class TQConnectionList :
public TList {
313 TQConnectionList(
const char *name,
Int_t nsigargs) :
TList()
314 { fName =
name; fSignalArgs = nsigargs; }
315 virtual ~TQConnectionList();
317 Bool_t Disconnect(
void *receiver=0,
const char *slot_name=0);
318 Int_t GetNargs()
const {
return fSignalArgs; }
325 TQConnectionList::~TQConnectionList()
333 if (connection->
IsEmpty())
delete connection;
342 Bool_t TQConnectionList::Disconnect(
void *receiver,
const char *slot_name)
352 const char *name = connection->
GetName();
355 if (!slot_name || !slot_name[0]
356 || !strcmp(name,slot_name)) {
358 if (!receiver || (receiver == obj)) {
359 return_value =
kTRUE;
360 savlnk = lnk->
Next();
376 void TQConnectionList::ls(
Option_t *option)
const
378 std::cout <<
"TQConnectionList:" <<
"\t" << GetName() << std::endl;
418 while ((connection = (
TQConnection*)next_connection())) {
419 TIter next_list(connection);
420 TQConnectionList *list;
421 while ((list = (TQConnectionList*)next_list())) {
422 list->Remove(connection);
460 while ((base = (
TBaseClass*) next_base_class()))
477 TQConnectionList *clist = (TQConnectionList*)
489 clist->AddFirst(con);
503 TQConnectionList *clist = (TQConnectionList*)
575 TIter nextSigList(&classSigLists);
576 while ((sigList = (
TList*) nextSigList()))
618 TIter nextSigList(&classSigLists);
619 while ((sigList = (
TList*) nextSigList()))
661 TIter nextSigList(&classSigLists);
662 while ((sigList = (
TList*) nextSigList()))
704 TIter nextSigList(&classSigLists);
705 while ((sigList = (
TList*) nextSigList()))
747 TIter nextSigList(&classSigLists);
748 while ((sigList = (
TList*) nextSigList()))
798 TQConnectionList *clist = 0;
803 TIter nextSigList(&classSigLists);
804 while ((sigList = (
TList*) nextSigList()))
806 clist = (TQConnectionList*) sigList->
FindObject(signal);
845 if ((nsigargs =
CheckConnectArgs(sender, sender->IsA(), signal_name, cl, slot_name)) == -1)
851 TQConnectionList *clist = (TQConnectionList*)
855 clist =
new TQConnectionList(signal_name, nsigargs);
863 if (!strcmp(slot_name,connection->
GetName()) &&
871 if (!clist->FindObject(connection)) {
872 clist->Add(connection);
903 if ((nsigargs =
CheckConnectArgs(0, sender, signal_name, cl, slot_name)) == -1)
909 TQConnectionList *clist = (TQConnectionList*) slist->
FindObject(signal_name);
912 clist =
new TQConnectionList(signal_name, nsigargs);
920 if (!strcmp(slot_name,connection->
GetName()) &&
928 if (!clist->FindObject(connection)) {
929 clist->Add(connection);
931 ((
TQClass*)sender)->Connected(signal_name);
977 if (rcv_cl)
return ConnectToClass(sender, signal, rcv_cl, receiver, slot);
993 if ((nsigargs =
CheckConnectArgs(sender, sender->IsA(), signal_name, 0, slot_name)) == -1)
998 TQConnectionList *clist = (TQConnectionList*)
1002 clist =
new TQConnectionList(signal_name, nsigargs);
1010 if (!strcmp(slot_name,connection->
GetName()) &&
1015 connection =
new TQConnection(cl, receiver, slot_name);
1018 if (!clist->FindObject(connection)) {
1019 clist->Add(connection);
1069 if (rcv_cl)
return ConnectToClass(class_name, signal, rcv_cl, receiver,
1089 if ((nsigargs =
CheckConnectArgs(0, sender, signal_name, 0, slot_name)) == -1)
1096 TQConnectionList *clist = (TQConnectionList*)
1100 clist =
new TQConnectionList(signal_name, nsigargs);
1108 if (!strcmp(slot_name,connection->
GetName()) &&
1113 connection =
new TQConnection(cl, receiver, slot_name);
1116 if (!clist->FindObject(connection)) {
1117 clist->Add(connection);
1119 ((
TQClass*)sender)->Connected(signal_name);
1136 const char *receiver_class,
1154 TQConnectionList *clist = (TQConnectionList*)
1158 clist =
new TQConnectionList(signal_name, nsigargs);
1166 if (!strcmp(slot_name,connection->
GetName()) &&
1171 connection =
new TQConnection(receiver_class, receiver, slot_name);
1174 if (!clist->FindObject(connection)) {
1175 clist->Add(connection);
1239 TQConnectionList *slist = 0;
1242 while ((slist = (TQConnectionList*)next_signal())) {
1243 if (!signal || signal_name.
IsNull()) {
1244 next_return = slist->Disconnect(receiver,slot_name);
1245 return_value = return_value || next_return;
1247 if (slist->IsEmpty()) {
1251 }
else if (signal && !strcmp(signal_name,slist->GetName())) {
1252 next_return = slist->Disconnect(receiver,slot_name);
1253 return_value = return_value || next_return;
1255 if (slist->IsEmpty()) {
1267 return return_value;
1286 return Disconnect(qcl, signal, receiver, slot);
1297 return Disconnect(
this, signal, receiver, slot);
1303 void TQObject::Streamer(
TBuffer &R__b)
1337 TString str =
"ProcessLine(=";
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
static Bool_t BlockAllSignals(Bool_t b)
Block or unblock all signals. Returns the previous block status.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
TQObject()
TQObject Constructor.
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.
Bool_t ConnectCINT(TQObject *sender, const char *signal, const char *slot)
Global function which simplifies making connection in interpreted ROOT session.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
virtual void * GetSender()
Int_t GetNargs() const
Number of function arguments.
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
virtual const char * GetSenderClassName() const
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
Buffer base class used for serializing objects.
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
This class implements a mutex interface.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual void AddLast(TObject *obj)
Add object at the end of the list.
const char * Data() const
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Provides iteration through tokens of a given string.
virtual Bool_t IsEmpty() const
virtual Int_t NumberOfSignals() const
Return number of signals for this object.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
virtual const char * GetCommentString()
Returns a comment string from the class declaration.
TList * GetListOfSignals() const
void Error(const char *location, const char *msgfmt,...)
void Emit(const char *signal)
Acitvate signal without args.
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
virtual Bool_t HasConnection(const char *signal_name) const
Return true if there is any object connected to this signal.
Int_t GetNargsOpt() const
Number of function optional (default) arguments.
TList * fListOfConnections
list of signals from this object
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...
static Bool_t fgAllSignalsBlocked
flag used for suppression of signals
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...
Basic data type descriptor (datatype information is obtained from CINT).
TQConnection class is an internal class, used in the object communication mechanism.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
TObject * GetObject() const
const char * GetName() const
Returns name of connection (aka name of slot)
static Bool_t ConnectToClass(TQObject *sender, const char *signal, TClass *receiver_class, void *receiver, const char *slot)
Create connection between sender and receiver.
char * Form(const char *fmt,...)
friend class TQConnection
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
virtual ~TQObject()
TQObject Destructor.
void ExecuteMethod()
Apply slot-method to the fReceiver object without arguments.
Each class (see TClass) has a linked list of its base class(es).
static TString CompressName(const char *method_name)
Bool_t fSignalsBlocked
list of connections to this object
TString & Remove(Ssiz_t pos)
virtual Int_t GetSize() const
void Print(std::ostream &os, const OptionType &opt)
Wrapper around a TObject so it can be stored in a TList.
static Bool_t AreAllSignalsBlocked()
Returns true if all signals are blocked.
TMethod * GetMethod(const char *method, const char *params, Bool_t objectIsConst=kFALSE)
Find the best method (if there is one) matching the parameters.
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Bool_t NextToken()
Get the next token, it is stored in this TString.
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.
TList * GetListOfClassSignals() const
Returns pointer to list of signals of this class.
Global functions class (global functions are obtained from CINT).
virtual void Connected(const char *)
virtual void Add(TObject *obj)
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Each ROOT class (see TClass) has a linked list of methods.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
virtual void LowPriority(const char *signal_name, const char *slot_name=0)
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...
virtual Int_t NumberOfConnections() const
Return number of connections for this object.
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
void CollectClassSignalLists(TList &list, TClass *cls)
Collect class signal lists from class cls and all its base-classes.
void * GetReceiver() const
virtual void HighPriority(const char *signal_name, const char *slot_name=0)