#include <source/toolbox/memory/ReferenceCounter.h>
Public Member Functions | |
ReferenceCounter () | |
ReferenceCounter (Arena *newArena, ReferenceCounter *arenaCounter) | |
~ReferenceCounter () | |
Arena * | getArena () |
bool | deleteReference () |
void | addReference () |
void * | operator new (size_t bytes) |
void | operator delete (void *what) |
Static Public Member Functions | |
static void | freeCachedCopies () |
{Do not subclass!} Changing the size of a ReferenceCounter object will cause my simple memory allocation mechanism to break in horrible and disgusting ways.
SAMRAI::tbox::ReferenceCounter::ReferenceCounter | ( | ) | [inline] |
Create a ReferenceCounter with an unmanaged memory arena. The number of references is set to one.
SAMRAI::tbox::ReferenceCounter::ReferenceCounter | ( | Arena * | newArena, | |
ReferenceCounter * | arenaCounter | |||
) |
Create a ReferenceCounter with a managed memory arena. Argument newArena is the managed memory arena and arenaCounter is the reference counter for that arena. The number of references is set to one.
SAMRAI::tbox::ReferenceCounter::~ReferenceCounter | ( | ) |
Destructor for ReferenceCounter. The destructor releases the managed memory arena if its count has gone to zero.
Arena * SAMRAI::tbox::ReferenceCounter::getArena | ( | ) | [inline] |
Get the managed memory arena (or NULL if none exists).
bool SAMRAI::tbox::ReferenceCounter::deleteReference | ( | ) | [inline] |
Decrement the number of references. True is returned if the reference count has gone to zero; false otherwise.
void SAMRAI::tbox::ReferenceCounter::addReference | ( | ) | [inline] |
Increment the number of references.
void SAMRAI::tbox::ReferenceCounter::freeCachedCopies | ( | ) | [static] |
Release the memory for all currently cached ReferenceCounter copies. This function may be called at any time. In general, it should not be necessary to call freeCachedCopies(), since it is called via the ShutdownRegistry mechanism.
void * SAMRAI::tbox::ReferenceCounter::operator new | ( | size_t | bytes | ) |
Class-specific operator new. Data is allocated off of an internal free list to speed memory allocation.
void SAMRAI::tbox::ReferenceCounter::operator delete | ( | void * | what | ) |
Class-specific operator delete. Freed data is returned to an internal free list for re-use by operator new.