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