14template <
class T,
bool bArg>
26 for (
int i = 0; i < nCount; ++i) {
27 mFree[i].SetNextFree(i == nCount - 1 ?
nullptr : &
mFree[i + 1]);
63 T *
const pItems =
mItems.get();
65 for (T *pItem = pItems + 1; pItem != pItems +
mCount; ++pItem) {
66 if (pItem->GetStartTime() < pOldest->GetStartTime()) {
82 if (pItem ==
nullptr) {
85 mFree = pItem->GetNextFree();
86 pItem->SetNextFree(
nullptr);
98 template <
class... Args>
101 if (pItem !=
nullptr) {
102 pItem->Start(args...);
116 pItem->SetNextFree(
mFree);
virtual ~FxPool()=default
Destroy the effects.
void Prepare(T *pItem)
Prepare a new effect of the pool.
Definition fxpool.h:41
int mCount
Definition fxpool.h:132
void Free(T *pItem)
Return an effect to the pool.
Definition fxpool.h:127
T * mFree
Definition fxpool.h:133
std::unique_ptr< T[]> mItems
Definition fxpool.h:134
T * Pop()
Take an effect off the free list.
Definition fxpool.h:80
T * Start(Args... args)
Take an effect off the free list and start it.
Definition fxpool.h:99
void Release(T *pItem)
Stop an effect and return it to the free list.
Definition fxpool.h:114
T * FindOldest()
Report the effect that started first.
Definition fxpool.h:59
FxPool(int nCount)
Construct a pool of effects, every one of them free.
Definition fxpool.h:24