CTermIter.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_iterators_CTermIter_h_
#define polybori_iterators_CTermIter_h_
// include basic definitions
#include <polybori/pbori_defs.h>
// include polybori functionals
#include <polybori/routines/pbori_func.h>
// include polybori properties
#include <polybori/common/traits.h>
// include boost's interator facade
#include <boost/iterator/iterator_facade.hpp>
#include <polybori/BooleEnv.h>
BEGIN_NAMESPACE_PBORI
template <class StackType, class TermGeneratorType>
class CTermIter:
public boost::iterator_facade<
CTermIter<StackType, TermGeneratorType>,
typename TermGeneratorType::value_type,
typename StackType::iterator_category,
typename TermGeneratorType::result_type
> {
public:
typedef StackType stack_type;
typedef typename stack_type::navigator navigator;
typedef typename navigator::idx_type idx_type;
typedef typename navigator::bool_type bool_type;
typedef typename navigator::size_type size_type;
typedef typename navigator::deg_type deg_type;
typedef TermGeneratorType term_generator;
typedef typename stack_type::const_iterator const_iterator;
typedef typename stack_type::const_reverse_iterator
const_reverse_iterator;
CTermIter(const CTermIter& rhs):
m_getTerm(rhs.m_getTerm), m_stack(rhs.m_stack) {
}
template <class MgrType>
CTermIter(navigator navi, const MgrType& mgr):
m_getTerm(mgr), m_stack(navi, mgr) {
m_stack.init();
}
~CTermIter() {}
void increment() {
m_stack.increment();
}
void decrement() {
m_stack.decrement();
}
bool_type equal (const CTermIter& rhs) const {
return m_stack.equal(rhs.m_stack);
}
typename term_generator::result_type dereference() const {
return m_getTerm(m_stack);
}
const_iterator begin() const { return m_stack.begin(); }
const_iterator end() const { return m_stack.end(); }
const_reverse_iterator rbegin() const { return m_stack.rbegin(); }
const_reverse_iterator rend() const { return m_stack.rend(); }
bool_type isOne() const { return m_stack.isOne(); }
bool_type isZero() const { return m_stack.isZero(); }
bool_type isEnd() const { return isZero(); }
deg_type deg() const { return m_stack.deg(); }
idx_type firstIndex() const {
PBORI_ASSERT(!m_stack.empty());
return *begin();
}
navigator navigation() const {
return m_stack.navigation();
}
protected:
term_generator m_getTerm;
stack_type m_stack;
};
END_NAMESPACE_PBORI
#endif
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::CTermIter::increment
void increment()
Incrementation operation.
Definition: CTermIter.h:98
polybori::CTermIter::stack_type
StackType stack_type
Define type for storing current path (term) in stack of nodes.
Definition: CTermIter.h:55
polybori::groebner::deg_type
int deg_type
Definition: groebner_defs.h:42
polybori::CTermIter::isEnd
bool_type isEnd() const
Check, whether end of iteration is reached.
Definition: CTermIter.h:132
polybori::CTermIter::CTermIter
CTermIter(const CTermIter &rhs)
Copy constructor.
Definition: CTermIter.h:83
polybori::CTermIter::m_stack
stack_type m_stack
The stack, which carries the current path.
Definition: CTermIter.h:153
polybori::CTermIter::isZero
bool_type isZero() const
Determine whether term is zero (without explicit constructing)
Definition: CTermIter.h:129
traits.h
polybori::CTermIter::navigation
navigator navigation() const
Get navigator of term start.
Definition: CTermIter.h:144
polybori::CTermIter::firstIndex
idx_type firstIndex() const
Get first index of current term.
Definition: CTermIter.h:138
pbori_func.h
polybori::CTermIter::deg
deg_type deg() const
Get degree of current term.
Definition: CTermIter.h:135
polybori::CTermIter::size_type
navigator::size_type size_type
Type for lengths.
Definition: CTermIter.h:67
polybori::CTermIter::~CTermIter
~CTermIter()
Destructor.
Definition: CTermIter.h:95
pbori_defs.h
polybori::CTermIter::idx_type
navigator::idx_type idx_type
Type for indices.
Definition: CTermIter.h:61
polybori::CTermIter
This class defines an iterator for the monomials in a Boolean polynomial.
Definition: CTermIter.h:44
polybori::CTermIter::navigator
stack_type::navigator navigator
Get type of navigators.
Definition: CTermIter.h:58
PBORI_ASSERT
#define PBORI_ASSERT(arg)
Definition: pbori_defs.h:118
polybori::CTermIter::equal
bool_type equal(const CTermIter &rhs) const
Equality test.
Definition: CTermIter.h:108
polybori::CTermIter::bool_type
navigator::bool_type bool_type
Type for Boolean results.
Definition: CTermIter.h:64
polybori::CTermIter::m_getTerm
term_generator m_getTerm
The functional which defines the dereferecing operation.
Definition: CTermIter.h:150
polybori::CTermIter::end
const_iterator end() const
Definition: CTermIter.h:120
polybori::CTermIter::decrement
void decrement()
Decrementation operation.
Definition: CTermIter.h:103
polybori::CTermIter::rbegin
const_reverse_iterator rbegin() const
Definition: CTermIter.h:121
polybori::CTermIter::CTermIter
CTermIter(navigator navi, const MgrType &mgr)
Construct from navigator over decision diagram.
Definition: CTermIter.h:89
polybori::CTermIter::dereference
term_generator::result_type dereference() const
Dereferencing of the iterator.
Definition: CTermIter.h:113
polybori::groebner::idx_type
polybori::CTypes::idx_type idx_type
Definition: groebner_defs.h:44
polybori::CTermIter::term_generator
TermGeneratorType term_generator
Type for functional, which generates actual term, for current path.
Definition: CTermIter.h:73
polybori::CTermIter::deg_type
navigator::deg_type deg_type
Type for degrees.
Definition: CTermIter.h:70
polybori::CTermIter::rend
const_reverse_iterator rend() const
Definition: CTermIter.h:122
polybori::CTermIter::isOne
bool_type isOne() const
Determine whether term is one (without explicit constructing)
Definition: CTermIter.h:126
polybori::CTermIter::const_iterator
stack_type::const_iterator const_iterator
Definition: CTermIter.h:77
BooleEnv.h
polybori::CTermIter::const_reverse_iterator
stack_type::const_reverse_iterator const_reverse_iterator
Definition: CTermIter.h:79
polybori::CTermIter::begin
const_iterator begin() const
Definition: CTermIter.h:119