Drag[en]gine Game Engine  1.0
deObject Class Reference

Basic object interface. More...

#include <deObject.h>

Inheritance diagram for deObject:
deAICondition deAIController deAINode deAnimatorRule decBaseFileReader decBaseFileWriter decMemoryFile deColliderCollisionTest deCollisionInfo deDecalList deLocomotionUnit deLogger deNetworkMessage deParallelTask deResource deSynthesizerController deSynthesizerEffect deSynthesizerLink deSynthesizerSource deVFSContainer deVirtualFileSystem

Public Member Functions

int GetRefCount () const
 Reference count. More...
void AddReference ()
 Add reference increasing reference count by 1. More...
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...

Constructors and Destructors

 deObject ()
 Create object with reference count of 1. More...
virtual ~deObject ()
 Clean up object. More...

Detailed Description

Basic object interface.

Provides the basic class for all engine objects. Each object has a reference count. Objects stay alive as long as the reference count is larger than 0. If you want to add a reference use the AddReference function. If you want to free the reference you have added before use the FreeReference function and do not call 'delete'. Upon creation each object is assigned a reference count of 1 so you do not have to add a refernece after creating an object.

Constructor & Destructor Documentation

◆ deObject()

deObject::deObject ( )

Create object with reference count of 1.

◆ ~deObject()

virtual deObject::~deObject ( )

Clean up object.

Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ AddReference()

void deObject::AddReference ( )

Add reference increasing reference count by 1.

Referenced by GetRefCount().

◆ FreeReference()

void deObject::FreeReference ( )

Decrease reference count by one and delete object if count reaches 0.

Referenced by GetRefCount().

◆ GetRefCount()

int deObject::GetRefCount ( ) const

Reference count.

References AddReference(), and FreeReference().

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