20 #if !defined(__MITSUBA_BIDIR_MEMPOOL_H_)
21 #define __MITSUBA_BIDIR_MEMPOOL_H_
33 : m_vertexPool(nEntries), m_edgePool(nEntries) { }
41 #if defined(MTS_BD_DEBUG_HEAVY)
42 memset(edge, 0xFF,
sizeof(
PathEdge));
50 #if defined(MTS_BD_DEBUG_HEAVY)
58 m_edgePool.release(edge);
63 m_vertexPool.release(vertex);
68 return m_vertexPool.unused() && m_edgePool.unused();
73 return m_edgePool.size();
78 return m_vertexPool.size();
83 std::ostringstream oss;
84 oss <<
"MemoryPool[" << endl
85 <<
" vertexPool = " << m_vertexPool.toString() <<
"," << endl
86 <<
" edgePool = " << m_edgePool.toString() << endl
void release(PathEdge *edge)
Release an edge.
Definition: mempool.h:57
void release(PathVertex *vertex)
Release an entry.
Definition: mempool.h:62
Bidirectional path vertex data structure.
Definition: vertex.h:48
bool unused() const
Check if every entry has been released.
Definition: mempool.h:67
PathVertex * allocVertex()
Acquire an vertex.
Definition: mempool.h:48
Basic memory pool for efficient allocation and deallocation of objects of the same type...
Definition: mempool.h:42
PathEdge * allocEdge()
Acquire an edge.
Definition: mempool.h:39
std::string toString() const
Return a human-readable description.
Definition: mempool.h:82
Bidirectional path edge data structure.
Definition: edge.h:46
MemoryPool(size_t nEntries=128)
Create a new memory pool with aninitial set of 128 entries.
Definition: mempool.h:32
~MemoryPool()
Destruct the memory pool and release all entries.
Definition: mempool.h:36
size_t vertexSize()
Return the currently allocated amount of storage for vertices.
Definition: mempool.h:77
size_t edgeSize()
Return the currently allocated amount of storage for edges.
Definition: mempool.h:72