00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ROOT_TObjectExecute
00014 #define ROOT_TObjectExecute
00015
00016 #include "TQtRConfig.h"
00017
00018 #include "TObject.h"
00019 #include "TFunction.h"
00020 #include "TObjArray.h"
00021 #include "TObjString.h"
00022 #include "TROOT.h"
00023
00024
00025 class TObjectExecute : public TObject {
00026 private:
00027 TObject *fObject;
00028 TMethod *fMethod;
00029 TFunction *fFunction;
00030 TObjArray *fParams;
00031 protected:
00032
00033 public:
00034
00035 TObjectExecute():fObject(0),fMethod(0),fFunction(0),fParams(0)
00036 {}
00037
00038 void Execute(TObject *o,TMethod *m,TObjArray *p=0)
00039 {
00040 if (o && m) {
00041 fFunction=0;fObject=o;fMethod=m;fParams=p;
00042 o->Execute(m,p);
00043 }
00044 }
00045
00046 void Execute(const char *method, const char *params, Int_t *error=0)
00047 {TObject::Execute(method,params,error);}
00048
00049 void Execute(TMethod *method, TObjArray *params, Int_t *error=0)
00050 {TObject::Execute(method,params,error);}
00051
00052
00053 void Execute(TObject *o,TFunction *f,TObjArray *p=0)
00054 {
00055 if (o && f) {
00056 fMethod=0;fObject=o;fFunction=f;fParams=p;
00057
00058 }
00059 }
00060
00061 void Execute(TFunction *f,TObjArray *p=0)
00062 {
00063 if (f) {
00064 fMethod=0;fObject=0;fFunction=f;fParams=p;
00065 TString args;
00066 TIter next(p);
00067 TObjString *s;
00068 while ((s = (TObjString*) next())) {
00069 if (!args.IsNull()) args += ",";
00070 args += s->String();
00071 }
00072 char *cmd = Form("%s(%s);", f->GetName(), args.Data());
00073 gROOT->ProcessLine(cmd);
00074 }
00075 }
00076
00077 virtual ~TObjectExecute(){}
00078 };
00079
00080 #endif