overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions
gameplay::Ref Class Reference

#include <Ref.h>

Inheritance diagram for gameplay::Ref:
gameplay::AIAgent gameplay::AIState gameplay::Animation gameplay::AnimationClip gameplay::AudioBuffer gameplay::AudioSource gameplay::Bundle gameplay::Camera gameplay::Control gameplay::Curve gameplay::DepthStencilTarget gameplay::Effect gameplay::Font gameplay::FrameBuffer gameplay::HeightField gameplay::Image gameplay::Layout gameplay::Light gameplay::MaterialParameter gameplay::Mesh gameplay::Model gameplay::Node gameplay::ParticleEmitter gameplay::PhysicsCollisionShape gameplay::RenderState gameplay::RenderState::StateBlock gameplay::RenderTarget gameplay::Scene gameplay::Script gameplay::Sprite gameplay::Terrain gameplay::Text gameplay::Texture gameplay::Texture::Sampler gameplay::Theme gameplay::Theme::ThemeImage gameplay::TileSet gameplay::VertexAttributeBinding

List of all members.

Public Member Functions

void addRef ()
void release ()
unsigned int getRefCount () const

Protected Member Functions

 Ref ()
 Ref (const Ref &copy)
virtual ~Ref ()

Detailed Description

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.


Constructor & Destructor Documentation

gameplay::Ref::Ref ( ) [protected]

Constructor.

gameplay::Ref::Ref ( const Ref copy) [protected]

Copy constructor.

Parameters:
copyThe Ref object to copy.
virtual gameplay::Ref::~Ref ( ) [protected, virtual]

Destructor.


Member Function Documentation

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.

Returns:
This object's reference count.

Decrements the reference count of this object.

When an object is initially created, its reference count is set to 1. Calling addRef() will increment the reference and calling release() will decrement the reference count. When an object reaches a reference count of zero, the object is destroyed.

 All Classes Functions Variables Typedefs Enumerations Enumerator