18 #ifndef B2_FREE_LIST_H
19 #define B2_FREE_LIST_H
21 #include <Box2D/Common/b2IntrusiveList.h>
26 #ifndef B2_FREE_LIST_CHECK_ALLOCATED_ON_FREE
27 #define B2_FREE_LIST_CHECK_ALLOCATED_ON_FREE 0
28 #endif // B2_FREE_LIST_CHECK_ALLOCATED_ON_FREE
87 if (!node)
return NULL;
88 return T::GetInstanceFromListNode(node);
94 m_freeList.
Free(instance->GetListNode());
106 b2FreeList* GetFreeList() {
return &m_freeList; }
107 const b2FreeList* GetFreeList()
const {
return &m_freeList; }
113 #endif // B2_FREE_LIST_H
~b2FreeList()
Destroy the free list.
Definition: b2FreeList.h:40
b2FreeList()
Construct the free list.
Definition: b2FreeList.h:37
void RemoveAll()
Remove all items (allocated and free) from the freelist.
Definition: b2FreeList.cpp:49
Definition: b2IntrusiveList.h:64
T * Allocate()
Allocate an item from the free list.
Definition: b2FreeList.h:85
Definition: b2FreeList.h:76
b2IntrusiveListNode * Allocate()
Allocate an item from the freelist.
Definition: b2FreeList.cpp:23
b2TypedFreeList()
Construct the free list.
Definition: b2FreeList.h:79
void AddToFreeList(T *instance)
Definition: b2FreeList.h:99
const b2IntrusiveListNode & GetFreeList() const
Get the list which tracks free items.
Definition: b2FreeList.h:61
Definition: b2FreeList.h:33
void Free(b2IntrusiveListNode *node)
Free an item from the freelist.
Definition: b2FreeList.cpp:32
void AddToFreeList(b2IntrusiveListNode *node)
Definition: b2FreeList.cpp:42
~b2TypedFreeList()
Destroy the free list.
Definition: b2FreeList.h:82
void Free(T *instance)
Free an item.
Definition: b2FreeList.h:92
const b2IntrusiveListNode & GetAllocatedList() const
Get the list which tracks allocated items.
Definition: b2FreeList.h:56
b2IntrusiveListNode m_free
List of free items.
Definition: b2FreeList.h:69
b2IntrusiveListNode m_allocated
List of allocated items.
Definition: b2FreeList.h:67