/usr/include/JAGS/sarray/RangeIterator.h is in jags 4.2.0-2.
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 | #ifndef RANGE_ITERATOR_H_
#define RANGE_ITERATOR_H_
#include <vector>
#include <sarray/Range.h>
namespace jags {
/**
* @short Mutable index that traverses a Range
*
* A RangeIterator is a numeric vector that traverses a given
* Range in row- or column-major order.
*
* @see Range
*/
class RangeIterator : public std::vector<int> {
std::vector<std::vector<int> > _scope;
std::vector<unsigned int> _dim;
std::vector<unsigned int> _index;
unsigned int _atend;
//Forbid assignment
RangeIterator &operator=(std::vector<int> const &);
public:
/**
* Constructor. The initial value of a RangeIterator is the
* beginning of the range.
*
* It is not possible to construct a RangeIterator if any of
* the dimensions of the Range are zero because there can be
* no index value corresponding to a zero dimension. In this
* case a logic_error is thrown.
*
* @param range. Range to traverse
*/
RangeIterator(Range const &range);
/**
* Goes to the next index in column-major order, (i.e. moving
* the left hand index fastest). If the RangeIterator reaches
* the end of the Range, then a call to nextLeft will move it
* to the beginning again.
*
* @return reference to self after incrementation
* @see nextRight
*/
RangeIterator &nextLeft();
/**
* Goes to the next index in row-major order (i.e. moving the
* right hand index fastest) but otherwise behaves like
* nextLeft.
*
* @return reference to self after incrementation
* @see nextLeft
*/
RangeIterator &nextRight();
/**
* Returns a numeric counter of the number of times the
* RangeIterator has gone past the end of the Range (and
* returned to the beginning) in a call to nexLeft or
* nextRight. The initial value is zero.
*/
unsigned int atEnd() const;
};
} /* namespace jags */
#endif /* RANGE_ITERATOR_H_ */
|