PolyBoRi
CVariableIter.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
13 //*****************************************************************************
14 
15 #ifndef polybori_iterators_CVariableIter_h_
16 #define polybori_iterators_CVariableIter_h_
17 
18 // include basic definitions
19 #include <polybori/pbori_defs.h>
20 
22 
31 template <class Iterator, class VariableType>
32 class CVariableIter :
33  public boost::iterator_facade<
34  CVariableIter<Iterator, VariableType>,
35  VariableType,
36  typename Iterator::iterator_category,
37  VariableType
38  > {
39 
40 public:
42  typedef Iterator iterator_type;
43 
45  typedef VariableType var_type;
46 
48  typedef typename var_type::ring_type ring_type;
49 
52 
54  CVariableIter(): m_iter(), m_ring() {}
55 
57  CVariableIter(const iterator_type& rhs, const ring_type& ring):
58  m_iter(rhs), m_ring(ring) {}
59 
61  bool isEnd() const { return m_iter.isEnd(); }
62 
64  void increment() { ++m_iter; }
65 
67  var_type dereference() const { return var_type(*m_iter, m_ring); }
68 
70  bool equal(const self& rhs) const { return m_iter == rhs.m_iter; }
71 
72 private:
74  iterator_type m_iter;
75 
77  ring_type m_ring;
78 };
79 
81 
82 
83 #endif // CVariableIter_h_
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
CVariableIter(const iterator_type &rhs, const ring_type &ring)
Constructor for given iterator (and ring)
Definition: CVariableIter.h:57
void increment()
Increment operation.
Definition: CVariableIter.h:64
This template class defines an iterator for monomial types.
Definition: CVariableIter.h:32
var_type::ring_type ring_type
Fixing ring, which is used to generate variables.
Definition: CVariableIter.h:48
bool equal(const self &rhs) const
Equality check.
Definition: CVariableIter.h:70
var_type dereference() const
Constant dereference operator.
Definition: CVariableIter.h:67
VariableType var_type
Fixing variables, which is used for dereferencing.
Definition: CVariableIter.h:45
Iterator iterator_type
Fixing Iterator type to be extended.
Definition: CVariableIter.h:42
CVariableIter()
Default constructor.
Definition: CVariableIter.h:54
bool isEnd() const
Check, whether end of iteration is reached.
Definition: CVariableIter.h:61