mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-19 20:30:58 +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 >
|
||||
class SimObjectPtr : public WeakRefPtr< T >
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
typedef WeakRefPtr< T > Parent;
|
||||
typedef WeakRefPtr< T > Parent;
|
||||
|
||||
SimObjectPtr() = default;
|
||||
SimObjectPtr(T *ptr) { set(ptr); }
|
||||
SimObjectPtr( const SimObjectPtr& ref ) { this->mReference = ref.mReference; }
|
||||
SimObjectPtr() = default;
|
||||
SimObjectPtr(T *ptr) { set(ptr); }
|
||||
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)
|
||||
{
|
||||
mReference = ref.mReference;
|
||||
return *this;
|
||||
}
|
||||
SimObjectPtr<T>& operator=(T *ptr)
|
||||
{
|
||||
set(ptr);
|
||||
return *this;
|
||||
}
|
||||
SimObjectPtr<T>& operator=(const SimObjectPtr ref)
|
||||
{
|
||||
this->mReference = ref.mReference;
|
||||
return *this;
|
||||
}
|
||||
SimObjectPtr<T>& operator=(T *ptr)
|
||||
{
|
||||
set(ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
void set(T * obj)
|
||||
{
|
||||
mReference = obj ? obj->getWeakReference() : nullptr;
|
||||
}
|
||||
void set(T * obj)
|
||||
{
|
||||
this->mReference = obj ? obj->getWeakReference() : NULL;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _SIMOBJECT_H_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue