My Project
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
ParaEngine::CObjectAutoReleasePool Class Reference

when base object is created it has zero reference, and is usually added to auto release pool to be removed in the next frame. More...

#include <ObjectAutoReleasePool.h>

Public Member Functions

void AddObject (CRefCounted *object)
 Add a given object to this pool. More...
 
void clear ()
 Clear the auto release pool. More...
 
bool contains (CRefCounted *object) const
 Checks whether the pool contains the specified object.
 
void dump ()
 Dump the objects that are put into autorelease pool. More...
 

Static Public Member Functions

static CObjectAutoReleasePool * GetInstance ()
 
static void DestoryInstance ()
 

Static Protected Attributes

static CObjectAutoReleasePool * s_singleInstance = nullptr
 

Detailed Description

when base object is created it has zero reference, and is usually added to auto release pool to be removed in the next frame.

when detach a base object from a node, the node is usually added to auto release pool as well, so that we may attach it again to another node before end of frame.

Note
: Objects in the pools are released, not reused. Some pool may allow reuse or caching of pool objects, like EntityPool or VectorPool,etc.

Member Function Documentation

§ AddObject()

void ParaEngine::CObjectAutoReleasePool::AddObject ( CRefCounted *  object)

Add a given object to this pool.

it will addref each time each function is called.

The same object may be added several times to the same pool; When the pool is destructed, the object's Release() method will be called for each time it was added.

§ clear()

void ParaEngine::CObjectAutoReleasePool::clear ( )

Clear the auto release pool.

Release() will be called for each time the managed object is added to the pool.

§ dump()

void ParaEngine::CObjectAutoReleasePool::dump ( )

Dump the objects that are put into autorelease pool.

It is used for debugging.

The result will look like: Object pointer address object id reference count


The documentation for this class was generated from the following files: