Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files 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 #include "TSQLResult.h"
29 
30 class TString;
31 class TObjArray;
32 
33 
34 class TTreeResult : public TSQLResult {
35 
36 friend class TTreePlayer;
37 
38 private:
39  Int_t fColumnCount; ///< number of columns in result
40  TString *fFields; ///<[fColumnCount] array containing field strings
41  TObjArray *fResult; ///< query result (TTreeRow objects)
42  Int_t fNextRow; ///< row iterator
43 
44  Bool_t IsValid(Int_t field);
45  void AddField(Int_t field, const char *fieldname);
46  void AddRow(TSQLRow *row);
47 
48 public:
49  TTreeResult();
50  TTreeResult(Int_t nfields);
51  virtual ~TTreeResult();
52 
53  void Close(Option_t *option="");
54  Int_t GetFieldCount();
55  const char *GetFieldName(Int_t field);
56  TObjArray *GetRows() const {return fResult;}
57  TSQLRow *Next();
58 
59  ClassDef(TTreeResult,1) // TTree query result
60 };
61 
62 #endif