74 #include "RConfigure.h" 110 static TPMERegexp *constRe = 0, *wspaceRe = 0;
112 constRe =
new TPMERegexp(
"(?<=\\(|\\s|,|&|\\*)const(?=\\s|,|\\)|&|\\*)",
"go");
113 wspaceRe =
new TPMERegexp(
"\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)",
"go");
116 wspaceRe->Substitute(res,
"");
131 if (arg[pri] ==
'*' || arg[pri] ==
'&') {
142 if (!arg.
AtEnd()) res +=
",";
153 TMethod *GetMethodWithPrototype(
TClass *cl,
const char *method,
183 TClass *receiver_class,
const char *slot)
185 char *signal_method =
new char[strlen(signal)+1];
186 if (signal_method) strcpy(signal_method, signal);
191 if ((signal_proto = strchr(signal_method,
'('))) {
193 *signal_proto++ =
'\0';
195 if ((tmp = strrchr(signal_proto,
')'))) *tmp =
'\0';
198 if (!signal_proto) signal_proto = (
char*)
"";
204 ::Error(
"TQObject::CheckConnectArgs",
"for signal/slot consistency\n" 205 "checking need to specify class name as argument to " 207 delete [] signal_method;
213 TMethod *signalMethod = GetMethodWithPrototype(sender_class,
218 ::Error(
"TQObject::CheckConnectArgs",
"signal %s::%s(%s) does not exist",
219 sender_class->
GetName(), signal_method, signal_proto);
220 delete [] signal_method;
223 Int_t nsigargs = nargs;
225 #if defined(CHECK_COMMENT_STRING) 227 if (signalMethod != (
TMethod *) -1)
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;
240 delete [] signal_method;
242 char *slot_method =
new char[strlen(slot)+1];
243 if (slot_method) strcpy(slot_method, slot);
246 char *slot_params = 0;
248 if ((slot_proto = strchr(slot_method,
'('))) {
251 *slot_proto++ =
'\0';
254 if ((tmp = strrchr(slot_proto,
')'))) *tmp =
'\0';
257 if (!slot_proto) slot_proto = (
char*)
"";
258 if ((slot_params = strchr(slot_proto,
'='))) *slot_params =
' ';
261 if (!receiver_class) {
263 slotMethod =
gROOT->GetGlobalFunction(slot_method,0,
kFALSE);
265 slotMethod = !slot_params ?
266 GetMethodWithPrototype(receiver_class,
271 slot_method, 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);
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);
284 delete [] slot_method;
288 #if defined(CHECK_ARGS_NUMBER) 291 ::Error(
"TQObject::CheckConnectArgs",
292 "inconsistency in numbers of arguments");
293 delete [] slot_method;
299 delete [] slot_method;
309 class TQConnectionList :
public TList {
316 { fName =
name; fSignalArgs = nsigargs; }
317 virtual ~TQConnectionList();
320 Int_t GetNargs()
const {
return fSignalArgs; }
321 void ls(
Option_t *option =
"")
const;
327 TQConnectionList::~TQConnectionList()
335 if (connection->
IsEmpty())
delete connection;
344 Bool_t TQConnectionList::Disconnect(
void *receiver,
const char *slot_name)
357 if (!slot_name || !slot_name[0]
358 || !strcmp(name,slot_name)) {
360 if (!receiver || (receiver == obj)) {
361 return_value =
kTRUE;
362 savlnk = lnk->
Next();
378 void TQConnectionList::ls(
Option_t *option)
const 380 std::cout <<
"TQConnectionList:" <<
"\t" <<
GetName() << std::endl;
420 while ((connection = (
TQConnection*)next_connection())) {
421 TIter next_list(connection);
422 TQConnectionList *list;
423 while ((list = (TQConnectionList*)next_list())) {
424 list->Remove(connection);
439 qcl =
dynamic_cast<TQClass*
>(IsA());
462 while ((base = (
TBaseClass*) next_base_class()))
479 TQConnectionList *clist = (TQConnectionList*)
491 clist->AddFirst(con);
505 TQConnectionList *clist = (TQConnectionList*)
577 TIter nextSigList(&classSigLists);
578 while ((sigList = (
TList*) nextSigList()))
620 TIter nextSigList(&classSigLists);
621 while ((sigList = (
TList*) nextSigList()))
663 TIter nextSigList(&classSigLists);
664 while ((sigList = (
TList*) nextSigList()))
706 TIter nextSigList(&classSigLists);
707 while ((sigList = (
TList*) nextSigList()))
749 TIter nextSigList(&classSigLists);
750 while ((sigList = (
TList*) nextSigList()))
800 TQConnectionList *clist = 0;
805 TIter nextSigList(&classSigLists);
806 while ((sigList = (
TList*) nextSigList()))
808 clist = (TQConnectionList*) sigList->
FindObject(signal);
847 if ((nsigargs =
CheckConnectArgs(sender, sender->IsA(), signal_name, cl, slot_name)) == -1)
853 TQConnectionList *clist = (TQConnectionList*)
857 clist =
new TQConnectionList(signal_name, nsigargs);
865 if (!strcmp(slot_name,connection->
GetName()) &&
873 if (!clist->FindObject(connection)) {
874 clist->Add(connection);
905 if ((nsigargs =
CheckConnectArgs(0, sender, signal_name, cl, slot_name)) == -1)
911 TQConnectionList *clist = (TQConnectionList*) slist->
FindObject(signal_name);
914 clist =
new TQConnectionList(signal_name, nsigargs);
922 if (!strcmp(slot_name,connection->
GetName()) &&
930 if (!clist->FindObject(connection)) {
931 clist->Add(connection);
933 ((
TQClass*)sender)->Connected(signal_name);
979 if (rcv_cl)
return ConnectToClass(sender, signal, rcv_cl, receiver, slot);
995 if ((nsigargs =
CheckConnectArgs(sender, sender->IsA(), signal_name, 0, slot_name)) == -1)
1000 TQConnectionList *clist = (TQConnectionList*)
1004 clist =
new TQConnectionList(signal_name, nsigargs);
1012 if (!strcmp(slot_name,connection->
GetName()) &&
1017 connection =
new TQConnection(cl, receiver, slot_name);
1020 if (!clist->FindObject(connection)) {
1021 clist->Add(connection);
1071 if (rcv_cl)
return ConnectToClass(class_name, signal, rcv_cl, receiver,
1091 if ((nsigargs =
CheckConnectArgs(0, sender, signal_name, 0, slot_name)) == -1)
1098 TQConnectionList *clist = (TQConnectionList*)
1102 clist =
new TQConnectionList(signal_name, nsigargs);
1110 if (!strcmp(slot_name,connection->
GetName()) &&
1115 connection =
new TQConnection(cl, receiver, slot_name);
1118 if (!clist->FindObject(connection)) {
1119 clist->Add(connection);
1121 ((
TQClass*)sender)->Connected(signal_name);
1138 const char *receiver_class,
1151 if ((nsigargs =
CheckConnectArgs(
this, IsA(), signal_name, cl, slot_name)) == -1)
1156 TQConnectionList *clist = (TQConnectionList*)
1160 clist =
new TQConnectionList(signal_name, nsigargs);
1168 if (!strcmp(slot_name,connection->
GetName()) &&
1173 connection =
new TQConnection(receiver_class, receiver, slot_name);
1176 if (!clist->FindObject(connection)) {
1177 clist->Add(connection);
1241 TQConnectionList *slist = 0;
1244 while ((slist = (TQConnectionList*)next_signal())) {
1245 if (!signal || signal_name.
IsNull()) {
1246 next_return = slist->Disconnect(receiver,slot_name);
1247 return_value = return_value || next_return;
1249 if (slist->IsEmpty()) {
1253 }
else if (signal && !strcmp(signal_name,slist->GetName())) {
1254 next_return = slist->Disconnect(receiver,slot_name);
1255 return_value = return_value || next_return;
1257 if (slist->IsEmpty()) {
1269 return return_value;
1288 return Disconnect(qcl, signal, receiver, slot);
1299 return Disconnect(
this, signal, receiver, slot);
1305 void TQObject::Streamer(
TBuffer &R__b)
1339 TString str =
"ProcessLine(=";
virtual const char * GetName() const
Returns name of object.
std::string GetName(const std::string &scope_name)
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.
virtual const char * GetSenderClassName() const
Bool_t ConnectCINT(TQObject *sender, const char *signal, const char *slot)
Global function which simplifies making connection in interpreted ROOT session.
virtual void * GetSender()
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 void AddLast(TObject *obj)
Add object at the end of the list.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
void * GetReceiver() 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 const char * GetCommentString()
Returns a comment string from the class declaration.
TList * GetListOfClassSignals() const
Returns pointer to list of signals of this class.
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)
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
Int_t GetNargs() const
Number of function arguments.
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.
virtual Int_t NumberOfSignals() const
Return number of signals for this object.
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 Int_t NumberOfConnections() const
Return number of connections for this object.
The ROOT global object gROOT contains a list of all defined classes.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
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).
Bool_t fSignalsBlocked
list of connections to this object
#define R__LOCKGUARD2(mutex)
TString & Remove(Ssiz_t pos)
virtual Bool_t IsEmpty() 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.
virtual Bool_t HasConnection(const char *signal_name) const
Return true if there is any object connected to this signal.
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 * GetListOfSignals() const
Global functions class (global functions are obtained from CINT).
TObject * GetObject() const
virtual void Connected(const char *)
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
virtual void Add(TObject *obj)
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Each ROOT class (see TClass) has a linked list of methods.
static TString CompressName(const char *method_name)
Removes "const" words and blanks from full (with prototype) method name and resolve any typedefs in t...
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
const char * GetName() const
Returns name of connection (aka name of slot)
virtual void LowPriority(const char *signal_name, const char *slot_name=0)
virtual Int_t GetSize() const
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...
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.
Int_t GetNargsOpt() const
Number of function optional (default) arguments.
virtual void HighPriority(const char *signal_name, const char *slot_name=0)
const char * Data() const