#include <source/toolbox/memory/ArenaManager.h>
Public Member Functions | |
virtual Pointer< Arena > | getFixedAllocator (const size_t bytes) |
virtual Pointer< Arena > | getScratchAllocator () |
virtual Pointer< Arena > | getStandardAllocator () |
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 ArenaManager * | getManager () |
static void | freeManager () |
Protected Member Functions | |
ArenaManager () | |
virtual | ~ArenaManager () |
void | registerSingletonSubclassInstance (ArenaManager *subclass_instance) |
See the Design Patterns book by Gamma {et al.} for more information about the singleton pattern.
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.
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.
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.
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.
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.
Define a new scratch memory arena allocator.
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.