29#ifndef EXT_SHARED_QUEUE_ENTRY_POOL_H
30#define EXT_SHARED_QUEUE_ENTRY_POOL_H
32#include "foundation/PxAllocator.h"
33#include "foundation/PxArray.h"
34#include "foundation/PxSList.h"
43 SharedQueueEntry(
void* objectRef) : mObjectRef(objectRef), mPooledEntry(
false) {}
53#pragma warning(disable:4324)
56 template<class Alloc = typename PxAllocatorTraits<SharedQueueEntry>::Type >
85 for(PxU32 i=0; i < poolSize; i++)
87 PX_ASSERT((
size_t(&mTaskEntryPool[i]) & (PX_SLIST_ALIGNMENT-1)) == 0);
90 PX_ASSERT(mTaskEntryPool[i].mPooledEntry ==
true);
91 mTaskEntryPtrPool.push(mTaskEntryPool[i]);
98SharedQueueEntryPool<Alloc>::~SharedQueueEntryPool()
102 PxAlignedAllocator<PX_SLIST_ALIGNMENT, Alloc> alignedAlloc(
"SharedQueueEntryPool");
103 alignedAlloc.deallocate(mTaskEntryPool);
108template <
class Alloc>
109SharedQueueEntry* SharedQueueEntryPool<Alloc>::getEntry(
void* objectRef)
111 SharedQueueEntry* e =
static_cast<SharedQueueEntry*
>(mTaskEntryPtrPool.pop());
114 PX_ASSERT(e->mPooledEntry ==
true);
115 e->mObjectRef = objectRef;
120 PxAlignedAllocator<PX_SLIST_ALIGNMENT, Alloc> alignedAlloc;
121 e =
reinterpret_cast<SharedQueueEntry*
>(alignedAlloc.allocate(
sizeof(SharedQueueEntry), __FILE__, __LINE__));
124 PX_PLACEMENT_NEW(e, SharedQueueEntry)(objectRef);
125 PX_ASSERT(e->mPooledEntry ==
false);
133template <
class Alloc>
134void SharedQueueEntryPool<Alloc>::putEntry(SharedQueueEntry& entry)
136 if (entry.mPooledEntry)
138 entry.mObjectRef = NULL;
139 mTaskEntryPtrPool.push(entry);
143 PxAlignedAllocator<PX_SLIST_ALIGNMENT, Alloc> alignedAlloc;
144 alignedAlloc.deallocate(&entry);
Definition ExtSharedQueueEntryPool.h:58
Definition ExtSharedQueueEntryPool.h:41
Definition PxAlignedMalloc.h:54
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39