#include <Ref.h>
Public Member Functions | |
void | addRef () |
void | release () |
unsigned int | getRefCount () const |
Protected Member Functions | |
Ref () | |
Ref (const Ref ©) | |
virtual | ~Ref () |
Defines the base class for game objects that require lifecycle management.
This class provides reference counting support for game objects that contain system resources or data that is normally long lived and referenced from possibly several sources at the same time. The built-in reference counting eliminates the need for programmers to manually keep track of object ownership and having to worry about when to safely delete such objects.
gameplay::Ref::Ref | ( | ) | [protected] |
Constructor.
gameplay::Ref::Ref | ( | const Ref & | copy | ) | [protected] |
Copy constructor.
copy | The Ref object to copy. |
virtual gameplay::Ref::~Ref | ( | ) | [protected, virtual] |
Destructor.
void gameplay::Ref::addRef | ( | ) |
Increments the reference count of this object.
The release() method must be called when the caller relinquishes its handle to this object in order to decrement the reference count.
unsigned int gameplay::Ref::getRefCount | ( | ) | const |
Returns the current reference count of this object.
void gameplay::Ref::release | ( | ) |