SimObjectPtr

Engine/source/console/simObject.h

Smart SimObject pointer.

More...

Public Types

Parent 

Protected Functions

Detailed Description

Smart SimObject pointer.

This class keeps track of the book-keeping necessary to keep a registered reference to a SimObject or subclass thereof.

Normally, if you want the SimObject to be aware that you have a reference to it, you must call SimObject::registerReference() when you create the reference, and SimObject::unregisterReference() when you're done. If you change the reference, you must also register/unregister it. This is a big headache, so this class exists to automatically keep track of things for you.

// Assign an object to the
SimObjectPtr<GameBase> mOrbitObject = Sim::findObject("anObject");

// Use it as a GameBase*.
mOrbitObject->getWorldBox().getCenter(&mPosition);

// And reassign it - it will automatically update the references.
mOrbitObject = Sim::findObject("anotherObject");

Public Types

typedef WeakRefPtr< T > Parent 

Public Functions

SimObjectPtr()

SimObjectPtr(const SimObjectPtr & ref)

SimObjectPtr(T * ptr)

~SimObjectPtr()

getObject()

operator=(const SimObjectPtr ref)

operator=(T * ptr)

Protected Functions

set(T * obj)

set(WeakRefBase::WeakReference * ref)