Logo ROOT   master
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 #include "Rtypes.h"
26 
27 class TCollection;
28 class TObject;
29 
30 class TIterator {
31 
32 protected:
33  TIterator() { }
34  TIterator(const TIterator &) { }
35 
36 public:
37  virtual TIterator &operator=(const TIterator &) { return *this; }
38  virtual ~TIterator() { }
39  virtual const TCollection *GetCollection() const = 0;
40  virtual Option_t *GetOption() const { return ""; }
41  virtual TObject *Next() = 0;
42  virtual void Reset() = 0;
43  TObject *operator()() { return Next(); }
44  virtual Bool_t operator!=(const TIterator &) const;
45  Bool_t operator==(const TIterator & other) const { return !(*this != other); }
46  virtual TObject *operator*() const;
47 
48  ClassDef(TIterator,0) //Iterator abstract base class
49 };
50 
51 #endif
TIterator()
Definition: TIterator.h:33
virtual Option_t * GetOption() const
Definition: TIterator.h:40
virtual void Reset()=0
const char Option_t
Definition: RtypesCore.h:64
bool Bool_t
Definition: RtypesCore.h:61
Iterator abstract base class.
Definition: TIterator.h:30
#define ClassDef(name, id)
Definition: Rtypes.h:322
virtual TObject * operator*() const
Return current object or nullptr.
Definition: TIterator.cxx:39
TIterator(const TIterator &)
Definition: TIterator.h:34
virtual Bool_t operator!=(const TIterator &) const
Compare two iterator objects.
Definition: TIterator.cxx:28
Collection abstract base class.
Definition: TCollection.h:63
virtual ~TIterator()
Definition: TIterator.h:38
virtual const TCollection * GetCollection() const =0
TObject * operator()()
Definition: TIterator.h:43
Mother of all ROOT objects.
Definition: TObject.h:37
Bool_t operator==(const TIterator &other) const
Definition: TIterator.h:45
virtual TIterator & operator=(const TIterator &)
Definition: TIterator.h:37
virtual TObject * Next()=0