/usr/include/polybori/CExpIter.h is in libpolybori-dev 0.5~rc1-2.1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | // -*- c++ -*-
//*****************************************************************************
/** @file CExpIter.h
*
* @author Alexander Dreyer
* @date 2007-05-03
*
* This file defines a variant for the natural (lexicographical) iterator, which
* iterator over all exponent vectors of a polynomial.
*
* @par Copyright:
* (c) 2007 by The PolyBoRi Team
*
* @internal
* @version \$Id: CExpIter.h,v 1.9 2008/07/08 21:41:58 alexanderdreyer Exp $
*
* @par History:
* @verbatim
* $Log: CExpIter.h,v $
* Revision 1.9 2008/07/08 21:41:58 alexanderdreyer
* Merge: from developer's repository
*
* Revision 1.3 2008/01/11 16:58:57 dreyer
* CHANGE: Experimenting with iterators and correct rings
*
* Revision 1.2 2007/11/06 15:03:34 dreyer
* CHANGE: More generic copyright
*
* Revision 1.1 2007/05/03 16:04:45 dreyer
* CHANGE: new-style CTermIter integrated
*
* @endverbatim
**/
//*****************************************************************************
// include basic definitions
#include "pbori_defs.h"
// get stuff for term iteration
#include "CTermStack.h"
#include "CTermIter.h"
#ifndef CExpIter_h_
#define CExpIter_h_
BEGIN_NAMESPACE_PBORI
template <class ExpType>
class CExpGenerator {
public:
typedef ExpType value_type;
typedef const value_type& result_type;
typedef typename value_type::size_type size_type;
/// Default constructor
CExpGenerator(): m_result() {}
/// Return currently stored results
template <class SequenceType>
result_type operator()(const SequenceType&) const{
return m_result;
}
/// Take the first nlen elements of the exponent vector only
void resize(size_type nlen) { m_result.resize(nlen); }
/// Prepare space for nlen elements
void reserve(size_type nlen) { m_result.reserve(nlen); }
/// Get current size
size_type size() const { return m_result.size(); }
/// Append elements to exponent vector
template <class Iterator>
void append(Iterator start, Iterator finish) {
while (start != finish){
m_result.push_back(*start);
++start;
}
}
private:
value_type m_result;
};
template <class NaviType, class ExpType>
struct pbori_base<CExpIter<NaviType, ExpType> > {
typedef CTermStack<NaviType, std::forward_iterator_tag> stack_type;
typedef CTermIter<stack_type, CExpGenerator<ExpType> > type;
};
template <class NaviType, class ExpType>
class CExpIter :
public pbori_base<CExpIter<NaviType, ExpType> >::type {
public:
/// Name type of *this
typedef CExpIter<NaviType, ExpType> self;
/// Get base type
typedef typename pbori_base<self>::type base;
/// Construct iteraor from navigator over decision diagram structure
CExpIter(NaviType navi): base(navi, typename base::term_generator() ) {
base::m_getTerm.reserve(base::m_stack.size());
base::m_getTerm.append(base::begin(), base::end());
}
/// Default Constructor
CExpIter(): base() {}
/// Incrementation operation core
void increment() {
assert(!base::m_stack.empty());
if (base::m_stack.markedOne()) {
base::m_stack.clearOne();
}
else {
base::m_stack.next();
base::m_getTerm.resize( base::m_stack.size() == 0 ?
0:
base::m_stack.size() - 1);
if (!base::m_stack.empty()) {
base::m_stack.followThen();
base::m_stack.terminate();
}
}
base::m_getTerm.reserve(base::m_stack.size());
base::m_getTerm.append(base::begin() + base::m_getTerm.size(), base::end());
}
/// Prefix incrementation operation
self& operator++() {
increment();
return *this;
}
/// Postfix incrementation operation
self operator++(int) {
self copy(*this);
increment();
return copy;
}
};
END_NAMESPACE_PBORI
#endif
|