ROOT » MISC » TABLE » TIndexTable::iterator

class TIndexTable::iterator

 TIndexTable class is helper class to keep the list of the referencs to the
 TTable rows and iterate over it.
 TIndexTable is a persistent class.
 The pointer to the TIndexTable object may be used as an element
 of the TTable row and saved with the table all together.

 For example, the track table may contain a member to the "map" of the hits
  struct {
    float helix;
    TIndexTable *hits;
  } tracks_t;

   // Create track table:
   LArTrackTable *tracks = new LArTrackTable(...);

   // Get pointer to the hit table
   LArHitTable *hits = GiveMeHits();
   // Loop over all tracks
   LArTrackTable::iterator track = tracks->begin();
   LArTrackTable::iterator last = tracks->end();
   for (;track != last;track++) {
     // Find all hits of this track
      LArHitTable::iterator hit     = hits->begin();
      LArHitTable::iterator lastHit = hits->end();
      Long_t hitIndx = 0;
      // Create an empty list of this track hits
      (*track).hits = new TIndexTable(hits);
      for(;hit != lastHit;hit++,hitIndx) {
        if (IsMyHit(*hit)) {  // add this hit index to the current track

Function Members (Methods)

Data Members

const int*fCurrentRow
const TTable*fTable

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

iterator(const TTable& t, const int& rowPtr)
iterator(const TTable& t)
iterator(const TIndexTable::iterator& iter)
iterator & operator=(const TIndexTable::iterator& iter)
{fTable = iter.fTable; fCurrentRow = iter.fCurrentRow; return *this;}
iterator & operator++()
{ if (fCurrentRow) ++fCurrentRow; return *this;}
void operator++(int )
iterator & operator--()
{ if (fCurrentRow) --fCurrentRow; return *this;}
void operator--(int )
iterator & operator+(Int_t idx)
{ if (fCurrentRow) fCurrentRow+=idx; return *this;}
iterator & operator-(Int_t idx)
{ if (fCurrentRow) fCurrentRow-=idx; return *this;}
Int_t operator-(const TIndexTable::iterator& it) const
{ return fCurrentRow-it.fCurrentRow; }
operator int()
{ return *fCurrentRow;}
Bool_t operator==(const TIndexTable::iterator& t) const
{ return (fCurrentRow == t.fCurrentRow); }
Bool_t operator!=(const TIndexTable::iterator& t) const
{ return !operator==(t); }