TTableIter.cxx

Go to the documentation of this file.
00001 // @(#)root/table:$Id: TTableIter.cxx 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 
00012 //////////////////////////////////////////////////////////////////////////
00013 //                                                                      //
00014 // TTableIter - class iterator to loop over sorted TTable's             //
00015 //                                                                      //
00016 //////////////////////////////////////////////////////////////////////////
00017 
00018 #include "TTableIter.h"
00019 #include "TTableSorter.h"
00020 
00021 ClassImp(TTableIter)
00022 
00023 //_____________________________________________________________________
00024 TTableIter::TTableIter(const TTableSorter *table, Float_t &keyvalue)
00025            : fTableSorter(table), fIndx(0), fFirstIndx(0)
00026 {
00027    //to be documented
00028    CountKey(keyvalue);
00029 }
00030 
00031 //_____________________________________________________________________
00032 TTableIter::TTableIter(const TTableSorter *table, Long_t &keyvalue)
00033            : fTableSorter(table), fIndx(0), fFirstIndx(0)
00034 {
00035    //to be documented
00036    CountKey(keyvalue);
00037 }
00038 
00039 //_____________________________________________________________________
00040 TTableIter::TTableIter(const TTableSorter *table, Int_t &keyvalue)
00041            : fTableSorter(table), fIndx(0), fFirstIndx(0)
00042 {
00043    //to be documented
00044    CountKey(keyvalue);
00045 }
00046 
00047 //_____________________________________________________________________
00048 TTableIter::TTableIter(const TTableSorter *table, Short_t &keyvalue)
00049            : fTableSorter(table), fIndx(0), fFirstIndx(0)
00050 {
00051    //to be documented
00052    CountKey(keyvalue);
00053 }
00054 
00055 //_____________________________________________________________________
00056 TTableIter::TTableIter(const TTableSorter *table, Double_t &keyvalue)
00057            : fTableSorter(table), fIndx(0), fFirstIndx(0)
00058 {
00059    //to be documented
00060    CountKey(keyvalue);
00061 }
00062 
00063 //_____________________________________________________________________
00064 Int_t TTableIter::CountKey(Float_t &keyvalue)
00065 {
00066    //to be documented
00067    fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00068    return GetNRows();
00069 }
00070 //_____________________________________________________________________
00071 Int_t TTableIter::CountKey(Long_t &keyvalue)
00072 {
00073    //to be documented
00074    fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00075    return GetNRows();
00076 }
00077 
00078 //_____________________________________________________________________
00079 Int_t TTableIter::CountKey(Int_t &keyvalue)
00080 {
00081    //to be documented
00082    fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00083    return GetNRows();
00084 }
00085 
00086 //_____________________________________________________________________
00087 Int_t TTableIter::CountKey(Short_t &keyvalue)
00088 {
00089    //to be documented
00090    fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00091    return GetNRows();
00092 }
00093 
00094 //_____________________________________________________________________
00095 Int_t TTableIter::CountKey(Double_t &keyvalue)
00096 {
00097    //to be documented
00098    fTotalKeys = fTableSorter->CountKey(&keyvalue,0,kTRUE,&fFirstIndx);
00099    return GetNRows();
00100 }
00101 
00102 //_____________________________________________________________________
00103 Int_t TTableIter::Next()
00104 {
00105    //to be documented
00106    Int_t rowIndx = -1;
00107    if (fIndx < fTotalKeys) {
00108       rowIndx = fTableSorter->GetIndex(UInt_t(fFirstIndx+fIndx));
00109       fIndx++;
00110    }
00111    return rowIndx;
00112 }
00113 
00114 //_____________________________________________________________________
00115 Int_t TTableIter::Next(Int_t idx)
00116 {
00117    //to be documented
00118    Int_t rowIndx = -1;
00119    if (idx < fTotalKeys)
00120       rowIndx = fTableSorter->GetIndex(UInt_t(fFirstIndx+idx));
00121    return rowIndx;
00122 }
00123 
00124 //_____________________________________________________________________
00125 Int_t TTableIter::Reset(Int_t indx)
00126 {
00127    //to be documented
00128    Int_t oldIdx = fIndx;
00129    fIndx = TMath::Min(indx,fTotalKeys);
00130    return oldIdx;
00131 }

Generated on Tue Jul 5 14:45:09 2011 for ROOT_528-00b_version by  doxygen 1.5.1