PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00013 //***************************************************************************** 00014 00015 // include basic definitions 00016 #include "pbori_defs.h" 00017 00018 #ifndef CVariableIter_h_ 00019 #define CVariableIter_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_