Logo ROOT   6.08/07
Reference Guide
TMethodCall.cxx
Go to the documentation of this file.
1 // @(#)Root/meta:$Id$
2 // Author: Fons Rademakers 13/06/96
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TMethodCall
13 Method or function calling interface. Objects of this class contain
14 the (CINT) environment to call a global function or a method for an
15 object of a specific class with the desired arguments. This class is
16 especially useful when a method has to be called more times for
17 different objects and/or with different arguments. If a function or
18 method needs to be called only once one better uses
19 TInterpreter::Execute().
20 */
21 
22 #include "TInterpreter.h"
23 #include "TMethodCall.h"
24 #include "TMethod.h"
25 #include "TClass.h"
26 #include "TROOT.h"
27 #include "Strlen.h"
28 #include "TVirtualMutex.h"
29 #include "TError.h"
30 
32 
33 ////////////////////////////////////////////////////////////////////////////////
34 /// Default TMethodCall ctor. Use Init() to initialize the method call
35 /// environment.
36 
38 fFunc(0), fOffset(0), fClass(0), fMetPtr(0), fDtorOnly(kFALSE), fRetType(kNone)
39 {
40 }
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// Create a method invocation environment for a specific class, method
44 /// described by the callfunc.
45 
46 TMethodCall::TMethodCall(TClass *cl, CallFunc_t *callfunc, Long_t offset):
47 fFunc(0), fOffset(0), fClass(0), fMetPtr(0), fDtorOnly(kFALSE), fRetType(kNone)
48 {
49  Init(cl, callfunc, offset);
50 }
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// Create a method invocation environment for a specific class, method and
54 /// parameters. The parameter string has the form: "\"aap\", 3, 4.35".
55 /// To execute the method call TMethodCall::Execute(object,...).
56 /// This two step method is much more efficient than calling for
57 /// every invocation TInterpreter::Execute(...).
58 
59 TMethodCall::TMethodCall(TClass *cl, const char *method, const char *params):
61 {
62  Init(cl, method, params);
63 }
64 
65 ////////////////////////////////////////////////////////////////////////////////
66 /// Create a global function invocation environment. The parameter
67 /// string has the form: "\"aap\", 3, 4,35". To execute the
68 /// function call TMethodCall::Execute(...).
69 /// This two step method is much more efficient than calling for
70 /// every invocation TInterpreter::Execute(...).
71 
72 TMethodCall::TMethodCall(const char *function, const char *params):
74 {
75  Init(function, params);
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// Create a global function invocation environment base on a TFunction object.
80 /// To execute the function call TMethodCall::Execute(...).
81 /// This two step method is much more efficient than calling for
82 /// every invocation TInterpreter::Execute(...).
83 
86 {
87  Init(func);
88 }
89 ////////////////////////////////////////////////////////////////////////////////
90 /// Copy ctor.
91 
93 TObject(orig),
94 fFunc(orig.fFunc ? gCling->CallFunc_FactoryCopy(orig.fFunc) : 0),
95 fOffset(orig.fOffset), fClass(orig.fClass), fMetPtr(0 /*!*/),
96 fMethod(orig.fMethod), fParams(orig.fParams), fProto(orig.fProto),
98 {
99 }
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 /// Assignment operator.
103 
105 {
106  if (this != &rhs) {
108  fFunc = rhs.fFunc ? gCling->CallFunc_FactoryCopy(rhs.fFunc) : 0;
109  fOffset = rhs.fOffset;
110  fClass = rhs.fClass;
111  fMethod = rhs.fMethod;
112  fParams = rhs.fParams;
113  fProto = rhs.fProto;
114  fDtorOnly = rhs.fDtorOnly;
115  fRetType = rhs.fRetType;
116 
117  delete fMetPtr;
118  fMetPtr = 0;
119  }
120 
121  return *this;
122 }
123 
124 ////////////////////////////////////////////////////////////////////////////////
125 /// TMethodCall dtor.
126 
128 {
130  delete fMetPtr;
131 }
132 
133 ////////////////////////////////////////////////////////////////////////////////
134 /// Return an exact copy of this object.
135 
136 TObject *TMethodCall::Clone(const char *) const
137 {
138  TObject *newobj = new TMethodCall(*this);
139  return newobj;
140 }
141 
142 ////////////////////////////////////////////////////////////////////////////////
143 /// Helper function to find the scope associated with a qualified
144 /// function name
145 
146 static TClass *R__FindScope(const char *function, UInt_t &pos, ClassInfo_t *cinfo)
147 {
148 
149 //______________________________________________________________________________
150 // FIXME: We don't need to split that into lookup scope and lookup member.
151 // Consider merging the implementation with the new lookup functionality.
152 
153  if (function) {
154  UInt_t nested = 0;
155  for(int i=strlen(function); i>=0; --i) {
156  switch(function[i]) {
157  case '<': ++nested; break;
158  case '>': if (nested==0) { Error("TMethodCall R__FindScope","%s is not well formed function name",function); return 0; }
159  --nested; break;
160  case ':':
161  if (nested==0) {
162  if (i>1 && function[i-1]==':') {
163  TString scope(function);
164  scope[i-1] = 0;
165  pos = i+1;
166  TClass *cl = TClass::GetClass(scope);
167  if (!cl) gCling->ClassInfo_Init(cinfo, scope);
168  return cl;
169  }
170  }
171  break;
172  }
173  }
174  }
175  return 0;
176 }
177 
178 ////////////////////////////////////////////////////////////////////////////////
179 /// Initialize the method invocation environment based on
180 /// the CallFunc object and the TClass describing the function context.
181 
182 void TMethodCall::Init(TClass *cl, CallFunc_t *function, Long_t offset)
183 {
184  if (!function) {
185  fOffset = 0;
186  fDtorOnly = kFALSE;
187  fRetType = kNone;
188  return;
189  }
190 
191  MethodInfo_t* info = gCling->CallFunc_FactoryMethod(function);
192 
193  if (!fFunc)
195  else
197 
198  fClass = cl;
199  if (fClass) {
200  fMetPtr = new TMethod(info,cl);
201  } else {
202  fMetPtr = new TFunction(info);
203  }
204  fMethod = fMetPtr->GetName();
205  fParams = "";
206  fProto = fMetPtr->GetSignature()+1; // skip leading )
207  Ssiz_t s = fProto.Last(')');
208  fProto.Remove(s); // still need to remove default values :(
209 
210  fOffset = offset;
211 
212  fDtorOnly = kFALSE;
213  fRetType = kNone;
214 
216 
217 }
218 
219 ////////////////////////////////////////////////////////////////////////////////
220 /// Initialize the method invocation environment based on
221 /// the TFunction object.
222 
223 void TMethodCall::Init(const TFunction *function)
224 {
225  if (!function) return;
226 
227  if (!fFunc)
229  else
231 
232  const TMethod *m = dynamic_cast<const TMethod*>(function);
233  fClass = m ? m->GetClass() : 0;
234  fMetPtr = (TFunction*)function->Clone();
235  fMethod = fMetPtr->GetName();
236  fParams = "";
237  fProto = fMetPtr->GetSignature()+1; // skip leading )
238  Ssiz_t s = fProto.Last(')');
239  fProto.Remove(s); // still need to remove default values :(
240 
241  fDtorOnly = kFALSE;
242  fRetType = kNone;
243 
244  gCling->CallFunc_SetFunc(fFunc,function->fInfo);
245 
246 }
247 
248 ////////////////////////////////////////////////////////////////////////////////
249 /// Initialize the method invocation environment. Necessary input
250 /// information: the class, method name and the parameter string
251 /// of the form "\"aap\", 3, 4.35".
252 ///
253 /// To execute the method call TMethodCall::Execute(object,...).
254 /// This two step method is much more efficient than calling for
255 /// every invocation TInterpreter::Execute(...).
256 
257 void TMethodCall::Init(TClass *cl, const char *method, const char *params, Bool_t objectIsConst /* = kFALSE */)
258 {
259  ClassInfo_t *cinfo = gCling->ClassInfo_Factory();
260  if (!cl) {
261  UInt_t pos = 0;
262  cl = R__FindScope(method,pos,cinfo);
263  method = method+pos;
264  }
265  InitImplementation(method,params,0,objectIsConst,cl,cinfo);
266  gCling->ClassInfo_Delete(cinfo);
267 }
268 
269 ////////////////////////////////////////////////////////////////////////////////
270 /// Initialize the function invocation environment. Necessary input
271 /// information: the function name and the parameter string of
272 /// the form "\"aap\", 3, 4.35".
273 ///
274 /// To execute the method call TMethodCall::Execute(...).
275 /// This two step method is much more efficient than calling for
276 /// every invocation TInterpreter::Execute(...).
277 
278 void TMethodCall::Init(const char *function, const char *params)
279 {
280  UInt_t pos = 0;
281  ClassInfo_t *cinfo = gCling->ClassInfo_Factory();
282  TClass *cl = R__FindScope(function,pos,cinfo);
283  InitImplementation(function+pos, params, 0, false, cl, cinfo);
284  gCling->ClassInfo_Delete(cinfo);
285 }
286 
287 ////////////////////////////////////////////////////////////////////////////////
288 /// This function implements Init and InitWithPrototype.
289 ///
290 /// 'methodname' should NOT have any scope information in it. The scope
291 /// information should be passed via the TClass or CINT ClassInfo.
292 
293 void TMethodCall::InitImplementation(const char *methodname, const char *params,
294  const char *proto,
295  Bool_t objectIsConst, TClass *cl,
296  const ClassInfo_t *cinfo,
297  ROOT::EFunctionMatchMode mode /* = ROOT::kConversionMatch */)
298 {
299  if (!fFunc) {
302  } else
304 
305  fClass = cl;
306  fMetPtr = 0;
307  fMethod = methodname;
308  fParams = params ? params : "";
309  fProto = proto ? proto : "";
310  fDtorOnly = kFALSE;
311  fRetType = kNone;
312 
313  ClassInfo_t *scope = 0;
314  if (cl) scope = (ClassInfo_t*)cl->GetClassInfo();
315  else scope = (ClassInfo_t*)cinfo;
316 
317  if (!scope) return;
318 
320  if (params && params[0]) {
321  gCling->CallFunc_SetFunc(fFunc, scope, (char *)methodname, (char *)params, objectIsConst, &fOffset);
322  } else if (proto && proto[0]) {
323  gCling->CallFunc_SetFuncProto(fFunc, scope, (char *)methodname, (char *)proto, objectIsConst, &fOffset, mode);
324  } else {
325  // No parameters
326  gCling->CallFunc_SetFuncProto(fFunc, scope, (char *)methodname, "", objectIsConst, &fOffset, mode);
327  }
328 }
329 
330 ////////////////////////////////////////////////////////////////////////////////
331 /// Initialize the method invocation environment. Necessary input
332 /// information: the class, method name and the prototype string of
333 /// the form: "char*,int,float".
334 ///
335 /// To execute the method call TMethodCall::Execute(object,...).
336 /// This two step method is much more efficient than calling for
337 /// every invocation TInterpreter::Execute(...).
338 
339 void TMethodCall::InitWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst /* = kFALSE */, ROOT::EFunctionMatchMode mode /* = ROOT::kConversionMatch */)
340 {
341  ClassInfo_t *cinfo = gCling->ClassInfo_Factory();
342  if (!cl) {
343  UInt_t pos = 0;
344  cl = R__FindScope(method,pos,cinfo);
345  method = method+pos;
346  }
347  InitImplementation(method, 0, proto, objectIsConst, cl, cinfo, mode);
348  gCling->ClassInfo_Delete(cinfo);
349 }
350 
351 ////////////////////////////////////////////////////////////////////////////////
352 /// Initialize the function invocation environment. Necessary input
353 /// information: the function name and the prototype string of
354 /// the form: "char*,int,float".
355 ///
356 /// To execute the method call TMethodCall::Execute(...).
357 /// This two step method is much more efficient than calling for
358 /// every invocation TInterpreter::Execute(...).
359 
360 void TMethodCall::InitWithPrototype(const char *function, const char *proto, ROOT::EFunctionMatchMode mode /* = ROOT::kConversionMatch */)
361 {
362  UInt_t pos = 0;
363  ClassInfo_t *cinfo = gCling->ClassInfo_Factory();
364  TClass *cl = R__FindScope(function,pos,cinfo);
365  InitImplementation(function+pos, 0, proto, false, cl, cinfo, mode);
366  gCling->ClassInfo_Delete(cinfo);
367 }
368 
369 ////////////////////////////////////////////////////////////////////////////////
370 /// Return true if the method call has been properly initialized and is
371 /// usable.
372 
374 {
376 }
377 
378 ////////////////////////////////////////////////////////////////////////////////
379 /// Returns the TMethod describing the method to be executed. This takes
380 /// all overriding and overloading into account (call TClass::GetMethod()).
381 /// Since finding the method is expensive the result is cached.
382 
384 {
385  // Since the object in the list of global function are often deleted
386  // we need to copy them.
387 
388  if (!fMetPtr) {
389  if (fFunc && gCling->CallFunc_IsValid(fFunc)) {
390  if (fClass) {
392  } else {
394  }
395  } else if (fClass) {
396  if (fProto == "") {
398  } else {
400  }
401  TMethod *met = dynamic_cast<TMethod*>(fMetPtr);
402  if (met) fMetPtr = new TMethod(*met);
403  } else {
404  if (fProto == "")
405  fMetPtr = gROOT->GetGlobalFunction(fMethod.Data(), fParams.Data(), kFALSE);
406  else
407  fMetPtr = gROOT->GetGlobalFunctionWithPrototype(fMethod.Data(), fProto.Data(), kFALSE);
408  if (fMetPtr) fMetPtr = new TFunction(*fMetPtr);
409  }
410  }
411 
412  return fMetPtr;
413 }
414 
415 ////////////////////////////////////////////////////////////////////////////////
416 /// Execute the method (with preset arguments) for the specified object.
417 
418 void TMethodCall::Execute(void *object)
419 {
420  if (!fFunc) return;
421 
422  void *address = 0;
423  if (object) address = (void*)((Long_t)object + fOffset);
424  if (!fDtorOnly && fMethod[0]=='~') {
425  Error("Execute","TMethodCall can no longer be use to call the operator delete and the destructor at the same time");
426  }
427  gCling->CallFunc_Exec(fFunc,address);
428 }
429 
430 ////////////////////////////////////////////////////////////////////////////////
431 /// Execute the method for the specified object and argument values.
432 
433 void TMethodCall::Execute(void *object, const char *params)
434 {
435  if (!fFunc) return;
436 
437  // SetArgs contains the necessary lock.
438  gCling->CallFunc_SetArgs(fFunc, (char *)params);
439 
440  void *address = 0;
441  if (object) address = (void*)((Long_t)object + fOffset);
442  gCling->SetTempLevel(1);
443  gCling->CallFunc_Exec(fFunc,address);
444  gCling->SetTempLevel(-1);
445 }
446 
447 ////////////////////////////////////////////////////////////////////////////////
448 /// Execute the method (with preset arguments) for the specified object.
449 
450 void TMethodCall::Execute(void *object, Long_t &retLong)
451 {
452  if (!fFunc) return;
453 
454  void *address = 0;
455  if (object) address = (void*)((Long_t)object + fOffset);
456  gCling->SetTempLevel(1);
457  retLong = gCling->CallFunc_ExecInt(fFunc,address);
458  gCling->SetTempLevel(-1);
459 }
460 
461 ////////////////////////////////////////////////////////////////////////////////
462 /// Execute the method for the specified object and argument values.
463 
464 void TMethodCall::Execute(void *object, const char *params, Long_t &retLong)
465 {
466  if (!fFunc) return;
467 
468  // SetArgs contains the necessary lock.
469  gCling->CallFunc_SetArgs(fFunc, (char *)params);
470 
471  void *address = 0;
472  if (object) address = (void*)((Long_t)object + fOffset);
473  gCling->SetTempLevel(1);
474  retLong = gCling->CallFunc_ExecInt(fFunc,address);
475  gCling->SetTempLevel(-1);
476 }
477 
478 ////////////////////////////////////////////////////////////////////////////////
479 /// Execute the method (with preset arguments) for the specified object.
480 
481 void TMethodCall::Execute(void *object, Double_t &retDouble)
482 {
483  if (!fFunc) return;
484 
485  void *address = 0;
486  if (object) address = (void*)((Long_t)object + fOffset);
487  gCling->SetTempLevel(1);
488  retDouble = gCling->CallFunc_ExecDouble(fFunc,address);
489  gCling->SetTempLevel(-1);
490 }
491 
492 ////////////////////////////////////////////////////////////////////////////////
493 /// Execute the method for the specified object and argument values.
494 
495 void TMethodCall::Execute(void *object, const char *params, Double_t &retDouble)
496 {
497  if (!fFunc) return;
498 
499  gCling->CallFunc_SetArgs(fFunc, (char *)params);
500 
501  void *address = 0;
502  if (object) address = (void*)((Long_t)object + fOffset);
503  gCling->SetTempLevel(1);
504  retDouble = gCling->CallFunc_ExecDouble(fFunc,address);
505  gCling->SetTempLevel(-1);
506 }
507 
508 ////////////////////////////////////////////////////////////////////////////////
509 /// Execute the method (with preset arguments) for the specified object.
510 
511 void TMethodCall::Execute(void *object, char **retText)
512 {
513  if (!fFunc) return;
514 
515  void *address = 0;
516  if (object) address = (void*)((Long_t)object + fOffset);
517  gCling->SetTempLevel(1);
518  *retText =(char*) (gCling->CallFunc_ExecInt(fFunc,address));
519  gCling->SetTempLevel(-1);
520 }
521 
522 ////////////////////////////////////////////////////////////////////////////////
523 /// Execute the method for the specified object and argument values.
524 
525 void TMethodCall::Execute(void *object, const char *params, char **retText)
526 {
527  if (!fFunc) return;
528 
529  // SetArgs contains the necessary lock.
530  gCling->CallFunc_SetArgs(fFunc, (char *)params);
531 
532  void *address = 0;
533  if (object) address = (void*)((Long_t)object + fOffset);
534  gCling->SetTempLevel(1);
535  *retText =(char*)(gCling->CallFunc_ExecInt(fFunc,address));
536  gCling->SetTempLevel(-1);
537 }
538 
539 ////////////////////////////////////////////////////////////////////////////////
540 /// Invoke the method
541 ///
542 /// \param[in] objAddress Address of the object to execute the method (nullptr if it is a free function)
543 /// \param[in] args Array of pointer to the address of the argument to pass to the
544 /// function as is. *No* conversion is done, the argument must be
545 /// of the expected type.
546 /// \param[in] nargs Number of arguments passed (must be less than actua size of args
547 /// \param[out] ret Address of value (or object) to use for the return value.
548 
549 void TMethodCall::Execute(void *objAddress, const void* args[], int nargs, void *ret /* = 0 */)
550 {
551  if (!fFunc) return;
552 
553  gCling->CallFunc_ExecWithArgsAndReturn(fFunc,objAddress,args,nargs,ret);
554 
555 }
556 
557 ////////////////////////////////////////////////////////////////////////////////
558 /// Returns the return type of the method. Either (unsigned) long,
559 /// int, short and char, or float and double or anything else.
560 /// Since finding the return type is expensive the result is cached.
561 
563 {
564  if ( fRetType == kNone) {
565  TFunction *func = GetMethod();
566  if (func == 0) {
567  fRetType = kOther;
568  Error("ReturnType","Unknown method");
569  return kOther;
570  }
571 
573  }
574 
575  return fRetType;
576 }
577 
578 ////////////////////////////////////////////////////////////////////////////////
579 /// ParamArr is an array containing the function argument values.
580 /// If nparam = -1 then paramArr must contain values for all function
581 /// arguments, otherwise Nargs-NargsOpt <= nparam <= Nargs, where
582 /// Nargs is the number of all arguments and NargsOpt is the number
583 /// of default arguments.
584 
585 void TMethodCall::SetParamPtrs(void *paramArr, Int_t nparam)
586 {
587  if (!fFunc) return;
588  gCling->CallFunc_SetArgArray(fFunc,(Long_t *)paramArr, nparam);
589 }
590 
591 ////////////////////////////////////////////////////////////////////////////////
592 /// Reset parameter list. To be used before the first call the SetParam().
593 
595 {
596  if (!fFunc) return;
598 }
599 
600 ////////////////////////////////////////////////////////////////////////////////
601 /// Add a long method parameter.
602 
604 {
605  if (!fFunc) return;
607 }
608 
609 ////////////////////////////////////////////////////////////////////////////////
610 /// Add a double method parameter.
611 
613 {
614  if (!fFunc) return;
616 }
617 
618 ////////////////////////////////////////////////////////////////////////////////
619 /// Add a double method parameter.
620 
622 {
623  if (!fFunc) return;
625 }
626 
627 ////////////////////////////////////////////////////////////////////////////////
628 /// Add a long long method parameter.
629 
631 {
632  if (!fFunc) return;
634 }
635 
636 ////////////////////////////////////////////////////////////////////////////////
637 /// Add a unsigned long long method parameter.
638 
640 {
641  if (!fFunc) return;
643 }
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual void CallFunc_SetFuncProto(CallFunc_t *, ClassInfo_t *, const char *, const char *, Long_t *, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
Definition: TInterpreter.h:353
TString fMethod
Definition: TMethodCall.h:62
virtual TObject * Clone(const char *newname="") const
Clone method.
Definition: TFunction.cxx:96
long long Long64_t
Definition: RtypesCore.h:69
virtual CallFunc_t * CallFunc_Factory() const
Definition: TInterpreter.h:284
virtual void CallFunc_SetArgArray(CallFunc_t *, Long_t *, Int_t) const
Definition: TInterpreter.h:292
float Float_t
Definition: RtypesCore.h:53
static const EReturnType kOther
Definition: TMethodCall.h:50
TMethodCall()
Default TMethodCall ctor.
Definition: TMethodCall.cxx:37
R__EXTERN TVirtualMutex * gInterpreterMutex
Definition: TInterpreter.h:46
virtual CallFunc_t * CallFunc_FactoryCopy(CallFunc_t *) const
Definition: TInterpreter.h:285
virtual void CallFunc_ExecWithArgsAndReturn(CallFunc_t *, void *, const void *[]=0, int=0, void *=0) const
Definition: TInterpreter.h:280
CallFunc_t * fFunc
Definition: TMethodCall.h:58
#define gROOT
Definition: TROOT.h:364
Basic string class.
Definition: TString.h:137
Long_t fOffset
Definition: TMethodCall.h:59
EReturnType fRetType
Definition: TMethodCall.h:66
virtual Long_t CallFunc_ExecInt(CallFunc_t *, void *) const
Definition: TInterpreter.h:281
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
static TClass * R__FindScope(const char *function, UInt_t &pos, ClassInfo_t *cinfo)
Helper function to find the scope associated with a qualified function name.
void SetParamPtrs(void *paramArr, Int_t nparam=-1)
ParamArr is an array containing the function argument values.
virtual Double_t CallFunc_ExecDouble(CallFunc_t *, void *) const
Definition: TInterpreter.h:283
virtual void CallFunc_SetArg(CallFunc_t *, Long_t) const =0
TFunction * fMetPtr
Definition: TMethodCall.h:61
void Init(const TFunction *func)
Initialize the method invocation environment based on the TFunction object.
virtual ClassInfo_t * ClassInfo_Factory(Bool_t=kTRUE) const =0
~TMethodCall()
TMethodCall dtor.
EFunctionMatchMode
Definition: TDictionary.h:155
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:391
virtual void CallFunc_SetFunc(CallFunc_t *, ClassInfo_t *, const char *, const char *, bool, Long_t *) const
Definition: TInterpreter.h:350
Method or function calling interface.
Definition: TMethodCall.h:41
virtual EReturnType MethodCallReturnType(TFunction *func) const =0
TObject * Clone(const char *newname="") const
Return an exact copy of this object.
TString fParams
Definition: TMethodCall.h:63
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:925
const Handle_t kNone
Definition: GuiTypes.h:89
virtual void CallFunc_Init(CallFunc_t *) const
Definition: TInterpreter.h:288
TLine * l
Definition: textangle.C:4
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
Bool_t IsValid() const
Return true if the method call has been properly initialized and is usable.
void Execute()
Definition: TMethodCall.h:135
void InitWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Initialize the method invocation environment.
#define R__LOCKGUARD2(mutex)
Bool_t fDtorOnly
Definition: TMethodCall.h:65
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
long Long_t
Definition: RtypesCore.h:50
int Ssiz_t
Definition: RtypesCore.h:63
TFunction * GetMethod()
Returns the TMethod describing the method to be executed.
#define ClassImp(name)
Definition: Rtypes.h:279
double f(double x)
void ResetParam()
Reset parameter list. To be used before the first call the SetParam().
virtual void ClassInfo_Init(ClassInfo_t *, const char *) const
Definition: TInterpreter.h:374
double Double_t
Definition: RtypesCore.h:55
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:865
unsigned long long ULong64_t
Definition: RtypesCore.h:70
virtual void CallFunc_SetArgs(CallFunc_t *, const char *) const
Definition: TInterpreter.h:293
virtual void CallFunc_Delete(CallFunc_t *) const
Definition: TInterpreter.h:276
double func(double *x, double *p)
Definition: stressTF1.cxx:213
TMethod * GetMethod(const char *method, const char *params, Bool_t objectIsConst=kFALSE)
Find the best method (if there is one) matching the parameters.
Definition: TClass.cxx:4176
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.
Definition: TClass.cxx:2893
Mother of all ROOT objects.
Definition: TObject.h:37
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
virtual void ClassInfo_Delete(ClassInfo_t *) const
Definition: TInterpreter.h:362
TString fProto
Definition: TMethodCall.h:64
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:40
void SetParam(Long_t l)
Add a long method parameter.
TClass * GetClass() const
Definition: TMethod.h:57
const char * proto
Definition: civetweb.c:11652
virtual void SetTempLevel(int) const
Definition: TInterpreter.h:239
virtual Bool_t CallFunc_IsValid(CallFunc_t *) const
Definition: TInterpreter.h:289
virtual void CallFunc_Exec(CallFunc_t *, void *) const
Definition: TInterpreter.h:277
void InitImplementation(const char *methodname, const char *params, const char *proto, Bool_t objectIsConst, TClass *cl, const ClassInfo_t *cinfo, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
This function implements Init and InitWithPrototype.
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:519
static const EReturnType kNone
Definition: TMethodCall.h:53
TMethodCall & operator=(const TMethodCall &rhs)
Assignment operator.
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
Definition: TClass.cxx:4225
virtual void CallFunc_ResetArg(CallFunc_t *) const
Definition: TInterpreter.h:291
TClass * fClass
Definition: TMethodCall.h:60
virtual MethodInfo_t * CallFunc_FactoryMethod(CallFunc_t *) const
Definition: TInterpreter.h:286
EReturnType ReturnType()
Returns the return type of the method.
const char * GetSignature()
Return signature of function.
Definition: TFunction.cxx:115
const char * Data() const
Definition: TString.h:349