00001
00002
00013
00014
00015 #ifndef polybori_iterators_CVariableIter_h_
00016 #define polybori_iterators_CVariableIter_h_
00017
00018
00019 #include <polybori/pbori_defs.h>
00020
00021 BEGIN_NAMESPACE_PBORI
00022
00031 template <class Iterator, class VariableType>
00032 class CVariableIter :
00033 public boost::iterator_facade<
00034 CVariableIter<Iterator, VariableType>,
00035 VariableType,
00036 typename Iterator::iterator_category,
00037 VariableType
00038 > {
00039
00040 public:
00042 typedef Iterator iterator_type;
00043
00045 typedef VariableType var_type;
00046
00048 typedef typename var_type::ring_type ring_type;
00049
00051 typedef CVariableIter<iterator_type, var_type> self;
00052
00054 CVariableIter(): m_iter(), m_ring() {}
00055
00057 CVariableIter(const iterator_type& rhs, const ring_type& ring):
00058 m_iter(rhs), m_ring(ring) {}
00059
00061 bool isEnd() const { return m_iter.isEnd(); }
00062
00064 void increment() { ++m_iter; }
00065
00067 var_type dereference() const { return var_type(*m_iter, m_ring); }
00068
00070 bool equal(const self& rhs) const { return m_iter == rhs.m_iter; }
00071
00072 private:
00074 iterator_type m_iter;
00075
00077 ring_type m_ring;
00078 };
00079
00080 END_NAMESPACE_PBORI
00081
00082
00083 #endif // CVariableIter_h_