26 template <
class VT,
class AVT>
31 : maxsize_( maxsize ) {}
38 inline VT getValue(
int rank)
const;
39 inline AVT getAssociatedValue(
int rank)
const;
41 inline bool getHighestValue( VT& )
const;
42 inline bool getLowestValue( VT& )
const;
44 inline int size()
const;
45 inline int isEmpty()
const {
return !size(); }
47 inline void addValue( VT val, AVT aval );
55 template <
class VT,
class AVT>
inline 62 template <
class VT,
class AVT>
inline 64 {
return values_[pos].first; }
67 template <
class VT,
class AVT>
inline 69 {
return values_[pos].second; }
72 template <
class VT,
class AVT>
inline 74 {
return values_.size(); }
78 template <
class VT,
class AVT>
inline 83 res = values_[0].first;
91 template <
class VT,
class AVT>
inline 94 const int sz = size();
97 res = values_[sz-1].first;
106 template <
class VT,
class AVT>
inline 110 const int mysize = size();
112 while ( pos<mysize && values_[pos].first>val ) pos++;
116 if ( mysize>=maxsize_ )
119 values_ += std::pair<VT,AVT>( val, aval );
123 values_.insert( pos, std::pair<VT,AVT>(val,aval) );
125 if ( mysize==maxsize_ )
126 values_.removeSingle(mysize);
AVT getAssociatedValue(int rank) const
Definition: toplist.h:68
bool getHighestValue(VT &) const
Definition: toplist.h:79
int isEmpty() const
Definition: toplist.h:45
bool getLowestValue(VT &) const
Definition: toplist.h:92
int size() const
Definition: toplist.h:73
TypeSet< std::pair< VT, AVT > > values_
Definition: toplist.h:50
VT getValue(int rank) const
Definition: toplist.h:63
void addValue(VT val, AVT aval)
Definition: toplist.h:107
Is a class that holds a "top N" list with the N highest (or lowest) values that is added...
Definition: houghtransform.h:23
Set of (small) copyable elements.
Definition: commontypes.h:30
const int maxsize_
Definition: toplist.h:51
TopList(int maxsize)
Definition: toplist.h:30
virtual ~TopList()
Definition: toplist.h:33
#define mClass(module)
Definition: commondefs.h:164
void reset()
Definition: toplist.h:56