library: libCore
#include "TList.h"


class description - header file - source file
viewCVS header - viewCVS source

class TListIter: public TIterator

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
TListIter(const TListIter& iter)
TListIter(const TList* l, Bool_t dir = kIterForward)
static TClass*Class()
virtual const TCollection*GetCollection() const
virtual Option_t*GetOption() const
virtual TClass*IsA() const
virtual TObject*Next()
virtual TIterator&operator=(const TIterator& rhs)
TListIter&operator=(const TListIter& rhs)
virtual voidReset()
voidSetOption(Option_t* option)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)

Data Members

const TList*fListlist being iterated
TObjLink*fCurCursorcurrent position in list
TObjLink*fCursornext position in list
Bool_tfDirectioniteration direction
Bool_tfStartediteration started

Class Description

 A doubly linked list. All classes inheriting from TObject can be     
 inserted in a TList. Before being inserted into the list the object  
 pointer is wrapped in a TObjLink object which contains, besides      
 the object pointer also a previous and next pointer.                 
 There are basically four ways to iterate over a TList (in order      
 of preference, if not forced by other constraints):                  
    1) Using the R__FOR_EACH macro:                                   
    2) Using the TList iterator TListIter (via the wrapper class      
         TIter next(GetListOfPrimitives());                           
         while (TObject *obj = next())                                
    3) Using the TObjLink list entries (that wrap the TObject*):      
         TObjLink *lnk = GetListOfPrimitives()->FirstLink();          
         while (lnk) {                                                
            lnk = lnk->Next();                                        
    4) Using the TList's After() and Before() member functions:       
         TFree *idcur = this;                                         
         while (idcur) {                                              
            idcur = (TFree*)GetListOfFree()->After(idcur);            
   Methods 2, 3 and 4 can also easily iterate backwards using either  
   a backward TIter (using argument kIterBackward) or by using        
   LastLink() and lnk->Prev() or by using the Before() member.        

TListIter(const TList *l, Bool_t dir)
 Create a new list iterator. By default the iteration direction
 is kIterForward. To go backward use kIterBackward.
TListIter(const TListIter &iter)
 Copy ctor.
TIterator & operator=(const TIterator &rhs)
 Overridden assignment operator.
TListIter & operator=(const TListIter &rhs)
 Overloaded assignment operator.
TObject * Next()
 Return next object in the list. Returns 0 when no more objects in list.
Option_t * GetOption()
 Returns the object option stored in the list.
void SetOption(Option_t *option)
 Sets the object option stored in the list.
{ }
{ }
const TCollection * GetCollection()
{ return fList; }
void Reset()
{ fStarted = kFALSE; }

Author: Fons Rademakers 10/08/95
Last update: root/cont:$Name: $:$Id: TList.cxx,v 1.22 2006/07/26 13:36:42 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.