1
0

Added generic Allocation Pool Interface

This commit is contained in:
Tycho
2014-06-14 19:46:34 +01:00
parent a1520c7a40
commit 94c48febd2
12 changed files with 110 additions and 69 deletions

View File

@@ -6,14 +6,19 @@
int main(int argc, char** argv)
{
class cStarvationCallbacks
: public cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks
{
virtual void OnStartingUsingBuffer() {}
virtual void OnStopUsingBuffer() {}
virtual void OnBufferEmpty() {}
};
cAllocationPool<cChunkData::sChunkSection, 1600> Pool(std::auto_ptr<cAllocationPool<cChunkData::sChunkSection, 1600>::cStarvationCallbacks>(new cStarvationCallbacks()));
class cMockAllocationPool
: public cAllocationPool<cChunkData::sChunkSection>
{
virtual cChunkData::sChunkSection * Allocate()
{
return new cChunkData::sChunkSection();
}
virtual void Free(cChunkData::sChunkSection * a_Ptr)
{
delete a_Ptr;
}
} Pool;
{
// Test first segment