latest version v1.9 - last update 10 Apr 2010 |
Sorts elements in a list that are computationally expensive to compare. More...
#include <ltiSortExpensive.h>
Classes | |
class | sortHelper |
Helper class for sorting. More... | |
Public Member Functions | |
sortExpensive () | |
sortExpensive (const sortExpensive &other) | |
virtual | ~sortExpensive () |
void | apply (std::list< T > &aList, void *callbackPtr, TValue(*computeValue)(void *callbackPtr, const T &)) |
virtual const char * | getTypeName () const |
Sorts elements in a list that are computationally expensive to compare.
You need to provide a pointer to a class member function that performs the expensive computation (e.g. area computation). This class sorts the list while performing the expensive computation exactly once for each element.
lti::sortExpensive< T, TValue >::sortExpensive | ( | ) |
Constructor.
lti::sortExpensive< T, TValue >::sortExpensive | ( | const sortExpensive< T, TValue > & | other | ) |
Copy constructor (same as sortExpensive() - no memory.
)
virtual lti::sortExpensive< T, TValue >::~sortExpensive | ( | ) | [virtual] |
Destructor.
void lti::sortExpensive< T, TValue >::apply | ( | std::list< T > & | aList, | |
void * | callbackPtr, | |||
TValue(*)(void *callbackPtr, const T &) | computeValue | |||
) |
Sort the elements in the given list.
Requires a function pointer that computes a double value for an object of type T. The function is assumed to be a class member function, therefore a pointer to an instance of that class (callbackPtr
) is required (see www.function-pointer.org
). See ltiObjectsFromMask for a usage example.
virtual const char* lti::sortExpensive< T, TValue >::getTypeName | ( | ) | const [virtual] |
returns the name of this type
Reimplemented from lti::object.