Lattice Tester Guide  1.0-9
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
LatticeTester::CoordinateSets Namespace Reference

A namespace containing different implementation of sets of coordinates. More...

Classes

class  AddCoordinate
 This template class wraps any implementation of a CoordinateSets and adds a specific coordinate to each coordinate sets. More...
 
class  FromRanges
 A CoordinateSets for coordinates within a given range. More...
 
class  Subsets
 This class implements a CoordinateSets that will build all the subsets of a Coordinates object that are of a cardinality in a certain range. More...
 

Detailed Description

A namespace containing different implementation of sets of coordinates.

These can be used to specify a set of projections of lattices or point sets. The classes in this namespace are iterable but are not containers, so they require very little storage. They virtually contain objects of type LatticeTester::Coordinates.

class CoordinateSets {
class const_iterator: public std::iterator<std::forward_iterator_tag,
const Coordinates> {
public:
struct end_tag {};
// Constructor that sets the iterator at the beginning
explicit const_iterator(const CoordinateSets& seq):
m_seq(&seq), m_atEnd(false){
resetToOrder (m_seq->ranges().begin());
}
// Constructor that sets the iterator at the end
const_iterator(const FromRanges& seq, end_tag):
m_seq(&seq), m_atEnd(true) {}
// Copy constructor.
const_iterator(const const_iterator& other) {
this->m_seq = other.m_seq;
this->m_atEnd = other.m_atEnd;
this->m_value = other.m_value;
}
// Default constructor that does nothing
const_iterator(): m_seq(nullptr), m_atEnd(false) {}
// Assignment operator. Normally this should do the same as the copy
// constructor.
const_iterator& operator=(const const_iterator& other) {
this->m_seq = other.m_seq;
this->m_atEnd = other.m_atEnd;
this->m_value = other.m_value;
return *this;
}
// Comparison operator.
bool operator==(const const_iterator& other) {
return m_seq == other.m_seq
&& (other.m_atEnd ? m_atEnd : m_value == other.m_value);
}
// Second comparison operator.
bool operator!=(const const_iterator& other) {
return !(*this == other);
}
// dereference operator. This should return the Coordinates this
// iterator is at.
const Coordinates& operator*() const {
return m_value;
}
// This is definitely the operator that should be reimplemented.
// Prefix increment operator
const_iterator& operator++();
// Same as before
// Postfix iteration operator
const_iterator operator++(int);
private:
// Maybe this is not that usefull
void resetToOrder (const RangeMap::const_iterator& it);
// This is the object this iterator iterates over.
const CoordinateSets* m_seq;
// Maybe this is not usefull
bool m_atEnd;
// The set of values the iterator is at
Coordinates m_value;
};
// Gives an iterator that is at the beginning of the sequence of the
// object
const_iterator begin() const {
return const_iterator(*this);
}
// Gives an iterator that is at the end of the sequence of the object
const_iterator end() const {
return const_iterator(*this, typename const_iterator::end_tag{});
}
}