#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.
|
Create a ReferenceCounter with an unmanaged memory arena. The number of references is set to one. |
|
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. |
|
Destructor for ReferenceCounter. The destructor releases the managed memory arena if its count has gone to zero. |
|
Get the managed memory arena (or NULL if none exists). |
|
Decrement the number of references. True is returned if the reference count has gone to zero; false otherwise. |
|
Increment the number of references. |
|
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. |
|
Class-specific operator new. Data is allocated off of an internal free list to speed memory allocation. |
|
Class-specific operator delete. Freed data is returned to an internal free list for re-use by operator new. |