|
|
@ -234,22 +234,14 @@ struct PoolItem {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Allocate a pool item; possibly allocate a new block in the pool.
|
|
|
|
|
|
|
|
* @return the allocated pool item (or NULL when the pool is full).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline T *AllocateRaw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return AllocateRaw(Tpool->first_free_index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Allocate a pool item; possibly allocate a new block in the pool.
|
|
|
|
* Allocate a pool item; possibly allocate a new block in the pool.
|
|
|
|
* @param first the first pool item to start searching
|
|
|
|
* @param first the first pool item to start searching
|
|
|
|
|
|
|
|
* @pre first <= Tpool->GetSize()
|
|
|
|
* @return the allocated pool item (or NULL when the pool is full).
|
|
|
|
* @return the allocated pool item (or NULL when the pool is full).
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static inline T *AllocateRaw(uint &first)
|
|
|
|
static inline T *AllocateSafeRaw(uint &first)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint last_minus_one = Tpool->GetSize() - 1;
|
|
|
|
uint last_minus_one = Tpool->GetSize() - 1;
|
|
|
|
|
|
|
|
|
|
|
@ -270,6 +262,28 @@ protected:
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Allocate a pool item; possibly allocate a new block in the pool.
|
|
|
|
|
|
|
|
* @return the allocated pool item (or NULL when the pool is full).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline T *AllocateRaw()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return AllocateSafeRaw(Tpool->first_free_index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Allocate a pool item; possibly allocate a new block in the pool.
|
|
|
|
|
|
|
|
* @param first the first pool item to start searching
|
|
|
|
|
|
|
|
* @return the allocated pool item (or NULL when the pool is full).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline T *AllocateRaw(uint &first)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (first >= Tpool->GetSize() && !Tpool->AddBlockToPool()) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return AllocateSafeRaw(first);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Are we cleaning this pool?
|
|
|
|
* Are we cleaning this pool?
|
|
|
|
* @return true if we are
|
|
|
|
* @return true if we are
|
|
|
|