#ifndef _COMMON_QUICKSORT_HPP_
#define _COMMON_QUICKSORT_HPP_
#ifndef _COMMON_SORTOPTIONS_HPP_
#include <common/sortopt.hpp>
#endif
#ifndef _COMMON_TYPES_HPP_
#include <common/types.hpp>
#endif
#ifdef _EXPAND_QSORT_TEMPLATES_
#pragma option -Jgd
#endif

template <class T>
class Block;
template <class T>
class Array;

template <class T>
class QuickSort
{
public:
	QuickSort(void);
	virtual ~QuickSort();
	void sortItems(Array<T> &arrayItems,SortOptions::SortOrder sortOrder=SortOptions::Ascending);
	void sortItems(Block<T> &someBlock,SortOptions::SortOrder sortOrder=SortOptions::Ascending);
private:
	void quickSort(long left,long right);
	void quickSortDescending(long left,long right);
	void sortBlockAscending(long left,long right);
	void sortBlockDescending(long left,long right);
  Block<T> *mlpBlockItems;
	T HUGE *mlpItemList;
};
#if defined(_MSC_VER)
#include <common/qsort.tpp>
#endif
#endif
