Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

Enumerator< Container, SiteIterator, Variant > Class Template Reference

Enumerator class. More...

#include <enumerator.h>

List of all members.

Public Types

Type definitions
typedef void(* MutatorFunction )(Variant &, const Variant &)
 Site mutator function.
typedef std::vector< Variant > VariantVector
 A vector containing all possible variants for a specific site.
typedef std::pair< SiteIterator,
VariantVector
Site
 A combination of a site position and all its possible variants.
typedef std::list< SiteSiteList
 A list of sites.
typedef ForwardIterator< Enumerator<
Container, SiteIterator,
Variant >, Container, EnumeratorIndex *,
IteratorTraits_ > 
Iterator
 Mutable forward iterator.
typedef ConstForwardIterator<
Enumerator< Container, SiteIterator,
Variant >, Container, EnumeratorIndex *,
IteratorTraits_ > 
ConstIterator
 Constant forward iterator.

Public Member Functions

Constructors and Destructors
 Enumerator () throw ()
 Default Constructor.
 Enumerator (Container &container) throw ()
 Detailed Constructor.
 Enumerator (Container &container, MutatorFunction mutator) throw ()
 Detailed Constructor.
 ~Enumerator () throw ()
 Default Destructor.
Accessors
void addVariants (const SiteIterator &it, const VariantVector &variants) throw ()
 Add variants to the list of variants.
void deleteVariants (const SiteIterator &it, const VariantVector &variants) throw ()
 Delete variants from the list of variants.
Size countVariants () throw ()
 Count all variants.
Container & getCurrent () throw ()
 Access the current content.
void createCombination (const Position index) throw (Exception::IndexOverflow)
 Create a combination denoted by its number.
void createCombination (const EnumeratorIndex &index) throw (EnumeratorIndex::IncompatibleIndex)
 Create a combination denoted by an instance of EnumeratorIndex.
Iterators
Iterator begin () throw ()
Iterator end () throw ()
ConstIterator begin () const throw ()
ConstIterator end () const throw ()

Protected Member Functions

void mutate_ (SiteIterator &it, const Variant &v) throw ()

Static Protected Member Functions

void defaultAssign_ (Variant &a, const Variant &b)

Protected Attributes

Container & container_
MutatorFunction mutator_
SiteList variant_sites_
EnumeratorIndex position_
bool is_valid_position_

Friends

class IteratorTraits_


Detailed Description

template<class Container, class SiteIterator, class Variant>
class Enumerator< Container, SiteIterator, Variant >

Enumerator class.

The EnumeratorIndex class is designed to enumerate all possible combinations of things. Applications are e.g. the enumeration of all possible sequences defined through a multisequence or enumerating all possible rotamers of a peptide or a bindings site.

Enumerator uses EnumeratorIndex as an inhomogeneous counter class. It is also highly templatized in order to be adaptable to most problem instances. In general, the enumeration problem can be seen as counting with a mixed-base number. For an example of the Enumerator's usage, please refer to the tutorial.
The Enumerator's template arguments are

In the case of a string sequence that has to be mutated, the Container is of class String , the SiteIterator is of type String::Iterator, and Variant is obviously of type char.


Member Typedef Documentation

template<class Container, class SiteIterator, class Variant>
typedef void(* Enumerator< Container, SiteIterator, Variant >::MutatorFunction)(Variant &, const Variant &)
 

Site mutator function.

A function used to assing one variant of a site in the container to another. In the trivial case, this is just the assignment operator (as implemented in the default case), but more involved enumeration problems (e.g. side chain rotamer enumeration) might require additional code for the assignment of the true variant.

template<class Container, class SiteIterator, class Variant>
typedef std::pair<SiteIterator, VariantVector> Enumerator< Container, SiteIterator, Variant >::Site
 

A combination of a site position and all its possible variants.

template<class Container, class SiteIterator, class Variant>
typedef std::list<Site> Enumerator< Container, SiteIterator, Variant >::SiteList
 

A list of sites.

template<class Container, class SiteIterator, class Variant>
typedef std::vector<Variant> Enumerator< Container, SiteIterator, Variant >::VariantVector
 

A vector containing all possible variants for a specific site.


Constructor & Destructor Documentation

template<typename Container, typename SiteIterator, typename Variant>
Enumerator< Container, SiteIterator, Variant >::Enumerator Container &  container  )  throw ()
 

Detailed Constructor.

The mutator function is set to a default mutator, using the assignment operator for Variant.

Parameters:
container a Container class to be mutated

template<typename Container, typename SiteIterator, typename Variant>
Enumerator< Container, SiteIterator, Variant >::Enumerator Container &  container,
MutatorFunction  mutator
throw ()
 

Detailed Constructor.

Parameters:
container a Container class to be mutated
mutator the function defining the mutations to be applied


Member Function Documentation

template<class Container, class SiteIterator, class Variant>
Size Enumerator< Container, SiteIterator, Variant >::countVariants  )  throw ()
 

Count all variants.

Returns:
the number of all possible variants

template<typename Container, typename SiteIterator, typename Variant>
void Enumerator< Container, SiteIterator, Variant >::createCombination const EnumeratorIndex index  )  throw (EnumeratorIndex::IncompatibleIndex)
 

Create a combination denoted by an instance of EnumeratorIndex.

Parameters:
index the instance of EnumeratorIndex that describes the combination to be created

template<typename Container, typename SiteIterator, typename Variant>
void Enumerator< Container, SiteIterator, Variant >::createCombination const Position  index  )  throw (Exception::IndexOverflow)
 

Create a combination denoted by its number.

Parameters:
index the number of the combination to be created

template<typename Container, typename SiteIterator, typename Variant>
Container & Enumerator< Container, SiteIterator, Variant >::getCurrent  )  throw ()
 

Access the current content.

Returns:
a reference to the container class of this enumerator