forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TObjectExecute.h
80 lines (72 loc) · 2.54 KB
/
TObjectExecute.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// @(#)root/qt:$Id$
// Author: Valeri Fine 21/01/2002
/*************************************************************************
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
* Copyright (C) 2002 by Valeri Fine. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TObjectExecute
#define ROOT_TObjectExecute
#include "TQtRConfig.h"
#include "TObject.h"
#include "TFunction.h"
#include "TObjArray.h"
#include "TObjString.h"
#include "TROOT.h"
//______________________________________________________________________________
class TObjectExecute : public TObject {
private:
TObject *fObject;
TMethod *fMethod;
TFunction *fFunction;
TObjArray *fParams;
protected:
public:
//_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
TObjectExecute():fObject(0),fMethod(0),fFunction(0),fParams(0)
{}
//_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
void Execute(TObject *o,TMethod *m,TObjArray *p=0)
{
if (o && m) {
fFunction=0;fObject=o;fMethod=m;fParams=p;
o->Execute(m,p);
}
}
//_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
void Execute(const char *method, const char *params, Int_t *error=0)
{TObject::Execute(method,params,error);}
//_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
void Execute(TMethod *method, TObjArray *params, Int_t *error=0)
{TObject::Execute(method,params,error);}
//_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
void Execute(TObject *o,TFunction *f,TObjArray *p=0)
{
if (o && f) {
fMethod=0;fObject=o;fFunction=f;fParams=p;
// o->Execute(f,p);
}
}
//_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
void Execute(TFunction *f,TObjArray *p=0)
{
if (f) {
fMethod=0;fObject=0;fFunction=f;fParams=p;
TString args;
TIter next(p);
TObjString *s;
while ((s = (TObjString*) next())) {
if (!args.IsNull()) args += ",";
args += s->String();
}
char *cmd = Form("%s(%s);", f->GetName(), args.Data());
gROOT->ProcessLine(cmd);
}
}
//_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
virtual ~TObjectExecute(){}
};
#endif