Logo ROOT  
Reference Guide
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="");
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
TTreeResult::AddRow
void AddRow(TSQLRow *row)
Adopt a row to result set.
Definition: TTreeResult.cxx:154
TTreeResult::Close
void Close(Option_t *option="")
Close query result.
Definition: TTreeResult.cxx:67
TObjArray
Definition: TObjArray.h:37
TTreeResult::IsValid
Bool_t IsValid(Int_t field)
Check if result set is open and field index within range.
Definition: TTreeResult.cxx:81
TTreeResult::fFields
TString * fFields
[fColumnCount] array containing field strings
Definition: TTreeResult.h:40
TString
Definition: TString.h:136
bool
TSQLResult
Definition: TSQLResult.h:32
TTreeResult::fResult
TObjArray * fResult
query result (TTreeRow objects)
Definition: TTreeResult.h:41
TTreePlayer
Definition: TTreePlayer.h:37
TTreeResult::GetFieldCount
Int_t GetFieldCount()
Get number of fields in result.
Definition: TTreeResult.cxx:97
TTreeResult::fNextRow
Int_t fNextRow
row iterator
Definition: TTreeResult.h:42
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TTreeResult::Next
TSQLRow * Next()
Get next query result row.
Definition: TTreeResult.cxx:122
TTreeResult::GetFieldName
const char * GetFieldName(Int_t field)
Get name of specified field.
Definition: TTreeResult.cxx:109
TTreeResult::GetRows
TObjArray * GetRows() const
Definition: TTreeResult.h:56
TSQLRow
Definition: TSQLRow.h:30
TTreeResult::TTreeResult
TTreeResult()
Create a query result object.
Definition: TTreeResult.cxx:32
TTreeResult::~TTreeResult
virtual ~TTreeResult()
Cleanup result object.
Definition: TTreeResult.cxx:56
TSQLResult.h
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TTreeResult
Definition: TTreeResult.h:34
TTreeResult::AddField
void AddField(Int_t field, const char *fieldname)
Add field name to result set.
Definition: TTreeResult.cxx:142
TTreeResult::fColumnCount
Int_t fColumnCount
number of columns in result
Definition: TTreeResult.h:39
int