00001
00002
00030
00031
00032
00033 #include "pbori_defs.h"
00034
00035 #ifndef CVariableIter_h_
00036 #define CVariableIter_h_
00037
00038 BEGIN_NAMESPACE_PBORI
00039
00048 template <class Iterator, class VariableType>
00049 class CVariableIter :
00050 public boost::iterator_facade<
00051 CVariableIter<Iterator, VariableType>,
00052 VariableType,
00053 typename Iterator::iterator_category,
00054 VariableType
00055 > {
00056
00057 public:
00059 typedef Iterator iterator_type;
00060
00062 typedef VariableType var_type;
00063
00065 typedef typename var_type::ring_type ring_type;
00066
00068 typedef CVariableIter<iterator_type, var_type> self;
00069
00071 CVariableIter(): m_iter(), m_ring() {}
00072
00074 CVariableIter(const iterator_type& rhs, const ring_type& ring):
00075 m_iter(rhs), m_ring(ring) {}
00076
00078 bool isEnd() const { return m_iter.isEnd(); }
00079
00081 void increment() { ++m_iter; }
00082
00084 var_type dereference() const { return var_type(*m_iter, m_ring); }
00085
00087 bool equal(const self& rhs) const { return m_iter == rhs.m_iter; }
00088
00089 private:
00091 iterator_type m_iter;
00092
00094 ring_type m_ring;
00095 };
00096
00097 END_NAMESPACE_PBORI
00098
00099
00100 #endif // CVariableIter_h_