CrystalSpace

Public API Reference

csRadixSorter Class Reference

A radix-sorter for signed and unsigned integers as well as floats. More...

#include <csutil/radixsort.h>

List of all members.

Public Member Functions

size_t * GetRanks () const
 Get the last generated ranks array.
template<class T>
bool Reorder (const T *source, T *dest, size_t size)
 Reorder a list with the ranks in-place.
template<class T>
void ReorderInplace (T *source, size_t size)
 Reorder a list with the ranks in-place.
void Sort (float *array, size_t size)
 Sort array of floats.
void Sort (int32 *array, size_t size)
 Sort array of signed integers.
void Sort (uint32 *array, size_t size)
 Sort array of unsigned integers.


Detailed Description

A radix-sorter for signed and unsigned integers as well as floats.

Creates an index-table instead of reordering elements. Based on ideas by Pierre Terdiman

Definition at line 40 of file radixsort.h.


Member Function Documentation

size_t* csRadixSorter::GetRanks (  )  const [inline]

Get the last generated ranks array.

Definition at line 70 of file radixsort.h.

template<class T>
bool csRadixSorter::Reorder ( const T *  source,
T *  dest,
size_t  size 
) [inline]

Reorder a list with the ranks in-place.

Source and destination arrays should not overlap in memory!

Definition at line 119 of file radixsort.h.

template<class T>
void csRadixSorter::ReorderInplace ( T *  source,
size_t  size 
) [inline]

Reorder a list with the ranks in-place.

Definition at line 79 of file radixsort.h.

References CS_ALLOC_STACK_ARRAY, cs_free(), and cs_malloc().

void csRadixSorter::Sort ( float *  array,
size_t  size 
)

Sort array of floats.

Parameters:
array Array of floats to sort
size Number of elements in array

void csRadixSorter::Sort ( int32 array,
size_t  size 
)

Sort array of signed integers.

Parameters:
array Array of integers to sort
size Number of elements in array

void csRadixSorter::Sort ( uint32 array,
size_t  size 
)

Sort array of unsigned integers.

Parameters:
array Array of integers to sort
size Number of elements in array


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.7