BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
BALL::Enumerator< Container, SiteIterator, Variant > Class Template Reference

#include <BALL/CONCEPT/enumerator.h>

Classes

class  IteratorTraits_
 

Public Types

Type definitions
typedef void(* MutatorFunction )(Variant &, const Variant &)
 
typedef std::vector< Variant > VariantVector
 
typedef std::pair
< SiteIterator, VariantVector
Site
 
typedef std::list< SiteSiteList
 
typedef ForwardIterator
< Enumerator< Container,
SiteIterator, Variant >
, Container, EnumeratorIndex
*, IteratorTraits_
Iterator
 
typedef ConstForwardIterator
< Enumerator< Container,
SiteIterator, Variant >
, Container, EnumeratorIndex
*, IteratorTraits_
ConstIterator
 

Public Member Functions

Constructors and Destructors
 Enumerator ()
 
 Enumerator (Container &container)
 
 Enumerator (Container &container, MutatorFunction mutator)
 
 ~Enumerator ()
 
Accessors
void addVariants (const SiteIterator &it, const VariantVector &variants)
 
void deleteVariants (const SiteIterator &it, const VariantVector &variants)
 
Size countVariants ()
 
Container & getCurrent ()
 
void createCombination (const Position index)
 
void createCombination (const EnumeratorIndex &index)
 
Iterators
Iterator begin ()
 
Iterator end ()
 
ConstIterator begin () const
 
ConstIterator end () const
 

Protected Member Functions

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

Static Protected Member Functions

static 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 BALL::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.

Definition at line 273 of file enumerator.h.

Member Typedef Documentation

template<class Container, class SiteIterator, class Variant>
typedef ConstForwardIterator<Enumerator<Container, SiteIterator, Variant>, Container, EnumeratorIndex*, IteratorTraits_> BALL::Enumerator< Container, SiteIterator, Variant >::ConstIterator

Constant forward iterator

Definition at line 314 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
typedef ForwardIterator<Enumerator<Container, SiteIterator, Variant>, Container, EnumeratorIndex*, IteratorTraits_> BALL::Enumerator< Container, SiteIterator, Variant >::Iterator

Mutable forward iterator

Definition at line 309 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
typedef void(* BALL::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.

Definition at line 292 of file enumerator.h.

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

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

Definition at line 300 of file enumerator.h.

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

A list of sites.

Definition at line 304 of file enumerator.h.

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

A vector containing all possible variants for a specific site.

Definition at line 296 of file enumerator.h.

Constructor & Destructor Documentation

template<typename Container , typename SiteIterator , typename Variant >
BALL::Enumerator< Container, SiteIterator, Variant >::Enumerator ( )

Default Constructor

Definition at line 590 of file enumerator.h.

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

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

Parameters
containera Container class to be mutated

Definition at line 597 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
BALL::Enumerator< Container, SiteIterator, Variant >::Enumerator ( Container &  container,
MutatorFunction  mutator 
)

Detailed Constructor

Parameters
containera Container class to be mutated
mutatorthe function defining the mutations to be applied
template<class Container, class SiteIterator, class Variant>
BALL::Enumerator< Container, SiteIterator, Variant >::~Enumerator ( )
inline

Default Destructor

Definition at line 340 of file enumerator.h.

Member Function Documentation

template<class Container, class SiteIterator, class Variant>
void BALL::Enumerator< Container, SiteIterator, Variant >::addVariants ( const SiteIterator &  it,
const VariantVector variants 
)
inline

Add variants to the list of variants

Definition at line 351 of file enumerator.h.

template<typename Container , typename SiteIterator , typename Variant >
BALL_INLINE Enumerator< Container, SiteIterator, Variant >::Iterator BALL::Enumerator< Container, SiteIterator, Variant >::begin ( )

Definition at line 654 of file enumerator.h.

template<typename Container , typename VariantConstIterator , typename Variant >
BALL_INLINE Enumerator< Container, VariantConstIterator, Variant >::ConstIterator BALL::Enumerator< Container, VariantConstIterator, Variant >::begin ( ) const

Definition at line 668 of file enumerator.h.

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

Count all variants.

Returns
the number of all possible variants

Definition at line 373 of file enumerator.h.

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

Create a combination denoted by its number.

Parameters
indexthe number of the combination to be created
Exceptions
Exception::IndexOverflow

Definition at line 621 of file enumerator.h.

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

Create a combination denoted by an instance of EnumeratorIndex.

Parameters
indexthe instance of EnumeratorIndex that describes the combination to be created
Exceptions
EnumeratorIndex::IncompatibleIndex

Definition at line 635 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
static void BALL::Enumerator< Container, SiteIterator, Variant >::defaultAssign_ ( Variant &  a,
const Variant &  b 
)
inlinestaticprotected

Definition at line 572 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
void BALL::Enumerator< Container, SiteIterator, Variant >::deleteVariants ( const SiteIterator &  it,
const VariantVector variants 
)
inline

Delete variants from the list of variants

Definition at line 359 of file enumerator.h.

template<typename Container , typename SiteIterator , typename Variant >
BALL_INLINE Enumerator< Container, SiteIterator, Variant >::Iterator BALL::Enumerator< Container, SiteIterator, Variant >::end ( )

Definition at line 661 of file enumerator.h.

template<typename Container , typename VariantConstIterator , typename Variant >
BALL_INLINE Enumerator< Container, VariantConstIterator, Variant >::ConstIterator BALL::Enumerator< Container, VariantConstIterator, Variant >::end ( ) const

Definition at line 675 of file enumerator.h.

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

Access the current content

Returns
a reference to the container class of this enumerator

Definition at line 615 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
void BALL::Enumerator< Container, SiteIterator, Variant >::mutate_ ( SiteIterator &  it,
const Variant &  v 
)
inlineprotected

Definition at line 577 of file enumerator.h.

Friends And Related Function Documentation

template<class Container, class SiteIterator, class Variant>
friend class IteratorTraits_
friend

Definition at line 422 of file enumerator.h.

Member Data Documentation

template<class Container, class SiteIterator, class Variant>
Container& BALL::Enumerator< Container, SiteIterator, Variant >::container_
protected

Definition at line 582 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
bool BALL::Enumerator< Container, SiteIterator, Variant >::is_valid_position_
protected

Definition at line 586 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
MutatorFunction BALL::Enumerator< Container, SiteIterator, Variant >::mutator_
protected

Definition at line 583 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
EnumeratorIndex BALL::Enumerator< Container, SiteIterator, Variant >::position_
protected

Definition at line 585 of file enumerator.h.

template<class Container, class SiteIterator, class Variant>
SiteList BALL::Enumerator< Container, SiteIterator, Variant >::variant_sites_
protected

Definition at line 584 of file enumerator.h.