StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StRecordIterator.h
1 #ifndef StRecordITERATOR_H
2 #define StRecordITERATOR_H
3 
4 #include <iterator>
5 #include "RecordList.h"
6 
7 namespace TxLogging {
8  class Iterator : public std::iterator<std::input_iterator_tag, RecordIterator>
9 {
10  RecordIterator fField;
11  RecordIterator fFieldEnd;
12 public:
13  Iterator(RecordList &fields) : fField(fields.begin()), fFieldEnd(fields.end()) {}
14  Iterator(RecordList *fields) : fField(fields->begin()), fFieldEnd(fields->end()) {}
15  Iterator(const Iterator& mit) : fField(mit.fField), fFieldEnd(mit.fFieldEnd) { }
16  Iterator(const RecordIterator &first,const RecordIterator &last) :fField(first), fFieldEnd(last) {}
17  Iterator& operator++();
18  Iterator& operator++(int);
19  bool operator==(const Iterator& rhs) {return fField==rhs.fField;}
20  bool operator!=(const Iterator& rhs) {return fField!=rhs.fField;}
21  StRecord* operator*();
22  const StRecord* operator*() const;
23  bool hasNext() const { return fField != fFieldEnd; }
24  StRecord* next();
25 };
26 }
27 
28 #endif