Rosetta Utilities  2014.35
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
utility::TopScoreSelector< T, S > Class Template Reference

The TopScoreSelector keeps an in-place, sorted, singly-linked list of the N top-scoring objects and their scores that it encounters. In the case of ties, the first object(s) encountered are kept. Class T must have a default constructor, a copy constructor, and must be assignable. Class S must be assignable and comparable, both by a < operator and by a > operator. More...

#include <TopScoreSelector.hh>

Public Types

typedef platform::Size Size
 

Public Member Functions

 TopScoreSelector ()
 
void n_to_keep (Size setting)
 
Size n_to_keep () const
 
void low_is_better (bool setting)
 
bool low_is_better () const
 
bool better (S s1, S s2) const
 
void insert (T const &obj, S score)
 Keep a particular element if it is better than the worst element, or if we have not yet stored n_to_keep_ elements. More...
 
Size size () const
 
T const & operator[] (Size ind) const
 
top_score (Size ind) const
 

Private Member Functions

void add_to_set (T const &obj, S score)
 
void sort_top_scores () const
 Copy the top_scorers_ data into the sorted_top_scorers_ array. More...
 

Private Attributes

Size n_to_keep_
 
bool low_is_better_
 
Size worst_ind_
 
vector1< std::pair< T, S > > top_scorers_
 
vector1< Sizenext_ptr_
 
bool is_sorted_
 
vector1< std::pair< T, S > > sorted_top_scorers_
 

Detailed Description

template<class T, class S>
class utility::TopScoreSelector< T, S >

The TopScoreSelector keeps an in-place, sorted, singly-linked list of the N top-scoring objects and their scores that it encounters. In the case of ties, the first object(s) encountered are kept. Class T must have a default constructor, a copy constructor, and must be assignable. Class S must be assignable and comparable, both by a < operator and by a > operator.

Member Typedef Documentation

template<class T , class S >
typedef platform::Size utility::TopScoreSelector< T, S >::Size

Constructor & Destructor Documentation

template<class T , class S >
utility::TopScoreSelector< T, S >::TopScoreSelector ( )
inline

Member Function Documentation

template<class T , class S >
void utility::TopScoreSelector< T, S >::add_to_set ( T const &  obj,
score 
)
inlineprivate
template<class T , class S >
bool utility::TopScoreSelector< T, S >::better ( s1,
s2 
) const
inline
template<class T , class S >
void utility::TopScoreSelector< T, S >::insert ( T const &  obj,
score 
)
inline
template<class T , class S >
void utility::TopScoreSelector< T, S >::low_is_better ( bool  setting)
inline
template<class T , class S >
bool utility::TopScoreSelector< T, S >::low_is_better ( ) const
inline
template<class T , class S >
void utility::TopScoreSelector< T, S >::n_to_keep ( Size  setting)
inline
template<class T , class S >
Size utility::TopScoreSelector< T, S >::n_to_keep ( ) const
inline
template<class T , class S >
T const& utility::TopScoreSelector< T, S >::operator[] ( Size  ind) const
inline
template<class T , class S >
Size utility::TopScoreSelector< T, S >::size ( ) const
inline
template<class T , class S >
void utility::TopScoreSelector< T, S >::sort_top_scores ( ) const
inlineprivate
template<class T , class S >
S utility::TopScoreSelector< T, S >::top_score ( Size  ind) const
inline

Member Data Documentation

template<class T , class S >
bool utility::TopScoreSelector< T, S >::is_sorted_
mutableprivate
template<class T , class S >
bool utility::TopScoreSelector< T, S >::low_is_better_
private
template<class T , class S >
Size utility::TopScoreSelector< T, S >::n_to_keep_
private
template<class T , class S >
vector1< Size > utility::TopScoreSelector< T, S >::next_ptr_
private
template<class T , class S >
vector1< std::pair< T, S > > utility::TopScoreSelector< T, S >::sorted_top_scorers_
mutableprivate
template<class T , class S >
vector1< std::pair< T, S > > utility::TopScoreSelector< T, S >::top_scorers_
private
template<class T , class S >
Size utility::TopScoreSelector< T, S >::worst_ind_
private

The documentation for this class was generated from the following files: