00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __NERADIX_H
00028 #define __NERADIX_H
00029
00030
00031 #include "base.h"
00032
00033
00040 namespace NeoEngine
00041 {
00042
00043
00044
00055 class NEOENGINE_API RadixSort
00056 {
00057 public:
00058
00063 enum RADIXSORTTYPE
00064 {
00066 INT32 = 0x00000000,
00067
00069 UINT32 = 0x00000001,
00070
00072 INT64 = 0x00000002,
00073
00075 UINT64 = 0x00000003,
00076
00078 FLOAT32 = 0x00000004
00079 };
00080
00081
00082 protected:
00083
00085 RADIXSORTTYPE m_eType;
00086
00088 unsigned int m_uiCurrentSize;
00089
00091 unsigned int m_uiPreviousSize;
00092
00094 unsigned int *m_puiIndices;
00095
00097 unsigned int *m_puiIndices2;
00098
00100 unsigned int m_uiTotalCalls;
00101
00103 unsigned int m_uiHits;
00104
00106 unsigned int *m_puiHistogram;
00107
00109 unsigned int *m_puiOffset;
00110
00115 bool Resize( unsigned int uiNB );
00116
00120 void ResetIndices();
00121
00128 bool CreateHistograms( const void *pInput, unsigned int uiNB );
00129
00136 RadixSort &Sort( const float *pfInput, unsigned int uiNB );
00137
00138
00139
00140 public:
00141
00145 RadixSort( RADIXSORTTYPE eType );
00146
00150 ~RadixSort();
00151
00158 RadixSort &Sort( const void *pInput, unsigned int uiNB );
00159
00164 inline unsigned int *GetIndices() { return m_puiIndices; }
00165
00169 unsigned int GetUsedMemory() const;
00170
00174 inline unsigned int GetTotalCalls() const { return m_uiTotalCalls; }
00175
00179 inline unsigned int GetHits() const { return m_uiHits; }
00180 };
00181
00182
00183 };
00184
00185
00186 #endif