46 template<
typename E, E* E::*next>
89 template<
typename E, E* E::*next>
98 template<
typename E, E* E::*next,
int E::*index>
106 inline void free(E* ptr) { m_freeList.free(ptr); }
114 if (m_freeList.empty())
117 res->*index = m_nextFreeIndex++;
121 return m_freeList.alloc();
EFreeList()
Constructs a new freelist.
bool empty() const
Returns true if the stack is empty.
More complex implementation of a FreeList, which is able to generate indeices for the elements...
E * alloc()
Returns a new instance of E by either using an instance from the stack or creating a new one...
Simple implementation of a FreeList which buffers the memory allocation of an embedded list item...
EFreeListIndexPool()
Creates a new IndexPool and a FreeList.
Type declarations for EFreeList.
void freeFreeList()
deletes all instances in the list
Declaration and implementation of embedded stack and list functionality which is useful for embedded ...
E * alloc()
Allocates a new Element by either using the free list or allocating a new one with a brand new index...
EFreeList< E, next > m_freeList
The free list for allocating the memory.
static void init(S *pStack)
Initializes pStack as empty stack.
int numUsedIndices() const
The value indicates that all indices in 0..numUsedIndices-1 might be in use.
static E * popRet(S *pStack)
Removes the top element and returns it.
The embedded stack class template.
static bool empty(const S *pStack)
Returns true if pStack is empty.
static void push(S *pStack, E *pElem)
Pushes the new element pElem onto pStack.
The namespace for all OGDF objects.
E * m_pTop
Top of the stack.
int m_nextFreeIndex
The next brand new index.
void free(E *ptr)
Frees an element using the FreeList.
void free(E *ptr)
Frees an item buy putting it onto the stack of free instances.
~EFreeList()
Destructor. Releases the mem used by the remaining elements on the stack.