32#include "foundation/Px.h"
33#include "foundation/PxArray.h"
34#include "foundation/PxUserAllocated.h"
40 template<
class FreeBuffer>
53 if(
id == (mCurrentID - 1))
56 mFreeIDs.pushBack(
id);
68 const PxU32 size = mFreeIDs.size();
72 return mFreeIDs.popBack();
78 PxU32 getNumUsedID()
const
80 return mCurrentID - mFreeIDs.size();
83 PxU32 getMaxID()
const
92 template<
class FreeBuffer>
95 FreeBuffer mDeferredFreeIDs;
98 void deferredFreeID(PxU32
id)
100 mDeferredFreeIDs.pushBack(
id);
104 void processDeferredIds()
106 const PxU32 deferredFreeIDCount = mDeferredFreeIDs.size();
107 for(PxU32 a = 0; a < deferredFreeIDCount;++a)
111 mDeferredFreeIDs.clear();
117 mDeferredFreeIDs.clear();
121 PxU32 getNumUsedID()
const
126 FreeBuffer& getDeferredFreeIDs() {
return mDeferredFreeIDs; }
130 template <
typename T, u
int32_t N>
143 void pushBack(
const T& t)
145 PX_ASSERT(mSize < N);
151 PX_ASSERT(mSize > 0);
152 return mArr[--mSize];
155 void clear() { mSize = 0; }
157 T& operator [] (PxU32 index) { PX_ASSERT(index < N);
return mArr[index]; }
159 const T& operator [] (PxU32 index)
const { PX_ASSERT(index < N);
return mArr[index]; }
161 PxU32 size()
const {
return mSize; }
165 template<PxU32 Capacity>
169 PxU32 getNumRemainingIDs()
171 return Capacity - this->getNumUsedID();
184 template<PxU32 Capacity>
188 PxU32 getNumRemainingIDs()
Definition CmIDPool.h:196
Definition CmIDPool.h:177
Definition CmIDPool.h:186
Definition CmIDPool.h:132
Definition CmIDPool.h:167
Definition PxUserAllocated.h:43
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39