UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
Sorter Class Referenceabstract

#include <sorter.hpp>

Public Member Functions

void qsort (bool bAscent=true)
 
virtual int countItems ()=0
 
virtual int compareItems (int i1, int i2)=0
 
virtual void exchangeItems (int i1, int i2)=0
 

Detailed Description

Class provides sorting and binary search functionality for custom objects with arbitrary storage nature.

Class should be specialized to exact object specifics by implementing several abstract methods.

Member Function Documentation

virtual int Sorter::compareItems ( int  i1,
int  i2 
)
pure virtual

Compare two items with mentioned indeces and return -1 if the first item is less than the second, 0 if two items are equal and 1 if the first one is greater than the second.

virtual int Sorter::countItems ( )
pure virtual

Return number of items in data container.

virtual void Sorter::exchangeItems ( int  i1,
int  i2 
)
pure virtual

Exchange two items with mentioned indeces.

void Sorter::qsort ( bool  bAscent = true)

QuickSort algorithm implementation for ascent or descent order.


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