source: trunk/Mars/mbase/MIter.h@ 20030

Last change on this file since 20030 was 1492, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 1.4 KB
Line 
1#ifndef MARS_MIter
2#define MARS_MIter
3
4/////////////////////////////////////////////////////////////////////////////
5// //
6// MIter //
7// //
8/////////////////////////////////////////////////////////////////////////////
9#ifndef MARS_MAGIC
10#include "MAGIC.h"
11#endif
12
13#ifndef ROOT_TIterator
14#include <TIterator.h>
15#endif
16
17class MParContainer;
18
19class MIter
20{
21private:
22 TIterator *fIterator; //collection iterator
23
24protected:
25 MIter() : fIterator(0) { }
26
27public:
28 MIter(const TCollection *col, Bool_t dir = kIterForward)
29 : fIterator(col ? col->MakeIterator(dir) : 0) { }
30 MIter(TIterator *it) : fIterator(it) { }
31 MIter(const MIter &iter);
32 MIter &operator=(const MIter &rhs);
33 virtual ~MIter() { SafeDelete(fIterator) }
34 MParContainer *operator()() { return (MParContainer*)(fIterator ? fIterator->Next() : 0); }
35 MParContainer *Next() { return (MParContainer*)(fIterator ? fIterator->Next() : 0); }
36 const TCollection *GetCollection() const { return fIterator ? fIterator->GetCollection() : 0; }
37 Option_t *GetOption() const { return fIterator ? fIterator->GetOption() : ""; }
38 void Reset() { if (fIterator) fIterator->Reset(); }
39
40 ClassDef(MIter,0) //Iterator wrapper
41};
42
43#endif
Note: See TracBrowser for help on using the repository browser.