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_