예제 #1
0
bool NotificationCenter::hasObserver(const AbstractObserver& observer) const
{
	Mutex::ScopedLock lock(_mutex);
	for (ObserverList::const_iterator it = _observers.begin(); it != _observers.end(); ++it)
		if (observer.equals(**it)) return true;

	return false;
}
예제 #2
0
void NotificationCenter::removeObserver(const AbstractObserver& observer)
{
    Mutex::ScopedLock lock(_mutex);
    for (ObserverList::iterator it = _observers.begin(); it != _observers.end(); ++it)
    {
        if (observer.equals(**it))
        {
            (*it)->disable();
            _observers.erase(it);
            return;
        }
    }
}