EqualAllocationUnit.hh

00001 #ifndef INCLUDE_MM_BLOCKMANAGER_EQUALALLOCATIONUNIT_HH
00002 #define INCLUDE_MM_BLOCKMANAGER_EQUALALLOCATIONUNIT_HH
00003 
00004 #include "BlockManager.hh"
00005 
00006 namespace fatalmind {
00007 
00008 class EqualAllocationUnit: BlockManager {
00009     public:
00010         EqualAllocationUnit(const size_t a_len, const size_t a_unitsize);
00011         void* allocate(const size_t a_len);
00012         void  deallocate(const void* ptr);
00013 
00014     private:
00015         struct freelst {
00016             freelst* next;
00017         };
00018         freelst* _ptr;
00019         const size_t _unitsize;
00020 
00021         static freelst* init_list(
00022             const void* a_start, 
00023             const size_t a_len, 
00024             const size_t a_unitsize
00025         );
00026 
00027 
00028         static inline freelst* init_list_next_step(
00029             freelst* i, 
00030             const size_t a_unitsize
00031         ) {
00032             i->next = (freelst*)((char*)i + a_unitsize);
00033             return 0; // TODO
00034         }
00035 
00036 };
00037 
00038 } // namespace fatalmind
00039 
00040 #endif

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