Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
27class TCollection;
28class TObject;
29
30class TIterator {
31
32protected:
34 TIterator(const TIterator &) { }
35
36public:
37 virtual TIterator &operator=(const TIterator &) = 0;
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
bool Bool_t
Definition RtypesCore.h:63
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:337
Collection abstract base class.
Definition TCollection.h:65
Iterator abstract base class.
Definition TIterator.h:30
TObject * operator()()
Definition TIterator.h:43
virtual void Reset()=0
Bool_t operator==(const TIterator &other) const
Definition TIterator.h:45
virtual ~TIterator()
Definition TIterator.h:38
virtual Bool_t operator!=(const TIterator &) const
Compare two iterator objects.
Definition TIterator.cxx:28
virtual TObject * Next()=0
TIterator(const TIterator &)
Definition TIterator.h:34
virtual Option_t * GetOption() const
Definition TIterator.h:40
virtual TObject * operator*() const
Return current object or nullptr.
Definition TIterator.cxx:39
virtual TIterator & operator=(const TIterator &)=0
virtual const TCollection * GetCollection() const =0
Mother of all ROOT objects.
Definition TObject.h:41