CVariableIter.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_iterators_CVariableIter_h_
#define polybori_iterators_CVariableIter_h_
// include basic definitions
#include <polybori/pbori_defs.h>
BEGIN_NAMESPACE_PBORI
template <class Iterator, class VariableType>
class CVariableIter :
public boost::iterator_facade<
CVariableIter<Iterator, VariableType>,
VariableType,
typename Iterator::iterator_category,
VariableType
> {
public:
typedef Iterator iterator_type;
typedef VariableType var_type;
typedef typename var_type::ring_type ring_type;
typedef CVariableIter<iterator_type, var_type> self;
CVariableIter(): m_iter(), m_ring() {}
CVariableIter(const iterator_type& rhs, const ring_type& ring):
m_iter(rhs), m_ring(ring) {}
bool isEnd() const { return m_iter.isEnd(); }
void increment() { ++m_iter; }
var_type dereference() const { return var_type(*m_iter, m_ring); }
bool equal(const self& rhs) const { return m_iter == rhs.m_iter; }
private:
iterator_type m_iter;
ring_type m_ring;
};
END_NAMESPACE_PBORI
#endif // CVariableIter_h_
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::CVariableIter::CVariableIter
CVariableIter(const iterator_type &rhs, const ring_type &ring)
Constructor for given iterator (and ring)
Definition: CVariableIter.h:57
polybori::CVariableIter::increment
void increment()
Increment operation.
Definition: CVariableIter.h:64
polybori::CVariableIter
This template class defines an iterator for monomial types.
Definition: CVariableIter.h:32
pbori_defs.h
polybori::CVariableIter::ring_type
var_type::ring_type ring_type
Fixing ring, which is used to generate variables.
Definition: CVariableIter.h:48
polybori::CVariableIter::equal
bool equal(const self &rhs) const
Equality check.
Definition: CVariableIter.h:70
polybori::CVariableIter::dereference
var_type dereference() const
Constant dereference operator.
Definition: CVariableIter.h:67
polybori::CVariableIter::var_type
VariableType var_type
Fixing variables, which is used for dereferencing.
Definition: CVariableIter.h:45
polybori::CVariableIter::iterator_type
Iterator iterator_type
Fixing Iterator type to be extended.
Definition: CVariableIter.h:42
polybori::CVariableIter::CVariableIter
CVariableIter()
Default constructor.
Definition: CVariableIter.h:54
polybori::CVariableIter::isEnd
bool isEnd() const
Check, whether end of iteration is reached.
Definition: CVariableIter.h:61