Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

radix.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           radix.h  -  Radix sorter
00003                              -------------------
00004     begin                : Mon May 13 2002
00005     copyright            : (C) 2002 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, radix.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2002
00023  Reality Rift Studios. All Rights Reserved.
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

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5