ROOT  6.06/09
Reference Guide
TSelectorCint.cxx
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Rene Brun 05/02/97
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 TSelectorCint
13 This class is a special version of TSelector for user interpreted classes.
14 */
15 
16 #include "TROOT.h"
17 #include "TTree.h"
18 #include "THashList.h"
19 #include "TSelectorCint.h"
20 #include "TError.h"
21 
23 
24 ////////////////////////////////////////////////////////////////////////////////
25 
27  fClass(0),
28  fFuncVersion (0),
29  fFuncInit (0),
30  fFuncBegin (0),
31  fFuncSlBegin (0),
32  fFuncNotif (0),
33  fFuncSlTerm (0),
34  fFuncTerm (0),
35  fFuncCut (0),
36  fFuncFill (0),
37  fFuncProc (0),
38  fFuncOption (0),
39  fFuncObj (0),
40  fFuncInp (0),
41  fFuncOut (0),
42  fFuncAbort (0),
43  fFuncGetAbort (0),
44  fFuncResetAbort (0),
45  fFuncGetStat (0),
46  fIntSelector(0),fIsOwner(kFALSE)
47 
48 {
49  // Default constructor for a Selector.
50 
51 }
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Destructor for a Selector.
55 
57 {
76 
79 }
80 
81 ////////////////////////////////////////////////////////////////////////////////
82 /// Set the function prototype.
83 
84 void TSelectorCint::SetFuncProto(CallFunc_t *cf, ClassInfo_t *cl,
85  const char* fname, const char* argtype,
86  Bool_t required)
87 {
88  Long_t offset = 0;
89 
90  gCling->CallFunc_SetFuncProto(cf, cl,fname,argtype,&offset);
91 
92  if (gDebug > 2)
93  Info("SetFuncProto","set %s(%s) offset = %ld",fname,argtype,offset);
94 
95  if (!gCling->CallFunc_IsValid(cf) && required)
96  Error("SetFuncProto","cannot set %s(%s)",fname,argtype);
97 }
98 
99 ////////////////////////////////////////////////////////////////////////////////
100 /// Initialize the CallFunc objects when selector is interpreted.
101 
102 void TSelectorCint::Build(TSelector *iselector, ClassInfo_t *cl, Bool_t isowner)
103 {
122 
125 
126  R__ASSERT(cl);
127 
128  // The CINT MethodInfo created by SetFuncProto will remember the address
129  // of cl, so we need to keep it around.
131 
132  fIntSelector = iselector;
133  fIsOwner = isowner;
152 
153  SetFuncProto(fFuncVersion,fClass,"Version","",kFALSE);
154  SetFuncProto(fFuncInit,fClass,"Init","TTree*");
155  SetFuncProto(fFuncBegin,fClass,"Begin","TTree*");
156  SetFuncProto(fFuncSlBegin,fClass,"SlaveBegin","TTree*",kFALSE);
157  SetFuncProto(fFuncNotif,fClass,"Notify","");
158  SetFuncProto(fFuncSlTerm,fClass,"SlaveTerminate","",kFALSE);
159  SetFuncProto(fFuncTerm,fClass,"Terminate","");
160  SetFuncProto(fFuncCut,fClass,"ProcessCut","Long64_t",kFALSE);
161  SetFuncProto(fFuncFill,fClass,"ProcessFill","Long64_t",kFALSE);
162  SetFuncProto(fFuncProc,fClass,"Process","Long64_t",kFALSE);
163  SetFuncProto(fFuncOption,fClass,"SetOption","const char*");
164  SetFuncProto(fFuncObj,fClass,"SetObject","TObject*");
165  SetFuncProto(fFuncInp,fClass,"SetInputList","TList*");
166  SetFuncProto(fFuncOut,fClass,"GetOutputList","");
167  SetFuncProto(fFuncAbort,fClass,"Abort","const char *,TSelector::EAbort",kFALSE);
168  SetFuncProto(fFuncGetAbort,fClass,"GetAbort","",kFALSE);
169  SetFuncProto(fFuncResetAbort,fClass,"ResetAbort","",kFALSE);
170  SetFuncProto(fFuncGetStat,fClass,"GetStatus","");
171 }
172 
173 ////////////////////////////////////////////////////////////////////////////////
174 /// Invoke the Version function via the interpreter.
175 
177 {
178  if (gDebug > 2)
179  Info("Version","Call Version");
180 
184  } else {
185  return 0; // emulate for old version
186  }
187 }
188 
189 ////////////////////////////////////////////////////////////////////////////////
190 /// Invoke the Init function via the interpreter.
191 
193 {
194  if (gDebug > 2)
195  Info("Init","Call Init tree = %p", tree);
196 
200 }
201 
202 ////////////////////////////////////////////////////////////////////////////////
203 /// Invoke the Begin function via the interpreter.
204 
206 {
207  if (gDebug > 2)
208  Info("Begin","Call Begin tree = %p", tree);
212 }
213 
214 ////////////////////////////////////////////////////////////////////////////////
215 /// Invoke the SlaveBegin function via the interpreter if available.
216 
218 {
219  if (gDebug > 2)
220  Info("SlaveBegin","Call SlaveBegin tree = %p", tree);
221 
226  } else {
227  if (gDebug > 1)
228  Info("SlaveBegin","SlaveBegin unavailable");
229  }
230 }
231 
232 ////////////////////////////////////////////////////////////////////////////////
233 /// Invoke the Notify function via the interpreter.
234 
236 {
237  if (gDebug > 2)
238  Info("Notify","Call Notify");
240  return (Bool_t)sel;
241 }
242 
243 ////////////////////////////////////////////////////////////////////////////////
244 /// Invoke the ProcessCut function via the interpreter.
245 
247 {
248  if (gDebug > 3)
249  Info("ProcessCut","Call ProcessCut entry = %lld", entry);
250 
255  return (Bool_t)sel;
256  } else {
257  Error("ProcessCut","ProcessCut unavailable");
258  return kFALSE;
259  }
260 }
261 
262 ////////////////////////////////////////////////////////////////////////////////
263 /// Invoke the ProcessFill function via the interpreter.
264 
266 {
267  if (gDebug > 3)
268  Info("ProcessFill","Call ProcessFill entry = %lld", entry);
269 
274  } else {
275  Error("ProcessFill","ProcessFill unavailable");
276  }
277 }
278 
279 ////////////////////////////////////////////////////////////////////////////////
280 /// Invoke the ProcessCut function via the interpreter.
281 
283 {
284  if (gDebug > 3)
285  Info("Process","Call Process entry = %lld", entry);
286 
291  return (Bool_t)sel;
292  } else {
293  Error("Process","Process unavailable");
294  return kFALSE;
295  }
296 }
297 
298 ////////////////////////////////////////////////////////////////////////////////
299 /// Set the selector option.
300 
301 void TSelectorCint::SetOption(const char *option)
302 {
303  if (gDebug > 2)
304  Info("SetOption","Option = %s", option);
308 }
309 
310 ////////////////////////////////////////////////////////////////////////////////
311 /// Set the current object.
312 
314 {
315  if (gDebug > 3)
316  Info("SetObject","Object = %p", obj);
320 }
321 
322 ////////////////////////////////////////////////////////////////////////////////
323 /// Set the selector list of input objects.
324 
326 {
327  if (gDebug > 2)
328  Info("SetInputList","Object = %p", input);
332 }
333 
334 ////////////////////////////////////////////////////////////////////////////////
335 /// Return the list of output object.
336 
338 {
340 
341  if (gDebug > 2)
342  Info("GetOutputList","List = %p", out);
343 
344  return out;
345 }
346 
347 ////////////////////////////////////////////////////////////////////////////////
348 /// Invoke the SlaveTerminate function via the interpreter if available.
349 
351 {
352  if (gDebug > 2)
353  Info("SlaveTerminate","Call SlaveTerminate");
354 
357  } else {
358  if (gDebug > 1)
359  Info("SlaveTerminate","SlaveTerminate unavailable");
360  }
361 }
362 
363 ////////////////////////////////////////////////////////////////////////////////
364 /// Invoke the Terminate function via the interpreter.
365 
367 {
368  if (gDebug > 2)
369  Info("Terminate","Call Terminate");
371 }
372 
373 ////////////////////////////////////////////////////////////////////////////////
374 /// Invoke the GetAbort function via the interpreter.
375 
376 void TSelectorCint::Abort(const char *mesg, EAbort what)
377 {
378  if (gDebug > 2)
379  Info("Abort","Call Abort");
380 
386  }
387 }
388 
389 ////////////////////////////////////////////////////////////////////////////////
390 /// Invoke the GetAbort function via the interpreter.
391 
393 {
394  if (gDebug > 2)
395  Info("GetAbort","Call GetAbort");
396 
400  } else {
401  return kContinue; // emulate for old version
402  }
403 }
404 
405 ////////////////////////////////////////////////////////////////////////////////
406 /// Invoke the GetAbort function via the interpreter.
407 
409 {
410  if (gDebug > 2)
411  Info("ResetAbort","Call ResetAbort");
412 
416  }
417 }
418 
419 ////////////////////////////////////////////////////////////////////////////////
420 /// Invoke the GetStatus function via the interpreter.
421 
423 {
424  if (gDebug > 2)
425  Info("GetStatus","Call GetStatus");
426 
430  } else {
431  return 0; // emulate for old version
432  }
433 }
434 
435 ////////////////////////////////////////////////////////////////////////////////
436 /// Retrieve the TClass object for the interpreted class.
437 
439 {
440  if (!fClass) return 0;
442 }
virtual void CallFunc_SetFuncProto(CallFunc_t *, ClassInfo_t *, const char *, const char *, Long_t *, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
Definition: TInterpreter.h:338
CallFunc_t * fFuncBegin
Definition: TSelectorCint.h:42
CallFunc_t * fFuncOption
Definition: TSelectorCint.h:50
CallFunc_t * fFuncVersion
Definition: TSelectorCint.h:40
long long Long64_t
Definition: RtypesCore.h:69
ClassImp(TSelectorCint) TSelectorCint
virtual void ClassInfo_Delete(ClassInfo_t *) const
Definition: TInterpreter.h:347
virtual TList * GetOutputList() const
Return the list of output object.
virtual void CallFunc_Exec(CallFunc_t *, void *) const
Definition: TInterpreter.h:262
virtual void ProcessFill(Long64_t entry)
Invoke the ProcessFill function via the interpreter.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:892
virtual void CallFunc_Delete(CallFunc_t *) const
Definition: TInterpreter.h:261
CallFunc_t * fFuncFill
Definition: TSelectorCint.h:48
#define R__ASSERT(e)
Definition: TError.h:98
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TSelector * fIntSelector
Definition: TSelectorCint.h:58
virtual void Terminate()
Invoke the Terminate function via the interpreter.
virtual void SetObject(TObject *obj)
Set the current object.
CallFunc_t * fFuncNotif
Definition: TSelectorCint.h:44
ClassInfo_t * fClass
Definition: TSelectorCint.h:39
virtual void SetInputList(TList *input)
Set the selector list of input objects.
virtual void CallFunc_SetArg(CallFunc_t *, Long_t) const =0
CallFunc_t * fFuncSlTerm
Definition: TSelectorCint.h:45
virtual void Abort(const char *why, EAbort what=kAbortProcess)
Invoke the GetAbort function via the interpreter.
virtual ClassInfo_t * ClassInfo_Factory(Bool_t=kTRUE) const =0
CallFunc_t * fFuncTerm
Definition: TSelectorCint.h:46
CallFunc_t * fFuncCut
Definition: TSelectorCint.h:47
TClass * fClass
pointer to the foreign object
CallFunc_t * fFuncInp
Definition: TSelectorCint.h:52
virtual void SetOption(const char *option)
Set the selector option.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
virtual void Init(TTree *)
Invoke the Init function via the interpreter.
virtual Long_t CallFunc_ExecInt(CallFunc_t *, void *) const
Definition: TInterpreter.h:266
char * out
Definition: TBase64.cxx:29
virtual Bool_t Process(Long64_t entry)
Invoke the ProcessCut function via the interpreter.
A doubly linked list.
Definition: TList.h:47
static const char * what
Definition: stlLoader.cc:6
virtual Long64_t CallFunc_ExecInt64(CallFunc_t *, void *) const
Definition: TInterpreter.h:267
virtual const char * ClassInfo_FullName(ClassInfo_t *) const
Definition: TInterpreter.h:376
virtual void ResetAbort()
Invoke the GetAbort function via the interpreter.
CallFunc_t * fFuncSlBegin
Definition: TSelectorCint.h:43
CallFunc_t * fFuncResetAbort
Definition: TSelectorCint.h:56
void SetFuncProto(CallFunc_t *cf, ClassInfo_t *cl, const char *fname, const char *argtype, Bool_t required=kTRUE)
Set the function prototype.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
Long64_t entry
virtual void CallFunc_ResetArg(CallFunc_t *) const
Definition: TInterpreter.h:276
long Long_t
Definition: RtypesCore.h:50
virtual void Build(TSelector *iselector, ClassInfo_t *cl, Bool_t isowner=kTRUE)
Initialize the CallFunc objects when selector is interpreted.
virtual CallFunc_t * CallFunc_Factory() const
Definition: TInterpreter.h:269
CallFunc_t * fFuncGetStat
Definition: TSelectorCint.h:57
CallFunc_t * fFuncInit
Definition: TSelectorCint.h:41
virtual TClass * GetInterpretedClass() const
Retrieve the TClass object for the interpreted class.
CallFunc_t * fFuncAbort
Definition: TSelectorCint.h:54
CallFunc_t * fFuncObj
Definition: TSelectorCint.h:51
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:2881
virtual Bool_t Notify()
Invoke the Notify function via the interpreter.
Mother of all ROOT objects.
Definition: TObject.h:58
virtual void SlaveTerminate()
Invoke the SlaveTerminate function via the interpreter if available.
CallFunc_t * fFuncOut
Definition: TSelectorCint.h:53
virtual Long64_t GetStatus() const
Invoke the GetStatus function via the interpreter.
virtual void SlaveBegin(TTree *)
Invoke the SlaveBegin function via the interpreter if available.
virtual Bool_t ProcessCut(Long64_t entry)
Invoke the ProcessCut function via the interpreter.
virtual int Version() const
Invoke the Version function via the interpreter.
virtual void Begin(TTree *tree)
Invoke the Begin function via the interpreter.
R__EXTERN Int_t gDebug
Definition: Rtypes.h:128
CallFunc_t * fFuncGetAbort
Definition: TSelectorCint.h:55
A TTree object has a header with a name and a title.
Definition: TTree.h:94
This class is a special version of TSelector for user interpreted classes.
Definition: TSelectorCint.h:32
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:504
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:39
const Bool_t kTRUE
Definition: Rtypes.h:91
TObject * obj
CallFunc_t * fFuncProc
Definition: TSelectorCint.h:49
virtual ~TSelectorCint()
Destructor for a Selector.
virtual EAbort GetAbort() const
Invoke the GetAbort function via the interpreter.
virtual Bool_t CallFunc_IsValid(CallFunc_t *) const
Definition: TInterpreter.h:274