Logo ROOT   6.08/07
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 \ingroup tree
14 
15 This class is a special version of TSelector for user interpreted classes.
16 */
17 
18 #include "TROOT.h"
19 #include "TTree.h"
20 #include "THashList.h"
21 #include "TSelectorCint.h"
22 #include "TError.h"
23 
25 
26 ////////////////////////////////////////////////////////////////////////////////
27 
29  fClass(0),
30  fFuncVersion (0),
31  fFuncInit (0),
32  fFuncBegin (0),
33  fFuncSlBegin (0),
34  fFuncNotif (0),
35  fFuncSlTerm (0),
36  fFuncTerm (0),
37  fFuncCut (0),
38  fFuncFill (0),
39  fFuncProc (0),
40  fFuncOption (0),
41  fFuncObj (0),
42  fFuncInp (0),
43  fFuncOut (0),
44  fFuncAbort (0),
45  fFuncGetAbort (0),
46  fFuncResetAbort (0),
47  fFuncGetStat (0),
48  fIntSelector(0),fIsOwner(kFALSE)
49 
50 {
51  // Default constructor for a Selector.
52 
53 }
54 
55 ////////////////////////////////////////////////////////////////////////////////
56 /// Destructor for a Selector.
57 
59 {
78 
81 }
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Set the function prototype.
85 
86 void TSelectorCint::SetFuncProto(CallFunc_t *cf, ClassInfo_t *cl,
87  const char* fname, const char* argtype,
88  Bool_t required)
89 {
90  Long_t offset = 0;
91 
92  gCling->CallFunc_SetFuncProto(cf, cl,fname,argtype,&offset);
93 
94  if (gDebug > 2)
95  Info("SetFuncProto","set %s(%s) offset = %ld",fname,argtype,offset);
96 
97  if (!gCling->CallFunc_IsValid(cf) && required)
98  Error("SetFuncProto","cannot set %s(%s)",fname,argtype);
99 }
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 /// Initialize the CallFunc objects when selector is interpreted.
103 
104 void TSelectorCint::Build(TSelector *iselector, ClassInfo_t *cl, Bool_t isowner)
105 {
124 
127 
128  R__ASSERT(cl);
129 
130  // The CINT MethodInfo created by SetFuncProto will remember the address
131  // of cl, so we need to keep it around.
133 
134  fIntSelector = iselector;
135  fIsOwner = isowner;
154 
155  SetFuncProto(fFuncVersion,fClass,"Version","",kFALSE);
156  SetFuncProto(fFuncInit,fClass,"Init","TTree*");
157  SetFuncProto(fFuncBegin,fClass,"Begin","TTree*");
158  SetFuncProto(fFuncSlBegin,fClass,"SlaveBegin","TTree*",kFALSE);
159  SetFuncProto(fFuncNotif,fClass,"Notify","");
160  SetFuncProto(fFuncSlTerm,fClass,"SlaveTerminate","",kFALSE);
161  SetFuncProto(fFuncTerm,fClass,"Terminate","");
162  SetFuncProto(fFuncCut,fClass,"ProcessCut","Long64_t",kFALSE);
163  SetFuncProto(fFuncFill,fClass,"ProcessFill","Long64_t",kFALSE);
164  SetFuncProto(fFuncProc,fClass,"Process","Long64_t",kFALSE);
165  SetFuncProto(fFuncOption,fClass,"SetOption","const char*");
166  SetFuncProto(fFuncObj,fClass,"SetObject","TObject*");
167  SetFuncProto(fFuncInp,fClass,"SetInputList","TList*");
168  SetFuncProto(fFuncOut,fClass,"GetOutputList","");
169  SetFuncProto(fFuncAbort,fClass,"Abort","const char *,TSelector::EAbort",kFALSE);
170  SetFuncProto(fFuncGetAbort,fClass,"GetAbort","",kFALSE);
171  SetFuncProto(fFuncResetAbort,fClass,"ResetAbort","",kFALSE);
172  SetFuncProto(fFuncGetStat,fClass,"GetStatus","");
173 }
174 
175 ////////////////////////////////////////////////////////////////////////////////
176 /// Invoke the Version function via the interpreter.
177 
179 {
180  if (gDebug > 2)
181  Info("Version","Call Version");
182 
186  } else {
187  return 0; // emulate for old version
188  }
189 }
190 
191 ////////////////////////////////////////////////////////////////////////////////
192 /// Invoke the Init function via the interpreter.
193 
195 {
196  if (gDebug > 2)
197  Info("Init","Call Init tree = %p", tree);
198 
202 }
203 
204 ////////////////////////////////////////////////////////////////////////////////
205 /// Invoke the Begin function via the interpreter.
206 
208 {
209  if (gDebug > 2)
210  Info("Begin","Call Begin tree = %p", tree);
214 }
215 
216 ////////////////////////////////////////////////////////////////////////////////
217 /// Invoke the SlaveBegin function via the interpreter if available.
218 
220 {
221  if (gDebug > 2)
222  Info("SlaveBegin","Call SlaveBegin tree = %p", tree);
223 
228  } else {
229  if (gDebug > 1)
230  Info("SlaveBegin","SlaveBegin unavailable");
231  }
232 }
233 
234 ////////////////////////////////////////////////////////////////////////////////
235 /// Invoke the Notify function via the interpreter.
236 
238 {
239  if (gDebug > 2)
240  Info("Notify","Call Notify");
242  return (Bool_t)sel;
243 }
244 
245 ////////////////////////////////////////////////////////////////////////////////
246 /// Invoke the ProcessCut function via the interpreter.
247 
249 {
250  if (gDebug > 3)
251  Info("ProcessCut","Call ProcessCut entry = %lld", entry);
252 
257  return (Bool_t)sel;
258  } else {
259  Error("ProcessCut","ProcessCut unavailable");
260  return kFALSE;
261  }
262 }
263 
264 ////////////////////////////////////////////////////////////////////////////////
265 /// Invoke the ProcessFill function via the interpreter.
266 
268 {
269  if (gDebug > 3)
270  Info("ProcessFill","Call ProcessFill entry = %lld", entry);
271 
276  } else {
277  Error("ProcessFill","ProcessFill unavailable");
278  }
279 }
280 
281 ////////////////////////////////////////////////////////////////////////////////
282 /// Invoke the ProcessCut function via the interpreter.
283 
285 {
286  if (gDebug > 3)
287  Info("Process","Call Process entry = %lld", entry);
288 
293  return (Bool_t)sel;
294  } else {
295  Error("Process","Process unavailable");
296  return kFALSE;
297  }
298 }
299 
300 ////////////////////////////////////////////////////////////////////////////////
301 /// Set the selector option.
302 
303 void TSelectorCint::SetOption(const char *option)
304 {
305  if (gDebug > 2)
306  Info("SetOption","Option = %s", option);
310 }
311 
312 ////////////////////////////////////////////////////////////////////////////////
313 /// Set the current object.
314 
316 {
317  if (gDebug > 3)
318  Info("SetObject","Object = %p", obj);
322 }
323 
324 ////////////////////////////////////////////////////////////////////////////////
325 /// Set the selector list of input objects.
326 
328 {
329  if (gDebug > 2)
330  Info("SetInputList","Object = %p", input);
334 }
335 
336 ////////////////////////////////////////////////////////////////////////////////
337 /// Return the list of output object.
338 
340 {
342 
343  if (gDebug > 2)
344  Info("GetOutputList","List = %p", out);
345 
346  return out;
347 }
348 
349 ////////////////////////////////////////////////////////////////////////////////
350 /// Invoke the SlaveTerminate function via the interpreter if available.
351 
353 {
354  if (gDebug > 2)
355  Info("SlaveTerminate","Call SlaveTerminate");
356 
359  } else {
360  if (gDebug > 1)
361  Info("SlaveTerminate","SlaveTerminate unavailable");
362  }
363 }
364 
365 ////////////////////////////////////////////////////////////////////////////////
366 /// Invoke the Terminate function via the interpreter.
367 
369 {
370  if (gDebug > 2)
371  Info("Terminate","Call Terminate");
373 }
374 
375 ////////////////////////////////////////////////////////////////////////////////
376 /// Invoke the GetAbort function via the interpreter.
377 
378 void TSelectorCint::Abort(const char *mesg, EAbort what)
379 {
380  if (gDebug > 2)
381  Info("Abort","Call Abort");
382 
388  }
389 }
390 
391 ////////////////////////////////////////////////////////////////////////////////
392 /// Invoke the GetAbort function via the interpreter.
393 
395 {
396  if (gDebug > 2)
397  Info("GetAbort","Call GetAbort");
398 
402  } else {
403  return kContinue; // emulate for old version
404  }
405 }
406 
407 ////////////////////////////////////////////////////////////////////////////////
408 /// Invoke the GetAbort function via the interpreter.
409 
411 {
412  if (gDebug > 2)
413  Info("ResetAbort","Call ResetAbort");
414 
418  }
419 }
420 
421 ////////////////////////////////////////////////////////////////////////////////
422 /// Invoke the GetStatus function via the interpreter.
423 
425 {
426  if (gDebug > 2)
427  Info("GetStatus","Call GetStatus");
428 
432  } else {
433  return 0; // emulate for old version
434  }
435 }
436 
437 ////////////////////////////////////////////////////////////////////////////////
438 /// Retrieve the TClass object for the interpreted class.
439 
441 {
442  if (!fClass) return 0;
444 }
CallFunc_t * fFuncBegin
Definition: TSelectorCint.h:42
virtual void CallFunc_SetFuncProto(CallFunc_t *, ClassInfo_t *, const char *, const char *, Long_t *, ROOT::EFunctionMatchMode=ROOT::kConversionMatch) const
Definition: TInterpreter.h:353
CallFunc_t * fFuncOption
Definition: TSelectorCint.h:50
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:899
CallFunc_t * fFuncVersion
Definition: TSelectorCint.h:40
long long Long64_t
Definition: RtypesCore.h:69
virtual int Version() const
Invoke the Version function via the interpreter.
virtual TClass * GetInterpretedClass() const
Retrieve the TClass object for the interpreted class.
virtual CallFunc_t * CallFunc_Factory() const
Definition: TInterpreter.h:284
virtual void ProcessFill(Long64_t entry)
Invoke the ProcessFill function via the interpreter.
CallFunc_t * fFuncFill
Definition: TSelectorCint.h:48
#define R__ASSERT(e)
Definition: TError.h:98
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
TSelector * fIntSelector
Pointer to interpreted selector (if interpreted)
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 EAbort GetAbort() const
Invoke the GetAbort function via the interpreter.
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
CallFunc_t * fFuncInp
Definition: TSelectorCint.h:52
virtual void SetOption(const char *option)
Set the selector option.
virtual void Init(TTree *)
Invoke the Init function via the interpreter.
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 void ResetAbort()
Invoke the GetAbort function via the interpreter.
virtual Long64_t CallFunc_ExecInt64(CallFunc_t *, void *) const
Definition: TInterpreter.h:282
CallFunc_t * fFuncSlBegin
Definition: TSelectorCint.h:43
CallFunc_t * fFuncResetAbort
Definition: TSelectorCint.h:56
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:925
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
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.
#define ClassImp(name)
Definition: Rtypes.h:279
CallFunc_t * fFuncGetStat
Definition: TSelectorCint.h:57
CallFunc_t * fFuncInit
Definition: TSelectorCint.h:41
virtual void CallFunc_Delete(CallFunc_t *) const
Definition: TInterpreter.h:276
virtual TList * GetOutputList() const
Return the list of output object.
virtual Long64_t GetStatus() const
Invoke the GetStatus function via the interpreter.
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:2893
virtual Bool_t Notify()
Invoke the Notify function via the interpreter.
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void SlaveTerminate()
Invoke the SlaveTerminate function via the interpreter if available.
CallFunc_t * fFuncOut
Definition: TSelectorCint.h:53
virtual void ClassInfo_Delete(ClassInfo_t *) const
Definition: TInterpreter.h:362
virtual const char * ClassInfo_FullName(ClassInfo_t *) const
Definition: TInterpreter.h:391
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 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
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:98
This class is a special version of TSelector for user interpreted classes.
Definition: TSelectorCint.h:32
virtual Bool_t CallFunc_IsValid(CallFunc_t *) const
Definition: TInterpreter.h:289
virtual void CallFunc_Exec(CallFunc_t *, void *) const
Definition: TInterpreter.h:277
Bool_t fIsOwner
True if fIntSelector should be deleted when the this object is deleted.
Definition: TSelectorCint.h:59
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:519
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
virtual void CallFunc_ResetArg(CallFunc_t *) const
Definition: TInterpreter.h:291
CallFunc_t * fFuncProc
Definition: TSelectorCint.h:49
virtual ~TSelectorCint()
Destructor for a Selector.