Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
PoolAllocator Class Reference

Public Types

enum  { DEFAULT_MAX_ALLOCS =4096 }
 
typedef int ID
 

Public Member Functions

ID alloc (int p_size)
 Alloc memory, get an ID on success, POOL_ALOCATOR_INVALID_ID on failure.
 
void free (ID p_mem)
 Free allocated memory.
 
Error resize (ID p_mem, int p_new_size)
 resize a memory chunk
 
int get_size (ID p_mem) const
 
int get_free_mem ()
 get free memory
 
int get_used_mem () const
 
int get_free_peak ()
 get free memory
 
Error lock (ID p_mem)
 
void * get (ID p_mem)
 
const void * get (ID p_mem) const
 
void unlock (ID p_mem)
 
bool is_locked (ID p_mem) const
 
 PoolAllocator (int p_size, bool p_needs_locking=false, int p_max_entries=DEFAULT_MAX_ALLOCS)
 
 PoolAllocator (void *p_mem, int p_size, int p_align=1, bool p_needs_locking=false, int p_max_entries=DEFAULT_MAX_ALLOCS)
 
 PoolAllocator (int p_align, int p_size, bool p_needs_locking=false, int p_max_entries=DEFAULT_MAX_ALLOCS)
 

Protected Member Functions

virtual void mt_lock () const
 Reimplement for custom mt locking.
 
virtual void mt_unlock () const
 Reimplement for custom mt locking.
 

The documentation for this class was generated from the following files: