Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SAMRAI::tbox::ArenaManager Class Reference

#include <source/toolbox/memory/ArenaManager.h>

List of all members.

Public Member Functions

virtual Pointer< ArenagetFixedAllocator (const size_t bytes)
virtual Pointer< ArenagetScratchAllocator ()
virtual Pointer< ArenagetStandardAllocator ()
virtual void setFixedAllocator (const Pointer< FixedArena > &arena)
virtual void setScratchAllocator (const Pointer< Arena > &arena)
virtual void setStandardAllocator (const Pointer< Arena > &arena)

Static Public Member Functions

static ArenaManagergetManager ()
static void freeManager ()

Protected Member Functions

 ArenaManager ()
virtual ~ArenaManager ()
void registerSingletonSubclassInstance (ArenaManager *subclass_instance)


Detailed Description

Class ArenaManager is a Singleton class that acts as an abstract factory for the arena memory management classes. It is a single point of control for memory allocation. Class ArenaManager supports three forms of memory management: standard allocators, scratch allocators, and fixed allocators. Standard memory allocators are the ones to be used in most cases; by default, the standard memory allocators use new and delete. The scratch allocators are for temporary scratch space. The fixed size memory allocators are arenas of a fixed size from which many memory requests will be made.

See the Design Patterns book by Gamma {et al.} for more information about the singleton pattern.

See also:
tbox::Arena

tbox::FixedArena


Constructor & Destructor Documentation

SAMRAI::tbox::ArenaManager::ArenaManager  )  [protected]
 

The constructor for ArenaManager is protected. Consistent with the definition of a Singleton class, only subclasses have access to the constructor for the class.

SAMRAI::tbox::ArenaManager::~ArenaManager  )  [protected, virtual]
 

The destructor for ArenaManager is protected. See the comments for the constructor.


Member Function Documentation

ArenaManager * SAMRAI::tbox::ArenaManager::getManager  )  [static]
 

Return a pointer to the single instance of the memory arena manager. All access to the ArenaManager object is through getManager. For example, to get a pointer to the standard allocator arena, we must use ArenaManager::getManager()->getStandardAllocator().

Note that when the manager is accessed for the first time, the Singleton instance is registered with the ShutdownRegistry class which destroys such objects at program completion. Thus, users of this class do not explicitly allocate or deallocate the Singleton instance.

void SAMRAI::tbox::ArenaManager::freeManager  )  [static]
 

Deallocate the ArenaManager instance. It is not necessary to call freeManager() at program termination, since it is automatically called by the ShutdownRegistry class.

Pointer< Arena > SAMRAI::tbox::ArenaManager::getFixedAllocator const size_t  bytes  )  [virtual]
 

Allocate a fixed size arena of the given size. This arena may then be used in multiple memory allocation calls, although only one call to new will have been made.

Pointer< Arena > SAMRAI::tbox::ArenaManager::getScratchAllocator  )  [virtual]
 

Return a pointer to scratch memory allocation arena. This arena is to be used for short-lived memory objects that should be allocated from a scratch space.

Pointer< Arena > SAMRAI::tbox::ArenaManager::getStandardAllocator  )  [virtual]
 

Return a pointer to the standard memory allocation arena. Use this arena for most standard memory allocation needs.

void SAMRAI::tbox::ArenaManager::setFixedAllocator const Pointer< FixedArena > &  arena  )  [virtual]
 

Define a new fixed memory arena allocator.

void SAMRAI::tbox::ArenaManager::setScratchAllocator const Pointer< Arena > &  arena  )  [virtual]
 

Define a new scratch memory arena allocator.

void SAMRAI::tbox::ArenaManager::setStandardAllocator const Pointer< Arena > &  arena  )  [virtual]
 

Define a new standard memory arena allocator.

void SAMRAI::tbox::ArenaManager::registerSingletonSubclassInstance ArenaManager subclass_instance  )  [protected]
 

Initialize Singleton instance with instance of subclass. This function is used to make the singleton object unique when inheriting from this base class.


The documentation for this class was generated from the following files:
Generated on Fri Dec 2 11:33:19 2005 for SAMRAI by  doxygen 1.4.2