PolyBoRi
CVariableIter.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
33 //*****************************************************************************
34 
35 // include basic definitions
36 #include "pbori_defs.h"
37 
38 #ifndef CVariableIter_h_
39 #define CVariableIter_h_
40 
42 
51 template <class Iterator, class VariableType>
52 class CVariableIter :
53  public boost::iterator_facade<
54  CVariableIter<Iterator, VariableType>,
55  VariableType,
56  typename Iterator::iterator_category,
57  VariableType
58  > {
59 
60 public:
62  typedef Iterator iterator_type;
63 
65  typedef VariableType var_type;
66 
68  typedef typename var_type::ring_type ring_type;
69 
72 
74  CVariableIter(): m_iter(), m_ring() {}
75 
77  CVariableIter(const iterator_type& rhs, const ring_type& ring):
78  m_iter(rhs), m_ring(ring) {}
79 
81  bool isEnd() const { return m_iter.isEnd(); }
82 
84  void increment() { ++m_iter; }
85 
87  var_type dereference() const { return var_type(*m_iter, m_ring); }
88 
90  bool equal(const self& rhs) const { return m_iter == rhs.m_iter; }
91 
92 private:
94  iterator_type m_iter;
95 
97  ring_type m_ring;
98 };
99 
101 
102 
103 #endif // CVariableIter_h_