mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Update simObject.h
This commit is contained in:
parent
43e673d8ea
commit
d688f1cfde
1 changed files with 22 additions and 22 deletions
|
|
@ -1049,35 +1049,35 @@ DefineBitfieldType(GameTypeMasksType);
|
||||||
template< typename T >
|
template< typename T >
|
||||||
class SimObjectPtr : public WeakRefPtr< T >
|
class SimObjectPtr : public WeakRefPtr< T >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef WeakRefPtr< T > Parent;
|
typedef WeakRefPtr< T > Parent;
|
||||||
|
|
||||||
SimObjectPtr() = default;
|
SimObjectPtr() = default;
|
||||||
SimObjectPtr(T *ptr) { set(ptr); }
|
SimObjectPtr(T *ptr) { set(ptr); }
|
||||||
SimObjectPtr( const SimObjectPtr& ref ) { this->mReference = ref.mReference; }
|
SimObjectPtr( const SimObjectPtr& ref ) { this->mReference = ref.mReference; }
|
||||||
|
|
||||||
T* getObject() const { return Parent::getPointer(); }
|
T* getObject() const { return Parent::getPointer(); }
|
||||||
|
|
||||||
~SimObjectPtr() { mReference = NULL; }
|
~SimObjectPtr() { this->mReference = NULL; }
|
||||||
|
|
||||||
SimObjectPtr<T>& operator=(const SimObjectPtr ref)
|
SimObjectPtr<T>& operator=(const SimObjectPtr ref)
|
||||||
{
|
{
|
||||||
mReference = ref.mReference;
|
this->mReference = ref.mReference;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
SimObjectPtr<T>& operator=(T *ptr)
|
SimObjectPtr<T>& operator=(T *ptr)
|
||||||
{
|
{
|
||||||
set(ptr);
|
set(ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void set(T * obj)
|
void set(T * obj)
|
||||||
{
|
{
|
||||||
mReference = obj ? obj->getWeakReference() : nullptr;
|
this->mReference = obj ? obj->getWeakReference() : NULL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SIMOBJECT_H_
|
#endif // _SIMOBJECT_H_
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue