SegmentedPool Class Reference

#include <SegmentedPool.h>

Inheritance diagram for SegmentedPool:

Pool List of all members.

Public Member Functions

 SegmentedPool (size_t nodeCapacity, uint32 nodes)
virtual ~SegmentedPool ()
 ENABLE_RUNTIME_CLASSTYPE ()
virtual void * allocate (size_t size)
virtual void deallocate (void *ptr)
virtual bool isFull ()
virtual bool isEmpty ()
virtual bool inPool (void *ptr)
void printInfo ()
size_t getNodeCapacity ()
SegmentedPoolNodegetPoolNode (void *ptr)

Private Attributes

uint8startOfPool
uint8endOfPool
size_t nodeOffset
size_t nodeCapacity
uint32 nodes
uint32 freeNodeCount
SegmentedPoolNodefirstFree
SegmentedPoolNodelastFree

Detailed Description

A pool with memory broken into even length segments. SegmentedPool only allocate memory one segment at a time. If the requested memory is larger than a segment, allocation will fail and return 0.

Definition at line 36 of file SegmentedPool.h.


Constructor & Destructor Documentation

SegmentedPool::SegmentedPool ( size_t  nodeCapacity,
uint32  nodes 
)

Definition at line 52 of file SegmentedPool.cpp.

References endOfPool, firstFree, lastFree, SegmentedPoolNode::nextFree, nodeCapacity, nodeOffset, nodes, SegmentedPoolNode::pool, redzoneSize, SegmentedPoolNode::size, and startOfPool.

SegmentedPool::~SegmentedPool (  )  [virtual]

Definition at line 90 of file SegmentedPool.cpp.

References isEmpty(), and startOfPool.


Member Function Documentation

void * SegmentedPool::allocate ( size_t  size  )  [virtual]

Implements Pool.

Definition at line 99 of file SegmentedPool.cpp.

References firstFree, freeNodeCount, isFull(), lastFree, SegmentedPoolNode::nextFree, nodeCapacity, redzoneSize, SegmentedPoolNode::size, startOfPool, and SegmentedPoolNode::valgrind_handle.

void SegmentedPool::deallocate ( void *  ptr  )  [virtual]

Implements Pool.

Definition at line 135 of file SegmentedPool.cpp.

References firstFree, freeNodeCount, getPoolNode(), inPool(), isFull(), lastFree, SegmentedPoolNode::nextFree, SegmentedPoolNode::pool, SegmentedPoolNode::size, startOfPool, and SegmentedPoolNode::valgrind_handle.

SegmentedPool::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from Pool.

size_t SegmentedPool::getNodeCapacity (  )  [inline]

Definition at line 54 of file SegmentedPool.h.

SegmentedPoolNode * SegmentedPool::getPoolNode ( void *  ptr  ) 

Definition at line 202 of file SegmentedPool.cpp.

References nodeOffset, and startOfPool.

Referenced by deallocate().

virtual bool SegmentedPool::inPool ( void *  ptr  )  [inline, virtual]

Implements Pool.

Definition at line 50 of file SegmentedPool.h.

References endOfPool, and startOfPool.

Referenced by deallocate().

virtual bool SegmentedPool::isEmpty (  )  [inline, virtual]

Implements Pool.

Definition at line 48 of file SegmentedPool.h.

References freeNodeCount.

Referenced by ~SegmentedPool().

virtual bool SegmentedPool::isFull (  )  [inline, virtual]

Implements Pool.

Definition at line 47 of file SegmentedPool.h.

References freeNodeCount.

Referenced by allocate(), and deallocate().

void SegmentedPool::printInfo (  )  [virtual]

Implements Pool.

Definition at line 163 of file SegmentedPool.cpp.

References con, endOfPool, freeNodeCount, max(), min(), nodeCapacity, nodeOffset, nodes, Console::Printf(), SegmentedPoolNode::size, and startOfPool.


Member Data Documentation

uint8* SegmentedPool::endOfPool [private]

Definition at line 59 of file SegmentedPool.h.

Referenced by inPool(), printInfo(), and SegmentedPool().

SegmentedPoolNode* SegmentedPool::firstFree [private]

Definition at line 66 of file SegmentedPool.h.

Referenced by allocate(), deallocate(), and SegmentedPool().

uint32 SegmentedPool::freeNodeCount [private]

Definition at line 64 of file SegmentedPool.h.

Referenced by allocate(), deallocate(), isEmpty(), isFull(), and printInfo().

SegmentedPoolNode* SegmentedPool::lastFree [private]

Definition at line 67 of file SegmentedPool.h.

Referenced by allocate(), deallocate(), and SegmentedPool().

size_t SegmentedPool::nodeCapacity [private]

Definition at line 62 of file SegmentedPool.h.

Referenced by allocate(), printInfo(), and SegmentedPool().

size_t SegmentedPool::nodeOffset [private]

Definition at line 61 of file SegmentedPool.h.

Referenced by getPoolNode(), printInfo(), and SegmentedPool().

uint32 SegmentedPool::nodes [private]

Definition at line 63 of file SegmentedPool.h.

Referenced by printInfo(), and SegmentedPool().

uint8* SegmentedPool::startOfPool [private]

Definition at line 58 of file SegmentedPool.h.

Referenced by allocate(), deallocate(), getPoolNode(), inPool(), printInfo(), SegmentedPool(), and ~SegmentedPool().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:29:54 2007 for pentagram by  doxygen 1.4.7