RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
CAutoreleasePool Class Reference

#include <cautoreleasepool.h>

Inheritance diagram for CAutoreleasePool:
CObject

Public Member Functions

 CAutoreleasePool (void)
 
virtual void addObject (CObject *obj)
 
virtual void drain ()
 
 ~CAutoreleasePool (void)
 
- Public Member Functions inherited from CObject
 CObject ()
 
 CObject (const CObject &object)
 
CObjectoperator= (const CObject &object)
 
CObjectretain ()
 
unsigned int release () const
 
CObjectautorelease ()
 
unsigned int retainCount () const
 
bool isValidCObject () const
 
virtual ~CObject ()
 

Static Public Member Functions

static void log ()
 
static void releasePools ()
 
- Static Public Member Functions inherited from CObject
static void safeRetain (void *pointer)
 
template<class T >
static void safeRelease (T *pointer)
 
template<class T >
static void safeReleaseArray (T *array)
 
static void safeRelease (const char *pointer)
 

Protected Attributes

std::vector< CObject * > * m_localPool
 

Static Protected Attributes

static std::vector< std::vector< CObject * > * > * m_pools
 

Additional Inherited Members

- Protected Member Functions inherited from CObject
virtual void copyValuesFromObject (const CObject &object)
 

Detailed Description

This is my own version of the NSAutoreleasePool class. An autorelease pool stores objects that are sent a release message when the pool itself is drained. I haven't take a look at the original NSAutoreleasePool code, but it seems that I managed to make this class very reliable on my own. If you analize the engine for memory leaks you will hardly find any. Let me know if you ever find one!

Definition at line 47 of file cautoreleasepool.h.

Constructor & Destructor Documentation

CAutoreleasePool::CAutoreleasePool ( void  )

Definition at line 40 of file cautoreleasepool.cpp.

CAutoreleasePool::~CAutoreleasePool ( void  )

Definition at line 104 of file cautoreleasepool.cpp.

Member Function Documentation

void CAutoreleasePool::addObject ( CObject obj)
virtual

Adds the object to the current pool.

Definition at line 48 of file cautoreleasepool.cpp.

void CAutoreleasePool::drain ( )
virtual

Drains the current pool.

Definition at line 56 of file cautoreleasepool.cpp.

void CAutoreleasePool::log ( )
static

Prints all the objects that are pending to be released. Useful when debugging.

Definition at line 72 of file cautoreleasepool.cpp.

void CAutoreleasePool::releasePools ( )
static

You should always call this static method before closing the application.

Definition at line 98 of file cautoreleasepool.cpp.

Member Data Documentation

std::vector<CObject*>* CAutoreleasePool::m_localPool
protected

Definition at line 77 of file cautoreleasepool.h.

std::vector< std::vector< CObject * > * > * CAutoreleasePool::m_pools
staticprotected
Initial value:
=
new std::vector< std::vector<CObject*>* >()

Definition at line 76 of file cautoreleasepool.h.


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