ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TTreeResult.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Fons Rademakers 30/11/99
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 #ifndef ROOT_TTreeResult
13 #define ROOT_TTreeResult
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TTreeResult //
19 // //
20 // Class defining interface to a TTree query result with the same //
21 // interface as for SQL databases. A TTreeResult is returned by //
22 // TTree::Query() (actually TTreePlayer::Query()). //
23 // //
24 // Related classes are TTreeRow. //
25 // //
26 //////////////////////////////////////////////////////////////////////////
27 
28 #ifndef ROOT_TSQLResult
29 #include "TSQLResult.h"
30 #endif
31 
32 class TString;
33 class TObjArray;
34 
35 
36 class TTreeResult : public TSQLResult {
37 
38 friend class TTreePlayer;
39 
40 private:
41  Int_t fColumnCount; // number of columns in result
42  TString *fFields; //[fColumnCount] array containing field strings
43  TObjArray *fResult; // query result (TTreeRow objects)
44  Int_t fNextRow; // row iterator
45 
46  Bool_t IsValid(Int_t field);
47  void AddField(Int_t field, const char *fieldname);
48  void AddRow(TSQLRow *row);
49 
50 public:
51  TTreeResult();
52  TTreeResult(Int_t nfields);
53  virtual ~TTreeResult();
54 
55  void Close(Option_t *option="");
57  const char *GetFieldName(Int_t field);
58  TObjArray *GetRows() const {return fResult;}
59  TSQLRow *Next();
60 
61  ClassDef(TTreeResult,1) // TTree query result
62 };
63 
64 #endif
tuple row
Definition: mrt.py:26
An array of TObjects.
Definition: TObjArray.h:39
void AddRow(TSQLRow *row)
Adopt a row to result set.
const char Option_t
Definition: RtypesCore.h:62
Int_t fColumnCount
Definition: TTreeResult.h:41
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Bool_t IsValid(Int_t field)
Check if result set is open and field index within range.
Definition: TTreeResult.cxx:79
#define ClassDef(name, id)
Definition: Rtypes.h:254
TObjArray * fResult
Definition: TTreeResult.h:43
Int_t GetFieldCount()
Get number of fields in result.
Definition: TTreeResult.cxx:95
TString * fFields
Definition: TTreeResult.h:42
TSQLRow * Next()
Get next query result row.
virtual ~TTreeResult()
Cleanup result object.
Definition: TTreeResult.cxx:54
Int_t fNextRow
Definition: TTreeResult.h:44
Class defining interface to a TTree query result with the same interface as for SQL databases...
Definition: TTreeResult.h:36
const char * GetFieldName(Int_t field)
Get name of specified field.
TObjArray * GetRows() const
Definition: TTreeResult.h:58
void Close(Option_t *option="")
Close query result.
Definition: TTreeResult.cxx:65
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
Definition: TTreePlayer.h:43
void AddField(Int_t field, const char *fieldname)
Add field name to result set.