SizeSorted.hh

00001 //********************************************************************
00002 //*** mm/ChunkManager/SizeSorted.hh
00003 //*** Copyright (c) 2002 by Markus Winand <mws@fatalmind.com>
00004 //*** $Id: SizeSorted.hh,v 1.2 2002-12-15 11:18:10 mws Exp $
00005 //********************************************************************
00006 
00007 #ifndef INCLUDE_MM_CHUNKMANAGER_SIZESORTED_HH
00008 #define INCLUDE_MM_CHUNKMANAGER_SIZESORTED_HH
00009 #include "ChunkManager.hh"
00010 
00011 namespace fatalmind {
00012 
00013 template<class BM>
00014 class SizeSorted: ChunkManager {
00015     public:
00016         SizeSorted(
00017             const size_t a_len, 
00018             const size_t a_unitstep,
00019             const size_t a_blocks,
00020             const size_t a_min, 
00021             const size_t a_max
00022         );
00023 
00024         void* allocate(const size_t a_len);
00025         void  deallocate(const void* a_ptr);
00026 
00027     private:
00028         typedef int unitlist_t;
00029 
00030         struct blocklst {
00031             int next;
00032         };
00033 
00034 
00035         const size_t _blocks;
00036         const void*  _end;
00037         const size_t _unitstep;
00038         const size_t _max;
00039         const int    _unitoffset;
00040         const int    _unitcnt;
00041 
00042         const unitlist_t*  _ulst;
00043         const blocklst*    _bmgrlst;
00044         const void*        _blst;
00045         const size_t _blocksize;
00046 };
00047 
00048 } // namespace fatalmind
00049 #endif

Generated on Mon Nov 9 16:21:24 2009 for ResourcePool by  doxygen 1.5.3