00001 // @(#)root/tree:$Id: TTreeResult.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Fons Rademakers 30/11/99 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TTreeResult 00013 #define ROOT_TTreeResult 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TTreeResult // 00019 // // 00020 // Class defining interface to a TTree query result with the same // 00021 // interface as for SQL databases. A TTreeResult is returned by // 00022 // TTree::Query() (actually TTreePlayer::Query()). // 00023 // // 00024 // Related classes are TTreeRow. // 00025 // // 00026 ////////////////////////////////////////////////////////////////////////// 00027 00028 #ifndef ROOT_TSQLResult 00029 #include "TSQLResult.h" 00030 #endif 00031 00032 class TString; 00033 class TObjArray; 00034 00035 00036 class TTreeResult : public TSQLResult { 00037 00038 friend class TTreePlayer; 00039 00040 private: 00041 Int_t fColumnCount; // number of columns in result 00042 TString *fFields; //[fColumnCount] array containing field strings 00043 TObjArray *fResult; // query result (TTreeRow objects) 00044 Int_t fNextRow; // row iterator 00045 00046 Bool_t IsValid(Int_t field); 00047 void AddField(Int_t field, const char *fieldname); 00048 void AddRow(TSQLRow *row); 00049 00050 public: 00051 TTreeResult(); 00052 TTreeResult(Int_t nfields); 00053 virtual ~TTreeResult(); 00054 00055 void Close(Option_t *option=""); 00056 Int_t GetFieldCount(); 00057 const char *GetFieldName(Int_t field); 00058 TObjArray *GetRows() const {return fResult;} 00059 TSQLRow *Next(); 00060 00061 ClassDef(TTreeResult,1) // TTree query result 00062 }; 00063 00064 #endif