00001 // @(#)root/table:$Id: TTableIter.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Valery Fine(fine@bnl.gov) 03/12/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 #ifndef ROOT_TTableIter 00012 #define ROOT_TTableIter 00013 00014 ////////////////////////////////////////////////////////////////////////// 00015 // // 00016 // TTableIter - class iterator to loop over sorted TTable's // 00017 // // 00018 ////////////////////////////////////////////////////////////////////////// 00019 00020 #include "TObject.h" 00021 00022 class TTableSorter; 00023 00024 class TTableIter : public TObject { 00025 private: 00026 const TTableSorter *fTableSorter; 00027 Int_t fIndx; 00028 Int_t fTotalKeys; 00029 Int_t fFirstIndx; 00030 protected: 00031 TTableIter(){;} 00032 TTableIter(const TTableIter &org) : TObject(org) {;} 00033 00034 public: 00035 TTableIter(const TTableSorter *table, Float_t &keyvalue); 00036 TTableIter(const TTableSorter *table, Double_t &keyvalue); 00037 TTableIter(const TTableSorter *table, Int_t &keyvalue); 00038 TTableIter(const TTableSorter *table, Long_t &keyvalue); 00039 TTableIter(const TTableSorter *table, Short_t &keyvalue); 00040 00041 virtual ~TTableIter(){;} 00042 00043 Int_t CountKey(Float_t &keyvalue); 00044 Int_t CountKey(Long_t &keyvalue); 00045 Int_t CountKey(Int_t &keyvalue); 00046 Int_t CountKey(Short_t &keyvalue); 00047 Int_t CountKey(Double_t &keyvalue); 00048 00049 Int_t GetNRows() const; 00050 Int_t Next(); 00051 Int_t Next(Int_t idx); 00052 Int_t Reset(Int_t indx=0); 00053 Int_t operator()(); 00054 Int_t operator[](Int_t idx); 00055 ClassDef(TTableIter,0) // Iterator over "sorted" TTable objects 00056 }; 00057 00058 //_____________________________________________________________________ 00059 inline Int_t TTableIter::GetNRows() const { return fTotalKeys;} 00060 //_____________________________________________________________________ 00061 inline Int_t TTableIter::operator()() { return Next();} 00062 00063 //_____________________________________________________________________ 00064 inline Int_t TTableIter::operator[](Int_t idx) { return Next(idx);} 00065 00066 #endif