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
30class TString;
31class TObjArray;
32
33
34class TTreeResult : public TSQLResult {
35
36friend class TTreePlayer;
37
38private:
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
48public:
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
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
An array of TObjects.
Definition: TObjArray.h:37
Basic string class.
Definition: TString.h:131
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
Definition: TTreePlayer.h:37
Class defining interface to a TTree query result with the same interface as for SQL databases.
Definition: TTreeResult.h:34
const char * GetFieldName(Int_t field)
Get name of specified field.
Int_t fColumnCount
number of columns in result
Definition: TTreeResult.h:39
void Close(Option_t *option="")
Close query result.
Definition: TTreeResult.cxx:67
TTreeResult()
Create a query result object.
Definition: TTreeResult.cxx:32
TObjArray * GetRows() const
Definition: TTreeResult.h:56
Int_t fNextRow
row iterator
Definition: TTreeResult.h:42
TSQLRow * Next()
Get next query result row.
TString * fFields
[fColumnCount] array containing field strings
Definition: TTreeResult.h:40
virtual ~TTreeResult()
Cleanup result object.
Definition: TTreeResult.cxx:56
Int_t GetFieldCount()
Get number of fields in result.
Definition: TTreeResult.cxx:97
Bool_t IsValid(Int_t field)
Check if result set is open and field index within range.
Definition: TTreeResult.cxx:81
void AddRow(TSQLRow *row)
Adopt a row to result set.
TObjArray * fResult
query result (TTreeRow objects)
Definition: TTreeResult.h:41
void AddField(Int_t field, const char *fieldname)
Add field name to result set.