Logo ROOT   6.08/07
Reference Guide
TIterator.h
Go to the documentation of this file.
1 // @(#)root/cont:$Id$
2 // Author: Fons Rademakers 13/08/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TIterator
13 #define ROOT_TIterator
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TIterator //
19 // //
20 // Iterator abstract base class. This base class provides the interface //
21 // for collection iterators. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #ifndef ROOT_Rtypes
26 #include "Rtypes.h"
27 #endif
28 
29 class TCollection;
30 class TObject;
31 
32 class TIterator {
33 
34 protected:
35  TIterator() { }
36  TIterator(const TIterator &) { }
37 
38 public:
39  virtual TIterator &operator=(const TIterator &) { return *this; }
40  virtual ~TIterator() { }
41  virtual const TCollection *GetCollection() const = 0;
42  virtual Option_t *GetOption() const { return ""; }
43  virtual TObject *Next() = 0;
44  virtual void Reset() = 0;
45  TObject *operator()() { return Next(); }
46  virtual Bool_t operator!=(const TIterator &) const;
47  Bool_t operator==(const TIterator & other) const { return !(*this != other); }
48  virtual TObject *operator*() const;
49 
50  ClassDef(TIterator,0) //Iterator abstract base class
51 };
52 
53 #endif
TIterator()
Definition: TIterator.h:35
virtual Option_t * GetOption() const
Definition: TIterator.h:42
virtual void Reset()=0
const char Option_t
Definition: RtypesCore.h:62
bool Bool_t
Definition: RtypesCore.h:59
Iterator abstract base class.
Definition: TIterator.h:32
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual TObject * operator*() const
Return current object or nullptr.
Definition: TIterator.cxx:39
TIterator(const TIterator &)
Definition: TIterator.h:36
virtual Bool_t operator!=(const TIterator &) const
Compare two iterator objects.
Definition: TIterator.cxx:28
Collection abstract base class.
Definition: TCollection.h:48
virtual ~TIterator()
Definition: TIterator.h:40
virtual const TCollection * GetCollection() const =0
TObject * operator()()
Definition: TIterator.h:45
Mother of all ROOT objects.
Definition: TObject.h:37
Bool_t operator==(const TIterator &other) const
Definition: TIterator.h:47
virtual TIterator & operator=(const TIterator &)
Definition: TIterator.h:39
virtual TObject * Next()=0