00001 // -*- c++ -*- 00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 00003 00004 // O S C L _ M E M P O O L _ A L L O C A T O R 00005 00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 00007 00018 /*************************************************************************************** 00019 File Name : oscl_mempool_allocator.h 00020 Description : File containing definition of class OsclMemPoolAllocator that provides 00021 methods for creating, deleting memory pool. 00022 Coding History : 00023 Achint Kaur April 11, 2006 Initial Draft 00024 ***************************************************************************************/ 00025 #ifndef OSCL_MEMPOOL_ALLOCATOR_H_INCLUDED 00026 #define OSCL_MEMPOOL_ALLOCATOR_H_INCLUDED 00027 00028 #ifndef OSCL_DEFALLOC_H_INCLUDED 00029 // For custom allocator Oscl_DefAlloc object 00030 #include "oscl_defalloc.h" 00031 #endif 00032 00033 class OsclMemPoolAllocator 00034 { 00035 public: 00036 // Constructor 00037 OsclMemPoolAllocator(Oscl_DefAlloc* gen_alloc = NULL); 00038 00039 // Virtual destructor 00040 virtual ~OsclMemPoolAllocator(); 00041 00042 // Create memory pool 00043 OsclAny* CreateMemPool(const uint32 aNumChunk = 2, const uint32 aChunkSize = 4); 00044 00045 // Delete memory pool 00046 void DestroyMemPool(); 00047 00048 // Memory alignment 00049 uint oscl_mem_aligned_size(uint size); 00050 00051 private: 00052 // Custom allocator for memory 00053 Oscl_DefAlloc* iCustomAllocator; 00054 00055 // Base address for memory pool 00056 OsclAny* iBaseAddress; 00057 00058 }; 00059 00060 #endif