// @(#)root/tree:$Id$
// Author: Fons Rademakers   30/11/99

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TTreeResult
#define ROOT_TTreeResult


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TTreeResult                                                          //
//                                                                      //
// Class defining interface to a TTree query result with the same       //
// interface as for SQL databases. A TTreeResult is returned by         //
// TTree::Query() (actually TTreePlayer::Query()).                      //
//                                                                      //
// Related classes are TTreeRow.                                        //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TSQLResult
#include "TSQLResult.h"
#endif

class TString;
class TObjArray;


class TTreeResult : public TSQLResult {

friend class TTreePlayer;

private:
   Int_t       fColumnCount;   // number of columns in result
   TString    *fFields;        //[fColumnCount] array containing field strings
   TObjArray  *fResult;        // query result (TTreeRow objects)
   Int_t       fNextRow;       // row iterator

   Bool_t  IsValid(Int_t field);
   void    AddField(Int_t field, const char *fieldname);
   void    AddRow(TSQLRow *row);

public:
   TTreeResult();
   TTreeResult(Int_t nfields);
   virtual ~TTreeResult();

   void        Close(Option_t *option="");
   Int_t       GetFieldCount();
   const char *GetFieldName(Int_t field);
   TObjArray  *GetRows() const {return fResult;}
   TSQLRow    *Next();

   ClassDef(TTreeResult,1)  // TTree query result
};

#endif
 TTreeResult.h:1
 TTreeResult.h:2
 TTreeResult.h:3
 TTreeResult.h:4
 TTreeResult.h:5
 TTreeResult.h:6
 TTreeResult.h:7
 TTreeResult.h:8
 TTreeResult.h:9
 TTreeResult.h:10
 TTreeResult.h:11
 TTreeResult.h:12
 TTreeResult.h:13
 TTreeResult.h:14
 TTreeResult.h:15
 TTreeResult.h:16
 TTreeResult.h:17
 TTreeResult.h:18
 TTreeResult.h:19
 TTreeResult.h:20
 TTreeResult.h:21
 TTreeResult.h:22
 TTreeResult.h:23
 TTreeResult.h:24
 TTreeResult.h:25
 TTreeResult.h:26
 TTreeResult.h:27
 TTreeResult.h:28
 TTreeResult.h:29
 TTreeResult.h:30
 TTreeResult.h:31
 TTreeResult.h:32
 TTreeResult.h:33
 TTreeResult.h:34
 TTreeResult.h:35
 TTreeResult.h:36
 TTreeResult.h:37
 TTreeResult.h:38
 TTreeResult.h:39
 TTreeResult.h:40
 TTreeResult.h:41
 TTreeResult.h:42
 TTreeResult.h:43
 TTreeResult.h:44
 TTreeResult.h:45
 TTreeResult.h:46
 TTreeResult.h:47
 TTreeResult.h:48
 TTreeResult.h:49
 TTreeResult.h:50
 TTreeResult.h:51
 TTreeResult.h:52
 TTreeResult.h:53
 TTreeResult.h:54
 TTreeResult.h:55
 TTreeResult.h:56
 TTreeResult.h:57
 TTreeResult.h:58
 TTreeResult.h:59
 TTreeResult.h:60
 TTreeResult.h:61
 TTreeResult.h:62
 TTreeResult.h:63
 TTreeResult.h:64