Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
13Method or function calling interface. Objects of this class contain
14the (CINT) environment to call a global function or a method for an
15object of a specific class with the desired arguments. This class is
16especially useful when a method has to be called more times for
17different objects and/or with different arguments. If a function or
18method needs to be called only once one better uses
19TInterpreter::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
38fFunc(nullptr), fOffset(0), fClass(nullptr), fMetPtr(nullptr), 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
46TMethodCall::TMethodCall(TClass *cl, CallFunc_t *callfunc, Longptr_t offset):
47fFunc(nullptr), fOffset(0), fClass(nullptr), fMetPtr(nullptr), 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
59TMethodCall::TMethodCall(TClass *cl, const char *method, const char *params):
60fFunc(nullptr), fOffset(0), fClass(nullptr), fMetPtr(nullptr), fDtorOnly(kFALSE), fRetType(kNone)
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
72TMethodCall::TMethodCall(const char *function, const char *params):
73fFunc(nullptr), fOffset(0), fClass(nullptr), fMetPtr(nullptr), fDtorOnly(kFALSE), fRetType(kNone)
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
85fFunc(nullptr), fOffset(0), fClass(nullptr), fMetPtr(nullptr), fDtorOnly(kFALSE), fRetType(kNone)
86{
87 Init(func);
88}
89////////////////////////////////////////////////////////////////////////////////
90/// Copy ctor.
91
93TObject(orig),
94fFunc(orig.fFunc ? gCling->CallFunc_FactoryCopy(orig.fFunc) : nullptr),
95fOffset(orig.fOffset), fClass(orig.fClass), fMetPtr(nullptr /*!*/),
96fMethod(orig.fMethod), fParams(orig.fParams), fProto(orig.fProto),
97fDtorOnly(orig.fDtorOnly), fRetType(orig.fRetType)
98{
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// Assignment operator.
103
105{
106 if (this != &rhs) {
108 fFunc = rhs.fFunc ? gCling->CallFunc_FactoryCopy(rhs.fFunc) : nullptr;
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 = nullptr;
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
136TObject *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
146static 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 nullptr; }
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 nullptr;
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Initialize the method invocation environment based on
180/// the CallFunc object and the TClass describing the function context.
181
183{
184 if (!function) {
185 fOffset = 0;
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 }
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
213 fRetType = kNone;
214
216
217}
218
219////////////////////////////////////////////////////////////////////////////////
220/// Initialize the method invocation environment based on
221/// the TFunction object.
222
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() : nullptr;
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
242 fRetType = kNone;
243
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
257void 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,nullptr,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
278void 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, nullptr, 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
293void 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 = nullptr;
307 fMethod = methodname;
308 fParams = params ? params : "";
309 fProto = proto ? proto : "";
311 fRetType = kNone;
312
313 ClassInfo_t *scope = nullptr;
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
339void 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, nullptr, 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
360void 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, nullptr, 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) {
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
418void TMethodCall::Execute(void *object)
419{
420 if (!fFunc) return;
421
422 void *address = nullptr;
423 if (object) address = (void*)((Longptr_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
433void 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 = nullptr;
441 if (object) address = (void*)((Longptr_t)object + fOffset);
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
450void TMethodCall::Execute(void *object, Longptr_t &retLong)
451{
452 if (!fFunc) return;
453
454 void *address = nullptr;
455 if (object) address = (void*)((Longptr_t)object + fOffset);
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
464void TMethodCall::Execute(void *object, const char *params, Longptr_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 = nullptr;
472 if (object) address = (void*)((Longptr_t)object + fOffset);
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
481void TMethodCall::Execute(void *object, Double_t &retDouble)
482{
483 if (!fFunc) return;
484
485 void *address = nullptr;
486 if (object) address = (void*)((Longptr_t)object + fOffset);
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
495void 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 = nullptr;
502 if (object) address = (void*)((Longptr_t)object + fOffset);
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
511void TMethodCall::Execute(void *object, char **retText)
512{
513 if (!fFunc) return;
514
515 void *address = nullptr;
516 if (object) address = (void*)((Longptr_t)object + fOffset);
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
525void 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 = nullptr;
533 if (object) address = (void*)((Longptr_t)object + fOffset);
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
549void 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 == nullptr) {
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
585void TMethodCall::SetParamPtrs(void *paramArr, Int_t nparam)
586{
587 if (!fFunc) return;
588 gCling->CallFunc_SetArgArray(fFunc,(Longptr_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}
std::string fRetType
Cppyy::TCppType_t fClass
const Handle_t kNone
Definition GuiTypes.h:88
#define d(i)
Definition RSha256.hxx:102
#define f(i)
Definition RSha256.hxx:104
RooAbsReal & function()
long Longptr_t
Definition RtypesCore.h:82
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
long long Long64_t
Definition RtypesCore.h:80
unsigned long long ULong64_t
Definition RtypesCore.h:81
#define ClassImp(name)
Definition Rtypes.h:377
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char mode
R__EXTERN TVirtualMutex * gInterpreterMutex
R__EXTERN TInterpreter * gCling
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.
#define gROOT
Definition TROOT.h:406
#define R__LOCKGUARD(mutex)
const char * proto
Definition civetweb.c:17536
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
Definition RooAbsArg.h:89
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
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:4411
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:4456
ClassInfo_t * GetClassInfo() const
Definition TClass.h:431
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:2968
Global functions class (global functions are obtained from CINT).
Definition TFunction.h:30
const char * GetSignature()
Return signature of function.
virtual void CallFunc_SetArgs(CallFunc_t *, const char *) const
virtual void SetTempLevel(int) const
virtual Longptr_t CallFunc_ExecInt(CallFunc_t *, void *) const
virtual void ClassInfo_Delete(ClassInfo_t *) const
virtual EReturnType MethodCallReturnType(TFunction *func) const =0
virtual void CallFunc_ExecWithArgsAndReturn(CallFunc_t *, void *, const void *[]=nullptr, int=0, void *=nullptr) const
virtual void CallFunc_ResetArg(CallFunc_t *) const
virtual void CallFunc_SetFuncProto(CallFunc_t *, ClassInfo_t *, const char *, const char *, Longptr_t *, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
virtual void CallFunc_Exec(CallFunc_t *, void *) const
virtual CallFunc_t * CallFunc_Factory() const
virtual void CallFunc_Init(CallFunc_t *) const
virtual ClassInfo_t * ClassInfo_Factory(Bool_t=kTRUE) const =0
virtual void CallFunc_SetFunc(CallFunc_t *, ClassInfo_t *, const char *, const char *, bool, Longptr_t *) const
virtual Bool_t CallFunc_IsValid(CallFunc_t *) const
virtual void CallFunc_SetArgArray(CallFunc_t *, Longptr_t *, Int_t) const
virtual CallFunc_t * CallFunc_FactoryCopy(CallFunc_t *) const
virtual void ClassInfo_Init(ClassInfo_t *, const char *) const
virtual void CallFunc_Delete(CallFunc_t *) const
virtual MethodInfo_t * CallFunc_FactoryMethod(CallFunc_t *) const
virtual Double_t CallFunc_ExecDouble(CallFunc_t *, void *) const
virtual void CallFunc_SetArg(CallFunc_t *, Long_t) const =0
Method or function calling interface.
Definition TMethodCall.h:37
EReturnType ReturnType()
Returns the return type of the method.
TMethodCall()
Default TMethodCall ctor.
TFunction * fMetPtr
Definition TMethodCall.h:57
TMethodCall & operator=(const TMethodCall &rhs)
Assignment operator.
~TMethodCall()
TMethodCall dtor.
Bool_t fDtorOnly
Definition TMethodCall.h:61
TString fParams
Definition TMethodCall.h:59
EReturnType fRetType
Definition TMethodCall.h:62
void ResetParam()
Reset parameter list. To be used before the first call the SetParam().
TObject * Clone(const char *newname="") const override
Return an exact copy of this object.
Longptr_t fOffset
Definition TMethodCall.h:55
static const EReturnType kOther
Definition TMethodCall.h:46
CallFunc_t * fFunc
Definition TMethodCall.h:54
TClass * fClass
Definition TMethodCall.h:56
TFunction * GetMethod()
Returns the TMethod describing the method to be executed.
static const EReturnType kNone
Definition TMethodCall.h:49
void Init(const TFunction *func)
Initialize the method invocation environment based on the TFunction object.
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.
Bool_t IsValid() const
Return true if the method call has been properly initialized and is usable.
TString fProto
Definition TMethodCall.h:60
void InitWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Initialize the method invocation environment.
void Execute()
void SetParam(Long_t l)
Add a long method parameter.
void SetParamPtrs(void *paramArr, Int_t nparam=-1)
ParamArr is an array containing the function argument values.
TString fMethod
Definition TMethodCall.h:58
Each ROOT class (see TClass) has a linked list of methods.
Definition TMethod.h:38
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition TString.cxx:931
TString & Remove(Ssiz_t pos)
Definition TString.h:685
EFunctionMatchMode
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4