Lattice Tester Online Documentation unknown
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
Loading...
Searching...
No Matches
LatticeTester::CoordinateSets Namespace Reference

The classes FromRange, SubSets, and AddCoordinate are defined here. 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 object that will build all the subsets of a Coordinates object that are of a cardinality in a certain range. More...
 

Detailed Description

The classes FromRange, SubSets, and AddCoordinate are defined here.

They are implemented in CoordinateSets.cc.

CoordinateSets (below) is a namespace that contains different implementations of sets of coordinates. They resemble Set objects in standard C++. Such sets 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 {
// An iterator over a set of subsets of coordinates.
class const_iterator: public std::iterator<std::forward_iterator_tag,
const Coordinates> {
public:
struct end_tag {};
// Constructor that sets the iterator to the beginning
explicit const_iterator(const CoordinateSets& seq):
m_seq(&seq), m_atEnd(false){
resetToOrder (m_seq->ranges().begin());
}
// Constructor that sets the iterator to 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 useful
void resetToOrder (const RangeMap::const_iterator& it);
// This is the object this iterator iterates over.
const CoordinateSets* m_seq;
// Maybe this is not useful.
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{});
}
}