Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

OsclMemPoolFixedChunkAllocator Class Reference
[OSCL Memory]

#include <oscl_mem_mempool.h>

Inheritance diagram for OsclMemPoolFixedChunkAllocator:

Oscl_DefAlloc Oscl_Alloc Oscl_Dealloc

Public Methods

OSCL_IMPORT_REF OsclMemPoolFixedChunkAllocator (const uint32 numchunk=1, const uint32 chunksize=0, Oscl_DefAlloc *gen_alloc=NULL)
virtual OSCL_IMPORT_REF void enablenullpointerreturn ()
virtual OSCL_IMPORT_REF ~OsclMemPoolFixedChunkAllocator ()
virtual OSCL_IMPORT_REF OsclAnyallocate (const uint32 n)
virtual OSCL_IMPORT_REF void deallocate (OsclAny *p)
virtual OSCL_IMPORT_REF void notifyfreechunkavailable (OsclMemPoolFixedChunkAllocatorObserver &obs, OsclAny *aContextData=NULL)
virtual OSCL_IMPORT_REF void CancelFreeChunkAvailableCallback ()
OSCL_IMPORT_REF void addRef ()
OSCL_IMPORT_REF void removeRef ()

Protected Methods

virtual OSCL_IMPORT_REF void createmempool ()
virtual OSCL_IMPORT_REF void destroymempool ()

Protected Attributes

uint32 iNumChunk
uint32 iChunkSize
uint32 iChunkSizeMemAligned
Oscl_DefAllociMemPoolAllocator
OsclAnyiMemPool
Oscl_Vector< OsclAny *, OsclMemAllocatoriFreeMemChunkList
bool iCheckNextAvailableFreeChunk
OsclMemPoolFixedChunkAllocatorObserveriObserver
OsclAnyiNextAvailableContextData
int32 iRefCount
bool iEnableNullPtrReturn

Constructor & Destructor Documentation

OSCL_IMPORT_REF OsclMemPoolFixedChunkAllocator::OsclMemPoolFixedChunkAllocator const uint32    numchunk = 1,
const uint32    chunksize = 0,
Oscl_DefAlloc   gen_alloc = NULL
 

This API throws an exception when the memory allocation for pool fails If numchunk and chunksize parameters are not set, memory pool of 1 chunk will be created in the first call to allocate. The chunk size will be set to the n passed in for allocate(). If numchunk parameter is set to 0, the memory pool will use 1 for numchunk.

Returns:
void

virtual OSCL_IMPORT_REF OsclMemPoolFixedChunkAllocator::~OsclMemPoolFixedChunkAllocator   [virtual]
 

The destructor for the memory pool


Member Function Documentation

OSCL_IMPORT_REF void OsclMemPoolFixedChunkAllocator::addRef  
 

Increments the reference count for this memory pool allocator

Returns:
void

virtual OSCL_IMPORT_REF OsclAny* OsclMemPoolFixedChunkAllocator::allocate const uint32    n [virtual]
 

This API throws an exception when n is greater than the fixed chunk size or there are no free chunk available in the pool, if "enablenullpointerreturn" has not been called. If the memory pool hasn't been created yet, the pool will be created with chunk size equal to n so n must be greater than 0. Exception will be thrown if memory allocation for the memory pool fails.

Returns:
pointer to available chunk from memory pool

Implements Oscl_DefAlloc.

virtual OSCL_IMPORT_REF void OsclMemPoolFixedChunkAllocator::CancelFreeChunkAvailableCallback   [virtual]
 

This API will cancel any past callback requests..

Returns:
void

virtual OSCL_IMPORT_REF void OsclMemPoolFixedChunkAllocator::createmempool   [protected, virtual]
 

virtual OSCL_IMPORT_REF void OsclMemPoolFixedChunkAllocator::deallocate OsclAny   p [virtual]
 

This API throws an exception when the pointer p passed in is not part of the memory pool. Exception will be thrown if the memory pool is not set up yet.

Returns:
void

Implements Oscl_DefAlloc.

virtual OSCL_IMPORT_REF void OsclMemPoolFixedChunkAllocator::destroymempool   [protected, virtual]
 

virtual OSCL_IMPORT_REF void OsclMemPoolFixedChunkAllocator::enablenullpointerreturn   [virtual]
 

This API will disable exceptions in case the memory pool runs out of memory Instead of doing "OSCL_LEAVE(OsclErrNoResources)" allocate API will return NULL.

Returns:
void

virtual OSCL_IMPORT_REF void OsclMemPoolFixedChunkAllocator::notifyfreechunkavailable OsclMemPoolFixedChunkAllocatorObserver   obs,
OsclAny   aContextData = NULL
[virtual]
 

This API will set the flag to send a callback via specified observer object when the next memory chunk is deallocated by deallocate() call..

Returns:
void

OSCL_IMPORT_REF void OsclMemPoolFixedChunkAllocator::removeRef  
 

Decrements the reference count for this memory pool allocator When the reference count goes to 0, this instance of the memory pool object is deleted

Returns:
void


Field Documentation

bool OsclMemPoolFixedChunkAllocator::iCheckNextAvailableFreeChunk [protected]
 

uint32 OsclMemPoolFixedChunkAllocator::iChunkSize [protected]
 

uint32 OsclMemPoolFixedChunkAllocator::iChunkSizeMemAligned [protected]
 

bool OsclMemPoolFixedChunkAllocator::iEnableNullPtrReturn [protected]
 

Oscl_Vector<OsclAny*, OsclMemAllocator> OsclMemPoolFixedChunkAllocator::iFreeMemChunkList [protected]
 

OsclAny* OsclMemPoolFixedChunkAllocator::iMemPool [protected]
 

Oscl_DefAlloc* OsclMemPoolFixedChunkAllocator::iMemPoolAllocator [protected]
 

OsclAny* OsclMemPoolFixedChunkAllocator::iNextAvailableContextData [protected]
 

uint32 OsclMemPoolFixedChunkAllocator::iNumChunk [protected]
 

OsclMemPoolFixedChunkAllocatorObserver* OsclMemPoolFixedChunkAllocator::iObserver [protected]
 

int32 OsclMemPoolFixedChunkAllocator::iRefCount [protected]
 


The documentation for this class was generated from the following file:
OSCL API
Posting Version: OPENCORE_20090310