#pragma once #include "MultiNotifyDelegate.hpp" // // a Notify delegate, send notification when insert, remove, clear // class UnsafeNotifyDelegate : public UnsafeDelegate { public: inline UnsafeNotifyDelegate () { } inline UnsafeNotifyDelegate (const char * DelegateID) : UnsafeDelegate (DelegateID) { } inline virtual ~UnsafeNotifyDelegate () { } inline virtual void AddDelegateHandler (DelegateHandler * handler) { UnsafeDelegate::AddDelegateHandler (handler); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); } inline virtual void RemoveDelegateHandler (DelegateHandler * handler) { UnsafeDelegate::RemoveDelegateHandler (handler); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); } inline void RemoveAll () { UnsafeDelegate::RemoveAll (); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); } inline virtual void AddFirst (DelegateHandler * handler) { UnsafeDelegate::AddFirst (handler); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); } inline virtual void AddLast (DelegateHandler * handler) { UnsafeDelegate::AddLast (handler); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); } inline int TransferTo (UnsafeDelegate & toDelegate) { int rc = UnsafeDelegate::TransferTo (toDelegate); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); return rc; } inline int TransferFrom (UnsafeDelegate & fromDelegate) { int rc = UnsafeDelegate::TransferFrom (fromDelegate); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); return rc; } inline int TransferTo (Array & toArray) { int rc = UnsafeDelegate::TransferTo (toArray); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); return rc; } inline int TransferFrom (Array & fromArray) { int rc = UnsafeDelegate::TransferFrom (fromArray); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); return rc; } virtual void SetTrace (bool bEnable) { UnsafeDelegate::SetTrace (bEnable); m_Notify.SetTrace (bEnable); } public: UnsafeDelegate m_Notify; };