Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 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 ~TTreeResult() override;
52
53 void Close(Option_t *option="") override;
54 Int_t GetFieldCount() override;
55 const char *GetFieldName(Int_t field) override;
56 TObjArray *GetRows() const { return fResult; }
57 TSQLRow *Next() override;
58
59 ClassDefOverride(TTreeResult,1) // TTree query result
60};
61
62#endif
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
An array of TObjects.
Definition TObjArray.h:31
Basic string class.
Definition TString.h:139
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
void Close(Option_t *option="") override
Close query result.
Int_t fColumnCount
number of columns in result
Definition TTreeResult.h:39
~TTreeResult() override
Cleanup result object.
TTreeResult()
Create a query result object.
TObjArray * GetRows() const
Definition TTreeResult.h:56
TSQLRow * Next() override
Get next query result row.
bool IsValid(Int_t field)
Check if result set is open and field index within range.
Int_t fNextRow
row iterator
Definition TTreeResult.h:42
const char * GetFieldName(Int_t field) override
Get name of specified field.
Int_t GetFieldCount() override
Get number of fields in result.
TString * fFields
[fColumnCount] array containing field strings
Definition TTreeResult.h:40
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.