40 #ifndef INCLUDED_WEAK_REFERENCE_H
41 #define INCLUDED_WEAK_REFERENCE_H
48 class WeakReferenceable;
102 : _referent( referent )
115 _referent->NotifyWeakReferenceDestroyed(
this );
120 WeakReferenceable* GetReferent()
const DISTI_METHOD_OVERRIDE {
return _referent; }
123 void NotifyReferentDestroyed()
146 SetWeakReference( weakReferenceable );
172 SetWeakReference( weakReferenceable );
202 return ( _weakReference.IsNull() || NULL == _weakReference->GetReferent() );
215 ret =
dynamic_cast<T*
>( _weakReference->GetReferent() );
226 return !_weakReference.IsNull() ? _weakReference->GetReferent() : NULL;
233 if( weakReferenceable )
237 weakRef =
new WeakReferenceImpl( weakReferenceable );
241 _weakReference.Reset( weakRef );
244 ScopedPtr<WeakReference> _weakReference;
WeakRef(const WeakRef &w)
Definition: weak_reference.h:152
virtual WeakReferenceable * GetReferent() const =0
WeakRef & operator=(WeakReferenceable *weakReferenceable)
Definition: weak_reference.h:170
WeakRef & operator=(const WeakRef< U > &w)
Definition: weak_reference.h:191
virtual void AddWeakReference(WeakReference *weakRef)=0
WeakRef(const WeakRef< U > &w)
Definition: weak_reference.h:161
WeakRef()
Definition: weak_reference.h:136
T * Get() const
Definition: weak_reference.h:208
Definition: weak_reference.h:51
WeakRef(WeakReferenceable *weakReferenceable)
Definition: weak_reference.h:144
Definition: weak_reference.h:64
virtual void NotifyReferentDestroyed()=0
WeakReferenceable * GetWeakReferenceable() const
Definition: weak_reference.h:224
Definition: weak_reference.h:91
bool IsNull() const
Definition: weak_reference.h:200
A smart pointer with unique ownership – poor man's std::unique_ptr.
Contains the DistiAssert macro.
WeakRef & operator=(const WeakRef &w)
Definition: weak_reference.h:180
virtual void NotifyWeakReferenceDestroyed(WeakReference *weakReference)=0
Definition: bmpimage.h:46
#define GLS_ASSERT(exp)
Definition: disti_assert.h:135