271 Sort (
const void* data,
uInt elementSize);
314 void sortKey (
const void* data, DataType,
uInt increment = 0,
370 template <
typename T>
372 template <
typename T>
374 template <
typename T>
383 void addKey (
const void* data, DataType,
uInt increment,
int options);
390 T
insSort (T nr, T* indices)
const;
399 T
parSort (
int nthr, T nrrec, T* inx)
const;
401 void merge (T* inx, T* tmp, T size, T* index,
412 void qkSort (T nr, T* indices)
const;
418 T
heapSort (T nr, T* indices)
const;
425 void siftDown (T low, T up, T* indices)
const;
429 int compare (T index1, T index2)
const;
438 inline void swap (T index1, T index2, T* indices)
const
440 T t = indices[index1];
441 indices[index1] = indices[index2];
void siftDown(T low, T up, T *indices) const
Siftdown algorithm for heapsort.
void merge(T *inx, T *tmp, T size, T *index, T nparts) const
unsigned long long uInt64
Order
Enumerate the sort order:
T insSort(T nr, T *indices) const
Do an insertion sort, optionally skipping duplicates.
void addKey(const void *data, DataType, uInt increment, int options)
Add a sort key giving a data type and stride or the sort key.
T doSort(Vector< T > &indexVector, T nrrec, int options=DefaultSort, Bool tryGenSort=True) const
T heapSort(T nr, T *indices) const
Do a heapsort, optionally skipping duplicates.
T parSort(int nthr, T nrrec, T *inx) const
Do a merge sort, if possible in parallel using OpenMP.
int order_p
sort order; -1 = ascending, 1 = descending
Sort on one or more keys, ascending and/or descending.
int order() const
Get the sort order.
Referenced counted pointer for constant data.
void qkSort(T nr, T *indices) const
Option
Enumerate the sort options:
bool Bool
Define the standard types used by Casacore.
SortKey(const void *data, const CountedPtr< BaseCompare > &, uInt increment, int order)
Define a sort key in a given data array using the indicated comparison object, stride and sort order...
T insSortNoDup(T nr, T *indices) const
int compare(T index1, T index2) const
Compare 2 records based on the comparison functions.
T heapSortNoDup(T nr, T *indices) const
void copy(const Sort &that)
Copy that Sort object to this.
T doUnique(Vector< T > &uniqueVector, T nrrec) const
A drop-in replacement for Block<T*>.
void swap(T index1, T index2, T *indices) const
Swap 2 indices.
SortKey & operator=(const SortKey &)
Assignment (copy semantics).
CountedPtr< BaseCompare > ccmpObj_p
comparison object; use CountedPtr for memory management
abstract base class for comparing two objects
BaseCompare * cmpObj_p
comparison object; use raw pointer for performance
T quickSortNoDup(T nr, T *indices) const
Sort()
The default constructor can be used when the data is only passed in via function sortKey.
int compareChangeIdx(T i1, T i2, size_t &idxComp) const
As compare() but it also gives back the index of the first comparison function that didn't match...
T quickSort(T nr, T *indices) const
Do a quicksort, optionally skipping duplicates (qkSort is the actual quicksort function).
uInt unique(Vector< uInt > &uniqueVector, uInt nrrec) const
Get all unique records in a sorted array.
uInt incr_p
increment for next data point
void sortKey(const void *data, DataType, uInt increment=0, Order=Ascending)
Define a sort key (the most significant key should be defined first).
const void * data_p
address of first data point
PtrBlock< SortKey * > keys_p
Sort & operator=(const Sort &)
Assignment (copy semantics).
uInt sort(Vector< uInt > &indexVector, uInt nrrec, int options=DefaultSort, Bool tryGenSort=True) const
Sort the data array of nrrec records.
uInt tryGenSort(Vector< uInt > &indexVector, uInt nrrec, int opt) const
Try if GenSort can be used for this single key.