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