ML Reference
MeVis/Foundation/Sources/MLMemoryManager/Include/mlMemoryAllocator.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //-----------------------------------------------------------------------------
00003 // The memory allocator used by the memory manager.
00004 //
00005 // \file    mlMemoryAllocator.h
00006 // \author  Marcus Barann
00007 // \date    03/2008
00008 // 
00009 //-----------------------------------------------------------------------------
00010 
00011 #ifndef MLMEMORYALLOCATOR_H_INCLUDED
00012 #define MLMEMORYALLOCATOR_H_INCLUDED
00013 
00014 #include <cstddef>
00015 
00016 #include "../mlMemoryManagerDllExport.h"
00017 
00021 typedef void* (*MLAllocationCallback)(size_t size, void* userData);
00022 
00027 typedef void (*MLDeallocationCallback)(void* data, size_t size, void* userData); 
00028 
00029 
00030 class MLMemoryAllocatorPrivate;
00031 
00032 
00034 class MLMEMORYMANAGER_EXPORT MLMemoryAllocator
00035 {
00036 public:
00043   static void initialize(MLAllocationCallback   allocationCallback,   void* allocationCallbackUserData,
00044                          MLDeallocationCallback deallocationCallback, void* deallocationCallbackUserData);
00045   
00047   static void deinitialize();
00048   
00050   static MLMemoryAllocator* singleton();
00051   
00053   ~MLMemoryAllocator();
00054   
00055   
00056 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00057 private:
00058   MLMemoryAllocator();
00059   MLMemoryAllocator(const MLMemoryAllocator&);
00060   MLMemoryAllocator& operator=(const MLMemoryAllocator&);
00061   
00062 
00063 private:
00064   MLMemoryAllocatorPrivate* _private;
00065   
00066   friend class MLMemoryBlock;
00067 #endif
00068 };
00069 
00070 #endif // MLMEMORYALLOCATOR_H_INCLUDED
00071