Wasabi
|
#include <WBase.hpp>
Public Member Functions | |
WBase (class Wasabi *const app, uint32_t ID=0) | |
virtual std::string | GetTypeName () const =0 |
virtual void | SetID (uint32_t newID)=0 |
virtual void | SetName (std::string newName)=0 |
uint32_t | GetID () const |
std::string | GetName () const |
class Wasabi * | GetAppPtr () const |
void | AddReference () |
void | RemoveReference () |
virtual bool | Valid () const =0 |
Protected Attributes | |
class Wasabi * | m_app |
uint32_t | m_ID |
std::string | m_name |
This is the base class, used as a parent for most engine classes (such as WObject, WImage, etc...). It provides a unified way of managing objects such that they all have IDs, names, managers, and can be freed using reference counting. Initially, a WBase has a reference count of 1. If the count ever reaches 0, the object will delete itself. So an application should NEVER delete or free an object that inherits from WBase, but should simply call its RemoveReference() instead.
void WBase::AddReference | ( | ) |
Add to the reference count.
class Wasabi* WBase::GetAppPtr | ( | ) | const |
uint32_t WBase::GetID | ( | ) | const |
Retrieves the ID of this object.
std::string WBase::GetName | ( | ) | const |
Retrieves the name of this object.
|
pure virtual |
This function must be implemented by a child class. This is used for debugging, in which a class should return its name.
Implemented in WEffect, WShader, WParticles, WGeometry, WObject, WAnimation, WOpenALSound, WImage, WMaterial, WSprite, WLight, WRenderTarget, WCamera, WTerrain, and WBulletRigidBody.
void WBase::RemoveReference | ( | ) |
Remove from the reference count. If the reference count reaches 0, this object destroys itself
|
pure virtual |
Sets the ID of this object and notifies its manager.
newID | New ID |
Implemented in WEffect, WShader, WParticles, WGeometry, WObject, WAnimation, WOpenALSound, WImage, WMaterial, WSprite, WLight, WRenderTarget, WCamera, WTerrain, and WBulletRigidBody.
|
pure virtual |
Sets the name of this object.
name | New name for the object |
Implemented in WEffect, WShader, WParticles, WGeometry, WObject, WAnimation, WOpenALSound, WImage, WMaterial, WSprite, WLight, WRenderTarget, WCamera, WTerrain, and WBulletRigidBody.
|
pure virtual |
Must be implemented by the child. This function should report the validity status of the object, in whatever sense of "validity" it chooses.
Implemented in WEffect, WGeometry, WShader, WParticles, WObject, WImage, WCamera, WRenderTarget, WSprite, WLight, WMaterial, WTerrain, WBulletRigidBody, WOpenALSound, WPhysicsAction, WSkeleton, WConstraint, and WRigidBody.
|
protected |
ID of this object
|
protected |
Name of this object