// rvHeapArena.cpp - Heap arena object that manages a set of heaps
// Date: 12/13/04
// Created by: Dwight Luetscher
//
#include "../idlib/precompiled.h"
#pragma hdrstop
#ifdef _RV_MEM_SYS_SUPPORT
// rvHeapArena
//
// constructor
rvHeapArena::rvHeapArena()
{
// ResetValues(); do this in the Init() call instead (due to the fact that other constructors could call rvHeapArena::Init() before this constructor is called)
}
// ~rvHeapArena
//
// destructor
rvHeapArena::~rvHeapArena()
{
Shutdown();
}
// Init
//
// initializes this heap arena for use
void rvHeapArena::Init( )
{
if ( m_isInitialized )
{
return;
}
ResetValues();
m_isInitialized = true;
// create the critical section used by this heap arena
InitializeCriticalSection( &m_criticalSection );
}
// Shutdown
//
// releases this heap arena from use (shutting down all associated heaps)
void rvHeapArena::Shutdown( )
{
// shutdown each heap from this arena's list
rvHeap *curHeap = m_heapList, *nextHeap;
while ( curHeap != NULL )
{
nextHeap = curHeap->GetNext();
curHeap->Shutdown();
curHeap = nextHeap;
}
DeleteCriticalSection( &m_criticalSection );
ResetValues();
}
// ResetValues
//
// resets the data members to their pre-initialized state